var J="undefined"!=typeof exports?exports:"undefined"!=typeof window?window:"undefined"!=typeof self?self:this;
(function(Nf){function lb(a,b){this.pe=!1;null==a&&null==b?this.pe=!1:null!=a&&(this.head=a,this.nd=null==b?lb.Pb:b,this.pe=!0)}function Qe(){}function Re(){this.Mh=new Md;this.Uj=new Md;this.pA=new Md}function Se(a,b){null==b&&(b="");this.name=a;this.value=b}function fe(a){Vc.call(this,a)}function Vc(a){this.uri=a;this.contentType="application/x-www-form-urlencoded";this.formData=new W;this.headers=[];this.method="GET";this.timeout=3E4;this.Rz=new Te;this.Rz.Yn(this)}function Ue(){}function zg(){}
function dc(a,b,c,d){null==d&&(d=0);null==c&&(c=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.width=c;this.height=d}function Wc(a,b,c,d,e,f){null==f&&(f=0);null==e&&(e=0);null==d&&(d=1);null==c&&(c=0);null==b&&(b=0);null==a&&(a=1);this.W=a;this.m=b;this.Iq=c;this.d=d;this.Cc=e;this.Dc=f}function Ve(a,b){this.bJ=a;null==b?this.rect=a.$A():(0>b.x&&(b.x=0),0>b.y&&(b.y=0),b.x+b.width>a.width&&(b.width=a.width-b.x),b.y+b.height>a.height&&(b.height=a.height-b.y),0>b.width&&(b.width=0),0>b.height&&
(b.height=0),this.rect=b);this.Co=a.buffer.cB();this.x=Math.ceil(this.rect.x);this.y=Math.ceil(this.rect.y);this.width=Math.floor(this.rect.width);this.height=Math.floor(this.rect.height);this.offset=this.Co*(this.y+a.offsetY)+4*(this.x+a.offsetX)}function Of(){}function ta(){}function Pf(){}function ec(a,b,c,d,e){null==c&&(c=0);null==b&&(b=0);this.data=a;this.width=b;this.height=c;this.format=null==e?0:e;this.WK=!1;this.xD=!0}function ha(a,b,c,d,e,f,g){null==e&&(e=-1);null==d&&(d=-1);null==c&&(c=
0);null==b&&(b=0);this.offsetX=b;this.offsetY=c;this.width=d;this.height=e;this.version=0;if(null==g)if(null!=Xc.current&&null!=Xc.current.SE[0]){switch(Xc.current.SE[0].context[1]){case 1:case 2:b=ua.mg;break;case 3:b=ua.To;break;default:b=ua.mk}this.type=b}else this.type=ua.mk;else this.type=g;if(null==a){if(0<d&&0<e)switch(this.type[1]){case 0:this.buffer=new ec(null,d,e);ta.Yo(this,d,e);null!=f&&this.fillRect(new dc(0,0,d,e),f);break;case 1:a=d*e*4;var h;null!=a?h=new Ka(a):h=null;this.buffer=
new ec(h,d,e);null!=f&&this.fillRect(new dc(0,0,d,e),f)}}else this.QE(a)}function Md(){this.Wz=!1;this.nk=[];this.$l=[];this.mp=[]}function fc(){this.pc=new Ac}function La(){}function Ac(a,b){null==b&&(b=!1);if(null!=a)if(b){var c=new fc;c.pc=this;La.Vv({Il:c,OM:a})}else try{this.value=a(),this.yl=!0}catch(d){d instanceof ja&&(d=d.Lo),this.error=d,this.$n=!0}}function Xc(){}function xc(){}function og(){}function Te(){}function Nb(){}function nc(){}function Xa(a){if(a instanceof Array&&null==a.jb)this.W=
a,this.byteLength=a.length;else{this.W=[];for(var b=0;b<a;){var c=b++;this.W[c]=0}this.byteLength=a}}function ja(a){this.Lo=a;this.message=String(a);Error.captureStackTrace&&Error.captureStackTrace(this,ja)}function gd(a){switch(a){case ".":case "..":this.dir=a;this.file="";return}var b=a.lastIndexOf("/"),c=a.lastIndexOf("\\");b<c?(this.dir=Q.substr(a,0,c),a=Q.substr(a,c+1,null)):c<b?(this.dir=Q.substr(a,0,b),a=Q.substr(a,b+1,null)):this.dir=null;b=a.lastIndexOf(".");-1!=b?(this.ext=Q.substr(a,b+
1,null),this.file=Q.substr(a,0,b)):(this.ext=null,this.file=a)}function ge(){}function W(){this.h={}}function he(a,b){this.map=a;this.keys=b;this.index=0;this.count=b.length}function Ob(){this.h={RE:{}}}function sc(){this.h={}}function We(a){for(var b=a.length,c=1;b>1<<c;)++c;if(8<c||b!=1<<c)throw new ja("BaseCode : base length must be a power of two.");this.rH=a;this.ZJ=c}function Cb(a){this.length=a.byteLength;this.m=new Ka(a);this.m.BH=a;a.ZI=this;a.EH=this.m}function Xe(){this.vs=""}function vb(a){var b=
this;this.id=setInterval(function(){b.fw()},a)}function hd(){}function Ca(){}function Qf(){}function Ye(a,b,c){this.height=this.width=0;this.width=b;this.height=c;this.data=null!=a?a:new Ka(b*c*4)}function Yb(){}function Rf(){this.qg=new W}function Ze(a,b){this.Uz=a;this.Cv=b}function R(){this.tg=[]}function $e(a,b){null==b&&(b=!1);this.Cv=a;this.jD=b}function af(){this.Rk=!1;this.gn=255;this.fn=519;this.rq=1;this.oz=255;this.pz=this.rz=7680;this.qz=7681;this.Wp=this.Ck=this.Bm=this.Cm=!0}function bf(){this.yb=
[];this.bF=new W;this.jI=50;this.iI=1E3}function Nd(a,b,c,d){var e=this;pa.call(this,a,"vrDistortionCorrection",["LensCenter","Scale","ScaleIn","HmdWarpParam"],null,d.Sv,b,2,null,!1);this.XF=c;this.Hp=d.fI;this.Ny=d.Sv;this.yy=d.wJ;this.Ri.add(function(){e.xj=.5*e.width/e.height;e.dz=new K(2,2/e.xj);e.cz=new K(1/e.Ny*.5,1/e.Ny*.5*e.xj);e.xy=new K(e.XF?.5-.5*e.yy:.5+.5*e.yy,.5)});this.Ne.add(function(a){var b=e.xy.x,c=e.xy.y;if(a.Jb("LensCenter",b,c)){var d=a.c,l=a.u.get("LensCenter");d.b.uniform2f(l,
b,c)}b=e.cz.x;c=e.cz.y;a.Jb("Scale",b,c)&&(d=a.c,l=a.u.get("Scale"),d.b.uniform2f(l,b,c));b=e.dz.x;c=e.dz.y;a.Jb("ScaleIn",b,c)&&(d=a.c,l=a.u.get("ScaleIn"),d.b.uniform2f(l,b,c));b=e.Hp[0];c=e.Hp[1];d=e.Hp[2];l=e.Hp[3];a.Oa("HmdWarpParam",b,c,d,l)&&a.c.Ub(a.u.get("HmdWarpParam"),b,c,d,l)})}function ie(a,b,c,d,e,f){null==f&&(f=!1);var g=this;pa.call(this,a,"stereoscopicInterlace",["stepSize"],["camASampler"],1,b[1],d,e,f,c?"#define IS_STEREOSCOPIC_HORIZ 1":"");this.Xm=b[0].If;this.rj=new K(1/this.width,
1/this.height);this.Ri.add(function(){g.rj=new K(1/g.width,1/g.height)});this.Ne.add(function(a){var b=g.Xm,c=a.c,d=a.Rd.indexOf("camASampler");0<b.ob.length&&(b=b.ob.data[b.$g].data,0<=d&&(d=33984+d,c.I!=d-33984&&(c.b.activeTexture(d),c.I=d-33984),c.O[c.I]!=b&&(c.b.bindTexture(3553,b),c.O[c.I]=b)));c=g.rj.x;d=g.rj.y;a.Jb("stepSize",c,d)&&(b=a.c,a=a.u.get("stepSize"),b.b.uniform2f(a,c,d))})}function Od(a,b,c,d,e,f,g,h){null==h&&(h=!1);null==f&&(f=2);var k=this;this.direction=b;this.pu=c;pa.call(this,
a,"glowBlurPostProcess",["screenSize","direction","blurWidth"],null,d,e,f,g,h);this.Ne.add(function(a){var b=k.width,c=k.height;if(a.Jb("screenSize",b,c)){var d=a.c,e=a.u.get("screenSize");d.b.uniform2f(e,b,c)}b=k.direction;a.Jb("direction",b.x,b.y)&&(c=a.c,d=a.u.get("direction"),c.b.uniform2f(d,b.x,b.y));b=k.pu;c=a.Qa.get("blurWidth");if(null==c||c[0]!=b)a.Qa.set("blurWidth",[b]),c=a.c,a=a.u.get("blurWidth"),c.b.uniform1f(a,b)})}function Ec(a,b,c){this.Zf=a;this.j=b;this.hs=c}function Pd(a,b){this.ja=
a;this.md=b;this.qe=zb.Bg(a[0].Zf,a[1].Zf,a[2].Zf)}function zb(a,b){this.j=a;this.o=b}function Pb(a){this.Qe=[];this.qe=this.Ke=this.back=null;null!=a&&this.Hq(a)}function A(){}function ba(){}function fb(a,b){this.width=a;this.height=b}function Yc(a,b){this.position=null!=a?a:new n(0,0,0);this.j=null!=b?b:new n(0,1,0)}function pg(){}function je(){}function Bc(){this.url=""}function id(){this.Zi=this.ei=0;Fc.call(this);this.ba="DIFFUSE AMBIENT OPACITY OPACITYRGB REFLECTION EMISSIVE SPECULAR BUMP PARALLAX PARALLAXOCCLUSION SPECULAROVERALPHA CLIPPLANE ALPHATEST ALPHAFROMDIFFUSE POINTSIZE FOG SPECULARTERM DIFFUSEFRESNEL OPACITYFRESNEL REFLECTIONFRESNEL REFRACTIONFRESNEL EMISSIVEFRESNEL FRESNEL NORMAL UV1 UV2 VERTEXCOLOR VERTEXALPHA INSTANCES GLOSSINESS ROUGHNESS EMISSIVEASILLUMINATION LINKEMISSIVEWITHDIFFUSE REFLECTIONFRESNELFROMSPECULAR LIGHTMAP USELIGHTMAPASSHADOWMAP REFLECTIONMAP_3D REFLECTIONMAP_SPHERICAL REFLECTIONMAP_PLANAR REFLECTIONMAP_CUBIC REFLECTIONMAP_PROJECTION REFLECTIONMAP_SKYBOX REFLECTIONMAP_EXPLICIT REFLECTIONMAP_EQUIRECTANGULAR REFLECTIONMAP_EQUIRECTANGULAR_FIXED INVERTCUBICMAP LOGARITHMICDEPTH REFRACTION REFRACTIONMAP_3D REFLECTIONOVERALPHA INVERTNORMALMAPX INVERTNORMALMAPY SHADOWFULLFLOAT SHADOWS CAMERACOLORCURVES CAMERACOLORGRADING".split(" ").slice(0);
this.Ac=Array(this.ba.length);for(var a=0,b=this.ba.length;a<b;){var c=a++;this.Ac[c]=!1}this.ei=this.Zi=0}function gc(){}function Fc(){this.Jc="";this.zJ=[];this.yJ=[];this.qE=!1;this.Rh=[];this.Th=[];this.Sh=[];this.Xi=[];this.Fi=[];this.zi=[];this.Si=[];this.ic=[]}function ya(){this.GG=this.JG=this.HG=0;this.IG=30;this.Ey=this.Hy=this.Fy=0;this.Gy=30;this.my=this.py=this.ny=0;this.oy=30;this.hy=this.ky=this.iy=0;this.jy=30;this.Lm=new ca(0,0,0,0);this.Ym=new ca(0,0,0,0);this.kz=new ca(0,0,0,0);
this.kj=new ca(0,0,0,0);this.ly=new ca(0,0,0,0);this.Qp=new ca(0,0,0,0);this.Tk=new ca(0,0,0,0);this.Ux=!0}function cf(){}function jd(a,b,c,d,e,f){null==f&&(f=!1);null==e&&(e=!1);this.c=a;this.rh=c;this.qg=b;this.Wt=d;e||this.create();this.ge=f}function v(){}function Gb(){this.Ri=new R;this.VB=new R;this.ZB=new R;this.eK=new R;this.YB=new R;this.$B=new R;this.Nb=new R;this.gJ=this.isEnabled=this.HK=!0;this.vk=new sc;this.TF=Gb.PM++;this.qh=!1;this.aq=0;this.wc=new sc;this.he={width:0,height:0};this.ua=
new W}function df(){}function Ag(){}function rd(){}function sd(){}function Qd(){}function Sf(){}function ke(a,b,c){this.name=a;this.from=b;this.Tl=c}function Tf(){this.ur=!1}function ef(){}function hc(a,b,c,d){this.type=a;this.event=b;this.sw=!1;new K(c,d)}function Nc(a,b){this.type=a;this.event=b}function qb(){}function ff(){}function le(a,b){var c=Db.Bb;(null!=t["videoios10fix.fragment"]?c.Id("videoios10fix.fragment"):c.h.hasOwnProperty("videoios10fix.fragment"))||(c=Db.Bb,null!=t["videoios10fix.fragment"]?
c.C("videoios10fix.fragment","#ifdef GL_ES\r\nprecision highp float;\r\n#endif\r\n\r\n// Samplers\r\nvarying vec2 vUV;\r\nuniform sampler2D textureSampler;\r\n\r\nvoid main(void)\r\n{\r\n\tgl_FragColor = texture2D(textureSampler, vUV).bgra;\r\n}"):c.h["videoios10fix.fragment"]="#ifdef GL_ES\r\nprecision highp float;\r\n#endif\r\n\r\n// Samplers\r\nvarying vec2 vUV;\r\nuniform sampler2D textureSampler;\r\n\r\nvoid main(void)\r\n{\r\n\tgl_FragColor = texture2D(textureSampler, vUV).bgra;\r\n}");pa.call(this,
a,"videoios10fix",null,null,1,b)}function me(a,b,c,d,e,f){null==f&&(f=!1);var g=this,h=Db.Bb;(null!=t["stereoscopic.fragment"]?h.Id("stereoscopic.fragment"):h.h.hasOwnProperty("stereoscopic.fragment"))||(h=Db.Bb,null!=t["stereoscopic.fragment"]?h.C("stereoscopic.fragment","precision highp float;\r\n\r\nconst vec3 TWO = vec3(2.0, 2.0, 2.0);\r\n\r\nvarying vec2 vUV;\r\nuniform sampler2D camASampler;\r\nuniform sampler2D textureSampler;\r\nuniform vec2 stepSize;\r\n\r\nvoid main(void)\r\n{\r\n    bool useCamB;\r\n    vec2 texCoord1;\r\n    vec2 texCoord2;\r\n\r\n    vec3 frag1;\r\n    vec3 frag2;\r\n\r\n#ifdef IS_STEREOSCOPIC_HORIZ\r\n\t    useCamB = vUV.x > 0.5;\r\n\t    texCoord1 = vec2(useCamB ? (vUV.x - 0.25) : vUV.x + 0.25, vUV.y);\r\n\t    texCoord2 = vec2(texCoord1.x + stepSize.x, vUV.y);\r\n#else\r\n\t    useCamB = vUV.y > 0.5;\r\n\t    texCoord1 = vec2(vUV.x, useCamB ? vUV.y - 0.25 : vUV.y + 0.25);\r\n\t    texCoord2 = vec2(vUV.x, texCoord1.y + stepSize.y);\r\n#endif\r\n\r\n    // cannot assign a sampler to a variable, so must duplicate texture accesses\r\n    if (useCamB){\r\n        frag1 = texture2D(textureSampler, texCoord1).rgb;\r\n        frag2 = texture2D(textureSampler, texCoord2).rgb;\r\n    }else{\r\n        frag1 = texture2D(camASampler   , texCoord1).rgb;\r\n        frag2 = texture2D(camASampler   , texCoord2).rgb;\r\n    }\r\n\r\n    gl_FragColor = vec4((frag1 + frag2) / TWO, 1.0);\r\n}"):
h.h["stereoscopic.fragment"]="precision highp float;\r\n\r\nconst vec3 TWO = vec3(2.0, 2.0, 2.0);\r\n\r\nvarying vec2 vUV;\r\nuniform sampler2D camASampler;\r\nuniform sampler2D textureSampler;\r\nuniform vec2 stepSize;\r\n\r\nvoid main(void)\r\n{\r\n    bool useCamB;\r\n    vec2 texCoord1;\r\n    vec2 texCoord2;\r\n\r\n    vec3 frag1;\r\n    vec3 frag2;\r\n\r\n#ifdef IS_STEREOSCOPIC_HORIZ\r\n\t    useCamB = vUV.x > 0.5;\r\n\t    texCoord1 = vec2(useCamB ? (vUV.x - 0.25) : vUV.x + 0.25, vUV.y);\r\n\t    texCoord2 = vec2(texCoord1.x + stepSize.x, vUV.y);\r\n#else\r\n\t    useCamB = vUV.y > 0.5;\r\n\t    texCoord1 = vec2(vUV.x, useCamB ? vUV.y - 0.25 : vUV.y + 0.25);\r\n\t    texCoord2 = vec2(vUV.x, texCoord1.y + stepSize.y);\r\n#endif\r\n\r\n    // cannot assign a sampler to a variable, so must duplicate texture accesses\r\n    if (useCamB){\r\n        frag1 = texture2D(textureSampler, texCoord1).rgb;\r\n        frag2 = texture2D(textureSampler, texCoord2).rgb;\r\n    }else{\r\n        frag1 = texture2D(camASampler   , texCoord1).rgb;\r\n        frag2 = texture2D(camASampler   , texCoord2).rgb;\r\n    }\r\n\r\n    gl_FragColor = vec4((frag1 + frag2) / TWO, 1.0);\r\n}");
pa.call(this,a,"stereoscopic",["stepSize"],["camASampler"],1,b[1],d,e,f,c?"#define IS_STEREOSCOPIC_HORIZ 1":"");this.Xm=b[0].If;this.rj=new K(1/this.width,1/this.height);this.Ri.add(function(){g.rj=new K(1/g.width,1/g.height)});this.Ne.add(function(a){var b=g.Xm,c=a.c,d=a.Rd.indexOf("camASampler");0<b.ob.length&&(b=b.ob.data[b.$g].data,0<=d&&(d=33984+d,c.I!=d-33984&&(c.b.activeTexture(d),c.I=d-33984),c.O[c.I]!=b&&(c.b.bindTexture(3553,b),c.O[c.I]=b)));c=g.rj.x;d=g.rj.y;a.Jb("stepSize",c,d)&&(b=a.c,
a=a.u.get("stepSize"),b.b.uniform2f(a,c,d))})}function tc(){}function td(a,b,c){Ya.call(this,a,b,c)}function gf(a,b){null==a&&(a=new Ya(0,0,0));null==b&&(b=new Ya(1,0,0));this.IK=a;this.JK=b}function Uf(){}function ne(a,b,c,d,e){null==e&&(e=3);null==d&&(d=!1);var f=this;ma.call(this,null,b,!0,d);this.name=a;this.zg=c.video;this.zg.oncanplaythrough=function(){var a;a=f.zg.videoWidth;for(var c=1;c*=2,c<a;);if(c==a){a=f.zg.videoHeight;for(c=1;c*=2,c<a;);a=c==a}else a=!1;a?(f.kg=1,f.lg=1):(f.kg=0,f.lg=
0);f.fa=b.c.QH(f.zg.videoWidth,f.zg.videoHeight,!1,e);f.fa.pa=!0;f.f.Yv(B(f,f.update));f.zg.oncanplaythrough=null};this.Yp=1E3*((new Date).getTime()/1E3-ga.ce)|0}function Rd(a,b,c,d){rb.call(this,a,d);this.Pd=b;this.set_inputFormat(c)}function Vf(){}function uc(){}function va(){}function Zc(){}function oe(a,b,c,d,e,f,g,h){null==h&&(h="spherical");null==g&&(g="erect");sb.call(this,a,b,c,d,e,f,g,h)}function hf(a,b,c,d,e,f,g){null==g&&(g="spherical");null==f&&(f="erect");null==e&&(e=0);null==d&&(d=180);
null==c&&(c=360);this.dd=[];this.hG=a;this.f=b;this.set_panoramaHFOV(c);this.set_panoramaVFOV(d);this.set_panoramaPitch(e);this.set_inputFormat(f);this.set_outputFormat(g)}function pe(a,b,c,d,e,f,g,h,k){null==h&&(h="spherical");null==g&&(g="erect");this.alpha=1;sb.call(this,a,b,c,d,e,f,g,h);this.ld(k)}function sb(a,b,c,d,e,f,g,h){null==h&&(h="spherical");null==g&&(g="erect");this.bq=!1;this.name=a;this.f=b;this.set_panoramaHFOV(c);this.set_panoramaVFOV(d);this.set_panoramaPitch(e);this.nw(f);this.set_inputFormat(g);
this.set_outputFormat(h)}function Oc(a,b,c,d,e){this.ze=new K(0,0);this.panoramaHFOV=a;this.panoramaVFOV=b;this.panoramaPitch=c;this.mC=a<2*Math.PI;this.maxHFOV=d;this.minHFOV=e;this.yaw=0;this.pitch=c;this.Gv=.5*-a;this.Gv<-Math.PI&&(this.Gv=-Math.PI);this.Ev=.5*a;this.Ev>Math.PI&&(this.Ev=Math.PI);this.Ar=.5*-b+c;this.Ar<.5*-Math.PI&&(this.Ar=.5*-Math.PI);this.yr=.5*b+c;this.yr>.5*Math.PI&&(this.yr=.5*Math.PI)}function Ia(){this.Wn()}function Ya(a,b,c){null==c&&(c=0);null==b&&(b=0);null==a&&(a=
0);this.x=a;this.y=b;this.z=c}function qe(){this.panoramaHFOV=this.panoramaVFOV=this.panoramaPitch=this.maxHFOV=this.minHFOV=this.initialHFOV=0}function Sd(a,b,c,d){Za.call(this,a,b,c,d);this.Pr=.15}function re(a,b,c,d){Za.call(this,a,b,c,d)}function Za(a,b,c,d){this.Cb=new K(0,0);this.df=new K(0,0);this.Lk=0;this.Fc=new K(0,0);Fa.call(this,a,b,c,d)}function Ma(a,b,c,d){this.St=-1;Fa.call(this,a,b,c,d);this.ub=new da;this.hz=new da;a=new da;b=Ma.Fa;var e=.25*Math.PI;c=Math.sin(0);d=Math.cos(0);var f=
Math.sin(0),g=Math.cos(0),h=Math.sin(e),e=Math.cos(e);b.x=e*f*d+h*g*c;b.y=h*g*d-e*f*c;b.z=e*g*c-h*f*d;b.o=e*g*d+h*f*c;f=.25*-Math.PI;b=Math.sin(0);c=Math.cos(0);d=Math.sin(f);f=Math.cos(f);g=Math.sin(0);h=Math.cos(0);a.x=h*d*c+g*f*b;a.y=g*f*c-h*d*b;a.z=h*f*b-g*d*c;a.o=h*f*c+g*d*b;b=Ma.Fa;c=new da(0,0,0,1);d=-a.x*b.z+a.y*b.o+a.z*b.x+a.o*b.y;f=a.x*b.y-a.y*b.x+a.z*b.o+a.o*b.z;g=-a.x*b.x-a.y*b.y-a.z*b.z+a.o*b.o;c.x=a.x*b.o+a.y*b.z-a.z*b.y+a.o*b.x;c.y=d;c.z=f;c.o=g;this.aH=c}function Fa(a,b,c,d){this.Tm=
this.Vm=this.Um=this.Hm=this.Km=this.et=this.oc=this.La=this.Ua=0;this.zI="dfov";this.Pr=.05;aa.call(this,a,b,c);this.Tm=d.panoramaHFOV;this.Vm=d.panoramaVFOV;this.Um=d.panoramaPitch;this.Hm=d.maxHFOV;this.Km=d.minHFOV;this.et=d.initialHFOV;this.oc=this.Sa;this.Mk=B(this,this.reset);this.speed=.3;this.ih=!0}function se(){$c.call(this,"Attitude","rot");this.values=[1,0,0,0]}function $c(a,b){this.values=[];this.EK=new ud;this.name=a;this.id=b}function Y(){if(null!=Y.Ro)throw new ja("Sensors is a static class");
}function Gc(){}function jf(a,b){this.Hn=new W;this.Kj=new W;this.LH=a;b&&(this.ms=b)}function kf(){}function ic(){}function Td(){}function Wf(){}function Xf(){}function Eb(){}function wa(){}function na(){}function X(){}function Q(){}function jc(a,b){this.r=new RegExp(a,b.split("u").join(""))}function wb(){return v.Ve(this,"")}function F(a,b){function c(){}c.prototype=a;var d=new c,e;for(e in b)d[e]=b[e];b.toString!==Object.prototype.toString&&(d.toString=b.toString);return d}function B(a,b){if(null==
b)return null;null==b.Ef&&(b.Ef=Lg++);var c;null==a.kv?a.kv={}:c=a.kv[b.Ef];null==c&&(c=function(){return c.method.apply(c.scope,arguments)},c.scope=a,c.method=b,a.kv[b.Ef]=c);return c}J.BABYLON=J.BABYLON||{};J.CAPTURA=J.CAPTURA||{};J.CAPTURA.Viewer=J.CAPTURA.Viewer||{};J.CAPTURA.Extension=J.CAPTURA.Extension||{};J.CAPTURA.Extension.Signal=J.CAPTURA.Extension.Signal||{};J.CAPTURA.Extension.Video=J.CAPTURA.Extension.Video||{};J.CAPTURA.Extension.Babylon=J.CAPTURA.Extension.Babylon||{};var q={};q.EReg=
jc;jc.i=["EReg"];jc.prototype={match:function(a){this.r.global&&(this.r.lastIndex=0);this.r.a=this.r.exec(a);this.r.xP=a;return null!=this.r.a},Kg:function(a){if(null!=this.r.a&&0<=a&&a<this.r.a.length)return this.r.a[a];throw new ja("EReg::matched");},l:jc};q.HxOverrides=Q;Q.i=["HxOverrides"];Q.oN=function(a){switch(a.length){case 8:a=a.split(":");var b=new Date;b.setTime(0);b.setUTCHours(a[0]);b.setUTCMinutes(a[1]);b.setUTCSeconds(a[2]);return b;case 10:return a=a.split("-"),new Date(a[0],a[1]-
1,a[2],0,0,0);case 19:return b=a.split(" "),a=b[0].split("-"),b=b[1].split(":"),new Date(a[0],a[1]-1,a[2],b[0],b[1],b[2]);default:throw new ja("Invalid date format : "+a);}};Q.Wo=function(a,b){var c=a.charCodeAt(b);return c!=c?void 0:c};Q.substr=function(a,b,c){if(null==c)c=a.length;else if(0>c)if(0==b)c=a.length+c;else return"";return a.substr(b,c)};Q.remove=function(a,b){var c=a.indexOf(b);if(-1==c)return!1;a.splice(c,1);return!0};Q.Sw=function(a){return{dA:0,Nz:a,Ca:function(){return this.dA<this.Nz.length},
next:function(){return this.Nz[this.dA++]}}};Math.i=["Math"];q.Reflect=X;X.i=["Reflect"];X.vJ=function(a){try{return a.stage}catch(b){return null}};X.Fa=function(a,b){var c;if(null==a)return null;var d;a.ha?d=c=a.ha["get_"+b]:d=!1;return d?a[c]():a[b]};X.$b=function(a,b,c){var d,e;a.ha?e=d=a.ha["set_"+b]:e=!1;if(e)a[d](c);else a[b]=c};X.Eg=function(a){var b=[];if(null!=a){var c=Object.prototype.hasOwnProperty,d;for(d in a)"__id__"!=d&&"hx__closures__"!=d&&c.call(a,d)&&b.push(d)}return b};X.us=function(a){return"function"==
typeof a?!(a.i||a.$i):!1};X.El=function(a,b){return a==b?!0:X.us(a)&&X.us(b)?a.scope==b.scope&&a.method==b.method?null!=a.method:!1:!1};X.hE=function(a){if(null==a)return!1;var b=typeof a;return"string"==b||"object"==b&&null==a.jb?!0:"function"==b?null!=(a.i||a.$i):!1};q.Std=na;na.i=["Std"];na.Pb=function(a){return v.Ve(a,"")};na.$a=function(a){var b=parseInt(a,10);0!=b||120!=Q.Wo(a,1)&&88!=Q.Wo(a,1)||(b=parseInt(a));return isNaN(b)?null:b};q.StringTools=wa;wa.i=["StringTools"];wa.KM=function(a){return 10<=
a.length?"from_image"==Q.substr(a,0,10):!1};wa.Rw=function(a,b){var c=Q.Wo(a,b);return 8<c&&14>c?!0:32==c};wa.sE=function(a){for(var b=a.length,c=0;c<b&&wa.Rw(a,c);)++c;return 0<c?Q.substr(a,c,b-c):a};wa.yE=function(a){for(var b=a.length,c=0;c<b&&wa.Rw(a,b-c-1);)++c;return 0<c?Q.substr(a,0,b-c):a};wa.Kl=function(a){return wa.sE(wa.yE(a))};wa.replace=function(a,b,c){return a.split(b).join(c)};q.Type=Eb;Eb.i=["Type"];Eb.VD=function(a){a=a.i;return null==a?null:a.join(".")};Eb.wE=function(a){a=q[a];
return null!=a&&a.i?a:null};Eb.bl=function(a,b){switch(b.length){case 0:return new a;case 1:return new a(b[0]);case 2:return new a(b[0],b[1]);case 3:return new a(b[0],b[1],b[2]);case 4:return new a(b[0],b[1],b[2],b[3]);case 5:return new a(b[0],b[1],b[2],b[3],b[4]);case 6:return new a(b[0],b[1],b[2],b[3],b[4],b[5]);case 7:return new a(b[0],b[1],b[2],b[3],b[4],b[5],b[6]);case 8:return new a(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7]);case 9:return new a(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8]);case 10:return new a(b[0],
b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9]);case 11:return new a(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10]);case 12:return new a(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11]);case 13:return new a(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12]);case 14:return new a(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13]);default:throw new ja("Too many arguments");}};Eb.rD=function(a){function b(){}b.prototype=a.prototype;return new b};
var lf={};q["_UInt.UInt_Impl_"]=lf;lf.i=["_UInt","UInt_Impl_"];lf.wD=function(a){return 0>a?4294967296+a:a+0};var vd=J.CAPTURA.Extension.Babylon.App=function(a){this.Ot=this.sy=!1;null==a?(this.mb=window.document.createElement("canvas"),this.mb.width=window.innerWidth,this.mb.height=window.innerHeight,window.document.body.appendChild(this.mb),this.sy=!0):v.D(a,HTMLCanvasElement)?this.mb=a:"string"==typeof a&&(this.mb=window.document.getElementById(a));a=ga.ps();"pointer"!=a&&"ontouchstart"in window&&
(this.mb.addEventListener("touchstart",B(this,this.jC)),this.mb.addEventListener("touchend",B(this,this.hC)),this.mb.addEventListener("touchmove",B(this,this.iC)));this.mb.addEventListener(a+"down",B(this,this.Vj));this.mb.addEventListener(a+"up",B(this,this.Xj));this.mb.addEventListener(a+"move",B(this,this.Wj));this.mb.addEventListener("mousewheel",B(this,this.Yj));this.mb.addEventListener("DOMMouseScroll",B(this,this.Yj),!1);ga.qs([{name:"keydown",Rc:B(this,this.mo)},{name:"keyup",Rc:B(this,this.no)}]);
this.engine=this.RH();this.scene=this.Cu();this.scene.eC.add(B(this,this.uK));this.scene.bC.add(B(this,this.jK));this.UC(-16777216)};q["cc.core.babylon.html5.BabylonApp"]=vd;vd.i=["cc","core","babylon","html5","BabylonApp"];vd.prototype={UC:function(a){this.backgroundColor=a;this.oM();return this.backgroundColor},dispose:function(){if(null!=this.mb){var a=ga.ps();"pointer"!=a&&"ontouchstart"in window&&(this.mb.removeEventListener("touchstart",B(this,this.jC)),this.mb.removeEventListener("touchend",
B(this,this.hC)),this.mb.removeEventListener("touchmove",B(this,this.iC)));this.mb.removeEventListener(a+"down",B(this,this.Vj));this.mb.removeEventListener(a+"up",B(this,this.Xj));this.mb.removeEventListener(a+"move",B(this,this.Wj));this.mb.removeEventListener("mousewheel",B(this,this.Yj));this.mb.removeEventListener("DOMMouseScroll",B(this,this.Yj),!1);ga.Oo([{name:"keydown",Rc:B(this,this.mo)},{name:"keyup",Rc:B(this,this.no)}]);this.sy&&window.document.body.removeChild(this.mb);this.mb=null}null!=
this.scene&&(this.scene.dispose(),this.scene=null);null!=this.engine&&(this.engine.dispose(),this.engine=null)},mo:function(a){for(var b=0,c=this.engine.ao;b<c.length;){var d=c[b];++b;d(this.Zz(a.keyCode))}},no:function(a){for(var b=0,c=this.engine.bo;b<c.length;){var d=c[b];++b;d(this.Zz(a.keyCode))}},jC:function(a){var b=0;for(a=a.changedTouches;b<a.length;){var c=a[b];++b;for(var d=0,e=this.engine.fk;d<e.length;){var f=e[d];++d;f(c.clientX,c.clientY,c.identifier)}}},iC:function(a){var b=0;for(a=
a.changedTouches;b<a.length;){var c=a[b];++b;for(var d=0,e=this.engine.gk;d<e.length;){var f=e[d];++d;f(c.clientX,c.clientY,c.identifier)}}},hC:function(a){var b=0;for(a=a.changedTouches;b<a.length;){var c=a[b];++b;for(var d=0,e=this.engine.hk;d<e.length;){var f=e[d];++d;f(c.clientX,c.clientY,c.identifier)}}},Vj:function(a){for(var b=0,c=this.engine.ho;b<c.length;){var d=c[b];++b;d(a.clientX,a.clientY,0)}},Wj:function(a){for(var b=0,c=this.engine.io;b<c.length;){var d=c[b];++b;d(a.clientX,a.clientY)}},
Xj:function(a){for(var b=0,c=this.engine.jo;b<c.length;){var d=c[b];++b;d(a.clientX,a.clientY,0)}},Yj:function(a){for(var b=0,c=this.engine.Hv;b<c.length;){var d=c[b];++b;d(a.wheelDelta)}},uK:function(){var a=this;this.Ot||(this.Ot=!0,vb.aa(function(){var b=a.engine,c=B(a,a.DC);-1==b.fi.indexOf(c)&&(b.fi.push(c),b.Nt||(b.Nt=!0,window.requestAnimationFrame(B(b,b.Yy))))},0))},jK:function(){0==this.scene.mf.length&&(this.Ot=!1,this.engine.nD(B(this,this.DC)))},oM:function(){var a=lf.wD(this.backgroundColor>>>
24&255)/lf.wD(255),b=this.backgroundColor,b=new L((b>>16&255)/255,(b>>8&255)/255,(b&255)/255);0==a?this.scene.Dq=!1:(this.scene.Dq=!0,this.scene.clearColor=.1>a?new ca(0,0,0,a):1>a?new ca(b.r,b.v,b.m,a):b)},RH:function(){return new p(this.mb,!1)},Cu:function(){return new Aa(this.engine)},DC:function(){this.mb.clientWidth==this.engine.width&&this.mb.clientHeight==this.engine.height&&this.mb.clientWidth==this.mb.width&&this.mb.clientHeight==this.mb.height||this.engine.resize();this.scene.hb()},Zz:function(a){if(65<=
a&&90>=a)return a+32;switch(a){case 16:return 1073742049;case 17:return 1073742048;case 18:return 1073742050;case 20:return 1073741881;case 33:return 1073741899;case 34:return 1073741902;case 35:return 1073741901;case 36:return 1073741898;case 37:return 1073741904;case 38:return 1073741906;case 39:return 1073741903;case 40:return 1073741905;case 45:return 1073741897;case 46:return 127;case 112:return 1073741882;case 113:return 1073741883;case 114:return 1073741884;case 115:return 1073741885;case 116:return 1073741886;
case 117:return 1073741887;case 118:return 1073741888;case 119:return 1073741889;case 120:return 1073741890;case 121:return 1073741891;case 122:return 1073741892;case 123:return 1073741893;case 124:return 1073741928;case 125:return 1073741929;case 126:return 1073741930;case 144:return 1073741907;case 186:return 59;case 187:return 61;case 188:return 44;case 189:return 45;case 190:return 46;case 191:return 47;case 192:return 96;case 219:return 91;case 220:return 92;case 221:return 93;case 222:return 39}return a},
l:vd,ha:{UC:"set_backgroundColor"}};q["cc.core.lime.graphics.image.ImageExtender"]=Xf;Xf.i="cc core lime graphics image ImageExtender".split(" ");Xf.Ic=function(a,b,c,d){null==d&&(d=!1);ta.xh(a);ta.Ww(a,!0);a=a.buffer;var e=a.nc;d||(a.nc.KB=!1,a.nc.MB=!1,a.nc.lB=!1);c=null!=c?c:new Wc;ta.Ww(b,!1);e.globalAlpha=1;e.setTransform(c.W,c.m,c.Iq,c.d,c.Cc|0,c.Dc|0);e.drawImage(b.Un(),0,0);d||(a.nc.KB=!0,a.nc.MB=!0,a.nc.lB=!0);a.nc.setTransform(1,0,0,1,0,0);a.de=null;a.data=null};q["cc.core.native.js.BrowserUtils"]=
Wf;Wf.i=["cc","core","native","js","BrowserUtils"];Wf.jE=function(){return(new jc("Safari","")).match(window.navigator.userAgent)?(new jc("Apple Computer","")).match(window.navigator.platform):!1};q["cc.core.native.js.DeviceUtils"]=Td;Td.i=["cc","core","native","js","DeviceUtils"];Td.YD=function(){return(new jc("iP(hone|od|ad)","")).match(window.navigator.platform)};Td.MM=function(){if(!Td.YD())return null;var a=new jc("OS (\\d+)_(\\d+)_?(\\d+)?","");return a.match(window.navigator.appVersion)?[na.$a(a.Kg(1)),
na.$a(a.Kg(2)),na.$a(a.Kg(3))|0]:null};q["cc.core.native.js.MediaUtils"]=ic;ic.i=["cc","core","native","js","MediaUtils"];ic.aE=function(a){null==a&&(a=window.document.createElement("video"));var b=window.MediaSource||window.WebKitMediaSource;return null==b||b.isTypeSupported?null!=b?b.isTypeSupported('video/mp4; codecs="avc1.4d401e"'):!1:""!=a.canPlayType('video/mp4; codecs="avc1.4d401e"')};ic.bE=function(a){return ic.aE(a)};ic.$D=function(a){null==a&&(a=window.document.createElement("video"));return null!=
a&&null!=B(a,a.canPlayType)?""!=a.canPlayType('video/mp4; codecs="avc1.4d401e, mp4a.40.2"'):!1};ic.dE=function(a){null==a&&(a=window.document.createElement("video"));return null!=a&&null!=B(a,a.canPlayType)?""!=a.canPlayType('video/webm; codecs="vp8.0, vorbis"'):!1};ic.cE=function(a){null==a&&(a=window.document.createElement("video"));return null!=a&&null!=B(a,a.canPlayType)?""!=a.canPlayType('video/ogg; codecs="theora, vorbis"'):!1};q["cc.core.native.js.ScriptUtils"]=kf;kf.i=["cc","core","native",
"js","ScriptUtils"];kf.Uw=function(a,b,c){var d=window.document.head,e=window.document.createElement("script");e.type="text/javascript";e.src=a;e.onload=b;null!=c&&(e.onerror=c);d.appendChild(e)};q["cc.core.validation.Validator"]=jf;jf.i=["cc","core","validation","Validator"];jf.prototype={Ih:function(a){if(this.nv)return!0;if(null==a){a=this.Kj;for(a=new he(a,a.mu());a.Ca();)return a.next(),!0;return!1}var b=this.Kj;return null!=t[a]?b.Id(a):b.h.hasOwnProperty(a)},ne:function(a){if(!this.ms||null!=
X.vJ(this.ms)){var b=this.Ih(),c=!1;if(this.zl)for(var d=this.Hn,d=new he(d,d.mu());d.Ca();){d.next();c=!0;break}null==a||"all"==a?this.zl?(a=this.Hn,null!=t.all?a.C("all",!0):a.h.all=!0):this.nv=!0:this.zl?(d=this.Hn,null!=t[a]?d.C(a,!0):d.h[a]=!0):("all"!=a?(d=this.Kj,d=!(null!=t[a]?d.Id(a):d.h.hasOwnProperty(a))):d=!1,d&&(d=this.Kj,null!=t[a]?d.C(a,!0):d.h[a]=!0));this.zl?c||vb.aa(B(this,this.Wl),0):b||vb.aa(B(this,this.Wl),0)}},Wl:function(){if(!this.zl&&this.Ih()&&(!this.ms||Object.prototype.hasOwnProperty.call(this.ms,
"stage"))){this.zl=!0;this.LH();for(var a=this.Kj.keys();a.Ca();){var b=a.next();this.Kj.remove(b)}this.nv=!1;for(a=this.Hn.keys();a.Ca();){b=a.next();if("all"==b)this.nv=!0;else{var c=this.Kj;null!=t[b]?c.C(b,!0):c.h[b]=!0}this.Hn.remove(b)}this.zl=!1}},l:jf};q["cc.sensors.Sensors"]=Gc;Gc.i=["cc","sensors","Sensors"];Gc.Uu=function(){return Y.ts().Uu()};Gc.Wu=function(){return Y.ts().Wu()};Gc.qv=function(){return Y.ts().qv()};q["cc.sensors.impl.SensorsHTML5"]=Y;Y.i=["cc","sensors","impl","SensorsHTML5"];
Y.fE=function(){var a=!1,b=navigator.userAgent||navigator.vendor||window.opera;if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(b)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(b.substr(0,
4)))a=!0;return a};Y.ts=function(){null==Y.Ro&&(Y.Ro=new Y);return Y.Ro};Y.prototype={qv:function(){return window.DeviceOrientationEvent?Y.fE():!1},Wu:function(){return window.orientation},NI:function(){Y.zC||(Y.Tj=[],this.addEventListener("deviceorientation",B(this,this.oK)),Y.zC=!0);return Y.Tj},Uu:function(){Y.wC||(Y.Bg=[],Y.wC=!0);if(Y.Qo){var a=this.NI(),b=a[0],c=a[1],d=a[2],a=Math.cos(b/2),e=Math.cos(c/2),f=Math.cos(d/2),b=Math.sin(b/2),c=Math.sin(c/2),d=Math.sin(d/2);Y.Bg[0]=a*e*f-b*c*d;Y.Bg[1]=
b*e*f-a*c*d;Y.Bg[2]=a*c*f+b*e*d;Y.Bg[3]=a*e*d+b*c*f;Y.Qo=!1}return Y.Bg},addEventListener:function(a,b){window.addEventListener(a,b)},oK:function(a){Y.Tj[0]=a.beta*Y.ns;Y.Tj[1]=a.gamma*Y.ns;Y.Tj[2]=a.alpha*Y.ns;Y.Qo=!0},l:Y};q["cc.sensors.models.Sensor"]=$c;$c.i=["cc","sensors","models","Sensor"];$c.prototype={update:function(){this.EK.pf(this.values)},l:$c};q["cc.sensors.models.Attitude"]=se;se.i=["cc","sensors","models","Attitude"];se.U=$c;se.prototype=F($c.prototype,{update:function(){this.values=
Gc.Uu();$c.prototype.update.call(this)},l:se});var Pc=J.CAPTURA.Viewer=function(a){vd.call(this,a)};q["cc.viewer.CapturaViewer"]=Pc;Pc.i=["cc","viewer","CapturaViewer"];Pc.Ib=function(){console.log("CapturaViewer v"+Pc.Bb)};Pc.U=vd;Pc.prototype=F(vd.prototype,{Cu:function(){var a=vd.prototype.Cu.call(this);a.Yr=!1;a.nC=!1;a.Lz=!1;a.wu=!1;a.qf=!1;a.rw=!1;a.mD=!1;a.zB=!1;T.lb=!1;T.Za=!1;T.Ta=!1;T.$a=!1;T.Ib=!1;T.$b=!1;T.mc=!1;T.tc=!1;T.Ec=!1;return a},get:function(a){return X.Fa(this,a)},set:function(a,
b){X.$b(this,a,b);return X.Fa(this,a)},l:Pc});var $a=J.BABYLON.ISmartArrayCompatible=function(){};q["com.babylonhx.ISmartArrayCompatible"]=$a;$a.i=["com","babylonhx","ISmartArrayCompatible"];$a.prototype={l:$a};var fa=J.BABYLON.Node=function(a,b){this.yb=[];this.ud=this.Wm=-1;this.Vp=this.Nc=!0;this.Hf=new W;this.Xa=[];this.zr=null;this.state="";this.id=this.name=a;this.f=b;this.dh()};q["com.babylonhx.Node"]=fa;fa.i=["com","babylonhx","Node"];fa.xb=[$a];fa.aa=function(a,b){if(null!=b.Ui)for(var c=
0,d=b.Ui.length;c<d;){var e=c++,e=b.Ui[e];a.PH(e.name,e.from,e.Tl)}};fa.prototype={ck:function(a){if(this.ca==a)return a;if(null!=this.ca){var b=this.ca.cj.indexOf(this);-1!=b&&this.ca.cj.splice(b,1)}this.ca=a;null!=this.ca&&(null==this.ca.cj&&(this.ca.cj=[]),this.ca.cj.push(this));return a},va:function(){var a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=1;return a},dh:function(){this.K=new ff;
this.K.parent=null},Aw:function(a){null==a&&(a=!1);if(a||!this.sB(null))this.K.parent=this.ca,this.uj()},uj:function(){},Dm:function(){return!0},rv:function(){return null==this.ca?!0:this.Wm!=this.ca.ud?!1:this.ca.sB(null)},sB:function(a){null==a&&(a=!1);var b=this.iB(),b=(b=b?!0:!this.rv())?!0:!this.Dm();a&&this.Aw(!0);return!b},iB:function(a){null==a&&(a=!1);if(this.K.parent==this.ca)return!1;a&&(this.K.parent=this.ca);return!0},pa:function(){return this.Nc},isEnabled:function(){return this.Vp?
null!=this.ca?this.ca.isEnabled():!0:!1},at:function(a,b,c){null==b&&(b=!1);if(null!=this.cj)for(var d=0,e=this.cj.length;d<e;){var f=d++,f=this.cj[f];(null==c||c(f))&&a.push(f);b||f.at(a,!1,c)}},HI:function(a,b){null==a&&(a=!1);var c=[];this.at(c,a,function(a){return null==b||b(a)?v.D(a,ka):!1});return c},mq:function(a){a!=this.Nc&&(a?(this.Nc=!0,null!=this.Nv&&this.Nv(this)):this.Nc=!1)},PH:function(a,b,c){var d=this.Hf;if(null==(null!=t[a]?d.H(a):d.h[a])){var d=new ke(a,b,c),e=this.Hf;null!=t[a]?
e.C(a,d):e.h[a]=d;d=0;for(e=this.Xa.length;d<e;){var f=d++;null!=this.Xa[f]&&this.Xa[f].createRange(a,b,c)}}},EL:function(){for(var a=[],b=this.Hf.keys();b.Ca();){var c=b.next(),d={};d.name=c;var e=this.Hf;d.from=(null!=t[c]?e.H(c):e.h[c]).from;e=this.Hf;d.Tl=(null!=t[c]?e.H(c):e.h[c]).Tl;a.push(d)}return a},dispose:function(){this.ck(null)},l:fa,ha:{ck:"set_parent"}};var Qb=J.BABYLON.IAnimatable=function(){};q["com.babylonhx.animations.IAnimatable"]=Qb;Qb.i=["com","babylonhx","animations","IAnimatable"];
Qb.prototype={l:Qb};var oa=J.BABYLON.Camera=function(a,b,c){this.Hd="mouse";this.hj=[];this.dt=new n(0,0,0);this.Vg=new Ga(256);var d=new r;d.a[0]=1;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=1;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=1;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=1;d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=0;this.sb=d;this.cc=[];this.BF=!1;this.Va=new r;d=new r;
d.a[0]=1;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=1;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=1;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=1;this.bf=d;this.ma=[];this.Yc=this.Rb=0;this.tb=-1;this.oD=[];this.viewport=new wd(0,0,1,1);this.pv=!1;this.mode=0;this.vf=.9;this.Fb=1E4;this.Tb=1;this.Sa=.8;this.Mg=this.Ng=this.Lg=this.Og=null;this.Bf=new n(0,1,0);this.position=new n(0,0,0);fa.call(this,a,c);c.eH(this);null==c.L&&(c.L=this);this.Pf=B(this,this.MI);this.ey=B(this,this.ct);this.Hd=ga.ps();
this.position=b};q["com.babylonhx.cameras.Camera"]=oa;oa.i=["com","babylonhx","cameras","Camera"];oa.xb=[Qb];oa.ab=function(a,b){var c=null,d=a.position,e=new n(d[0],d[1],d[2]),d=null!=a.vv?b.JI(a.vv):null;if("AnaglyphArcRotateCamera"==a.type||"ArcRotateCamera"==a.type){var e=a.alpha,f=a.beta,g=a.P;"AnaglyphArcRotateCamera"==a.type?(c=a.mv,c=new Qc(a.name,e,f,g,d,c,b)):c=new Zb(a.name,e,f,g,d,b)}else"AnaglyphFreeCamera"==a.type?(c=a.mv,c=new te(a.name,e,c,b)):"DeviceOrientationCamera"!=a.type&&("FollowCamera"==
a.type?(c=new xd(a.name,e,b),c.iv=a.iv,c.P=a.P,c.dw=a.dw,null!=d&&(v.g(c,xd).target=d)):"GamepadCamera"!=a.type&&("TouchCamera"==a.type?c=new ue(a.name,e,b):"VirtualJoysticksCamera"!=a.type&&(c="WebVRFreeCamera"==a.type?new ve(a.name,e,b):"VRDeviceOrientationFreeCamera"==a.type?new we(a.name,e,b):new qa(a.name,e,b))));null!=a.Rb&&c.Nl(a.Rb,null!=a.mv?{Hh:a.mv}:{});null!=d&&v.D(c,qa)&&(v.g(c,qa).jd=d);c.id=a.id;za.ae(c,a.Rl);null!=a.Fl&&(c.Cz=a.Fl);a.target?Object.prototype.hasOwnProperty.call(c,"setTarget")?
(d=a.target,c.Ol(new n(d[0],d[1],d[2]))):(d=a.target,c.target=new n(d[0],d[1],d[2])):(d=a.rotation,c.rotation=new n(d[0],d[1],d[2]));c.Sa=a.Sa;c.Tb=a.Tb;c.Fb=a.Fb;c.speed=a.speed;c.vf=a.vf;c.vh=a.vh;c.lu=a.lu;null!=a.Ai&&(d=a.Ai,c.Ai=new n(d[0],d[1],d[2]));if(null!=a.Xa){d=0;for(e=a.Xa.length;d<e;)f=d++,c.Xa.push(Hb.ab(a.Xa[f]));fa.aa(c,a)}1==a.nu&&b.Fq(c,a.Oz,a.Qz,a.Pz,1);c.tb=null==a.tb||isNaN(a.tb)?268435455:Math.abs(na.$a(a.tb));return c};oa.U=fa;oa.prototype=F(fa.prototype,{Dh:function(){return this.dt},
oO:function(){return this.Vg},OO:function(a){var b=this.Vg;a=b.data.indexOf(a);return-1!=(a>=b.length?-1:a)},dh:function(){fa.prototype.dh.call(this);this.K.position=new n(Infinity,Infinity,Infinity);this.K.Bf=new n(Infinity,Infinity,Infinity);this.K.mode=null;this.K.Tb=null;this.K.Fb=null;this.K.Sa=null;this.K.Yc=null;this.K.xj=null;this.K.Mg=null;this.K.Ng=null;this.K.Lg=null;this.K.Og=null;this.K.GC=null;this.K.CC=null},uj:function(a){null==a&&(a=!1);a||fa.prototype.uj.call(this);a=this.f.c;var b=
this.K.position,c=this.position;b.x=c.x;b.y=c.y;b.z=c.z;b=this.K.Bf;c=this.Bf;b.x=c.x;b.y=c.y;b.z=c.z;this.K.mode=this.mode;this.K.Tb=this.Tb;this.K.Fb=this.Fb;this.K.Sa=this.Sa;this.K.Yc=this.Yc;this.K.xj=a.ll(this);this.K.Mg=this.Mg;this.K.Ng=this.Ng;this.K.Lg=this.Lg;this.K.Og=this.Og;this.K.GC=a.Wb();this.K.CC=a.Lb()},wz:function(){this.Aw();this.ed()},Dm:function(){return this.jj()?this.vy():!1},jj:function(){if(!fa.prototype.Dm.call(this))return!1;var a;a=this.K.position;var b=this.position;
null!=b&&a.x==b.x&&a.y==b.y&&a.z==b.z?(a=this.K.Bf,b=this.Bf,a=null!=b&&a.x==b.x&&a.y==b.y?a.z==b.z:!1):a=!1;return a?this.rv():!1},vy:function(){var a=this.K.mode==this.mode&&this.K.Tb==this.Tb&&this.K.Fb==this.Fb;if(!a)return!1;a=this.f.c;return a=0==this.mode?this.K.Sa==this.Sa&&this.K.Yc==this.Yc?this.K.xj==a.ll(this):!1:this.K.Mg==this.Mg&&this.K.Ng==this.Ng&&this.K.Lg==this.Lg&&this.K.Og==this.Og&&this.K.GC==a.Wb()?this.K.CC==a.Lb():!1},attachControl:function(){},le:function(){},ed:function(){0!=
this.Rb&&this.vj();this.fe()},fe:function(){},Cp:function(){0<this.cc.length&&this.cc[0].Bv();for(var a=0,b=this.ma.length;a<b;){var c=a++,c=this.ma[c],d=c.If;null!=d&&(v.D(d,kc)&&(c.pv=0==this.cc.length),c.cc=this.cc.slice(0).concat([d]),d.Bv())}},oH:function(a,b){if(!a.kq&&-1<this.cc.indexOf(a))return console.log("You're trying to reuse a post process not defined as reusable."),0;null==b||0>b?this.cc.push(a):this.cc.splice(b,0,a);this.Cp();return this.cc.indexOf(a)},bI:function(a,b){var c=[];if(null==
b){var d=this.cc.indexOf(a);-1!=d&&this.cc.splice(d,1)}else for(b instanceof Array&&null==b.jb||(b=[b]),d=b.length-1;0<=d;)this.cc[b[d]]!=a?c.push(d):(this.cc.splice(d,1),--d);this.Cp();return c},va:function(){if(null==this.Ea){var a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=1;this.Ea=a}var b=this.rf(),a=this.Ea,c=b.a[0],d=b.a[1],e=b.a[2],f=b.a[3],g=b.a[4],h=b.a[5],k=b.a[6],l=b.a[7],m=b.a[8],
w=b.a[9],C=b.a[10],u=b.a[11],y=b.a[12],n=b.a[13],z=b.a[14],ea=b.a[15],b=C*ea-u*z,M=w*ea-u*n,Cc=w*z-C*n,x=m*ea-u*y,p=m*z-C*y,q=m*n-w*y,D=h*b-k*M+l*Cc,t=-(g*b-k*x+l*p),P=g*M-h*x+l*q,N=-(g*Cc-h*p+k*q),E=1/(c*D+d*t+e*P+f*N),O=k*ea-l*z,Tb=h*ea-l*n,H=h*z-k*n,ea=g*ea-l*y,z=g*z-k*y,y=g*n-h*y,n=k*u-l*C,yd=h*u-l*w,v=h*C-k*w,l=g*u-l*m,k=g*C-k*m,g=g*w-h*m;a.a[0]=D*E;a.a[4]=t*E;a.a[8]=P*E;a.a[12]=N*E;a.a[1]=-(d*b-e*M+f*Cc)*E;a.a[5]=(c*b-e*x+f*p)*E;a.a[9]=-(c*M-d*x+f*q)*E;a.a[13]=(c*Cc-d*p+e*q)*E;a.a[2]=(d*O-e*
Tb+f*H)*E;a.a[6]=-(c*O-e*ea+f*z)*E;a.a[10]=(c*Tb-d*ea+f*y)*E;a.a[14]=-(c*H-d*z+e*y)*E;a.a[3]=-(d*n-e*yd+f*v)*E;a.a[7]=(c*n-e*l+f*k)*E;a.a[11]=-(c*yd-d*l+f*g)*E;a.a[15]=(c*v-d*k+e*g)*E;return this.Ea},ct:function(){var a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=1;return a},rf:function(a){null==a&&(a=!1);this.bf=this.oF(a);if(!a&&this.jj())return this.bf;if(null==this.ca||null==this.ca.va()){a=
this.dt;var b=this.position;a.x=b.x;a.y=b.y;a.z=b.z}else{null==this.Ea&&(a=new r,a.a[0]=1,a.a[1]=0,a.a[2]=0,a.a[3]=0,a.a[4]=0,a.a[5]=1,a.a[6]=0,a.a[7]=0,a.a[8]=0,a.a[9]=0,a.a[10]=1,a.a[11]=0,a.a[12]=0,a.a[13]=0,a.a[14]=0,a.a[15]=1,this.Ea=a);var c=this.bf;a=this.Ea;var b=c.a[0],d=c.a[1],e=c.a[2],f=c.a[3],g=c.a[4],h=c.a[5],k=c.a[6],l=c.a[7],m=c.a[8],w=c.a[9],C=c.a[10],u=c.a[11],y=c.a[12],n=c.a[13],z=c.a[14],ea=c.a[15],c=C*ea-u*z,M=w*ea-u*n,Cc=w*z-C*n,x=m*ea-u*y,p=m*z-C*y,q=m*n-w*y,D=h*c-k*M+l*Cc,t=
-(g*c-k*x+l*p),P=g*M-h*x+l*q,N=-(g*Cc-h*p+k*q),E=1/(b*D+d*t+e*P+f*N),O=k*ea-l*z,Tb=h*ea-l*n,H=h*z-k*n,ea=g*ea-l*y,z=g*z-k*y,y=g*n-h*y,n=k*u-l*C,yd=h*u-l*w,v=h*C-k*w,l=g*u-l*m,k=g*C-k*m,g=g*w-h*m;a.a[0]=D*E;a.a[4]=t*E;a.a[8]=P*E;a.a[12]=N*E;a.a[1]=-(d*c-e*M+f*Cc)*E;a.a[5]=(b*c-e*x+f*p)*E;a.a[9]=-(b*M-d*x+f*q)*E;a.a[13]=(b*Cc-d*p+e*q)*E;a.a[2]=(d*O-e*Tb+f*H)*E;a.a[6]=-(b*O-e*ea+f*z)*E;a.a[10]=(b*Tb-d*ea+f*y)*E;a.a[14]=-(b*H-d*z+e*y)*E;a.a[3]=-(d*n-e*yd+f*v)*E;a.a[7]=(b*n-e*l+f*k)*E;a.a[11]=-(b*yd-d*
l+f*g)*E;a.a[15]=(b*v-d*k+e*g)*E;this.Ea.qa(this.ca.va(),this.bf.a,0);a=this.dt;b=this.bf.a[13];d=this.bf.a[14];a.x=this.bf.a[12];a.y=b;a.z=d;a=this.bf;b=a.a[0];d=a.a[1];e=a.a[2];f=a.a[3];E=a.a[4];O=a.a[5];C=a.a[6];u=a.a[7];Tb=a.a[8];H=a.a[9];ea=a.a[10];z=a.a[11];y=a.a[12];n=a.a[13];l=a.a[14];k=a.a[15];g=ea*k-z*l;h=H*k-z*n;m=H*l-ea*n;w=Tb*k-z*y;c=Tb*l-ea*y;M=Tb*n-H*y;Cc=O*g-C*h+u*m;x=-(E*g-C*w+u*c);p=E*h-O*w+u*M;q=-(E*m-O*c+C*M);D=1/(b*Cc+d*x+e*p+f*q);t=C*k-u*l;P=O*k-u*n;N=O*l-C*n;k=E*k-u*y;l=E*l-
C*y;y=E*n-O*y;n=C*z-u*ea;yd=O*z-u*H;v=O*ea-C*H;u=E*z-u*Tb;C=E*ea-C*Tb;E=E*H-O*Tb;a.a[0]=Cc*D;a.a[4]=x*D;a.a[8]=p*D;a.a[12]=q*D;a.a[1]=-(d*g-e*h+f*m)*D;a.a[5]=(b*g-e*w+f*c)*D;a.a[9]=-(b*h-d*w+f*M)*D;a.a[13]=(b*m-d*c+e*M)*D;a.a[2]=(d*t-e*P+f*N)*D;a.a[6]=-(b*t-e*k+f*l)*D;a.a[10]=(b*P-d*k+f*y)*D;a.a[14]=-(b*N-d*l+e*y)*D;a.a[3]=-(d*n-e*yd+f*v)*D;a.a[7]=(b*n-e*u+f*C)*D;a.a[11]=-(b*yd-d*u+f*E)*D;a.a[15]=(b*v-d*C+e*E)*D;this.Wm=this.ca.ud}this.ud=this.f.Pa;return this.bf},oF:function(a){null==a&&(a=!1);if(!a&&
this.jj())return this.bf;this.bf=this.ey();this.ud=this.f.Pa;return this.bf},MI:function(a){null==a&&(a=!1);if(this.BF||!a&&this.vy())return this.Va;var b=this.f.c;a=this.f;if(0==this.mode)return 0>=this.Tb&&(this.Tb=.1),a.Kw?r.JB(this.Sa,b.ll(this),this.Tb,this.Fb,this.Va,0==this.Yc):r.Ag(this.Sa,b.ll(this),this.Tb,this.Fb,this.Va,0==this.Yc),this.Va;var c=b.Wb()/2,b=b.Lb()/2;a.Kw?r.kB(null!=this.Mg?this.Mg:-c,null!=this.Ng?this.Ng:c,null!=this.Lg?this.Lg:-b,null!=this.Og?this.Og:b,this.Tb,this.Fb,
this.Va):r.Rj(null!=this.Mg?this.Mg:-c,null!=this.Ng?this.Ng:c,null!=this.Lg?this.Lg:-b,null!=this.Og?this.Og:b,this.Tb,this.Fb,this.Va);return this.Va},dispose:function(){this.f.Ql(this);for(this.f.jL(this);0<this.ma.length;)this.ma.pop().dispose();for(var a=this.cc.length;0<=--a;)this.cc[a].dispose(this);fa.prototype.dispose.call(this)},Nl:function(a,b){for(;0<this.ma.length;)this.ma.pop().dispose();null==b&&(b={});this.Rb=a;this.Ja={};this.Ja.Hh=null!=b.Hh?b.Hh:.0637;this.Ja.Sg=this.Ja.Hh/.0637*
Math.PI/180;0!=this.Rb&&(this.ma.push(this.wh(this.name+"_L",0)),this.ma.push(this.wh(this.name+"_R",1)));switch(this.Rb){case 10:this.ma[0].If=new kc(this.name+"_passthru",1,this.ma[0]);this.ma[1].If=new zd(this.name+"_anaglyph",1,this.ma);break;case 11:case 12:case 13:var c=11==this.Rb||12==this.Rb;this.ma[0].If=new kc(this.name+"_passthru",1,this.ma[0]);this.ma[1].If=new ie(this.name+"_stereoInterlace",this.ma,c);break;case 20:c=null!=b.Nw?b.Nw:ad.os(),this.ma[0].Ja.Ow=c,this.ma[0].viewport=new wd(0,
0,.5,1),this.ma[0].Ja.Mo=new r,this.ma[0].Ja.SD=c.TA(),this.ma[0].Ja.TD=c.UA(),this.ma[0].Pf=(mb=this.ma[0],B(mb,mb.dy)),this.ma[1].Ja.Ow=c,this.ma[1].viewport=new wd(.5,0,.5,1),this.ma[1].Ja.Mo=new r,this.ma[1].Ja.SD=c.aB(),this.ma[1].Ja.TD=c.bB(),this.ma[1].Pf=(mb=this.ma[1],B(mb,mb.dy)),c.xu&&(this.ma[0].If=new Nd("VR_Distort_Compensation_Left",this.ma[0],!1,c),this.ma[1].If=new Nd("VR_Distort_Compensation_Right",this.ma[1],!0,c))}this.Cp();this.ed()},dy:function(){r.Ag(this.Ja.Ow.nH(),this.Ja.Ow.xj(),
this.Tb,this.Fb,this.Ja.Mo);v.g(this.Ja.Mo,r).qa(this.Ja.SD,this.Va.a,0);return this.Va},BP:function(a,b){null==this.Ja&&(this.Ja={});X.$b(this.Ja,a,b);"interaxialDistance"==a&&(this.Ja.Sg=b/.0637*Math.PI/180)},wh:function(){return null},vj:function(){for(var a=0,b=this.ma.length;a<b;){var c=a++;this.ma[c].Tb=this.Tb;this.ma[c].Fb=this.Fb;this.ma[c].Sa=this.Sa}10==this.Rb&&(this.ma[0].viewport=this.ma[1].viewport=this.viewport)},pO:function(a){var b=new n(0,0,0);this.II(a,b);return b},II:function(a,
b){var c=this.va();b.x=a.x*c.a[0]+a.y*c.a[4]+a.z*c.a[8];b.y=a.x*c.a[1]+a.y*c.a[5]+a.z*c.a[9];b.z=a.x*c.a[2]+a.y*c.a[6]+a.z*c.a[10]},S:function(){var a={};a.name=this.name;a.Rl=za.zE(this);a.id=this.id;var b=this.position,c=[];c[0]=b.x;c[1]=b.y;c[2]=b.z;a.position=c;null!=this.ca&&(a.Fl=this.ca.id);a.Sa=this.Sa;a.Tb=this.Tb;a.Fb=this.Fb;a.vf=this.vf;Hb.ya(this,a);a.Ui=this.EL();a.tb=this.tb;return a},l:oa,ha:F(fa.prototype.ha,{Dh:"get_globalPosition"})});var n=J.BABYLON.Vector3=function(a,b,c){null==
c&&(c=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=c};q["com.babylonhx.math.Vector3"]=n;n.i=["com","babylonhx","math","Vector3"];n.Df=function(a,b,c,d){a=a.x*c.x+a.y*c.y+a.z*c.z-d;return a/(a-(b.x*c.x+b.y*c.y+b.z*c.z-d))};n.Pb=function(a,b){null==b&&(b=0);return new n(a[b],a[b+1],a[b+2])};n.ce=function(a,b){null==b&&(b=0);return new n(a[b],a[b+1],a[b+2])};n.ap=function(a,b,c){c.x=a[b];c.y=a[b+1];c.z=a[b+2]};n.ue=function(a,b,c){c.x=a[b];c.y=a[b+1];c.z=a[b+2]};n.ve=function(a,b,c,d){d.x=
a;d.y=b;d.z=c};n.jp=function(){return new n(0,0,0)};n.yh=function(){return new n(1,1,1)};n.Up=function(){return new n(0,1,0)};n.Down=function(){return new n(0,-1,0)};n.be=function(){return new n(0,0,1)};n.Back=function(){return new n(0,0,-1)};n.Right=function(){return new n(1,0,0)};n.Left=function(){return new n(-1,0,0)};n.Ho=function(a,b){var c=new n(0,0,0),d=a.x,e=a.y,f=a.z,g=b.a,h=d*g[1]+e*g[5]+f*g[9]+g[13],k=d*g[2]+e*g[6]+f*g[10]+g[14],l=d*g[3]+e*g[7]+f*g[11]+g[15];c.x=(d*g[0]+e*g[4]+f*g[8]+g[12])/
l;c.y=h/l;c.z=k/l;return c};n.ns=function(a,b,c){var d=a.x,e=a.y;a=a.z;b=b.a;var f=d*b[1]+e*b[5]+a*b[9]+b[13],g=d*b[2]+e*b[6]+a*b[10]+b[14],h=d*b[3]+e*b[7]+a*b[11]+b[15];c.x=(d*b[0]+e*b[4]+a*b[8]+b[12])/h;c.y=f/h;c.z=g/h};n.js=function(a,b,c,d,e){var f=a*d.a[1]+b*d.a[5]+c*d.a[9]+d.a[13],g=a*d.a[2]+b*d.a[6]+c*d.a[10]+d.a[14],h=a*d.a[3]+b*d.a[7]+c*d.a[11]+d.a[15];e.x=(a*d.a[0]+b*d.a[4]+c*d.a[8]+d.a[12])/h;e.y=f/h;e.z=g/h};n.os=function(a,b){var c=new n(0,0,0);c.x=a.x*b.a[0]+a.y*b.a[4]+a.z*b.a[8];c.y=
a.x*b.a[1]+a.y*b.a[5]+a.z*b.a[9];c.z=a.x*b.a[2]+a.y*b.a[6]+a.z*b.a[10];return c};n.qs=function(a,b,c){c.x=a.x*b.a[0]+a.y*b.a[4]+a.z*b.a[8];c.y=a.x*b.a[1]+a.y*b.a[5]+a.z*b.a[9];c.z=a.x*b.a[2]+a.y*b.a[6]+a.z*b.a[10]};n.ps=function(a,b,c,d,e){e.x=a*d.a[0]+b*d.a[4]+c*d.a[8];e.y=a*d.a[1]+b*d.a[5]+c*d.a[9];e.z=a*d.a[2]+b*d.a[6]+c*d.a[10]};n.Vo=function(a,b,c,d,e){var f=e*e,g=e*f;return new n(.5*(2*b.x+(-a.x+c.x)*e+(2*a.x-5*b.x+4*c.x-d.x)*f+(-a.x+3*b.x-3*c.x+d.x)*g),.5*(2*b.y+(-a.y+c.y)*e+(2*a.y-5*b.y+4*
c.y-d.y)*f+(-a.y+3*b.y-3*c.y+d.y)*g),.5*(2*b.z+(-a.z+c.z)*e+(2*a.z-5*b.z+4*c.z-d.z)*f+(-a.z+3*b.z-3*c.z+d.z)*g))};n.Xo=function(a,b,c){var d=a.x;d>c.x&&(d=c.x);d<b.x&&(d=b.x);var e=a.y;e>c.y&&(e=c.y);e<b.y&&(e=b.y);a=a.z;a>c.z&&(a=c.z);a<b.z&&(a=b.z);return new n(d,e,a)};n.ep=function(a,b,c,d,e){var f=e*e,g=e*f,h=2*g-3*f+1,k=-2*g+3*f;e=g-2*f+e;f=g-f;return new n(a.x*h+c.x*k+b.x*e+d.x*f,a.y*h+c.y*k+b.y*e+d.y*f,a.z*h+c.z*k+b.z*e+d.z*f)};n.D=function(a,b,c){var d=new n(0,0,0);d.x=a.x+(b.x-a.x)*c;d.y=
a.y+(b.y-a.y)*c;d.z=a.z+(b.z-a.z)*c;return d};n.fp=function(a,b,c,d){d.x=a.x+(b.x-a.x)*c;d.y=a.y+(b.y-a.y)*c;d.z=a.z+(b.z-a.z)*c};n.$o=function(a,b){return a.x*b.x+a.y*b.y+a.z*b.z};n.Vc=function(a,b){var c=new n(0,0,0);c.x=a.y*b.z-a.z*b.y;c.y=a.z*b.x-a.x*b.z;c.z=a.x*b.y-a.y*b.x;return c};n.$c=function(a,b,c){c.x=a.y*b.z-a.z*b.y;c.y=a.z*b.x-a.x*b.z;c.z=a.x*b.y-a.y*b.x};n.ip=function(a){var b=new n(0,0,0);b.x=a.x;b.y=a.y;b.z=a.z;b.normalize();return b};n.Cg=function(a,b){b.x=a.x;b.y=a.y;b.z=a.z;b.normalize()};
n.Gi=function(a,b,c,d){var e=d.width,f=d.height,g=ba.Ra[0];r.aa(e/2,0,0,0,-f/2,0,0,0,1,d.x+e/2,f/2+d.y,0,g);d=ba.Ra[1];b.qa(c,d.a,0);d.qa(g,d.a,0);b=new n(0,0,0);c=a.x;g=a.y;a=a.z;d=d.a;var e=c*d[1]+g*d[5]+a*d[9]+d[13],f=c*d[2]+g*d[6]+a*d[10]+d[14],h=c*d[3]+g*d[7]+a*d[11]+d[15];b.x=(c*d[0]+g*d[4]+a*d[8]+d[12])/h;b.y=e/h;b.z=f/h;return b};n.Po=function(a,b,c,d,e){var f=ba.Ra[1];d.qa(e,f.a,0);d=f.a[0];e=f.a[1];var g=f.a[2],h=f.a[3],k=f.a[4],l=f.a[5],m=f.a[6],w=f.a[7],C=f.a[8],u=f.a[9],y=f.a[10],V=f.a[11],
z=f.a[12],ea=f.a[13],M=f.a[14],r=f.a[15],x=y*r-V*M,p=u*r-V*ea,q=u*M-y*ea,D=C*r-V*z,t=C*M-y*z,P=C*ea-u*z,N=l*x-m*p+w*q,E=-(k*x-m*D+w*t),O=k*p-l*D+w*P,Tb=-(k*q-l*t+m*P),H=1/(d*N+e*E+g*O+h*Tb),yd=m*r-w*M,v=l*r-w*ea,A=l*M-m*ea,r=k*r-w*z,M=k*M-m*z,z=k*ea-l*z,ea=m*V-w*y,B=l*V-w*u,I=l*y-m*u,w=k*V-w*C,m=k*y-m*C,k=k*u-l*C;f.a[0]=N*H;f.a[4]=E*H;f.a[8]=O*H;f.a[12]=Tb*H;f.a[1]=-(e*x-g*p+h*q)*H;f.a[5]=(d*x-g*D+h*t)*H;f.a[9]=-(d*p-e*D+h*P)*H;f.a[13]=(d*q-e*t+g*P)*H;f.a[2]=(e*yd-g*v+h*A)*H;f.a[6]=-(d*yd-g*r+h*M)*
H;f.a[10]=(d*v-e*r+h*z)*H;f.a[14]=-(d*A-e*M+g*z)*H;f.a[3]=-(e*ea-g*B+h*I)*H;f.a[7]=(d*ea-g*w+h*m)*H;f.a[11]=-(d*B-e*w+h*k)*H;f.a[15]=(d*I-e*m+g*k)*H;a.x=a.x/b*2-1;a.y=-(a.y/c*2-1);b=new n(0,0,0);c=a.x;d=a.y;e=a.z;g=f.a;h=c*g[1]+d*g[5]+e*g[9]+g[13];x=c*g[2]+d*g[6]+e*g[10]+g[14];p=c*g[3]+d*g[7]+e*g[11]+g[15];b.x=(c*g[0]+d*g[4]+e*g[8]+g[12])/p;b.y=h/p;b.z=x/p;a=a.x*f.a[3]+a.y*f.a[7]+a.z*f.a[11]+f.a[15];f=a-1;-1.401298E-45<=f&&1.401298E-45>=f&&(a=1/a,b=new n(b.x*a,b.y*a,b.z*a));return b};n.Za=function(a,
b,c,d,e,f){var g=ba.Ra[1];d.qa(e,g.a,0);g.qa(f,g.a,0);d=g.a[0];e=g.a[1];f=g.a[2];var h=g.a[3],k=g.a[4],l=g.a[5],m=g.a[6],w=g.a[7],C=g.a[8],u=g.a[9],y=g.a[10],V=g.a[11],z=g.a[12],ea=g.a[13],M=g.a[14],r=g.a[15],x=y*r-V*M,p=u*r-V*ea,q=u*M-y*ea,D=C*r-V*z,t=C*M-y*z,P=C*ea-u*z,N=l*x-m*p+w*q,E=-(k*x-m*D+w*t),O=k*p-l*D+w*P,Tb=-(k*q-l*t+m*P),H=1/(d*N+e*E+f*O+h*Tb),v=m*r-w*M,A=l*r-w*ea,B=l*M-m*ea,r=k*r-w*z,M=k*M-m*z,z=k*ea-l*z,ea=m*V-w*y,I=l*V-w*u,F=l*y-m*u,w=k*V-w*C,m=k*y-m*C,k=k*u-l*C;g.a[0]=N*H;g.a[4]=E*
H;g.a[8]=O*H;g.a[12]=Tb*H;g.a[1]=-(e*x-f*p+h*q)*H;g.a[5]=(d*x-f*D+h*t)*H;g.a[9]=-(d*p-e*D+h*P)*H;g.a[13]=(d*q-e*t+f*P)*H;g.a[2]=(e*v-f*A+h*B)*H;g.a[6]=-(d*v-f*r+h*M)*H;g.a[10]=(d*A-e*r+h*z)*H;g.a[14]=-(d*B-e*M+f*z)*H;g.a[3]=-(e*ea-f*I+h*F)*H;g.a[7]=(d*ea-f*w+h*m)*H;g.a[11]=-(d*I-e*w+h*k)*H;g.a[15]=(d*F-e*m+f*k)*H;b=a.x/b*2-1;c=-(a.y/c*2-1);a=a.z;d=new n(0,0,0);e=g.a;f=b*e[1]+c*e[5]+a*e[9]+e[13];h=b*e[2]+c*e[6]+a*e[10]+e[14];x=b*e[3]+c*e[7]+a*e[11]+e[15];d.x=(b*e[0]+c*e[4]+a*e[8]+e[12])/x;d.y=f/x;
d.z=h/x;g=b*g.a[3]+c*g.a[7]+a*g.a[11]+g.a[15];a=g-1;-1.401298E-45<=a&&1.401298E-45>=a&&(g=1/g,d=new n(d.x*g,d.y*g,d.z*g));return d};n.hp=function(a,b){var c=new n(a.x,a.y,a.z);b.x<c.x&&(c.x=b.x);b.y<c.y&&(c.y=b.y);b.z<c.z&&(c.z=b.z);return c};n.gp=function(a,b){var c=new n(a.x,a.y,a.z);b.x>c.x&&(c.x=b.x);b.y>c.y&&(c.y=b.y);b.z>c.z&&(c.z=b.z);return c};n.Yo=function(a,b){var c=a.x-b.x,d=a.y-b.y,e=a.z-b.z;return Math.sqrt(c*c+d*d+e*e)};n.Zo=function(a,b){var c=a.x-b.x,d=a.y-b.y,e=a.z-b.z;return c*c+
d*d+e*e};n.Wo=function(a,b){var c=new n(a.x+b.x,a.y+b.y,a.z+b.z);c.x*=.5;c.y*=.5;c.z*=.5;return c};n.Kl=function(a,b,c){b=new n(0,0,0);n.Bb(a,c,b);return b};n.Bb=function(a,b,c){var d=ba.Ec[0],e=ba.Ec[1];d.x=a.x;d.y=a.y;d.z=a.z;d.normalize();e.x=b.x;e.y=b.y;e.z=b.z;e.normalize();n.g[0]=0;n.g[1]=0;n.g[2]=0;var f=-1;a=0;var g;n.g[3]=0;b=ba.Ec[3];g=e.z;-.001<=g&&.001>=g?n.g[1]=1:(g=e.x,-.001<=g&&.001>=g?n.g[0]=1:(n.g[2]=e.z/e.x,n.g[0]=-n.g[2]*Math.sqrt(1/(1+n.g[2]*n.g[2])),n.g[1]=Math.sqrt(1/(1+n.g[2]*
n.g[2]))));g=n.g[1];b.x=n.g[0];b.y=0;b.z=g;b.normalize();var h=new n(0,0,0);h.x=e.y*b.z-e.z*b.y;h.y=e.z*b.x-e.x*b.z;h.z=e.x*b.y-e.y*b.x;h.normalize();g=new n(0,0,0);g.x=d.y*b.z-d.z*b.y;g.y=d.z*b.x-d.x*b.z;g.z=d.x*b.y-d.y*b.x;g.normalize();0>e.x*g.x+e.y*g.y+e.z*g.z&&(f=1);n.g[4]=d.x*b.x+d.y*b.y+d.z*b.z;n.g[4]=Math.min(1,Math.max(-1,n.g[4]));c.z=Math.acos(n.g[4])*f;f=gb.X;0>b.x*f.x+b.y*f.y+b.z*f.z&&(c.z=Math.PI+c.z,b.x*=-1,b.y*=-1,b.z*=-1,h.x*=-1,h.y*=-1,h.z*=-1,++a);d=ba.Ec[5];n.g[0]=0;n.g[1]=0;f=
-1;g=e.z;-.001<=g&&.001>=g?n.g[0]=1:(n.g[2]=b.z/b.x,n.g[0]=-n.g[2]*Math.sqrt(1/(1+n.g[2]*n.g[2])),n.g[1]=Math.sqrt(1/(1+n.g[2]*n.g[2])));g=n.g[1];d.x=n.g[0];d.y=0;d.z=g;d.normalize();h=new n(0,0,0);h.x=d.y*b.z-d.z*b.y;h.y=d.z*b.x-d.x*b.z;h.z=d.x*b.y-d.y*b.x;h.normalize();g=new n(0,0,0);g.x=e.y*d.z-e.z*d.y;g.y=e.z*d.x-e.x*d.z;g.z=e.x*d.y-e.y*d.x;g.normalize();0>b.x*g.x+b.y*g.y+b.z*g.z&&(f=1);n.g[4]=e.x*d.x+e.y*d.y+e.z*d.z;n.g[4]=Math.min(1,Math.max(-1,n.g[4]));c.x=Math.acos(n.g[4])*f;f=gb.Y;0>h.x*
f.x+h.y*f.y+h.z*f.z&&(c.x=Math.PI+c.x,h.x*=-1,h.y*=-1,h.z*=-1,d.x*=-1,d.y*=-1,d.z*=-1,++a);f=-1;e=gb.X;d=new n(0,0,0);d.x=e.y*b.z-e.z*b.y;d.y=e.z*b.x-e.x*b.z;d.z=e.x*b.y-e.y*b.x;g=d;g.normalize();e=gb.Y;0>g.x*e.x+g.y*e.y+g.z*e.z&&(f=1);e=gb.X;n.g[4]=b.x*e.x+b.y*e.y+b.z*e.z;n.g[4]=Math.min(1,Math.max(-1,n.g[4]));c.y=-Math.acos(n.g[4])*f;0>n.g[4]&&2>a&&(c.y=Math.PI+c.y)};n.prototype={normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);if(0==a||1==a)return this;a=1/a;this.x*=
a;this.y*=a;this.z*=a;return this},l:n};var aa=J.BABYLON.TargetCamera=function(a,b,c){var d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=0;d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=0;this.uq=new n(0,0,0);this.Rx=new n(0,1,0);this.Uy=new n(0,0,1);d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=
0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=0;this.gi=d;d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=0;this.Ap=d;d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=0;this.zp=d;d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=
0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=0;this.Aa=d;this.ye=new n(0,0,0);this.jd=null;this.aK=!1;this.speed=2;this.rotation=new n(0,0,0);this.Vb=new K(0,0);this.Gc=new n(0,0,0);oa.call(this,a,b,c)};q["com.babylonhx.cameras.TargetCamera"]=aa;aa.i=["com","babylonhx","cameras","TargetCamera"];aa.U=oa;aa.prototype=F(oa.prototype,{qO:function(a){var b=this.ye,c=this.position,b=new n(b.x-c.x,b.y-c.y,b.z-c.z);b.normalize();
b.x*=a;b.y*=a;b.z*=a;a=this.Dh();return new n(a.x+b.x,a.y+b.y,a.z+b.z)},bt:function(){return null==this.jd?null:null!=this.jd.bH?this.jd.bH:this.jd},dh:function(){oa.prototype.dh.call(this);this.K.jd=new n(Infinity,Infinity,Infinity);this.K.rotation=new n(Infinity,Infinity,Infinity);this.K.ub=new da(Infinity,Infinity,Infinity)},uj:function(a){null==a&&(a=!1);a||oa.prototype.uj.call(this);a=this.bt();if(null==a)this.K.jd=null;else if(null==this.K.jd)this.K.jd=new n(a.x,a.y,a.z);else{var b=this.K.jd;
b.x=a.x;b.y=a.y;b.z=a.z}a=this.K.rotation;b=this.rotation;a.x=b.x;a.y=b.y;a.z=b.z;null!=this.ub&&(a=this.K.ub,b=this.ub,a.x=b.x,a.y=b.y,a.z=b.z,a.o=b.o)},jj:function(){if(!oa.prototype.jj.call(this))return!1;var a=this.bt();if(null!=this.K.jd)var b=this.K.jd,a=null!=a&&b.x==a.x&&b.y==a.y?b.z==a.z:!1;else a=null==a;if(a){if(null!=this.ub)return a=this.ub,b=this.K.ub,null!=b&&a.x==b.x&&a.y==b.y&&a.z==b.z?a.o==b.o:!1;a=this.K.rotation;b=this.rotation;return null!=b&&a.x==b.x&&a.y==b.y?a.z==b.z:!1}return!1},
AN:function(){var a=this.f.c;return this.speed*Math.sqrt(a.el/(100*a.Yq))},Ol:function(a){this.Bf.normalize();r.$c(this.position,a,this.Rx,this.zp);var b=this.zp,c=b.a[0],d=b.a[1],e=b.a[2],f=b.a[3],g=b.a[4],h=b.a[5],k=b.a[6],l=b.a[7],m=b.a[8],w=b.a[9],C=b.a[10],u=b.a[11],y=b.a[12],V=b.a[13],z=b.a[14],ea=b.a[15],M=C*ea-u*z,p=w*ea-u*V,x=w*z-C*V,q=m*ea-u*y,t=m*z-C*y,D=m*V-w*y,$b=h*M-k*p+l*x,P=-(g*M-k*q+l*t),N=g*p-h*q+l*D,E=-(g*x-h*t+k*D),O=1/(c*$b+d*P+e*N+f*E),Tb=k*ea-l*z,H=h*ea-l*V,v=h*z-k*V,ea=g*ea-
l*y,z=g*z-k*y,y=g*V-h*y,V=k*u-l*C,A=h*u-l*w,B=h*C-k*w,l=g*u-l*m,k=g*C-k*m,g=g*w-h*m;b.a[0]=$b*O;b.a[4]=P*O;b.a[8]=N*O;b.a[12]=E*O;b.a[1]=-(d*M-e*p+f*x)*O;b.a[5]=(c*M-e*q+f*t)*O;b.a[9]=-(c*p-d*q+f*D)*O;b.a[13]=(c*x-d*t+e*D)*O;b.a[2]=(d*Tb-e*H+f*v)*O;b.a[6]=-(c*Tb-e*ea+f*z)*O;b.a[10]=(c*H-d*ea+f*y)*O;b.a[14]=-(c*v-d*z+e*y)*O;b.a[3]=-(d*V-e*A+f*B)*O;b.a[7]=(c*V-e*l+f*k)*O;b.a[11]=-(c*A-d*l+f*g)*O;b.a[15]=(c*B-d*k+e*g)*O;this.rotation.x=Math.atan(this.zp.a[6]/this.zp.a[10]);b=this.position;aa.aa=new n(a.x-
b.x,a.y-b.y,a.z-b.z);this.rotation.y=0<=aa.aa.x?-Math.atan(aa.aa.z/aa.aa.x)+Math.PI/2:-Math.atan(aa.aa.z/aa.aa.x)-Math.PI/2;this.rotation.z=0;null!=this.ub&&(a=this.ub,d=.5*this.rotation.z,f=.5*this.rotation.x,c=.5*this.rotation.y,b=Math.sin(d),d=Math.cos(d),e=Math.sin(f),f=Math.cos(f),M=Math.sin(c),c=Math.cos(c),a.x=c*e*d+M*f*b,a.y=M*f*d-c*e*b,a.z=c*f*b-M*e*d,a.o=c*f*d+M*e*b)},uO:function(){return this.ye},Ns:function(){return 0<Math.abs(this.Gc.x)||0<Math.abs(this.Gc.y)?!0:0<Math.abs(this.Gc.z)},
xz:function(){var a=this.position,b=this.Gc;a.x+=b.x;a.y+=b.y;a.z+=b.z},fe:function(){var a=this.Ns(),b=0<Math.abs(this.Vb.x)||0<Math.abs(this.Vb.y);a&&this.xz();if(b&&(this.rotation.x+=this.Vb.x,this.rotation.y+=this.Vb.y,!this.aK)){var c=Math.PI/2*.95;this.rotation.x>c&&(this.rotation.x=c);this.rotation.x<-c&&(this.rotation.x=-c)}a&&(.001>Math.abs(this.Gc.x)&&(this.Gc.x=0),.001>Math.abs(this.Gc.y)&&(this.Gc.y=0),.001>Math.abs(this.Gc.z)&&(this.Gc.z=0),a=this.Gc,c=this.vf,a.x*=c,a.y*=c,a.z*=c);b&&
(.001>Math.abs(this.Vb.x)&&(this.Vb.x=0),.001>Math.abs(this.Vb.y)&&(this.Vb.y=0),b=this.Vb,a=this.vf,b.x*=a,b.y*=a);oa.prototype.fe.call(this)},uz:function(){if(null!=this.ub){this.ub.Af(this.gi);var a=this.Rx,b=this.gi,c=this.Bf;c.x=a.x*b.a[0]+a.y*b.a[4]+a.z*b.a[8];c.y=a.x*b.a[1]+a.y*b.a[5]+a.z*b.a[9];c.z=a.x*b.a[2]+a.y*b.a[6]+a.z*b.a[10]}else{var a=r.Ta,d=.5*this.rotation.z,e=.5*this.rotation.x,c=.5*this.rotation.y,b=Math.sin(d),d=Math.cos(d),f=Math.sin(e),e=Math.cos(e),g=Math.sin(c),c=Math.cos(c);
a.x=c*f*d+g*e*b;a.y=g*e*d-c*f*b;a.z=c*e*b-g*f*d;a.o=c*e*d+g*f*b;r.Ta.Af(this.gi)}},ct:function(){if(null==this.jd){this.uz();var a=this.Uy,b=this.uq,c=a.x,d=a.y,a=a.z,e=this.gi.a,f=c*e[1]+d*e[5]+a*e[9]+e[13],g=c*e[2]+d*e[6]+a*e[10]+e[14],h=c*e[3]+d*e[7]+a*e[11]+e[15];b.x=(c*e[0]+d*e[4]+a*e[8]+e[12])/h;b.y=f/h;b.z=g/h;b=this.position;c=this.uq;d=this.ye;d.x=b.x+c.x;d.y=b.y+c.y;d.z=b.z+c.z}else b=this.ye,c=this.bt(),b.x=c.x,b.y=c.y,b.z=c.z;r.$c(this.position,this.ye,this.Bf,this.Aa);return this.Aa},
PF:function(){this.uz();var a=this.Uy,b=this.uq,c=a.x,d=a.y,a=a.z,e=this.gi.a,f=c*e[1]+d*e[5]+a*e[9]+e[13],g=c*e[2]+d*e[6]+a*e[10]+e[14],h=c*e[3]+d*e[7]+a*e[11]+e[15];b.x=(c*e[0]+d*e[4]+a*e[8]+e[12])/h;b.y=f/h;b.z=g/h;b=this.Bf;c=this.gi;d=this.Ja.RD;d.x=b.x*c.a[0]+b.y*c.a[4]+b.z*c.a[8];d.y=b.x*c.a[1]+b.y*c.a[5]+b.z*c.a[9];d.z=b.x*c.a[2]+b.y*c.a[6]+b.z*c.a[10];b=this.position;c=this.uq;d=this.ye;d.x=b.x+c.x;d.y=b.y+c.y;d.z=b.z+c.z;r.$c(this.position,this.ye,this.Ja.RD,this.Ja.Mo);v.g(this.Ja.Mo,r).qa(this.Ja.TD,
this.Aa.a,0);return this.Aa},wh:function(a){if(0!=this.Rb){var b=this.position;a=new aa(a,new n(b.x,b.y,b.z),this.f);20==this.Rb&&(null==this.ub&&(this.ub=new da),a.Ja={},a.Ja.RD=new n(0,0,0),a.ey=B(a,a.PF),a.ub=new da);return a}return null},vj:function(){var a=this.ma[0],b=this.ma[1];switch(this.Rb){case 10:case 11:case 12:case 13:var c=12==this.Rb?-1:1;this.by(this.Ja.Sg*(12==this.Rb?1:-1),a.position);this.by(this.Ja.Sg*c,b.position);a.Ol(this.ye);b.Ol(this.ye);break;case 20:var c=a.ub,d=this.ub;
c.x=d.x;c.y=d.y;c.z=d.z;c.o=d.o;c=b.ub;d=this.ub;c.x=d.x;c.y=d.y;c.z=d.z;c.o=d.o;a=a.position;c=this.position;a.x=c.x;a.y=c.y;a.z=c.z;b=b.position;a=this.position;b.x=a.x;b.y=a.y;b.z=a.z}oa.prototype.vj.call(this)},by:function(a,b){null==this.an&&(this.an=new r);var c=this.ye,d=-c.x,e=-c.y,f=-c.z,g=new r;g.a[0]=1;g.a[1]=0;g.a[2]=0;g.a[3]=0;g.a[4]=0;g.a[5]=1;g.a[6]=0;g.a[7]=0;g.a[8]=0;g.a[9]=0;g.a[10]=1;g.a[11]=0;g.a[12]=0;g.a[13]=0;g.a[14]=0;g.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,d,e,f,g);d=new r;e=Math.sin(a);
f=Math.cos(a);d.a[5]=1;d.a[15]=1;d.a[0]=f;d.a[2]=-e;d.a[8]=e;d.a[10]=f;d.a[1]=0;d.a[3]=0;d.a[4]=0;d.a[6]=0;d.a[7]=0;d.a[9]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;g.qa(d,this.an.a,0);g=this.an;d=c.x;e=c.y;f=c.z;c=new r;c.a[0]=1;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=0;c.a[5]=1;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=1;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,d,e,f,c);d=new r;g.qa(c,d.a,0);this.an=d;var d=this.position,c=d.x,g=d.y,d=d.z,e=this.an.a,f=c*e[1]+g*e[5]+
d*e[9]+e[13],h=c*e[2]+g*e[6]+d*e[10]+e[14],k=c*e[3]+g*e[7]+d*e[11]+e[15];b.x=(c*e[0]+g*e[4]+d*e[8]+e[12])/k;b.y=f/k;b.z=h/k},S:function(){var a=oa.prototype.S.call(this);a.speed=this.speed;if(null!=this.rotation){var b=this.rotation,c=[];c[0]=b.x;c[1]=b.y;c[2]=b.z;a.rotation=c}null!=this.jd&&null!=this.jd.id&&(a.vv=this.jd.id);return a},l:aa});q["cc.viewer.panorama.cameras.PanoramaCamera"]=Fa;Fa.i=["cc","viewer","panorama","cameras","PanoramaCamera"];Fa.U=aa;Fa.prototype=F(aa.prototype,{set_yaw:function(a){this.rotation.y!=
a&&(this.rotation.y=a);return this.rotation.y},get_yaw:function(){return this.rotation.y},set_pitch:function(a){this.rotation.x!=a&&(this.rotation.x=a);return this.rotation.x},get_pitch:function(){return this.rotation.x},set_hfov:function(a){return this.oc=0==this.Yc?2*Math.atan(this.Ua*Math.tan(.5*a)/this.La):a},get_hfov:function(){return 0==this.Yc?2*Math.atan(this.La*Math.tan(.5*this.Sa)/this.Ua):this.Sa},NL:function(a){return this.oc=0==this.Yc?a:2*Math.atan(this.La*Math.tan(.5*a)/this.Ua)},hB:function(){return 0==
this.Yc?this.Sa:2*Math.atan(this.Ua*Math.tan(.5*this.Sa)/this.La)},set_panoramaHFOV:function(a){this.Tm!=a&&(this.Tm=a,this.ih=!0);return a},XA:function(){return this.Tm},set_panoramaVFOV:function(a){this.Vm!=a&&(this.Vm=a,this.ih=!0);return a},ZA:function(){return this.Vm},set_panoramaPitch:function(a){this.Um!=a&&(this.Um=a,this.ih=!0);return a},YA:function(){return this.Um},set_maxHFOV:function(a){this.Hm!=a&&(this.Hm=a,this.ih=!0);return a},VA:function(){return this.Hm},set_minHFOV:function(a){this.Km!=
a&&(this.Km=a,this.ih=!0);return a},WA:function(){return this.Km},dispose:function(a){null==a&&(a=!1);this.le();aa.prototype.dispose.call(this,a)},Ns:function(){return!1},Nl:function(a,b){if(11==a||12==a||13==a){for(;0<this.ma.length;)this.ma.pop().dispose();null==b&&(b={});this.Rb=a;this.Ja={};this.Ja.Hh=null!=b.Hh?b.Hh:.0637;this.Ja.Sg=this.Ja.Hh/.0637*Math.PI/180;this.ma.push(this.wh(this.name+"_L",0));this.ma.push(this.wh(this.name+"_R",1));var c=11==this.Rb||12==this.Rb;this.ma[0].If=new kc(this.name+
"_passthru",1,this.ma[0]);this.ma[1].If=new me(this.name+"_stereo",this.ma,c);this.Cp();this.ed()}else aa.prototype.Nl.call(this,a,b)},ed:function(){this.ih&&(this.kk(),this.ih=!1);if(this.La!=this.f.c.Wb()||this.Ua!=this.f.c.Lb()){var a=this.f.c.Wb(),b=this.f.c.Lb();if(0!=this.La&&0!=this.Ua)switch(this.zI){case "dfov":var c,d;0==this.Yc?(c=this.Ua,d=b):(c=this.La,d=a);this.oc=2*Math.atan(d*Math.tan(1*Math.atan(Math.sqrt(this.La*this.La+this.Ua*this.Ua)*Math.tan(.5*this.Sa)/c))/Math.sqrt(a*a+b*b));
break;case "hfov":0==this.Yc&&(this.oc=2*Math.atan(b*Math.tan(.5*this.get_hfov())/a));break;case "mfov":this.oc=2*Math.atan((1.3333333333333333<this.La/this.Ua?this.La:4*this.Ua/3)*Math.tan(.5*this.Sa)/(1.3333333333333333<a/b?a:4*b/3));break;case "vfov":1==this.Yc&&(this.oc=2*Math.atan(a*Math.tan(.5*this.hB())/b))}else null!=a&&null!=b&&(this.oc=0==this.Yc?2*Math.atan(b*Math.tan(.5*this.et)/a):this.et);null!=a&&null!=b&&(this.La=a,this.Ua=b,this.ks(),this.Sa=this.oc)}this.oc!=this.Sa&&(this.Sa+=(this.oc-
this.Sa)*this.Pr,Math.abs(this.oc-this.Sa)<p.lb&&(this.Sa=this.oc));aa.prototype.ed.call(this)},reset:function(){this.Gc=new n(0,0,0);this.Vb=new K(0,0)},kk:function(){},ks:function(){},ND:function(){},l:Fa,ha:F(aa.prototype.ha,{set_minHFOV:"set_minHFOV",WA:"get_minHFOV",set_maxHFOV:"set_maxHFOV",VA:"get_maxHFOV",set_panoramaPitch:"set_panoramaPitch",YA:"get_panoramaPitch",set_panoramaVFOV:"set_panoramaVFOV",ZA:"get_panoramaVFOV",set_panoramaHFOV:"set_panoramaHFOV",XA:"get_panoramaHFOV",NL:"set_vfov",
hB:"get_vfov",set_hfov:"set_hfov",get_hfov:"get_hfov",set_pitch:"set_pitch",get_pitch:"get_pitch",set_yaw:"set_yaw",get_yaw:"get_yaw"})});var da=J.BABYLON.Quaternion=function(a,b,c,d){null==d&&(d=1);null==c&&(c=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=c;this.o=d};q["com.babylonhx.math.Quaternion"]=da;da.i=["com","babylonhx","math","Quaternion"];da.ue=function(a){var b=new da;da.$b(a,b);return b};da.$b=function(a,b){var c=a.a,d=c[0],e=c[4],f=c[8],g=c[1],h=c[5],k=c[9],l=c[2],m=c[6],
c=c[10],w=d+h+c;0<w?(d=.5/Math.sqrt(w+1),b.o=.25/d,b.x=(m-k)*d,b.y=(f-l)*d,b.z=(g-e)*d):d>h&&d>c?(d=2*Math.sqrt(1+d-h-c),b.o=(m-k)/d,b.x=.25*d,b.y=(e+g)/d,b.z=(f+l)/d):h>c?(d=2*Math.sqrt(1+h-d-c),b.o=(f-l)/d,b.x=(e+g)/d,b.y=.25*d,b.z=(k+m)/d):(d=2*Math.sqrt(1+c-d-h),b.o=(g-e)/d,b.x=(f+l)/d,b.y=(k+m)/d,b.z=.25*d)};da.Df=function(a){return new da(-a.x,-a.y,-a.z,a.o)};da.yh=function(){return new da(0,0,0,1)};da.Bh=function(a,b){var c=new da,d=Math.sin(b/2);a.normalize();c.o=Math.cos(b/2);c.x=a.x*d;c.y=
a.y*d;c.z=a.z*d;return c};da.Eh=function(a,b,c){var d=Math.sin(b/2);a.normalize();c.o=Math.cos(b/2);c.x=a.x*d;c.y=a.y*d;c.z=a.z*d;return c};da.ae=function(a,b){null==b&&(b=0);return new da(a[b],a[b+1],a[b+2],a[b+3])};da.Gi=function(a,b,c){var d=new da;c*=.5;var e=.5*b;b=.5*a;a=Math.sin(c);c=Math.cos(c);var f=Math.sin(e),e=Math.cos(e),g=Math.sin(b);b=Math.cos(b);d.x=b*f*c+g*e*a;d.y=g*e*c-b*f*a;d.z=b*e*a-g*f*c;d.o=b*e*c+g*f*a;return d};da.Ni=function(a,b,c,d){c*=.5;var e=.5*b;b=.5*a;a=Math.sin(c);c=
Math.cos(c);var f=Math.sin(e),e=Math.cos(e),g=Math.sin(b);b=Math.cos(b);d.x=b*f*c+g*e*a;d.y=g*e*c-b*f*a;d.z=b*e*a-g*f*c;d.o=b*e*c+g*f*a};da.Ib=function(a,b,c){var d=new da(0,0,0,1);da.pd(a,b,c,d);return d};da.pd=function(a,b,c,d){var e=0,f;f=a.x*b.x+a.y*b.y+a.z*b.z+a.o*b.o;var g=!1;0>f&&(g=!0,f=-f);if(.999999<f)f=1-c,g?e=-c:e=c;else{var e=Math.acos(f),h=1/Math.sin(e);f=Math.sin((1-c)*e)*h;e=g?-Math.sin(c*e)*h:Math.sin(c*e)*h}d.x=f*a.x+e*b.x;d.y=f*a.y+e*b.y;d.z=f*a.z+e*b.z;d.o=f*a.o+e*b.o};da.prototype=
{hM:function(a){var b=this.z,c=this.x,d=this.y,e=this.o,f=e*e,g=b*b,h=c*c,k=d*d,l=d*b-c*e;-.4999999>l?(a.y=2*Math.atan2(d,e),a.x=Math.PI/2,a.z=0):.4999999<l?(a.y=2*Math.atan2(d,e),a.x=-Math.PI/2,a.z=0):(a.z=Math.atan2(2*(c*d+b*e),-g-h+k+f),a.x=Math.asin(-2*(b*d-c*e)),a.y=Math.atan2(2*(b*c+d*e),g-h-k+f));return this},Af:function(a){var b=this.x*this.x,c=this.y*this.y,d=this.z*this.z,e=this.x*this.y,f=this.z*this.o,g=this.z*this.x,h=this.y*this.o,k=this.y*this.z,l=this.x*this.o;a.a[0]=1-2*(c+d);a.a[1]=
2*(e+f);a.a[2]=2*(g-h);a.a[3]=0;a.a[4]=2*(e-f);a.a[5]=1-2*(d+b);a.a[6]=2*(k+l);a.a[7]=0;a.a[8]=2*(g+h);a.a[9]=2*(k-l);a.a[10]=1-2*(c+b);a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=1},l:da};q["cc.viewer.panorama.cameras.DeviceOrientationPanoramaCamera"]=Ma;Ma.i=["cc","viewer","panorama","cameras","DeviceOrientationPanoramaCamera"];Ma.isSupported=function(){return Gc.qv()};Ma.U=Fa;Ma.prototype=F(Fa.prototype,{attachControl:function(){null==this.Wg&&(this.Wg=new se,this.f.Yv(B(this,this.Er)))},le:function(){null!=
this.Wg&&(this.Wg=null,this.f.BD(B(this,this.Er)))},fe:function(){if(null!=this.Wg){var a=Gc.Wu()|0;if(this.St!=a){this.St=a;var a=this.hz,b=.5*this.St*Math.PI/180,c=Math.sin(b),b=Math.cos(b);a.x=0;a.y=0;a.z=c;a.o=b}var a=Ma.Fa,c=this.Wg.values[2],b=-this.Wg.values[3],d=this.Wg.values[0];a.x=this.Wg.values[1];a.y=c;a.z=b;a.o=d;var a=Ma.Fa,c=this.aH,b=Ma.mc,d=-a.x*c.z+a.y*c.o+a.z*c.x+a.o*c.y,e=a.x*c.y-a.y*c.x+a.z*c.o+a.o*c.z,f=-a.x*c.x-a.y*c.y-a.z*c.z+a.o*c.o;b.x=a.x*c.o+a.y*c.z-a.z*c.y+a.o*c.x;b.y=
d;b.z=e;b.o=f;a=this.hz;c=Ma.mc;b=this.ub;d=-a.x*c.z+a.y*c.o+a.z*c.x+a.o*c.y;e=a.x*c.y-a.y*c.x+a.z*c.o+a.o*c.z;f=-a.x*c.x-a.y*c.y-a.z*c.z+a.o*c.o;b.x=a.x*c.o+a.y*c.z-a.z*c.y+a.o*c.x;b.y=d;b.z=e;b.o=f;this.ub.o*=-1}},sO:function(a,b){var c=.5*a*Math.PI/180,d=Math.sin(c),c=Math.cos(c);b.x=0;b.y=0;b.z=d;b.o=c},vO:function(){var a=new da,b=Ma.Fa,c=.25*Math.PI,d=Math.sin(0),e=Math.cos(0),f=Math.sin(0),g=Math.cos(0),h=Math.sin(c),c=Math.cos(c);b.x=c*f*e+h*g*d;b.y=h*g*e-c*f*d;b.z=c*g*d-h*f*e;b.o=c*g*e+h*
f*d;f=.25*-Math.PI;b=Math.sin(0);d=Math.cos(0);e=Math.sin(f);f=Math.cos(f);g=Math.sin(0);h=Math.cos(0);a.x=h*e*d+g*f*b;a.y=g*f*d-h*e*b;a.z=h*f*b-g*e*d;a.o=h*f*d+g*e*b;b=Ma.Fa;d=new da(0,0,0,1);e=-a.x*b.z+a.y*b.o+a.z*b.x+a.o*b.y;f=a.x*b.y-a.y*b.x+a.z*b.o+a.o*b.z;g=-a.x*b.x-a.y*b.y-a.z*b.z+a.o*b.o;d.x=a.x*b.o+a.y*b.z-a.z*b.y+a.o*b.x;d.y=e;d.z=f;d.o=g;return d},ed:function(){this.ih&&(this.kk(),this.ih=!1);Fa.prototype.ed.call(this)},Er:function(){this.Wg.update()},wh:function(a){if(0!=this.Rb){var b=
new qe;b.panoramaHFOV=this.Tm;b.panoramaVFOV=this.Vm;b.panoramaPitch=this.Um;b.maxHFOV=this.Hm;b.minHFOV=this.Km;b.initialHFOV=this.oc;var c=this.position;return new Ma(a,new n(c.x,c.y,c.z),this.f,b)}return null},l:Ma});q["cc.viewer.panorama.cameras.DragPanoramaCamera"]=Za;Za.i=["cc","viewer","panorama","cameras","DragPanoramaCamera"];Za.U=Fa;Za.prototype=F(Fa.prototype,{set_yaw:function(a){this.get_yaw()!=a&&(Fa.prototype.set_yaw.call(this,a),this.Nk=!0);return this.get_yaw()},set_pitch:function(a){this.get_pitch()!=
a&&(Fa.prototype.set_pitch.call(this,a),this.Nk=!0);return this.get_pitch()},set_hfov:function(a){this.get_hfov()!=a&&(Fa.prototype.set_hfov.call(this,a),this.Nk=!0);return a},attachControl:function(){this.f.c.ao.push(B(this,this.mo));this.f.c.bo.push(B(this,this.no));this.f.c.fk.push(B(this,this.Vj));this.f.c.hk.push(B(this,this.Xj));this.f.c.gk.push(B(this,this.Wj));this.f.c.ho.push(B(this,this.Vj));this.f.c.jo.push(B(this,this.Xj));this.f.c.io.push(B(this,this.Wj));this.f.c.Hv.push(B(this,this.Yj))},
le:function(){Q.remove(this.f.c.ao,B(this,this.mo));Q.remove(this.f.c.bo,B(this,this.no));Q.remove(this.f.c.fk,B(this,this.Vj));Q.remove(this.f.c.hk,B(this,this.Xj));Q.remove(this.f.c.gk,B(this,this.Wj));Q.remove(this.f.c.ho,B(this,this.Vj));Q.remove(this.f.c.jo,B(this,this.Xj));Q.remove(this.f.c.io,B(this,this.Wj));Q.remove(this.f.c.Hv,B(this,this.Yj))},reset:function(){Fa.prototype.reset.call(this);this.gq=this.Ip=!1;this.df.x=this.df.y=0},fe:function(){this.Ip?this.Bw():this.gq&&(this.Cb.x=this.Fc.x*
this.speed*this.Sa,this.Cb.y=this.Fc.y*this.speed*this.Sa,0!=this.Lk&&(this.oc+=this.Lk,this.ks()));if(0!=this.Cb.x||0!=this.Cb.y)this.Vb.y+=this.Cb.x*this.Pr,this.Vb.x+=this.Cb.y*this.Pr,this.Nk=!0;var a=0<Math.abs(this.Vb.x)||0<Math.abs(this.Vb.y);Fa.prototype.fe.call(this);if(a||this.Nk)this.ND(),this.Nk=!1},wh:function(a,b){var c=Fa.prototype.wh.call(this,a,b);20==this.Rb&&(this.ub=null,c.ub=null);return c},vj:function(){var a=this.ma[0],b=this.ma[1];if(20==this.Rb){var a=a.position,c=this.position;
a.x=c.x;a.y=c.y;a.z=c.z;b=b.position;a=this.position;b.x=a.x;b.y=a.y;b.z=a.z}else Fa.prototype.vj.call(this)},Bw:function(){},kk:function(){this.ti=new Oc(this.XA(),this.ZA(),this.YA(),this.VA(),this.WA())},ks:function(){this.ti.QC(this.oc,this.La,this.Ua,this.Yc);this.oc=0==this.Yc?this.ti.lk:this.ti.hfov},ND:function(){this.ti.setPosition(this.rotation.y,this.rotation.x);this.rotation.y=this.ti.yaw;this.rotation.x=this.ti.pitch},Vj:function(a,b){this.Ip=!0;this.df.x=this.Fc.x=a/this.La;this.df.y=
this.Fc.y=b/this.Ua},Xj:function(){this.Ip=!1;this.Fc.x=this.Fc.y=0;this.Cb.x=this.Cb.y=0},Wj:function(a,b){this.Ip&&(this.df.x=a/this.La,this.df.y=b/this.Ua)},Yj:function(a){this.oc-=Math.min(Math.max(-6,a),6)*(this.ti.maxHFOV-this.ti.minHFOV)*.02;this.ks();this.Nk=!0},mo:function(a){switch(a){case 100:case 1073741903:this.Fc.x=.1;break;case 115:case 1073741905:this.Fc.y=.1;break;case 119:case 1073741906:this.Fc.y=-.1;break;case 120:this.Lk=-.1;break;case 122:this.Lk=.1;break;case 97:case 1073741904:this.Fc.x=
-.1;break;default:return}this.gq=!0},no:function(a){switch(a){case 97:case 100:case 1073741903:case 1073741904:this.Fc.x=0;break;case 115:case 119:case 1073741905:case 1073741906:this.Fc.y=0;break;case 120:case 122:this.Lk=0}this.gq=0!=this.Fc.x||0!=this.Fc.y||0!=this.Lk;this.gq||(this.Cb.x=this.Cb.y=0)},l:Za});q["cc.viewer.panorama.cameras.DragAccelPanoramaCamera"]=re;re.i=["cc","viewer","panorama","cameras","DragAccelPanoramaCamera"];re.U=Za;re.prototype=F(Za.prototype,{Bw:function(){this.Cb.x=
(this.df.x-this.Fc.x)*this.speed*this.Sa;this.Cb.y=(this.df.y-this.Fc.y)*this.speed*this.Sa},l:re});q["cc.viewer.panorama.cameras.DragRotationPanoramaCamera"]=Sd;Sd.i=["cc","viewer","panorama","cameras","DragRotationPanoramaCamera"];Sd.U=Za;Sd.prototype=F(Za.prototype,{Bw:function(){this.Cb.x=(this.Fc.x-this.df.x)*this.Sa;this.Cb.y=(this.Fc.y-this.df.y)*this.Sa;this.Fc.x=this.df.x;this.Fc.y=this.df.y},l:Sd});q["cc.viewer.panorama.cameras.PanoramaCameraOptions"]=qe;qe.i=["cc","viewer","panorama","cameras",
"PanoramaCameraOptions"];qe.prototype={l:qe};q["cc.viewer.panorama.math.Point"]=Ya;Ya.i=["cc","viewer","panorama","math","Point"];Ya.prototype={l:Ya};q["cc.viewer.panorama.math.Transformation"]=Ia;Ia.i=["cc","viewer","panorama","math","Transformation"];Ia.prototype={Wn:function(){this.m11=1;this.m21=this.m13=this.m12=0;this.m22=1;this.m32=this.m31=this.m23=0;this.m33=1;this.tz=this.Dc=this.Cc=0},yu:function(a){this.m11=a.m11;this.m12=a.m12;this.m13=a.m13;this.m21=a.m21;this.m22=a.m22;this.m23=a.m23;
this.m31=a.m31;this.m32=a.m32;this.m33=a.m33;this.Cc=a.Cc;this.Dc=a.Dc;this.tz=a.tz},concat:function(a){var b=Ia.BE;b.yu(this);this.m11=b.m11*a.m11+b.m12*a.m21+b.m13*a.m31;this.m12=b.m11*a.m12+b.m12*a.m22+b.m13*a.m32;this.m13=b.m11*a.m13+b.m12*a.m23+b.m13*a.m33;this.m21=b.m21*a.m11+b.m22*a.m21+b.m23*a.m31;this.m22=b.m21*a.m12+b.m22*a.m22+b.m23*a.m32;this.m23=b.m21*a.m13+b.m22*a.m23+b.m23*a.m33;this.m31=b.m31*a.m11+b.m32*a.m21+b.m33*a.m31;this.m32=b.m31*a.m12+b.m32*a.m22+b.m33*a.m32;this.m33=b.m31*
a.m13+b.m32*a.m23+b.m33*a.m33;this.Cc=b.Cc*a.m11+b.Dc*a.m21+b.tz*a.m31+a.Cc;this.Dc=b.Cc*a.m12+b.Dc*a.m22+b.tz*a.m32+a.Dc;this.tz=b.Cc*a.m13+b.Dc*a.m23+b.tz*a.m33+a.tz},cw:function(a){var b=Ia.wA;b.Wn();var c=Math.sin(a);a=Math.cos(a);b.m22=a;b.m23=c;b.m32=-c;b.m33=a;this.concat(b)},LC:function(a){var b=Ia.wA;b.Wn();var c=Math.sin(a);a=Math.cos(a);b.m11=a;b.m13=-c;b.m31=c;b.m33=a;this.concat(b)},l:Ia};q["cc.viewer.panorama.cameras.PanoramaPositionManager"]=Oc;Oc.i=["cc","viewer","panorama","cameras",
"PanoramaPositionManager"];Oc.prototype={QC:function(a,b,c,d){null==d&&(d=0);this.La=b;this.Ua=c;0==d?(this.lk=a,this.hfov=2*Math.atan(b*Math.tan(.5*a)/c)):(this.hfov=a,this.lk=2*Math.atan(c*Math.tan(.5*a)/b));this.hfov>this.maxHFOV?(this.hfov=this.maxHFOV,this.lk=2*Math.atan(c*Math.tan(.5*this.hfov)/b)):this.hfov<this.minHFOV&&(this.hfov=this.minHFOV,this.lk=2*Math.atan(c*Math.tan(.5*this.hfov)/b));this.lk>this.panoramaVFOV&&(this.lk=this.panoramaVFOV,this.hfov=2*Math.atan(b*Math.tan(.5*this.lk)/
c),this.pitch=this.panoramaPitch);this.ze.x=Math.sin(.5*this.hfov)/Math.cos(.5*this.hfov);this.ze.y=this.ze.x*c/b},setPosition:function(a,b){for(var c=0;a>Math.PI;)a-=2*Math.PI;for(;a<-Math.PI;)a+=2*Math.PI;b>.5*Math.PI?(b=.5*Math.PI,c|=4):b<.5*-Math.PI&&(b=.5*-Math.PI,c|=8);var d=Oc.$a,e=Oc.aa;e.Wn();e.cw(-b);d.x=0;d.y=this.ze.y;d.z=1;var f=d.x*e.m12+d.y*e.m22+d.z*e.m32+e.Dc,g=d.x*e.m13+d.y*e.m23+d.z*e.m33+e.tz;d.x=d.x*e.m11+d.y*e.m21+d.z*e.m31+e.Cc;d.y=f;d.z=g;f=(0==d.y&&0==d.z?0:Math.atan2(d.y,
d.z))-this.yr;d.x=0;d.y=-this.ze.y;d.z=1;var g=d.x*e.m12+d.y*e.m22+d.z*e.m32+e.Dc,h=d.x*e.m13+d.y*e.m23+d.z*e.m33+e.tz;d.x=d.x*e.m11+d.y*e.m21+d.z*e.m31+e.Cc;d.y=g;d.z=h;e=this.Ar-(0==d.y&&0==d.z?0:Math.atan2(d.y,d.z));this.mC||(this.yr==.5*Math.PI&&(f=b-.5*Math.PI),this.Ar==.5*-Math.PI&&(e=-(b+.5*Math.PI)));0<f?(b-=f,c|=4):0<e&&(b+=e,c|=8);this.mC&&(e=Oc.aa,e.Wn(),e.cw(-b),e.LC(-a),0<b?(d.x=this.ze.x,d.y=this.ze.y):(d.x=this.ze.x,d.y=-this.ze.y),d.z=1,f=d.x*e.m12+d.y*e.m22+d.z*e.m32+e.Dc,g=d.x*e.m13+
d.y*e.m23+d.z*e.m33+e.tz,d.x=d.x*e.m11+d.y*e.m21+d.z*e.m31+e.Cc,d.y=f,d.z=g,g=0==d.x&&0==d.z?0:-Math.atan2(d.x,d.z),g>a&&(g-=2*Math.PI),f=this.Gv-g,0<b?(d.x=-this.ze.x,d.y=this.ze.y):(d.x=-this.ze.x,d.y=-this.ze.y),d.z=1,g=d.x*e.m12+d.y*e.m22+d.z*e.m32+e.Dc,h=d.x*e.m13+d.y*e.m23+d.z*e.m33+e.tz,d.x=d.x*e.m11+d.y*e.m21+d.z*e.m31+e.Cc,d.y=g,d.z=h,g=0==d.x&&0==d.z?0:-Math.atan2(d.x,d.z),g<a&&(g+=2*Math.PI),d=g-this.Ev,0<d&&0<f?(a=0,this.QC(this.hfov-(d+f),this.La,this.Ua,1),c|=3):0<d?(a-=d,c|=2):0<f&&
(a+=f,c|=1));this.yaw=a;this.pitch=b;return c},l:Oc};var lc=J.CAPTURA.Extension.Video.VideoStream=function(a){this.Jf=-1;this.state="undefined";this.onStateChange=new ud;this.onTimeUpdate=new xe;this.Am=Td.YD();this.lw(window.document.createElement("video"));this.set_autoSwitchQuality(!0);this.set_autoplay(!0);this.set_muted(!1);this.set_loop(!1);this.set_volume(1);this.wg=[];this.representations=[];this.set_source(a)};q["extension.video.backend.html5.VideoStream"]=lc;lc.i=["extension","video","backend",
"html5","VideoStream"];lc.prototype={set_autoplay:function(a){return this.autoplay=this.video.autoplay=a},get_autoplay:function(){return this.set_autoplay(this.video.autoplay)},set_autoSwitchQuality:function(a){this.autoSwitchQuality!=a&&(this.autoSwitchQuality=a,null!=this.cd?this.cd.setAutoSwitchQuality(a):null!=this.vd&&(this.vd.loadLevel=-1));return this.autoSwitchQuality},set_currentTime:function(a){this.video.currentTime!=a&&this.seek(a);return this.video.currentTime},get_currentTime:function(){return this.video.currentTime},
get_duration:function(){return this.video.duration},set_loop:function(a){return this.loop=this.video.loop=a},get_loop:function(){return this.set_loop(this.video.loop)},set_muted:function(a){return this.muted=this.video.muted=a},get_muted:function(){return this.set_muted(this.video.muted)},set_volume:function(a){this.get_muted()&&this.set_muted(!1);return this.volume=this.video.volume=0>a?0:1<a?1:a},get_volume:function(){return this.set_volume(this.video.volume)},get_selectedRepresentationIndex:function(){null!=
this.cd?this.Jf=this.cd.getQualityFor("video"):null!=this.vd&&(this.Jf=this.vd.loadLevel);return this.Jf},set_selectedRepresentationIndex:function(a){this.Jf!=a&&a<this.representations.length&&0<=a&&(this.Jf=a,this.Dw());return this.Jf},set_source:function(a){this.source!=a&&(this.source=a,this.yM());return this.source},dispose:function(){"undefined"!=this.state&&(this.stop(),this.set_source(null),this.state="undefined")},play:function(){"playing"!=this.state&&"undefined"!=this.state&&this.video.play()},
pause:function(){"playing"==this.state&&"undefined"!=this.state&&this.video.pause()},stop:function(){"stopped"!=this.state&&"undefined"!=this.state&&("paused"!=this.state?this.video.pause():this.wo("stopped"),this.video.currentTime=0)},seek:function(a){"undefined"!=this.state&&(this.video.currentTime=a)},hH:function(){this.video.addEventListener("loadedmetadata",B(this,this.dC));this.video.addEventListener("timeupdate",B(this,this.gC));this.video.addEventListener("play",B(this,this.Dl));this.video.addEventListener("pause",
B(this,this.Dl));this.video.addEventListener("ended",B(this,this.Dl))},oL:function(){this.video.removeEventListener("loadedmetadata",B(this,this.dC));this.video.removeEventListener("timeupdate",B(this,this.gC));this.video.removeEventListener("play",B(this,this.Dl));this.video.removeEventListener("pause",B(this,this.Dl));this.video.removeEventListener("ended",B(this,this.Dl))},vA:function(a){switch(gd.lb(a).toLowerCase()){case "m3u8":return"application/x-mpegurl";case "mp4":return"video/mp4";case "mpd":return"application/dash+xml";
case "ogg":case "ogv":return"video/ogv";case "web,":return"video/webm";default:return null}},BJ:function(a){var b=a.type.toLowerCase();"application/dash+xml"==b?this.tv(a):"application/x-mpegurl"==b&&this.uv(a)},tv:function(a){var b=this;if("undefined"==typeof dashjs)kf.Uw(null!=this.dashScriptUrl?this.dashScriptUrl:"//cdn.dashjs.org/latest/dash.all.min.js",function(){b.tv(a)},function(){if(null!=b.dashScriptUrl)b.dashScriptUrl=null,b.tv(a);else throw new ja("dash.js couldn't be loaded");});else{var c=
function(){b.cd.off(dashjs.MediaPlayer.events.STREAM_INITIALIZED,c);var d=b.cd.getTracksFor("video");if(0<d.length)for(var d=d[0],e=0,f=d.bitrateList.length;e<f;){var g=e++,g=d.bitrateList[g];b.representations.push({type:"application/dash+xml",url:a.url,width:g.width,height:g.height,framerate:0,bitrate:g.bandwidth})}else b.GB()};this.cd=dashjs.MediaPlayer().create();this.cd.enableBufferOccupancyABR(!0);this.cd.getDebug().setLogToBrowserConsole(!1);this.cd.initialize(this.video,a.url,this.get_autoplay());
this.cd.setAutoSwitchQuality(this.autoSwitchQuality);this.cd.on(dashjs.MediaPlayer.events.STREAM_INITIALIZED,c)}},uv:function(a){var b=this;if(this.Am||Wf.jE())this.Jf=0,this.representations=[a],this.Dw();else if("undefined"!=typeof Hls||this.Am){var c=function(){b.vd.off(Hls.Events.MANIFEST_PARSED,c);var d=b.vd.levels;if(0<d.length)for(var e=0,f=d.length;e<f;){var g=e++,g=d[g];b.representations.push({type:"application/x-mpegurl",url:0<g.url.length?g.url[0]:a.url,width:g.width,height:g.height,framerate:0,
bitrate:g.bitrate})}};this.vd=new Hls;this.autoSwitchQuality&&(this.vd.startLevel=-1);this.vd.loadSource(a.url);this.vd.attachMedia(this.video);this.vd.on(Hls.Events.MANIFEST_PARSED,c)}else kf.Uw(null!=this.hlsScriptUrl?this.hlsScriptUrl:"//cdn.jsdelivr.net/hls.js/latest/hls.min.js",function(){b.uv(a)},function(){if(null!=b.hlsScriptUrl)b.hlsScriptUrl=null,b.uv(a);else throw new ja("hls.js couldn't be loaded");})},GB:function(){for(var a=new W,b=["video/mp4","video/webm","video/ogv"],c=0,d=this.wg;c<
d.length;){var e=d[c];++c;var f=e.type.toLowerCase();if(-1!=b.indexOf(f)){var g=(null!=t[f]?a.Id(f):a.h.hasOwnProperty(f))?null!=t[f]?a.H(f):a.h[f]:[];g.push(e);null!=t[f]?a.C(f,g):a.h[f]=g}}var b=null,h;(null!=t["video/mp4"]?a.Id("video/mp4"):a.h.hasOwnProperty("video/mp4"))&&0<(null!=t["video/mp4"]?a.H("video/mp4"):a.h["video/mp4"]).length?h=ic.$D(this.video):h=!1;if(h)b=null!=t["video/mp4"]?a.H("video/mp4"):a.h["video/mp4"];else{var k;(null!=t["video/webm"]?a.Id("video/webm"):a.h.hasOwnProperty("video/webm"))&&
0<(null!=t["video/webm"]?a.H("video/webm"):a.h["video/webm"]).length?k=ic.dE(this.video):k=!1;if(k)b=null!=t["video/webm"]?a.H("video/webm"):a.h["video/webm"];else{var l;(null!=t["video/ogv"]?a.Id("video/ogv"):a.h.hasOwnProperty("video/ogv"))&&0<(null!=t["video/ogv"]?a.H("video/ogv"):a.h["video/ogv"]).length?l=ic.cE(this.video):l=!1;l&&(b=null!=t["video/ogv"]?a.H("video/ogv"):a.h["video/ogv"])}}if(null!=b)this.Jf=0,this.representations=b,this.Dw();else throw new ja("VideoStream source not supported");
},wo:function(a){if(this.state!=a){var b=this.state;this.state=a;this.onStateChange.pf({oldState:b,newState:this.state})}},lw:function(a){null!=this.video&&this.oL();this.video=a;null!=this.video&&(this.hH(),this.Am&&(this.video.setAttribute("playsinline","true"),this.video.setAttribute("webkit-playsinline","true")));return this.video},IC:function(){if(null==this.video)this.lw(this.video);else for(var a=0,b=this.video.childNodes;a<b.length;){var c=b[a];++a;this.video.removeChild(c)}},Dw:function(){if(!this.hasAdaptative||
null==this.cd&&null==this.vd){this.IC();var a=v.g(window.document.createElement("source"),HTMLSourceElement);a.src=this.representations[this.Jf].url;this.video.appendChild(a)}else null!=this.cd?this.cd.setQualityFor("video",this.Jf):null!=this.vd&&(this.vd.loadLevel=this.Jf)},yM:function(){this.wg.splice(0,this.wg.length);this.representations.splice(0,this.representations.length);this.IC();this.height=this.width=0;this.hasAdaptative=!1;if(null==this.source)null!=this.cd&&(this.cd.reset(),this.cd=
null),null!=this.vd&&(this.vd.destroy(),this.vd=null);else{if(this.source instanceof Array&&null==this.source.jb)for(var a=this.source,b=0;b<a.length;){var c=a[b];++b;"string"==typeof c?this.wg.push({type:this.vA(c),url:c,width:0,height:0,framerate:0}):this.wg.push(c)}else if("string"==typeof this.source)this.wg.push({type:this.vA(this.source),url:this.source,width:0,height:0,framerate:0});else if(v.D(this.source,HTMLVideoElement))for(this.lw(v.g(this.source,HTMLVideoElement)),a=0,b=this.video.childNodes.length;a<
b;)c=a++,c=this.video.childNodes.item(c),v.D(c,HTMLSourceElement)&&this.wg.push({type:c.type,url:c.src,width:0,height:0,framerate:0});else this.wg.push(this.source);if(0<this.wg.length){a=null;if((b=ic.bE(this.video))||this.Am)for(var c=0,d=this.wg;c<d.length;){var e=d[c];++c;if("application/dash+xml"==e.type.toLowerCase()&&b||"application/x-mpegurl"==e.type.toLowerCase()&&(this.Am||b)){a=e;this.hasAdaptative=!0;break}}else this.hasAdaptative=!1;this.hasAdaptative?this.BJ(a):this.GB()}}},dC:function(){this.width=
this.video.videoWidth;this.height=this.video.videoHeight;"undefined"==this.state&&this.wo("ready")},Dl:function(a){if("undefined"!=this.state)switch(a.type){case "pause":"ready"!=this.state&&this.wo(0==this.get_currentTime()?"stopped":"paused");break;case "play":this.wo("playing");break;case "ended":case "ready":this.wo("stopped")}},gC:function(){this.onTimeUpdate.pf()},l:lc,ha:{set_currentTime:"set_currentTime",get_currentTime:"get_currentTime",get_duration:"get_duration",set_volume:"set_volume",
get_volume:"get_volume",set_loop:"set_loop",get_loop:"get_loop",set_muted:"set_muted",get_muted:"get_muted",set_autoplay:"set_autoplay",get_autoplay:"get_autoplay",set_autoSwitchQuality:"set_autoSwitchQuality",set_selectedRepresentationIndex:"set_selectedRepresentationIndex",get_selectedRepresentationIndex:"get_selectedRepresentationIndex",set_source:"set_source"}};var bd=J.CAPTURA.Viewer.VideoStream=function(a){this.dashScriptUrl=bd.DASH_SCRIPT_URL;this.hlsScriptUrl=bd.HLS_SCRIPT_URL;lc.call(this,
a)};q["cc.viewer.panorama.core.VideoStream"]=bd;bd.i=["cc","viewer","panorama","core","VideoStream"];bd.U=lc;bd.prototype=F(lc.prototype,{get:function(a){return X.Fa(this,a)},set:function(a,b){X.$b(this,a,b);return X.Fa(this,a)},l:bd});q["cc.viewer.panorama.layers.PanoramaLayerBase"]=sb;sb.i=["cc","viewer","panorama","layers","PanoramaLayerBase"];sb.prototype={set_panoramaHFOV:function(a){this.panoramaHFOV!=a&&(this.panoramaHFOV=a,this.wl());return a},set_panoramaVFOV:function(a){this.panoramaVFOV!=
a&&(this.panoramaVFOV=a,this.wl());return a},set_panoramaPitch:function(a){this.panoramaPitch!=a&&(this.panoramaPitch=a,this.wl());return a},nw:function(a){this.P!=a&&(this.P=a,this.wl());return a},set_inputFormat:function(a){this.inputFormat!=a&&(this.inputFormat=a);return a},set_outputFormat:function(a){this.outputFormat!=a&&(this.outputFormat=a);return a},wl:function(){this.bq||(this.bq=!0,vb.aa(B(this,this.JM),0))},JM:function(){this.bq&&(this.Fn(),this.bq=!1)},Fn:function(){this.nA()},nA:function(){null!=
this.ta&&(this.ta.dispose(),this.ta=null)},dispose:function(){this.nA()},l:sb,ha:{set_outputFormat:"set_outputFormat",set_inputFormat:"set_inputFormat",nw:"set_radius",set_panoramaPitch:"set_panoramaPitch",set_panoramaVFOV:"set_panoramaVFOV",set_panoramaHFOV:"set_panoramaHFOV"}};q["cc.viewer.panorama.layers.PanoramaLayer"]=pe;pe.i=["cc","viewer","panorama","layers","PanoramaLayer"];pe.U=sb;pe.prototype=F(sb.prototype,{Rg:function(a){if(this.alpha!=a){this.alpha=a;if(null!=this.ef)for(var b=0,c=this.ef.re;b<
c.length;){var d=c[b];++b;d.alpha=this.alpha}null!=this.ta&&(this.ta.hd=0<this.alpha)}return a},ld:function(a){this.Pd!=a&&(this.Pd=a,null!=this.ef&&(this.ef.dispose(),this.ef=null),null!=this.Pd&&(this.ef=new Rd(""+this.name+"_material",this.Pd,this.inputFormat,this.f),this.ef.alpha=this.alpha),this.wl());return a},set_inputFormat:function(a){this.inputFormat!=a&&(this.inputFormat=a,null!=this.ef&&this.ef.set_inputFormat(a));return a},Fn:function(){sb.prototype.Fn.call(this);if(!(null==this.ef||
isNaN(this.panoramaHFOV)||isNaN(this.panoramaVFOV)||isNaN(this.panoramaPitch)||isNaN(this.P))){if("spherical"==this.outputFormat)this.ta=tc.AD(""+this.name+"_mesh",this.f,this.panoramaHFOV,this.panoramaVFOV,this.panoramaPitch,this.ef.so,this.ef.al,this.P,!0);else throw new ja("Output format "+this.outputFormat+" is not implemented yet");this.ta.ld(this.ef);this.ta.hd=0<this.alpha}},dispose:function(){this.ld(null);sb.prototype.dispose.call(this)},l:pe,ha:F(sb.prototype.ha,{ld:"set_material",Rg:"set_alpha"})});
q["cc.viewer.panorama.layers.PanoramaLayerSet"]=hf;hf.i=["cc","viewer","panorama","layers","PanoramaLayerSet"];hf.prototype={set_panoramaHFOV:function(a){if(this.panoramaHFOV!=a){this.panoramaHFOV=a;for(var b=0,c=this.dd;b<c.length;){var d=c[b];++b;d.set_panoramaHFOV(a)}}return a},set_panoramaVFOV:function(a){if(this.panoramaVFOV!=a){this.panoramaVFOV=a;for(var b=0,c=this.dd;b<c.length;){var d=c[b];++b;d.set_panoramaVFOV(a)}}return a},set_panoramaPitch:function(a){if(this.panoramaPitch!=a){this.panoramaPitch=
a;for(var b=0,c=this.dd;b<c.length;){var d=c[b];++b;d.set_panoramaPitch(a)}}return a},set_inputFormat:function(a){if(this.inputFormat!=a){this.inputFormat=a;for(var b=0,c=this.dd;b<c.length;){var d=c[b];++b;d.set_inputFormat(a)}}return a},set_outputFormat:function(a){if(this.outputFormat!=a){this.outputFormat=a;for(var b=0,c=this.dd;b<c.length;){var d=c[b];++b;d.set_outputFormat(a)}}return a},tl:function(){return this.dd.length},gu:function(a){a=new pe(""+this.hG+"_"+this.dd.length,this.f,this.panoramaHFOV,
this.panoramaVFOV,this.panoramaPitch,100-this.dd.length,this.inputFormat,this.outputFormat,a);a.Rg(1);this.dd.push(a)},dispose:function(){this.hL()},hL:function(){for(var a=this.dd.length-1;0<=a;)this.mL(a),--a},nl:function(a){return 0<=a&&a<this.dd.length?this.dd[a]:null},mL:function(a){0<=a&&a<this.dd.length&&(this.dd.splice(a,1)[0].dispose(),this.dd.splice(a,1),this.uM())},uM:function(){for(var a=0,b=this.dd.length;a<b;){var c=a++;this.dd[c].nw(100-c)}},l:hf,ha:{tl:"get_length",set_outputFormat:"set_outputFormat",
set_inputFormat:"set_inputFormat",set_panoramaPitch:"set_panoramaPitch",set_panoramaVFOV:"set_panoramaVFOV",set_panoramaHFOV:"set_panoramaHFOV"}};q["cc.viewer.panorama.layers.VideoPanoramaLayer"]=oe;oe.i=["cc","viewer","panorama","layers","VideoPanoramaLayer"];oe.U=sb;oe.prototype=F(sb.prototype,{cD:function(a){this.video=a;null!=this.video&&this.wl();return this.video},set_inputFormat:function(a){this.inputFormat!=a&&(this.inputFormat=a);return a},Fn:function(){sb.prototype.Fn.call(this);if(!(isNaN(this.panoramaHFOV)||
isNaN(this.panoramaVFOV)||isNaN(this.panoramaPitch)||isNaN(this.P))){if("spherical"==this.outputFormat)this.ta=tc.AD(""+this.name+"_mesh",this.f,this.panoramaHFOV,this.panoramaVFOV,this.panoramaPitch,1,1,this.P,!1);else throw new ja("Output format "+this.outputFormat+" is not implemented yet");null!=this.Ce&&this.Ce.dispose();this.vq=new ne(""+this.name+"_texture",this.f,this.video,!0,3);this.Ce=new T(""+this.name+"_material",this.f);this.Ce.Fd=this.vq;this.Ce.Kn=new L(0,0,0);this.Ce.Bo=new L(0,0,
0);this.Ce.Ln=!0;this.Ce.freeze();this.ta.ld(this.Ce)}},dispose:function(){sb.prototype.dispose.call(this);null!=this.Ce&&(this.Ce.dispose(),this.Ce=null);null!=this.vq&&(this.vq.dispose(),this.vq=null)},l:oe,ha:F(sb.prototype.ha,{cD:"set_video"})});q["cc.viewer.panorama.layers.controllers.PanoramaLayersController"]=Zc;Zc.i="cc viewer panorama layers controllers PanoramaLayersController".split(" ");Zc.prototype={yn:function(){},l:Zc};q["cc.viewer.panorama.layers.controllers.HDRPanoramaLayersController"]=
va;va.i="cc viewer panorama layers controllers HDRPanoramaLayersController".split(" ");va.U=Zc;va.prototype=F(Zc.prototype,{set_luminanceLowerLimit:function(a){this.lt=Math.min(1,Math.max(0,a));this.kt=Math.max(this.jr(),this.ir());return this.lt},jr:function(){return this.lt},set_luminanceHigherLimit:function(a){this.kt=Math.min(1,Math.max(0,a));this.lt=Math.min(this.jr(),this.ir());return this.kt},ir:function(){return this.kt},set_luminanceChangeTime:function(a){return this.luminanceChangeTime=
Math.max(100,Math.min(5E3,a))},set_maxLuminanceChangeSpeed:function(a){return this.maxLuminanceChangeSpeed=Math.max(0,a)},yn:function(a,b,c,d,e){if(null!=this.Qu&&1<this.Qu.length){this.Su.dD(d);this.Su.XC(e);this.Su.set_hfov(c);d=this.LI(a,b,this.Su);c=this.Qu.length;var f=this.position*(c-1),g=v.g(Math.max(0,Math.min(c-2,Math.floor(f))),qg);e=g+1;for(var f=1-(f-g),h=1-f,k=0;k<c;){var l=k++,m=this.nb.nl(l);null!=m&&(l==g?m.Rg(1>h?1:0):l==e?m.Rg(h):m.Rg(0))}l=Math.round((new Date).getTime()/1E3*1E3);
k=0!=this.vB?l-this.vB:16;this.vB=l;l=a-this.uJ;m=b-this.tJ;this.uJ=a;this.tJ=b;1E3*Math.sqrt(l*l+m*m)*va.kM/k<=this.maxLuminanceChangeSpeed&&(a=this.EA(g,d),b=this.EA(e,d),d=f*a+h*b,c=Math.min(1/c,1*k/this.luminanceChangeTime),d<this.jr()?this.position=b>d?this.position+c:this.position-c:d>this.ir()&&(this.position=a<d?this.position-c:this.position+c),this.position=Math.min(1,Math.max(0,this.position)))}},LI:function(a,b,c){var d=new Ia;d.cw(-b);d.LC(-a);a=[];b=0;for(var e=va.Ll.length;b<e;){var f=
b++,f=c.nM(new Ya(va.Ll[f][0]*c.width,va.Ll[f][1]*c.height,0)),f=td.Ib(f.IK,f.JK),g=f.x*d.m12+f.y*d.m22+f.z*d.m32+d.Dc,h=f.x*d.m13+f.y*d.m23+f.z*d.m33+d.tz;f.x=f.x*d.m11+f.y*d.m21+f.z*d.m31+d.Cc;f.y=g;f.z=h;a.push([0==f.x&&0==f.z?0:-Math.atan2(f.x,f.z),0==f.y&&0==f.z?0:Math.atan2(f.y,f.z)])}return a},EA:function(a,b){for(var c=this.Qu[a],d=0,e=0,f=va.Ll.length;e<f;)var g=e++,d=d+va.uE[g]*c.getData(b[g][0],b[g][1],this.nb.panoramaHFOV,this.nb.panoramaVFOV,this.nb.panoramaPitch);return d},l:va,ha:{set_maxLuminanceChangeSpeed:"set_maxLuminanceChangeSpeed",
set_luminanceChangeTime:"set_luminanceChangeTime",set_luminanceHigherLimit:"set_luminanceHigherLimit",ir:"get_luminanceHigherLimit",set_luminanceLowerLimit:"set_luminanceLowerLimit",jr:"get_luminanceLowerLimit"}});q["cc.viewer.panorama.layers.controllers.LivePanoramaLayersController"]=uc;uc.i="cc viewer panorama layers controllers LivePanoramaLayersController".split(" ");uc.U=Zc;uc.prototype=F(Zc.prototype,{yn:function(){if(this.Yz){var a=Math.min(1,(Math.round((new Date).getTime()/1E3*1E3)-this.ou)/
(this.oI-this.ou));1==a?this.kK():this.Al>this.Gn?this.nb.nl(this.Al).Rg(a):this.nb.nl(this.Gn).Rg(1-a)}},lK:function(){this.Al=(this.Gn+1)%this.nb.tl();var a=this.nb.nl(this.Al);null!=a&&(this.ou=Math.round((new Date).getTime()/1E3*1E3),this.oI=this.ou+this.changingTime,this.Al<this.Gn&&a.Rg(1),this.Yz=!0)},kK:function(){this.Yz=!1;this.nb.nl(this.Gn).Rg(0);this.nb.nl(this.Al).Rg(1);this.Gn=this.Al;vb.aa(B(this,this.lK),this.displayingTime)},l:uc});q["cc.viewer.panorama.layers.controllers.LuminanceData"]=
Vf;Vf.i="cc viewer panorama layers controllers LuminanceData".split(" ");Vf.prototype={getData:function(a,b,c,d,e){for(;a>Math.PI;)a-=2*Math.PI;for(;a<-Math.PI;)a+=2*Math.PI;a=Math.round((a+Math.PI)*this.width/c);b=Math.round((.5*d+e-b)*this.height/d);return 0<=a&&a<this.width&&0<=b&&b<this.height?this.data[b*this.width+a]:0},l:Vf};var sa=J.BABYLON.Material=function(a,b,c){null==c&&(c=!1);this.yb=[];this.Ys=0;this.Dz=!1;this.XD=0;this.pC=1;this.qf=!0;this.gl=!1;this.Iz=2;this.kC=new R;this.aC=new R;
this.Nb=new R;this.$=1;this.xn=!0;this.alpha=1;this.tu=this.Zk=!1;this.name=this.id=a;this.f=b;c||b.xf.push(this);Object.defineProperty(this,"wireframe",{get:this.xO,set:this.qw});Object.defineProperty(this,"fillMode",{get:this.av,set:this.DP});Object.defineProperty(this,"pointsCloud",{get:this.lr,set:this.FP})};q["com.babylonhx.materials.Material"]=sa;sa.i=["com","babylonhx","materials","Material"];sa.xb=[$a];sa.Bh=function(a,b){var c=new rb(a.name,b);c.id=a.id;za.ae(c,a.Rl);for(var d=0,e=a.xf.length;d<
e;){var f=d++,f=a.xf[f];null!=f?c.re.push(b.GA(f)):c.re.push(null)}return c};sa.ab=function(a,b,c){if(null==a.Eu)return T.ab(a,b,c);var d=Eb.wE(a.Eu);return null!=d?Eb.rD(d).ab(a,b,c):null};sa.prototype={qw:function(a){this.Ys=a?1:0;return a},lr:function(){return 2==this.Ys},av:function(){return this.Ys},dv:function(){return this.Zk},freeze:function(){this.Zk=!0},pa:function(){return!0},Oi:function(){return 1>this.alpha},Yf:function(){return!1},br:function(){return null},Ct:function(){var a=this.f.c,
b=this.s,c=b.zd;a.vc!=c&&(a.b.useProgram(c),a.vc=c);a.Ff=b;null!=b.Tc&&b.Tc(b);var b=this.xn,c=this.XD,d=0==this.$,d=a.Dg?d?1028:1029:d?1029:1028;if(a.G.Sf()!=b||a.G.Fg()!=d)b?(a.G.mw(d),a.G.fg(!0)):a.G.fg(!1);a.G.Qh(c)},bind:function(a,b){this.f.$e=this;this.aC.la(b);if(this.gl){var c=this.f.c;this.dF=c.G.gr();c.G.vb(!1)}},zn:function(){},Io:function(){this.kC.la(this);this.gl&&this.f.c.G.vb(this.dF)},dispose:function(a){null==a&&(a=!1);this.f.Ql(this);var b=this.f.xf.indexOf(this);0<=b&&this.f.xf.splice(b,
1);a&&null!=this.s&&(this.f.c.tG(this.s),this.s=null);a=0;for(b=this.f.Yb.length;a<b;){var c=a++,c=this.f.Yb[c];c.Gg()==this&&c.ld(null)}this.Nb.la(this);this.Nb.clear();this.aC.clear();this.kC.clear()},l:sa,ha:{dv:"get_isFrozen",av:"get_fillMode",lr:"get_pointsCloud",qw:"set_wireframe"}};var rb=J.BABYLON.MultiMaterial=function(a,b){this.re=[];sa.call(this,a,b,!0);b.NB.push(this)};q["com.babylonhx.materials.MultiMaterial"]=rb;rb.i=["com","babylonhx","materials","MultiMaterial"];rb.ab=function(a,b){for(var c=
new rb(a.name,b),d=a.xf,e=0;e<d.length;){var f=d[e];++e;f=b.GA(f);null!=f?c.re.push(f):null!=f&&c.re.push(f)}return c};rb.U=sa;rb.prototype=F(sa.prototype,{KA:function(a){return 0>a||a>=this.re.length?this.f.Rq:this.re[a]},pa:function(a){for(var b=0,c=this.re.length;b<c;){var d=b++;if(null!=this.re[d]&&!this.re[d].pa(a))return!1}return!0},l:rb});q["cc.viewer.panorama.materials.ERectMultiMaterial"]=Rd;Rd.i=["cc","viewer","panorama","materials","ERectMultiMaterial"];Rd.U=rb;Rd.prototype=F(rb.prototype,
{set_inputFormat:function(a){this.inputFormat!=a&&(this.inputFormat=a,this.mA(),this.TH());return a},Of:function(a,b){return this.KA(a*this.al+b)},dispose:function(a,b){null==b&&(b=!0);null==a&&(a=!1);rb.prototype.dispose.call(this,a,b);b&&this.mA();this.Pd=null},mA:function(){this.re.splice(0,this.re.length);this.so=this.al=0},TH:function(){if(null!=this.Pd){var a=new Wc,b=new Wc,c;switch(this.inputFormat){case "erect_sbs":c=new dc(.5*this.Pd.width,0,.5*this.Pd.width,this.Pd.height);break;case "erect_uo":c=
new dc(0,.5*this.Pd.height,this.Pd.width,.5*this.Pd.height);break;default:c=new dc(0,0,this.Pd.width,this.Pd.height)}this.so=Math.ceil(c.height/512);this.al=Math.ceil(c.width/512);a.scale(512*this.al/c.width,512*this.so/c.height);b.Cc+=-c.x;b.Dc+=-c.y;b.scale(512*this.al/c.width,512*this.so/c.height);b=0;for(c=this.so;b<c;)for(var d=b++,e=0,f=this.al;e<f;){var g=e++;"erect"==this.inputFormat?this.re.push(this.UH(a,d,g)):this.re.push(null)}this.freeze()}},UH:function(a,b,c){var d=new T(""+this.name+
"_"+b+"_"+c,this.f);d.Fd=this.Pq(a,b,c);d.Kn=new L(0,0,0);d.Bo=new L(0,0,0);d.Ln=!0;d.freeze();return d},XN:function(){return null},Pq:function(a,b,c){a=new Wc(a.W,a.m,a.Iq,a.d,a.Cc,a.Dc);var d=new ha(null,0,0,512,512);a.Cc+=512*-c;a.Dc+=512*-b;Xf.Ic(d,this.Pd,a,!0);return Ad.D(d.OA(),d.width,d.height,this.f)},l:Rd,ha:F(rb.prototype.ha,{set_inputFormat:"set_inputFormat"})});var hb=J.BABYLON.BaseTexture=function(a){this.yb=[];this.Nb=new R;this.Cq=4;this.kg=this.lg=1;this.Lf=this.Ed=0;this.Xa=[];this.rc=
this.Mi=!1;this.level=1;this.Ij=this.Tu=!1;this.Ma=0;this.f=a;this.f.Sl.push(this)};q["com.babylonhx.materials.textures.BaseTexture"]=hb;hb.i=["com","babylonhx","materials","textures","BaseTexture"];hb.xb=[$a,Qb];hb.prototype={Le:function(){return null},ol:function(){return null},pa:function(){return 4==this.Ma?!0:null!=this.fa?this.fa.pa:!1},Yu:function(){return-1!=this.fa.La&&0!=this.fa.La?{width:this.fa.La,height:this.fa.Ua}:null!=this.fa.Db?{width:this.fa.Db,height:this.fa.Db}:{width:0,height:0}},
GI:function(){return this.pa()&&null!=this.fa?null!=this.fa.Db?{width:this.fa.Db,height:this.fa.Db}:{width:this.fa.qk,height:this.fa.pk}:{width:0,height:0}},Pp:function(a,b,c){for(var d=this.f.c.rg,e=0,f=d.length;e<f;){var g=e++,g=d[g];if(g.url==a&&g.Cr==b&&(null==c||c==g.kd))return g.ia++,g}return null},Sq:function(){},BC:function(){if(null!=this.fa){var a=this.f.c.rg;this.fa.ia--;0==this.fa.ia&&(Q.remove(a,this.fa),this.f.c.Kt(this.fa),this.fa=null)}},dispose:function(){this.f.Ql(this);var a=this.f.Sl.indexOf(this);
0<=a&&this.f.Sl.splice(a,1);null!=this.fa&&(this.BC(),this.Nb.la(this),this.Nb.clear())},l:hb};var ma=J.BABYLON.Texture=function(a,b,c,d,e,f,g,h,k){null==k&&(k=!1);null==e&&(e=3);null==d&&(d=!0);null==c&&(c=!1);this.Go=this.Ko=this.No=0;this.Xh=this.di=1;this.ik=this.jk=0;hb.call(this,b);this.url=this.name=a;this.Mm=c;this.it=d;this.lq=e;this.R=h;this.yF=k;null!=a&&""!=wa.Kl(a)&&(this.fa=this.Pp(a,c,e),null==this.fa&&(wa.KM(a)&&null!=ma.g?(this.fa=b.c.XH(ma.g,c,b,this.lq),ma.g=null):b.HD?this.Ma=
4:-1!=a.indexOf(".")&&(this.fa=b.c.createTexture(a,c,d,b,this.lq,f,g,this.R),k&&(this.R=null))))};q["com.babylonhx.materials.textures.Texture"]=ma;ma.i=["com","babylonhx","materials","textures","Texture"];ma.D=function(a,b,c){var d;null==d&&(d=3);return new ma("data:"+b,c,void 0,void 0,d,void 0,void 0,a)};ma.ab=function(a,b,c){if(a.Eu)return Eb.rD(a.Eu).ab(a,b,c);if(a.rc)return vc.ab(a,b,c);if(null==a.name&&!a.Mi)return null;a.fo?(b=new Rc(a.name,a.uL,b),v.g(b,Rc).tn=a.lc,c=a.fo,v.g(b,Rc).fo=new Sc(c[0],
c[1],c[2],c[3])):a.Mi?(b=new nb(a.name,a.uL,b),v.g(b,nb).tn=a.lc):b=a.sH?ma.D(a.sH,a.name,b):new ma(c+na.Pb(a.name),b);b.name=a.name;b.Ij=a.Ij;b.Tu=a.Tu;b.level=a.level;b.Lf=a.Lf;b.Ed=a.Ed;b.ik=a.ik;b.jk=a.jk;b.Xh=a.Xh;b.di=a.di;b.Go=a.Go;b.Ko=a.Ko;b.No=a.No;b.kg=a.kg;b.lg=a.lg;if(null!=a.Xa){c=0;for(var d=a.Xa.length;c<d;){var e=c++;b.Xa.push(Hb.ab(a.Xa[e]))}}return b};ma.U=hb;ma.prototype=F(hb.prototype,{Sq:function(){4==this.Ma&&(this.Ma=1,this.fa=this.Pp(this.url,this.Mm,this.lq),null==this.fa&&
(this.fa=this.f.c.createTexture(this.url,this.Mm,this.it,this.f,this.lq,null,null,this.R),this.yF&&(this.R=null)))},DD:function(a){if(null!=this.fa){var b=this.f.c,c=this.fa;a=p.ya(a,c.qc);c.rc?(c=c.data,b.O[b.I]!=c&&(b.b.bindTexture(34067,c),b.O[b.I]=c),b.b.texParameteri(34067,10240,a.Kh),b.b.texParameteri(34067,10241,a.min),null!=b.O[b.I]&&(b.b.bindTexture(34067,null),b.O[b.I]=null)):(c=c.data,b.O[b.I]!=c&&(b.b.bindTexture(3553,c),b.O[b.I]=c),b.b.texParameteri(3553,10240,a.Kh),b.b.texParameteri(3553,
10241,a.min),null!=b.O[b.I]&&(b.b.bindTexture(3553,null),b.O[b.I]=null))}},Et:function(a,b,c,d){a*=this.Xh;b*=this.di;a-=.5*this.Xh;b-=.5*this.di;c-=.5;var e=this.az,f=a*e.a[1]+b*e.a[5]+c*e.a[9]+e.a[13],g=a*e.a[2]+b*e.a[6]+c*e.a[10]+e.a[14],h=a*e.a[3]+b*e.a[7]+c*e.a[11]+e.a[15];d.x=(a*e.a[0]+b*e.a[4]+c*e.a[8]+e.a[12])/h;d.y=f/h;d.z=g/h;d.x+=.5*this.Xh+this.ik;d.y+=.5*this.di+this.jk;d.z+=.5},Le:function(){if(this.ik==this.sx&&this.jk==this.ux&&this.Xh==this.tx&&this.di==this.vx&&this.Go==this.eF&&
this.Ko==this.fF&&this.No==this.gF)return this.ac;this.sx=this.ik;this.ux=this.jk;this.tx=this.Xh;this.vx=this.di;this.eF=this.Go;this.fF=this.Ko;this.gF=this.No;if(null==this.ac){var a=new r;a.a[0]=0;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=0;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=0;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=0;this.ac=a;this.az=new r;this.Sk=new n(0,0,0);this.jn=new n(0,0,0);this.kn=new n(0,0,0)}var a=r.Ta,b=.5*this.No,c=.5*this.Go,d=.5*this.Ko,e=Math.sin(b),b=Math.cos(b),
f=Math.sin(c),c=Math.cos(c),g=Math.sin(d),d=Math.cos(d);a.x=d*f*b+g*c*e;a.y=g*c*b-d*f*e;a.z=d*c*e-g*f*b;a.o=d*c*b+g*f*e;r.Ta.Af(this.az);this.Et(0,0,0,this.Sk);this.Et(1,0,0,this.jn);this.Et(0,1,0,this.kn);a=this.jn;e=this.Sk;a.x-=e.x;a.y-=e.y;a.z-=e.z;a=this.kn;e=this.Sk;a.x-=e.x;a.y-=e.y;a.z-=e.z;r.aa(1,0,0,0,1,0,0,0,1,0,0,0,this.ac);this.ac.a[0]=this.jn.x;this.ac.a[1]=this.jn.y;this.ac.a[2]=this.jn.z;this.ac.a[4]=this.kn.x;this.ac.a[5]=this.kn.y;this.ac.a[6]=this.kn.z;this.ac.a[8]=this.Sk.x;this.ac.a[9]=
this.Sk.y;this.ac.a[10]=this.Sk.z;return this.ac},ol:function(){if(this.ik==this.sx&&this.jk==this.ux&&this.Xh==this.tx&&this.di==this.vx&&this.Ed==this.yp)return this.ac;if(null==this.ac){var a=new r;a.a[0]=0;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=0;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=0;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=0;this.ac=a;a=new r;a.a[0]=0;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=0;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=0;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=
0;a.a[15]=0;this.oh=a}this.yp=this.Ed;switch(this.Ed){case 2:r.aa(1,0,0,0,1,0,0,0,1,0,0,0,this.ac);this.ac.a[0]=this.Xh;this.ac.a[5]=this.di;this.ac.a[12]=this.ik;this.ac.a[13]=this.jk;break;case 4:r.aa(1,0,0,0,1,0,0,0,1,0,0,0,this.oh);this.oh.a[0]=.5;this.oh.a[5]=-.5;this.oh.a[10]=0;this.oh.a[12]=.5;this.oh.a[13]=.5;this.oh.a[14]=1;this.oh.a[15]=1;this.f.Va.qa(this.oh,this.ac.a,0);break;default:r.aa(1,0,0,0,1,0,0,0,1,0,0,0,this.ac)}return this.ac},l:ma});q["cc.viewer.panorama.materials.textures.VideoTexture"]=
ne;ne.i="cc viewer panorama materials textures VideoTexture".split(" ");ne.U=ma;ne.prototype=F(ma.prototype,{dispose:function(){this.f.BD(B(this,this.update));ma.prototype.dispose.call(this)},update:function(){this.Yp!=this.zg.currentTime&&4==this.zg.readyState&&(this.Yp=this.zg.currentTime,this.f.c.FD(this.fa,this.zg,this.it))},l:ne});q["cc.viewer.panorama.math.Frustum"]=Uf;Uf.i=["cc","viewer","panorama","math","Frustum"];Uf.prototype={dD:function(a){this.width!=a&&(this.width=a,this.Kq=!0);return a},
XC:function(a){this.height!=a&&(this.height=a,this.Kq=!0);return a},set_hfov:function(a){this.hfov!=a&&(this.hfov=a,this.Kq=!0);return a},nM:function(a){this.xM();return new gf(new Ya(0,0,0),new Ya(.5*this.width-a.x,.5*this.height-a.y,this.YK))},xM:function(){this.Kq&&(this.YK=.5*this.width/Math.tan(.5*this.hfov),this.Kq=!1)},l:Uf,ha:{set_hfov:"set_hfov",XC:"set_height",dD:"set_width"}};q["cc.viewer.panorama.math.Line"]=gf;gf.i=["cc","viewer","panorama","math","Line"];gf.prototype={l:gf};q["cc.viewer.panorama.math.Vector3D"]=
td;td.i=["cc","viewer","panorama","math","Vector3D"];td.Ib=function(a,b){return new td(b.x-a.x,b.y-a.y,b.z-a.z)};td.U=Ya;td.prototype=F(Ya.prototype,{l:td});q["cc.viewer.panorama.mesh.SphereBuilder"]=tc;tc.i=["cc","viewer","panorama","mesh","SphereBuilder"];tc.AD=function(a,b,c,d,e,f,g,h,k){null==k&&(k=!0);var l=new I;l.pb=[];l.gb=[];l.Na=[];l.zb=[];var m=.5*c,w=.5*d,C=c/g,u=d/f;c=Math.ceil(100*c/(2*Math.PI*g));d=Math.ceil(50*d/(Math.PI*f));for(var y=0;y<f;)for(var n=y++,z=0,ea=g;z<ea;){var M=z++;
tc.YI(l,-m+M*C,w+e-n*u,C,u,h,c,d)}a=new S(a,b);l.dc(a);if(k)for(k=a.Qf(),l=0,c=c*d*6,a.Ha=[],d=0;d<f;)for(b=d++,e=0,h=g;e<h;)m=e++,a.Ha.push(new Rb(b*g+m,0,k,l,c,a)),l+=c;return a};tc.YI=function(a,b,c,d,e,f,g,h){null==h&&(h=12);null==g&&(g=16);null==f&&(f=50);var k=a.Na,l=a.gb,m=a.pb;a=a.zb;for(var w=k.length/3|0,C=0,u=h+1;C<u;)for(var y=C++,n=c-e*y/h,z=f*Math.cos(n),n=f*Math.sin(n),ea=y/h,M=0,r=g+1;M<r;){var x=M++,p=b+d*x/g,q=z*Math.sin(p),p=z*Math.cos(p),t=1/Math.sqrt(q*q+n*n+p*p);k.push(q);k.push(n);
k.push(p);l.push(q*t);l.push(n*t);l.push(p*t);a.push(x/g);a.push(ea);0<x&&0<y&&(q=w+(g+1)*y+x,p=w+(g+1)*y+x-1,t=w+(g+1)*(y-1)+x-1,x=w+(g+1)*(y-1)+x,m.push(q),m.push(t),m.push(p),m.push(q),m.push(x),m.push(t))}};var pa=J.BABYLON.PostProcess=function(a,b,c,d,e,f,g,h,k,l,m){null==m&&(m=0);null==l&&(l="");null==k&&(k=!1);null==g&&(g=1);this.Lc=new R;this.sc=new R;this.Ne=new R;this.Ri=new R;this.UB=new R;this.Pt=new K(1,1);this.$g=0;this.ob=new Ga(2);this.mI=this.kq=!1;this.width=this.height=-1;null!=
f?(this.cb=f,this.f=f.f,f.oH(this),this.c=this.f.c):this.c=h;this.name=a;this.ui=e;this.EC=g;this.kq=k;this.QG=m;this.Rd=null!=d?d:[];this.Rd.push("textureSampler");this.LF=b;this.My=null!=c?c:[];this.My.push("scale");this.rM(l)};q["com.babylonhx.postprocess.PostProcess"]=pa;pa.i=["com","babylonhx","postprocess","PostProcess"];pa.prototype={rM:function(a){null==a&&(a="");this.s=this.c.Aj({vertex:"postprocess",fragment:this.LF},["position"],this.My,this.Rd,a)},Bv:function(){this.width=-1},du:function(a,
b){null==a&&(a=this.cb);var c=a.f,d=a.f.c.T.eo,e=(null!=b?b.La:this.c.Wb())*this.ui,f=(null!=b?b.Ua:this.c.Lb())*this.ui,g=null!=this.ui.width?this.ui.width:e,h=null!=this.ui.height?this.ui.height:f;if(1!=this.EC){if(null==this.ui.width){for(var k=1;k*=2,k<g;);k>d&&(k=d);g=k}if(null==this.ui.height){for(k=1;k*=2,k<h;);k>d&&(k=d);h=k}}if(this.width!=g||this.height!=h){if(0<this.ob.length){d=0;for(k=this.ob.length;d<k;){var l=d++;this.c.Kt(this.ob.data[l])}d=this.ob;d.length=0;d.Ka++}this.width=g;this.height=
h;var d={width:this.width,height:this.height},k={qc:!1,jl:0==a.cc.indexOf(this),kl:0==a.cc.indexOf(this)&&this.c.SA(),kd:this.EC,type:this.QG},l=this.ob,m=this.c.Bu(d,k);l.data[l.length++]=m;m.yb[l.eb]=l.Ka;this.kq&&(l=this.ob,d=this.c.Bu(d,k),l.data[l.length++]=d,d.yb[l.eb]=l.Ka);this.Ri.la(this.s)}this.mI?(d=this.Pt,d.x=e/g,d.y=f/h,this.c.bindFramebuffer(this.ob.data[this.$g],0,e,f)):(e=this.Pt,e.x=1,e.y=1,this.c.bindFramebuffer(this.ob.data[this.$g]));this.UB.la(a);null!=this.clearColor?(c=this.c,
e=this.clearColor,c.G.apply(c.b),c.rb.apply(c.b),c.J.apply(c.b),f=0,v.D(e,ca)?c.b.clearColor(e.r,e.v,e.m,e.W):c.b.clearColor(e.r,e.v,e.m,1),f|=16384,c.b.clearDepth(1),f|=256,c.b.clearStencil(0),c.b.clear(f|1024)):(e=this.c,f=c.clearColor,c=c.Dq||c.Pu,e.G.apply(e.b),e.rb.apply(e.b),e.J.apply(e.b),g=0,c&&(v.D(f,ca)?e.b.clearColor(f.r,f.v,f.m,f.W):e.b.clearColor(f.r,f.v,f.m,1),g|=16384),e.b.clearDepth(1),g|=256,e.b.clearStencil(0),e.b.clear(g|1024));this.kq&&(this.$g=(this.$g+1)%2)},Tf:function(){return this.s.Tf()},
apply:function(){if(!this.s.Nc)return null;var a=this.c,b=this.s,c=b.zd;a.vc!=c&&(a.b.useProgram(c),a.vc=c);a.Ff=b;null!=b.Tc&&b.Tc(b);a=this.c;b=a.Dg?1029:1028;0==a.G.Sf()&&a.G.Fg()==b||a.G.fg(!1);a.G.Qh(0);a=this.c;0!=a.bb&&(a.J.za(!1),a.G.vb(!0),a.bb=0);this.c.G.Re(!1);this.c.G.vb(!1);0<this.ob.length&&(b=this.s,a=b.c,c=b.Rd.indexOf("textureSampler"),b=this.ob.data[this.$g].data,0<=c&&(c=33984+c,a.I!=c-33984&&(a.b.activeTexture(c),a.I=c-33984),a.O[a.I]!=b&&(a.b.bindTexture(3553,b),a.O[a.I]=b)));
c=this.s;a=this.Pt;c.Jb("scale",a.x,a.y)&&(b=c.c,c=c.u.get("scale"),b.b.uniform2f(c,a.x,a.y));this.Ne.la(this.s);return this.s},dispose:function(a){null==a&&(a=this.cb);if(0<this.ob.length){for(var b=0,c=this.ob.length;b<c;){var d=b++;this.c.Kt(this.ob.data[d])}b=this.ob;b.length=0;b.Ka++}null!=a&&(a.bI(this),0==a.cc.indexOf(this)&&0<a.cc.length&&this.cb.cc[0].Bv(),this.UB.clear(),this.Lc.clear(),this.Ne.clear(),this.sc.clear(),this.Ri.clear())},l:pa,ha:{Tf:"get_isSupported"}};q["cc.viewer.panorama.postprocess.StereoscopicPostProcess"]=
me;me.i=["cc","viewer","panorama","postprocess","StereoscopicPostProcess"];me.U=pa;me.prototype=F(pa.prototype,{l:me});q["cc.viewer.panorama.postprocess.VideoIOS10FixPostProcess"]=le;le.i=["cc","viewer","panorama","postprocess","VideoIOS10FixPostProcess"];le.U=pa;le.prototype=F(pa.prototype,{l:le});var U=J.CAPTURA.Viewer.PanoramaViewBase=function(a,b,c,d){null==d&&(d="normal");null==c&&(c="spherical");null==b&&(b="erect");this.wj=this.mj=0;this.ij=90;this.attachControl=!0;this.controlMode="drag_acceleration";
this.minHFOV=30;this.maxHFOV=120;this.panoramaPitch=0;this.panoramaVFOV=180;this.panoramaHFOV=360;this.yc=new jf(B(this,this.Wl));this.scene=a;this.set_inputFormat(b);this.set_outputFormat(c);this.set_cameraMode(d);this.yc.ne()};q["cc.viewer.panorama.view.PanoramaViewBase"]=U;U.i=["cc","viewer","panorama","view","PanoramaViewBase"];U.prototype={set_inputFormat:function(a){this.inputFormat!=a&&(this.inputFormat=a,this.yc.ne("input"));return this.inputFormat},set_outputFormat:function(a){this.outputFormat!=
a&&(this.outputFormat=a,this.yc.ne("cameras"));return this.outputFormat},set_cameraMode:function(a){this.cameraMode!=a&&(this.cameraMode=a,this.yc.ne("cameras"));return this.cameraMode},set_panoramaHFOV:function(a){this.panoramaHFOV!=a&&(this.panoramaHFOV=a,this.yc.ne("cameras"));return a},set_panoramaVFOV:function(a){this.panoramaVFOV!=a&&(this.panoramaVFOV=a,this.yc.ne("cameras"));return a},set_panoramaPitch:function(a){this.panoramaPitch!=a&&(this.panoramaPitch=a,this.yc.ne("cameras"));return a},
set_maxHFOV:function(a){this.maxHFOV!=a&&(this.maxHFOV=a,this.yc.ne("cameras"));return a},set_minHFOV:function(a){this.minHFOV!=a&&(this.minHFOV=a,this.yc.ne("cameras"));return a},set_hfov:function(a){isNaN(a)||this.ij==a||(this.ij=a,null==this.cb||this.yc.Ih("cameras")||this.cb.set_hfov(this.ij*U.D));return a},get_hfov:function(){return null!=this.cb?this.ij=this.cb.get_hfov()*U.aa:this.ij},set_yaw:function(a){this.wj!=a&&(this.wj=a,null==this.cb||this.yc.Ih("cameras")||this.cb.set_yaw(this.wj*U.D));
return a},get_yaw:function(){return null!=this.cb?this.wj=this.cb.get_yaw()*U.aa:this.wj},set_pitch:function(a){this.mj!=a&&(this.mj=a,null==this.cb||this.yc.Ih("cameras")||this.cb.set_pitch(this.mj*U.D));return a},get_pitch:function(){return null!=this.cb?this.mj=this.cb.get_pitch()*U.aa:this.mj},set_controlMode:function(a){this.controlMode!=a&&(this.controlMode=a,this.yc.ne("cameras"));return this.controlMode},ML:function(a){this.attachControl!=a&&(this.attachControl=a,null!=this.cb&&(this.attachControl?
this.cb.attachControl(this):this.cb.le(this)));return this.attachControl},dispose:function(){},zu:function(a){var b=new qe;b.panoramaHFOV=this.panoramaHFOV*U.D;b.panoramaVFOV=this.panoramaVFOV*U.D;b.panoramaPitch=this.panoramaPitch*U.D;b.maxHFOV=this.maxHFOV*U.D;b.minHFOV=this.minHFOV*U.D;b.initialHFOV=this.ij*U.D;this.cb=Eb.bl(a,["cameras",new n(0,0,0),this.scene,b]);this.attachControl&&this.cb.attachControl(this)},Jo:function(){this.set_maxHFOV(this.MD(this.maxHFOV));this.set_minHFOV(this.maxHFOV<
this.minHFOV?this.maxHFOV:this.minHFOV);this.set_hfov(this.MD(this.ij));var a=null;switch(this.controlMode){case "device_orientation":a=Ma.isSupported()?Ma:Sd;break;case "drag_acceleration":a=re;break;case "drag_rotation":a=Sd}var b;null!=this.cb?(b=this.cb,b=(null==b?null:v.Bh(b))!=a):b=!0;b&&(null!=this.cb&&(this.wj=this.cb.get_yaw()*U.aa,this.mj=this.cb.get_pitch()*U.aa,this.cb.dispose()),this.zu(a));this.cb.set_yaw(this.wj*U.D);this.cb.set_pitch(this.mj*U.D);a=0;switch(this.cameraMode){case "anaglyph":a=
10;break;case "over_under":a=13;break;case "side_by_side_crosseyed":a=12;break;case "side_by_side_parallel":a=11;break;case "vr":a=20}this.cb.Nl(a,{})},Cw:function(){},kk:function(){},MD:function(a){2*Math.atan(this.scene.c.Lb()*Math.tan(a*U.D*.5)/this.scene.c.Wb())*U.aa>this.panoramaVFOV&&(a=2*Math.atan(this.scene.c.Wb()*Math.tan(this.panoramaVFOV*U.D*.5)/this.scene.c.Lb())*U.aa);return a},Wl:function(){var a=this.yc.Ih("cameras"),b=this.yc.Ih("data"),c=this.yc.Ih("input");b&&this.kk();c&&this.Cw();
a&&this.Jo()},get:function(a){return X.Fa(this,a)},set:function(a,b){X.$b(this,a,b);return X.Fa(this,a)},l:U,ha:{ML:"set_attachControl",set_controlMode:"set_controlMode",set_pitch:"set_pitch",get_pitch:"get_pitch",set_yaw:"set_yaw",get_yaw:"get_yaw",set_hfov:"set_hfov",get_hfov:"get_hfov",set_minHFOV:"set_minHFOV",set_maxHFOV:"set_maxHFOV",set_panoramaPitch:"set_panoramaPitch",set_panoramaVFOV:"set_panoramaVFOV",set_panoramaHFOV:"set_panoramaHFOV",set_cameraMode:"set_cameraMode",set_outputFormat:"set_outputFormat",
set_inputFormat:"set_inputFormat"}};var ye=J.CAPTURA.Viewer.PanoramaView=function(a,b,c,d){null==d&&(d="normal");null==c&&(c="spherical");null==b&&(b="erect");this.maxLuminanceChangeSpeed=1;this.luminanceChangeTime=5E3;this.luminanceHigherLimit=.45;this.luminanceLowerLimit=.2;this.changingTime=2E3;this.displayingTime=5E3;this.panoramaMode="hdr";U.call(this,a,b,c,d);a.Yv(B(this,this.Er))};q["cc.viewer.panorama.view.PanoramaView"]=ye;ye.i=["cc","viewer","panorama","view","PanoramaView"];ye.U=U;ye.prototype=
F(U.prototype,{set_source:function(a){this.source!=a&&(this.source=a,this.yc.ne("data"));return a},set_panoramaMode:function(a){this.panoramaMode!=a&&(this.panoramaMode=a,this.yc.ne("layersController"));return a},set_displayingTime:function(a){this.displayingTime=a;v.D(this.wd,uc)&&(v.g(this.wd,uc).displayingTime=this.displayingTime);return a},set_changingTime:function(a){this.changingTime=a;v.D(this.wd,uc)&&(v.g(this.wd,uc).changingTime=this.changingTime);return a},set_luminanceLowerLimit:function(a){this.luminanceLowerLimit=
a;v.D(this.wd,va)&&v.g(this.wd,va).set_luminanceLowerLimit(this.luminanceLowerLimit);return a},set_luminanceHigherLimit:function(a){this.luminanceHigherLimit=a;v.D(this.wd,va)&&v.g(this.wd,va).set_luminanceHigherLimit(this.luminanceHigherLimit);return a},set_luminanceChangeTime:function(a){this.luminanceChangeTime=a;v.D(this.wd,va)&&v.g(this.wd,va).set_luminanceChangeTime(this.luminanceChangeTime);return a},set_maxLuminanceChangeSpeed:function(a){this.maxLuminanceChangeSpeed=a;v.D(this.wd,va)&&v.g(this.wd,
va).set_maxLuminanceChangeSpeed(this.maxLuminanceChangeSpeed);return a},dispose:function(){this.nb.dispose();U.prototype.dispose.call(this)},Er:function(a){null!=this.wd&&null!=this.cb&&this.wd.yn(this.cb.get_yaw(),this.cb.get_pitch(),this.cb.get_hfov(),a.c.Wb(),a.c.Lb())},Wl:function(){var a=this.yc.Ih("layersController");U.prototype.Wl.call(this);a&&this.tM()},kk:function(){var a=this;null!=this.nb&&this.nb.dispose();null!=this.source&&(null==this.nb&&(this.nb=new hf("layers",this.scene,this.panoramaHFOV*
U.D,this.panoramaVFOV*U.D,this.panoramaPitch*U.D,this.inputFormat,this.outputFormat)),this.bA(this.source).Uj(function(){a.yc.ne("layersController")}))},bA:function(a){var b=this,c=new fc;if(Object.prototype.hasOwnProperty.call(this.source,"resource")){var d=this.source;a=d.resource;null!=d.inputFormat&&this.set_inputFormat(d.inputFormat);null!=d.outputFormat&&this.set_outputFormat(d.outputFormat);null!=d.maxHFOV&&this.set_maxHFOV(d.maxHFOV);null!=d.minHFOV&&this.set_minHFOV(d.minHFOV);null!=d.initialHFOV&&
this.set_hfov(d.initialHFOV);null!=d.panoramaHFOV&&this.set_panoramaHFOV(d.panoramaHFOV);null!=d.panoramaVFOV&&this.set_panoramaVFOV(d.panoramaVFOV);null!=d.panoramaPitch&&this.set_panoramaPitch(d.panoramaPitch)}if("string"==typeof a)if(d=v.g(a,String),-1!=d.indexOf("http://")||-1!=d.indexOf("https://"))(new fe).load(d).Uj(function(a){ha.Ru(a,function(a){b.nb.gu(a);c.complete(b.nb)})});else{var e=new Image;e.onload=function(){b.nb.gu(ha.$a(e));c.complete(b.nb)};e.src=a}else if(v.D(a,ha))a=v.g(a,ha),
this.nb.gu(a),c.complete(this.nb);else if(a instanceof Array&&null==a.jb)this.FB(a,c,0);else throw new ja("Source not soported");return c.pc},FB:function(a,b,c){var d=this;c<a.length?this.bA(a[c]).Uj(function(){d.FB(a,b,c+1)}):b.complete(this.nb)},Jo:function(){U.prototype.Jo.call(this);null!=this.nb&&(this.nb.set_panoramaHFOV(this.panoramaHFOV*U.D),this.nb.set_panoramaVFOV(this.panoramaVFOV*U.D),this.nb.set_panoramaPitch(this.panoramaPitch*U.D))},Cw:function(){null!=this.nb&&this.nb.set_inputFormat(this.inputFormat)},
tM:function(){if(null!=this.nb&&0!=this.nb.tl()){var a=null,b;switch(this.panoramaMode){case "hdr":a=va;b=[this.nb,this.luminanceLowerLimit,this.luminanceHigherLimit,this.luminanceChangeTime,this.maxLuminanceChangeSpeed];break;case "live":a=uc,b=[this.nb,this.displayingTime,this.changingTime]}var c;null!=this.wd?(c=this.wd,c=(null==c?null:v.Bh(c))!=a):c=!0;c&&(this.wd=Eb.bl(a,b))}},l:ye,ha:F(U.prototype.ha,{set_maxLuminanceChangeSpeed:"set_maxLuminanceChangeSpeed",set_luminanceChangeTime:"set_luminanceChangeTime",
set_luminanceHigherLimit:"set_luminanceHigherLimit",set_luminanceLowerLimit:"set_luminanceLowerLimit",set_changingTime:"set_changingTime",set_displayingTime:"set_displayingTime",set_panoramaMode:"set_panoramaMode",set_source:"set_source"})});var Bd=J.CAPTURA.Viewer.VideoPanoramaView=function(a,b,c,d){null==d&&(d="normal");null==c&&(c="spherical");null==b&&(b="erect");U.call(this,a,b,c,d);this.video=new bd};q["cc.viewer.panorama.view.VideoPanoramaView"]=Bd;Bd.i=["cc","viewer","panorama","view","VideoPanoramaView"];
Bd.U=U;Bd.prototype=F(U.prototype,{set_source:function(a){this.source!=a&&(this.source=a,this.yc.ne("data"));return a},dispose:function(){null!=this.Be&&(this.Be.dispose(),this.Be=null);this.video.dispose();U.prototype.dispose.call(this)},kk:function(){null!=this.Be&&(this.Be.dispose(),this.Be=null);if(Object.prototype.hasOwnProperty.call(this.source,"resource")){var a=this.source;null!=a.inputFormat&&this.set_inputFormat(a.inputFormat);null!=a.outputFormat&&this.set_outputFormat(a.outputFormat);
null!=a.maxHFOV&&this.set_maxHFOV(a.maxHFOV);null!=a.minHFOV&&this.set_minHFOV(a.minHFOV);null!=a.initialHFOV&&this.set_hfov(a.initialHFOV);null!=a.panoramaHFOV&&this.set_panoramaHFOV(a.panoramaHFOV);null!=a.panoramaVFOV&&this.set_panoramaVFOV(a.panoramaVFOV);null!=a.panoramaPitch&&this.set_panoramaPitch(a.panoramaPitch);null!=a.autoplay&&this.video.set_autoplay(a.autoplay);null!=a.muted&&this.video.set_muted(a.muted);this.video.set_source(a.resource)}else this.video.set_source(this.source);null!=
this.source&&(this.Be=new oe("video_layer",this.scene,this.panoramaHFOV*U.D,this.panoramaVFOV*U.D,this.panoramaPitch*U.D,100,this.inputFormat,this.outputFormat),this.Be.cD(this.video))},zu:function(a){U.prototype.zu.call(this,a);a=Td.MM();null!=a&&10==a[0]&&new le("ios10fix",this.cb)},Jo:function(){U.prototype.Jo.call(this);null!=this.Be&&(this.Be.set_panoramaHFOV(this.panoramaHFOV*U.D),this.Be.set_panoramaVFOV(this.panoramaVFOV*U.D),this.Be.set_panoramaPitch(this.panoramaPitch*U.D))},Cw:function(){null!=
this.Be&&this.Be.set_inputFormat(this.inputFormat)},l:Bd,ha:F(U.prototype.ha,{set_source:"set_source"})});var p=J.BABYLON.Engine=function(a,b,c){null==b&&(b=!1);this.DK=[];this.ao=[];this.bo=[];this.gk=[];this.hk=[];this.fk=[];this.Hv=[];this.io=[];this.jo=[];this.ho=[];this.Bp={x:0,y:0,width:960,height:640};this.td=[];this.ad=[];this.Mx=[];this.V=new sc;this.Ud=!1;this.na=[];this.ej=new W;this.Dy=16;this.rg=[];this.bb=0;this.J=new mf;this.rb=new af;this.G=new nf;this.el=0;this.Yq=60;this.Ti=[];this.BA=
60;this.fi=[];this.Nt=!1;this.Kp=0;this.gK=[];this.YG=!1;this.Wi=[];this.Dg=this.qL=!0;this.wr=!1;this.fc=a;var d=null!=X.Fa(a,"width")?X.Fa(a,"width"):960;this.Bp.width=d;a=null!=X.Fa(a,"height")?X.Fa(a,"height"):640;this.Bp.height=a;null==c&&(c={});c.antialias=b;null==c.preserveDrawingBuffer&&(c.preserveDrawingBuffer=!1);v.D(this.fc,HTMLCanvasElement)||(this.fc=window.document.getElementsByTagName("canvas")[0]);this.b=v.g(this.fc,HTMLCanvasElement).getContext("webgl",c);null==this.b&&(this.b=v.g(this.fc,
HTMLCanvasElement).getContext("experimental-webgl",c));this.iF();b=this.jF();null==c.stencil&&(c.stencil=!0);this.width=this.Bp.width;this.height=this.Bp.height;this.yk=1;this.resize();this.YF=c.stencil;this.T=new of;this.T.RJ=this.b.getParameter(34930);this.T.eo=this.b.getParameter(3379);this.T.NJ=this.b.getParameter(34076);this.T.XO=this.b.getParameter(34024);this.T.IB=this.b.getParameter(34921);try{var e=this.b.getExtension("OES_standard_derivatives");this.T.tw=null!=e;this.T.hw=this.b.getExtension("WEBGL_compressed_texture_s3tc");
var f=this.b.getExtension("OES_texture_float");this.T.sD=null!=f;var g=this.b.getExtension("EXT_texture_filter_anisotropic")||this.b.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this.b.getExtension("MOZ_EXT_texture_filter_anisotropic");this.T.yw=g;this.T.MJ=null!=this.T.yw?this.b.getParameter(this.T.yw.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0;this.T.Kc=this.b.getExtension("ANGLE_instanced_arrays");var h=this.b.getExtension("OES_element_index_uint");this.T.Ul=null!=h;var k=this.b.getExtension("EXT_frag_depth");
this.T.lO=null!=k;this.T.jv=!0;if(null!=(mb=this.b,B(mb,mb.getShaderPrecisionFormat))){var l=this.b.getShaderPrecisionFormat(35632,36338);this.T.jv=null!=l&&0!=l.precision}this.T.aO=this.b.getExtension("WEBGL_draw_buffers");var m=this.b.getExtension("OES_texture_float_linear");this.T.tD=null!=m;var w=this.b.getExtension("EXT_shader_texture_lod");this.T.fM=null!=w;this.T.fM&&(this.T.gM="GL_EXT_shader_texture_lod",this.T.dM="textureCubeLodEXT");var C=this.b.getExtension("OES_texture_half_float");this.T.MP=
null!=C;this.T.eM=this.b.getExtension("OES_texture_half_float_linear");this.T.NP=b}catch(u){u instanceof ja&&(u=u.Lo),console.log(u)}this.G.Re(!0);this.G.bk(515);this.G.vb(!0);this.wr=!1;this.O=Array(this.Dy)};q["com.babylonhx.Engine"]=p;p.i=["com","babylonhx","Engine"];p.compileShader=function(a,b,c,d){c=a.createShader("vertex"==c?35633:35632);a.shaderSource(c,(null!=d?d+"\n":"")+b);a.compileShader(c);if(0==a.getShaderParameter(c,35713))throw new ja(a.getShaderInfoLog(c));return c};p.Ec=function(a){return 1==
a?5126:2==a?p.ce:5121};p.ya=function(a,b){var c=9728,d=9728;2==a?(c=9729,d=b?9985:9729):3==a?(c=9729,d=b?9987:9729):1==a&&(c=9728,d=b?9986:9728);return{min:d,Kh:c}};p.prototype={uC:function(a,b,c,d,e,f,g,h,k,l){null==l&&(l=3);var m=b.c;e=m.T.eo;for(var w=1;w*=2,w<c;);w>e&&(w=e);e=w;m=m.T.eo;for(w=1;w*=2,w<d;);w>m&&(w=m);m=w;e==c&&m==d||console.log("Texture '"+a.url+"' is not power of two !");w=a.data;this.O[this.I]!=w&&(this.b.bindTexture(3553,w),this.O[this.I]=w);a.qk=c;a.pk=d;a.La=e;a.Ua=m;a.pa=
!0;h(e|0,m|0);c=p.ya(l,!f);this.b.texParameteri(3553,10240,c.Kh);this.b.texParameteri(3553,10241,c.min);f||g||this.b.generateMipmap(3553);null!=this.O[this.I]&&(this.b.bindTexture(3553,null),this.O[this.I]=null);this.Nh();b.uG(a);if(null!=a.sK)for(b=0,a=a.sK;b<a.length;)f=a[b],++b,null!=f&&f();null!=k&&k()},SA:function(){return this.YF},Nh:function(){for(var a=0,b=this.Dy;a<b;){var c=a++;this.O[c]=null}},ll:function(a,b){null==b&&(b=!1);var c=a.viewport;return this.Wb(b)*c.width/(this.Lb(b)*c.height)},
Wb:function(a){null==a&&(a=!1);return a||null==this.pg?this.fc.width:this.pg.La},Lb:function(a){null==a&&(a=!1);return a||null==this.pg?this.fc.height:this.pg.Ua},nD:function(a){null==a?this.fi=[]:(a=this.fi.indexOf(a),0<=a&&this.fi.splice(a,1))},Yy:function(){var a=!0;!this.qL&&this.YG&&(a=!1);if(a){this.Ti.push(1E3*((new Date).getTime()/1E3-ga.ce)|0);a=this.Ti.length;2<=a&&(this.el=this.Ti[a-1]-this.Ti[a-2]);if(a>=this.BA){a>this.BA&&(this.Ti.splice(0,1),a=this.Ti.length);for(var b=0,c=0,d=a-1;c<
d;)var e=c++,b=b+(this.Ti[e+1]-this.Ti[e]);this.Yq=1E3/(b/(a-1))}a=0;for(b=this.fi.length;a<b;)c=a++,(0,this.fi[c])();a=0;for(b=this.gK;a<b.length;)c=b[a],++a,c()}0<this.fi.length?window.requestAnimationFrame(B(this,this.Yy)):this.Nt=!1},resize:function(){this.width=window.navigator.D?window.innerWidth:this.fc.clientWidth;this.height=window.navigator.D?window.innerHeight:this.fc.clientHeight;this.LL(this.width/this.yk|0,this.height/this.yk|0);for(var a=0,b=this.DK;a<b.length;){var c=b[a];++a;c()}},
LL:function(a,b){this.fc.width=a;this.fc.height=b;for(var c=0,d=this.Wi.length;c<d;)for(var e=c++,e=this.Wi[e],f=0,g=e.mf.length;f<g;){var h=f++;e.mf[h].ud=0}},bindFramebuffer:function(a,b,c,d){null==b&&(b=0);this.pg=a;var e=a.jm;this.uc!=e&&(this.b.bindFramebuffer(36160,e),this.uc=e);a.rc?this.b.framebufferTexture2D(36160,36064,34069+b,a.data,0):this.b.framebufferTexture2D(36160,36064,3553,a.data,0);this.b.viewport(0,0,null!=c?c:a.La,null!=d?d:a.Ua);this.Xl()},DA:function(a){a.qc&&(a=a.data,this.O[this.I]!=
a&&(this.b.bindTexture(34067,a),this.O[this.I]=a),this.b.generateMipmap(34067),null!=this.O[this.I]&&(this.b.bindTexture(34067,null),this.O[this.I]=null))},vertexAttribPointer:function(a,b,c,d,e,f,g){var h=this.Mx[b],k=!1;null==h?(k=!0,this.Mx[b]={LO:b,size:c,type:d,QB:e,Co:f,offset:g,buffer:a}):(h.buffer!=a&&(h.buffer=a,k=!0),h.size!=c&&(h.size=c,k=!0),h.type!=d&&(h.type=d,k=!0),h.QB!=e&&(h.QB=e,k=!0),h.Co!=f&&(h.Co=f,k=!0),h.offset!=g&&(h.offset=g,k=!0));k&&(this.V.get(34962)!=a&&(this.b.bindBuffer(34962,
null==a?null:a.buffer),this.V.set(34962,null==a?null:a)),this.b.vertexAttribPointer(b,c,d,e,f,g))},mM:function(){for(var a=null,b=0,c=this.ad.length;b<c;){var d=b++,e=this.td[d];a!=e&&(a=e,this.V.get(34962)!=e&&(this.b.bindBuffer(34962,null==e?null:e.buffer),this.V.set(34962,null==e?null:e)));this.T.Kc.vertexAttribDivisorANGLE(this.ad[d],0)}this.td.splice(0,this.td.length-1);this.ad.splice(0,this.ad.length-1)},Ic:function(a,b,c,d){null==d&&(d=0);this.G.apply(this.b);this.rb.apply(this.b);this.J.apply(this.b);
this.Kp++;var e=this.Ud?5125:5123,f=this.Ud?4:2;0<d?this.T.Kc.drawElementsInstancedANGLE(a?4:1,c,e,b*f,d):this.b.drawElements(a?4:1,c,e,b*f|0)},gI:function(a,b,c){null==c&&(c=-1);this.G.apply(this.b);this.rb.apply(this.b);this.J.apply(this.b);this.Kp++;-1!=c?this.T.Kc.drawArraysInstancedANGLE(0,a,b,c):this.b.drawArrays(0,a,b)},qA:function(a,b,c,d){null==d&&(d=-1);this.G.apply(this.b);this.rb.apply(this.b);this.J.apply(this.b);this.Kp++;-1!=d?this.T.Kc.drawArraysInstancedANGLE(a?4:1,b,c,d):this.b.drawArrays(a?
4:1,b,c)},tG:function(a){var b=a.wy,c=this.ej;if(null!=t[b]?c.Id(b):c.h.hasOwnProperty(b))this.ej.remove(a.wy),null!=a.zd&&this.b.deleteProgram(a.zd)},Aj:function(a,b,c,d,e,f,g,h,k){var l=(null!=a.LM?a.LM:null!=a.vertex?a.vertex:a)+"+"+(null!=a.Zq?a.Zq:null!=a.fragment?a.fragment:a)+"@"+e,m=this.ej;if(null!=t[l]?m.Id(l):m.h.hasOwnProperty(l))return a=this.ej,null!=t[l]?a.H(l):a.h[l];a=new pf(a,b,c,d,this,e,f,g,h,k);a.wy=l;b=this.ej;null!=t[l]?b.C(l,a):b.h[l]=a;return a},cA:function(a,b,c){a=p.compileShader(this.b,
a,"vertex",c);b=p.compileShader(this.b,b,"fragment",c);c=this.b.createProgram();this.b.attachShader(c,a);this.b.attachShader(c,b);this.b.linkProgram(c);if(0==this.b.getProgramParameter(c,35714)){var d=this.b.getProgramInfoLog(c);if(""!=d)throw new ja(d);}this.b.deleteShader(a);this.b.deleteShader(b);return c},Ub:function(a,b,c,d,e){this.b.uniform4f(a,b,c,d,e)},Xl:function(){this.Nh();this.Ff=null;var a=this.rb;a.Rk=!1;a.gn=255;a.fn=519;a.rq=1;a.oz=255;a.rz=7680;a.pz=7680;a.qz=7681;a.Cm=!0;a.Bm=!0;
a.Ck=!0;a.Wp=!0;this.G.reset();this.G.bk(515);this.J.reset();this.Qb=this.kb=this.qb=null},XH:function(a,b,c,d){null==d&&(d=3);var e=this,f=new ab("from_image",this.b.createTexture());c.qp(f);f.url="from_image";f.Cr=b;f.ia=1;f.kd=d;this.rg.push(f);this.uC(f,c,a.width,a.height,!1,b,!1,function(b,c){e.b.texImage2D(3553,0,6408,b,c,0,6408,5121,a.data)},null,d);return f},createTexture:function(a,b,c,d,e,f,g,h){null==e&&(e=3);var k=this,l=new ab(a,this.b.createTexture()),m="";g=null;"data:"==Q.substr(a,
0,5)&&(g=!0);null==g?m=Q.substr(a,a.length-4,4).toLowerCase():(g=a.split(":"),m=g[1].substr(g[1].length-4,4).toLowerCase());var w=this.T.hw&&".dds"==m,m=".tga"==m;d.qp(l);l.url=a;l.Cr=b;l.ia=1;l.kd=e;this.rg.push(l);m||w||(w=function(a){k.uC(l,d,a.width,a.height,c,b,!1,function(b,c){k.b.texImage2D(3553,0,6408,b,c,0,6408,5121,a.data);null!=f&&f()},null,e)},g instanceof Array&&null==g.jb?ga.Qj(h,w):ga.Qj(a,w));return l},AM:function(a,b,c){a.La=b;a.Ua=c;a.Db=b*c;a.qk=b;a.pk=c},Pq:function(a,b,c,d,e,
f,g,h){null==h&&(h="");f=new ab("",this.b.createTexture());f.qk=b;f.pk=c;f.La=b;f.Ua=c;f.qc=e;f.kd=g;f.ia=1;b=this.$x(d);c=f.data;this.O[this.I]!=c&&(this.b.bindTexture(3553,c),this.O[this.I]=c);0!=f.La%4&&this.b.pixelStorei(3317,1);""!=h?this.b.compressedTexImage2D(3553,0,X.Fa(this.T.hw,h),f.La,f.Ua,0,a):this.b.texImage2D(3553,0,b,f.La,f.Ua,0,b,5121,a);a=p.ya(f.kd,f.qc);this.b.texParameteri(3553,10240,a.Kh);this.b.texParameteri(3553,10241,a.min);f.qc&&this.b.generateMipmap(3553);null!=this.O[this.I]&&
(this.b.bindTexture(3553,null),this.O[this.I]=null);this.Nh();f.pa=!0;this.rg.push(f);return f},$x:function(a){var b=6408;switch(a){case 0:b=6406;break;case 1:b=6409;break;case 2:b=6410;break;case 4:b=6407;break;case 5:b=6408}return b},QH:function(a,b,c,d){var e=new ab("",this.b.createTexture());e.qk=a;e.pk=b;if(c){for(var f=this.T.eo,g=1;g*=2,g<a;);g>f&&(g=f);a=g;f=this.T.eo;for(g=1;g*=2,g<b;);g>f&&(g=f);b=g}this.Nh();e.La=a;e.Ua=b;e.pa=!1;e.qc=c;e.ia=1;e.kd=d;a=p.ya(d,e.qc);e.rc?(b=e.data,this.O[this.I]!=
b&&(this.b.bindTexture(34067,b),this.O[this.I]=b),this.b.texParameteri(34067,10240,a.Kh),this.b.texParameteri(34067,10241,a.min),null!=this.O[this.I]&&(this.b.bindTexture(34067,null),this.O[this.I]=null)):(b=e.data,this.O[this.I]!=b&&(this.b.bindTexture(3553,b),this.O[this.I]=b),this.b.texParameteri(3553,10240,a.Kh),this.b.texParameteri(3553,10241,a.min),null!=this.O[this.I]&&(this.b.bindTexture(3553,null),this.O[this.I]=null));this.rg.push(e);return e},FD:function(a,b,c){if(!a.ry){var d=a.data;this.O[this.I]!=
d&&(this.b.bindTexture(3553,d),this.O[this.I]=d);this.b.pixelStorei(37440,c?0:1);try{null==this.Az&&(this.b.texImage2D(3553,0,6408,6408,5121,b),this.Az=0!=this.b.getError()?!1:!0),this.Az?this.b.texImage2D(3553,0,6408,6408,5121,v.g(b,HTMLVideoElement)):(null==a.yi&&(a.yi=v.g(window.document.createElement("canvas"),HTMLCanvasElement),a.ZG=a.yi.getContext("2d"),a.yi.width=a.La,a.yi.height=a.Ua),a.ZG.drawImage(b,0,0,b.videoWidth,b.videoHeight,0,0,a.La,a.Ua),this.b.texImage2D(3553,0,6408,6408,5121,a.yi)),
a.qc&&this.b.generateMipmap(3553),null!=this.O[this.I]&&(this.b.bindTexture(3553,null),this.O[this.I]=null),this.Nh(),a.pa=!0}catch(e){a.ry=!0}}},Bu:function(a,b){var c=!1,d=!0,e=!1,f=0,g=3;null!=b&&(c=null!=b.qc?b.qc:b,null!=b.jl?d=b.jl:d=!0,e=null!=b.kl?b.kl:d,null!=b.type&&(f=b.type),null!=b.kd&&(g=b.kd),1!=f||this.T.tD?2!=f||this.T.eM||(g=1):g=1);var h=new ab("",this.b.createTexture()),k=h.data;this.O[this.I]!=k&&(this.b.bindTexture(3553,k),this.O[this.I]=k);var k=null!=a.width?a.width:a,l=null!=
a.height?a.height:a,m=p.ya(g,c);1!=f||this.T.sD||(f=0,console.log("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));this.b.texParameteri(3553,10240,m.Kh);this.b.texParameteri(3553,10241,m.min);this.b.texParameteri(3553,10242,33071);this.b.texParameteri(3553,10243,33071);this.b.texImage2D(3553,0,6408,k,l,0,6408,p.Ec(f),null);m=null;e?(m=this.b.createRenderbuffer(),this.b.bindRenderbuffer(36161,m),this.b.renderbufferStorage(36161,34041,k,l)):d&&(m=this.b.createRenderbuffer(),
this.b.bindRenderbuffer(36161,m),this.b.renderbufferStorage(36161,33189,k,l));var w=this.b.createFramebuffer();this.uc!=w&&(this.b.bindFramebuffer(36160,w),this.uc=w);e?this.b.framebufferRenderbuffer(36160,33306,36161,m):d&&this.b.framebufferRenderbuffer(36160,36096,36161,m);this.b.framebufferTexture2D(36160,36064,3553,h.data,0);c&&this.b.generateMipmap(3553);null!=this.O[this.I]&&(this.b.bindTexture(3553,null),this.O[this.I]=null);this.b.bindRenderbuffer(36161,null);null!=this.uc&&(this.b.bindFramebuffer(36160,
null),this.uc=null);h.jm=w;d&&(h.Ep=m);h.qk=k;h.pk=l;h.La=k;h.Ua=l;h.pa=!0;h.qc=c;h.ia=1;h.kd=g;h.type=f;this.Nh();this.rg.push(h);return h},VH:function(a,b){var c=new ab("",this.b.createTexture()),d=!0,e=!0,f=!1,g=3;null!=b&&(d=null==b.qc?b:b.qc,null==b.jl?e=!0:e=b.jl,f=null!=b.kl?b.kl:e,null!=b.kd&&(g=b.kd));c.rc=!0;c.qc=d;c.ia=1;c.kd=g;d=p.ya(g,d);g=c.data;this.O[this.I]!=g&&(this.b.bindTexture(34067,g),this.O[this.I]=g);for(g=0;6>g;){var h=g++;this.b.texImage2D(34069+h,0,6408,a.width,a.height,
0,6408,5121,null)}this.b.texParameteri(34067,10240,d.Kh);this.b.texParameteri(34067,10241,d.min);this.b.texParameteri(34067,10242,33071);this.b.texParameteri(34067,10243,33071);d=null;f?(d=this.b.createRenderbuffer(),this.b.bindRenderbuffer(36161,d),this.b.renderbufferStorage(36161,34041,a.width,a.height)):e&&(d=this.b.createRenderbuffer(),this.b.bindRenderbuffer(36161,d),this.b.renderbufferStorage(36161,33189,a.width,a.height));g=this.b.createFramebuffer();this.uc!=g&&(this.b.bindFramebuffer(36160,
g),this.uc=g);f?this.b.framebufferRenderbuffer(36160,33306,36161,d):e&&this.b.framebufferRenderbuffer(36160,36096,36161,d);c.qc&&(f=c.data,this.O[this.I]!=f&&(this.b.bindTexture(34067,f),this.O[this.I]=f),this.b.generateMipmap(34067));null!=this.O[this.I]&&(this.b.bindTexture(34067,null),this.O[this.I]=null);this.b.bindRenderbuffer(36161,null);null!=this.uc&&(this.b.bindFramebuffer(36160,null),this.uc=null);c.jm=g;e&&(c.Ep=d);c.La=a.width;c.Ua=a.height;c.pa=!0;this.Nh();this.rg.push(c);return c},
aA:function(a,b,c,d){null==d&&(d=!1);var e=this,f=new ab(a,this.b.createTexture());f.rc=!0;f.url=a;f.ia=1;a=Q.substr(a,a.length-4,4).toLowerCase();if(!this.T.hw||".dds"!=a){var g=[34069,34071,34073,34070,34072,34074],h=[],k=0,l=null,l=function(){ga.Qj(c[k],function(a){h.push(a);if((k+=1)==c.length){a=h[0].width;for(var b=e.T.NJ,C=1;C*=2,C<a;);C>b&&(C=b);a=C;b=f.data;e.O[e.I]!=b&&(e.b.bindTexture(34067,b),e.O[e.I]=b);b=0;for(C=g.length;b<C;){var u=b++,y=h[u];e.yi=y;e.b.texImage2D(g[u],0,6408,e.yi.width,
e.yi.height,0,6408,5121,y.data)}d||e.b.generateMipmap(34067);e.b.texParameteri(34067,10240,9729);e.b.texParameteri(34067,10241,d?9729:9987);e.b.texParameteri(34067,10242,33071);e.b.texParameteri(34067,10243,33071);null!=e.O[e.I]&&(e.b.bindTexture(34067,null),e.O[e.I]=null);e.Nh();f.La=a;f.Ua=a;f.pa=!0}else l()})};l()}return f},Kt:function(a){null!=a.jm&&this.b.deleteFramebuffer(a.jm);null!=a.Ep&&this.b.deleteRenderbuffer(a.Ep);this.b.deleteTexture(a.data);this.lM();a=this.rg.indexOf(a);-1!=a&&this.rg.splice(a,
1)},lM:function(){for(var a=0,b=this.T.RJ;a<b;){var c=33984+a++;this.I!=c-33984&&(this.b.activeTexture(c),this.I=c-33984);null!=this.O[this.I]&&(this.b.bindTexture(3553,null),this.O[this.I]=null);null!=this.O[this.I]&&(this.b.bindTexture(34067,null),this.O[this.I]=null)}},Hb:function(a,b,c){0>a||(this.b.uniform1i(b,a),this.EG(a,c))},EG:function(a,b){if(null!=b&&b.pa()){var c=!1;if(v.D(b,Ud)){var d=33984+a;this.I!=d-33984&&(this.b.activeTexture(d),this.I=d-33984);c=!0;v.g(b,Ud).update()}else if(4==
b.Ma){b.Sq();return}d=b.fa;if(this.O[a]!=d.data)if(c||(c=33984+a,this.I!=c-33984&&(this.b.activeTexture(c),this.I=c-33984)),d.rc)c=d.data,this.O[this.I]!=c&&(this.b.bindTexture(34067,c),this.O[this.I]=c),d.yp!=b.Ed&&(d.yp=b.Ed,d=3!=b.Ed&&5!=b.Ed?10497:33071,this.b.texParameteri(34067,10242,d),this.b.texParameteri(34067,10243,d)),this.jz(34067,b);else{c=d.data;this.O[this.I]!=c&&(this.b.bindTexture(3553,c),this.O[this.I]=c);if(d.xx!=b.kg)switch(d.xx=b.kg,b.kg){case 0:this.b.texParameteri(3553,10242,
33071);break;case 1:this.b.texParameteri(3553,10242,10497);break;case 2:this.b.texParameteri(3553,10242,33648)}if(d.yx!=b.lg)switch(d.yx=b.lg,b.lg){case 0:this.b.texParameteri(3553,10243,33071);break;case 1:this.b.texParameteri(3553,10243,10497);break;case 2:this.b.texParameteri(3553,10243,33648)}this.jz(3553,b)}}else null!=this.O[a]&&(d=33984+a,this.I!=d-33984&&(this.b.activeTexture(d),this.I=d-33984),null!=this.O[this.I]&&(this.b.bindTexture(3553,null),this.O[this.I]=null),null!=this.O[this.I]&&
(this.b.bindTexture(34067,null),this.O[this.I]=null))},jz:function(a,b){var c=this.T.yw,d=b.Cq;1==b.fa.kd&&(d=1);null!=c&&b.cF!=d&&(this.b.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.Cq,this.T.MJ)),b.cF=d)},dispose:function(){for(this.nD();0<this.Wi.length;)this.Wi[0].dispose(),this.Wi[0]=null,this.Wi.shift();for(var a=this.ej.keys();a.Ca();){var b=a.next(),c=this.ej;this.b.deleteProgram((null!=t[b]?c.H(b):c.h[b]).zd)}a=0;for(b=this.na.length;a<b;)c=a++,c>=this.T.IB||!this.na[c]||this.b.disableVertexAttribArray(c)},
iF:function(){return this.Ax(1,"OES_texture_float")},jF:function(){return this.Ax(2,"OES_texture_half_float")},Ax:function(a,b){function c(){d.b.deleteProgram(e);d.b.disableVertexAttribArray(f);d.b.deleteBuffer(h);d.b.deleteFramebuffer(m);d.b.deleteTexture(k);d.b.deleteTexture(l)}var d=this;if(null==this.b.getExtension(b))return!1;var e=this.cA("attribute vec4 a_position;\nvoid main() {\n\tgl_Position = a_position;\n}","precision mediump float;\nuniform vec4 u_color;\nuniform sampler2D u_texture;\nvoid main() {\n\tgl_FragColor = texture2D(u_texture, vec2(0.5, 0.5)) * u_color;\n}",
null);this.b.useProgram(e);var f=this.b.getAttribLocation(e,"a_position"),g=this.b.getUniformLocation(e,"u_color"),h=this.b.createBuffer();this.b.bindBuffer(34962,h);this.b.bufferData(34962,new ib([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),35044);this.b.enableVertexAttribArray(f);this.b.vertexAttribPointer(f,2,5126,!1,0,0);var k=this.b.createTexture();this.b.bindTexture(3553,k);this.b.texImage2D(3553,0,6408,1,1,0,6408,5121,new Ka([255,255,255,255]));var l=this.b.createTexture();this.b.bindTexture(3553,l);this.b.texImage2D(3553,
0,6408,1,1,0,6408,p.Ec(a),null);this.b.texParameteri(3553,10241,9728);this.b.texParameteri(3553,10240,9728);var m=this.b.createFramebuffer();this.b.bindFramebuffer(36160,m);this.b.framebufferTexture2D(36160,36064,3553,l,0);if(36053!=this.b.checkFramebufferStatus(36160))return console.log("GL Support: can **NOT** render to "+a+" texture"),c(),!1;this.b.bindTexture(3553,k);this.b.uniform4fv(g,new ib([0,10,20,1]));this.b.drawArrays(4,0,6);this.b.bindTexture(3553,l);this.b.bindFramebuffer(36160,null);
this.b.clearColor(1,0,0,1);this.b.clear(16384);this.b.uniform4fv(g,new ib([0,.1,.05,1]));this.b.drawArrays(4,0,6);g=new Ka(4);this.b.readPixels(0,0,1,1,6408,5121,g);if(0!=g[0]||248>g[1]||248>g[2]||254>g[3])return console.log("GL Support: Was not able to actually render to "+a+" texture"),c(),!1;c();return!0},l:p,ha:{SA:"get_isStencilEnable"}};var of=J.BABYLON.EngineCapabilities=function(){this.dM="textureCubeLodEXT";this.gM=""};q["com.babylonhx.EngineCapabilities"]=of;of.i=["com","babylonhx","EngineCapabilities"];
of.prototype={l:of};var ze=J.BABYLON.IDisposable=function(){};q["com.babylonhx.IDisposable"]=ze;ze.i=["com","babylonhx","IDisposable"];ze.prototype={l:ze};q["com.babylonhx.NodeCache"]=ff;ff.i=["com","babylonhx","NodeCache"];ff.prototype={l:ff};q["com.babylonhx.PointerEventTypes"]=qb;qb.i=["com","babylonhx","PointerEventTypes"];q["com.babylonhx.PointerInfo"]=Nc;Nc.i=["com","babylonhx","PointerInfo"];Nc.prototype={l:Nc};q["com.babylonhx.PointerInfoPre"]=hc;hc.i=["com","babylonhx","PointerInfoPre"];
hc.prototype={l:hc};q["com.babylonhx.RenderingGroupInfo"]=ef;ef.i=["com","babylonhx","RenderingGroupInfo"];ef.prototype={l:ef};var Aa=J.BABYLON.Scene=function(a){this.au=0;this.Op=new Ga(16);var b=new r;b.a[0]=0;b.a[1]=0;b.a[2]=0;b.a[3]=0;b.a[4]=0;b.a[5]=0;b.a[6]=0;b.a[7]=0;b.a[8]=0;b.a[9]=0;b.a[10]=0;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0;b.a[15]=0;this.sb=b;this.Xe=[];this.ex=0;this.nq=new Ga(32);this.gx=new Ga(32);this.am=new Ga(256);this.hf=new Ga(256);this.Ht=new Ga(256);this.Vg=new Ga(256);
this.yt=[];this.mn=new Ga(256);this.qm=!1;this.Pa=0;this.Ds=-1;this.yg=this.op=this.fx=this.ix=0;this.kD=[];this.hq=[];this.XK=!0;this.cq=new Ga(256);this.dx=[];this.HD=!1;this.Du=[];this.rA=!1;this.tC=this.Nr=!0;this.Vn=new n(0,-9,0);this.Ez=!1;this.wu=!0;this.xB=[];this.zB=!0;this.Zr=[];this.rw=!0;this.tf=[];this.Jg=[];this.gg=[];this.mD=!0;this.Pe=[];this.nC=!0;this.Sl=[];this.uD=!0;this.NB=[];this.xf=[];this.xk=[];this.Yb=[];this.un=[];this.mf=[];this.ic=[];this.Yr=this.BB=!0;this.zA=1E3;this.AA=
0;this.yA=.1;this.xA=new L(.2,.2,.3);this.Fj=Aa.g;this.qf=!0;this.en=0;this.wi=new K(0,0);this.Qc=null;this.Qi=new R;this.Cl=new R;this.Xa=[];this.fC=new R;this.tK=new R;this.xK=new R;this.pK=new R;this.vK=new R;this.rK=new R;this.wK=new R;this.bC=new R;this.eC=new R;this.fK=new R;this.hK=new R;this.Lc=new R;this.sc=new R;this.Nb=new R;this.NH=this.Kw=!1;this.Lz=!0;this.Pu=this.Ou=this.yI=!1;this.vn=new L(0,0,0);this.clearColor=new L(.2,.2,.3);this.Dq=!0;this.c=a;a.Wi.push(this);this.pj=new Ae(this);
this.Gl=new qf(this);this.VK=new rf;this.cm=new sf(this);this.vt=new tf(this);this.attachControl();new uf(this,{WO:!0});this.hD=new vf;this.eD(!1);Object.defineProperty(this,"pointerX",{get:this.Rn});Object.defineProperty(this,"pointerY",{get:this.Sn});this.Rq=new T("default material",this)};q["com.babylonhx.Scene"]=Aa;Aa.i=["com","babylonhx","Scene"];Aa.xb=[Qb];Aa.prototype={VC:function(a){null!=this.Jy&&this.sc.remove(this.Jy);this.Jy=this.sc.add(a);return a},SC:function(a){null!=this.Iy&&this.Lc.remove(this.Iy);
this.Iy=this.Lc.add(a);return a},eD:function(a){this.Ez=a;null!=this.Dn&&this.Dn.destroy();this.Dn=new Be;this.Dn.Yn(this);return a},nr:function(){return this.Ez},$u:function(){return this.iz},kr:function(){return this.DN},Rn:function(){return this.xd},Sn:function(){return this.yd},attachControl:function(){function a(a){return a.vr&&null!=a.ka?a.ka.bv():!1}var b=this;this.vg=function(c,d){b.xd=c;b.yd=d;b.jf=b.xd;b.kf=b.yd;null!=b.Qc&&(b.xd=b.xd-(b.Qc.viewport.x|0)*b.c.Wb(),b.yd=b.yd-(b.Qc.viewport.y|
0)*b.c.Lb());if(b.Cl.Fh()){var e=qb.uB,f=new hc(e,{x:c,y:d,button:null},b.jf,b.kf);b.Cl.la(f,e);if(f.sw)return}if(null!=b.Qc||null!=b.L){null==b.rC&&(b.rC=function(a){return a.Di()&&a.hd&&a.pa()?b.NH?!0:null!=a.ka?null!=a.ka:!1:!1});var g=b.jf,h=b.kf,k=b.Qc,e=b.rm(function(a){return b.Oq(g,h,a,k)},b.rC,!1);e.uf&&null!=e.ib?(b.jw(null),b.RC(e.ib)):(b.RC(null),e=b.Qc,f=b.Au(b.jf,b.kf,e),e=b.gt(f,a,!1,e),e.uf&&null!=e.Zb?b.jw(e.Zb):b.jw(null));null!=b.zK&&b.zK(c,d,e);b.Qi.Fh()&&(e=qb.uB,b.Qi.la(new Nc(e,
{x:c,y:d,button:null}),e))}};this.ff=function(c,d,e){b.xd=c;b.yd=d;b.jf=b.xd;b.kf=b.yd;null!=b.Qc&&(b.xd=b.xd-(b.Qc.viewport.x|0)*b.c.Wb(),b.yd=b.yd-(b.Qc.viewport.y|0)*b.c.Lb());if(b.Cl.Fh()){var f=qb.tB,g=new hc(f,{x:c,y:d,button:e},b.jf,b.kf);b.Cl.la(g,f);if(g.sw)return}if(null!=b.Qc||null!=b.L){b.wi.x=b.xd;b.wi.y=b.yd;b.en=1E3*((new Date).getTime()/1E3-ga.ce)|0;null==b.qC&&(b.qC=function(a){return a.Di()&&a.hd?a.pa():!1});b.si=null;var h=b.jf,k=b.kf,l=b.Qc,f=b.rm(function(a){return b.Oq(h,k,a,
l)},b.qC,!1);if(f.uf&&null!=f.ib&&null!=f.ib.ka){b.si=f.ib;if(f.ib.ka.bv()){switch(e){case 0:f.ib.ka.ec(2,ia.g(f.ib));break;case 1:f.ib.ka.ec(4,ia.g(f.ib));break;case 2:f.ib.ka.ec(3,ia.g(f.ib));break;default:f.ib.ka.ec(2,ia.g(f.ib))}null!=f.ib.ka&&f.ib.ka.ec(1,ia.g(f.ib))}null!=f.ib.ka&&f.ib.ka.hv(7)&&ga.Ah(function(){var a=b.jf,c=b.kf,d=b.Qc,e=b.rm(function(e){return b.Oq(a,c,e,d)},function(a){return a.Di()&&a.hd&&a.pa()&&null!=a.ka?a.ka.hv(7):!1},!1);e.uf&&null!=e.ib&&null!=e.ib.ka&&0!=b.en&&500<
(1E3*((new Date).getTime()/1E3-ga.ce)|0)-b.en&&10>Math.abs(b.wi.x-b.xd)&&10>Math.abs(b.wi.y-b.yd)&&(b.en=0,e.ib.ka.ec(7,ia.g(e.ib)))},500)}null!=b.yK&&b.yK(c,d,e,f);b.Qi.Fh()&&(f=qb.tB,b.Qi.la(new Nc(f,{x:c,y:d,button:e}),f));b.Jk=null;if(0<b.gg.length&&(c=b.Qc,d=b.Au(b.jf,b.kf,c),f=b.gt(d,a,!1,c),f.uf&&null!=f.Zb&&null!=f.Zb.ka)){b.Jk=f.Zb;switch(e){case 0:f.Zb.ka.ec(2,ia.D(f.Zb,b));break;case 1:f.Zb.ka.ec(4,ia.D(f.Zb,b));break;case 2:f.Zb.ka.ec(3,ia.D(f.Zb,b));break;default:f.Zb.ka.ec(2,ia.D(f.Zb,
b))}null!=f.Zb.ka&&f.Zb.ka.ec(1,ia.D(f.Zb,b))}}};this.gf=function(c,d,e){b.xd=c;b.yd=d;b.jf=b.xd;b.kf=b.yd;null!=b.Qc&&(b.xd=b.xd-(b.Qc.viewport.x|0)*b.c.Wb(),b.yd=b.yd-(b.Qc.viewport.y|0)*b.c.Lb());if(b.Cl.Fh()){var f=qb.wB,g=new hc(f,{x:c,y:d,button:e},b.jf,b.kf);b.Cl.la(g,f);if(g.sw)return}if(null!=b.Qc||null!=b.L){null==b.sC&&(b.sC=function(a){return a.Di()&&a.hd?a.pa():!1});var h=b.jf,k=b.kf,l=b.Qc,f=b.rm(function(a){return b.Oq(h,k,a,l)},b.sC,!1);f.uf&&null!=f.ib&&(null!=b.si&&f.ib==b.si&&(null!=
b.AK&&b.AK(f),b.Qi.Fh()&&(g=qb.GE,b.Qi.la(new Nc(g,{x:c,y:d,button:e}),g))),null!=f.ib.ka&&(f.ib.ka.ec(6,ia.g(f.ib)),null!=f.ib.ka&&10>Math.abs(b.wi.x-b.xd)&&10>Math.abs(b.wi.y-b.yd)&&f.ib.ka.ec(1,ia.g(f.ib))));null!=b.si&&null!=b.si.ka&&b.si!=f.ib&&b.si.ka.ec(15,ia.g(b.si));null!=b.BK&&b.BK(c,d,e,f);b.Qi.Fh()&&(f=qb.wB,b.Qi.la(new Nc(f,{x:c,y:d,button:e}),f));b.en=0;0<b.gg.length&&(c=b.Qc,d=b.Au(b.jf,b.kf,c),f=b.gt(d,a,!1,c),f.uf&&null!=f.Zb&&null!=f.Zb.ka&&(f.Zb.ka.ec(6,ia.D(f.Zb,b)),null!=f.Zb.ka&&
10>Math.abs(b.wi.x-b.xd)&&10>Math.abs(b.wi.y-b.yd)&&f.Zb.ka.ec(1,ia.D(f.Zb,b))),null!=b.Jk&&null!=b.Jk.ka&&b.Jk!=f.Zb&&b.Jk.ka.ec(15,ia.D(b.Jk,b)))}};this.gh=function(a){null!=b.ka&&b.ka.ec(13,ia.aa(b,a))};this.hh=function(a){null!=b.ka&&b.ka.ec(14,ia.aa(b,a))};this.c.fk.push(this.ff);this.c.hk.push(this.gf);this.c.gk.push(this.vg);this.c.ho.push(this.ff);this.c.jo.push(this.gf);this.c.io.push(this.vg);this.c.ao.push(this.gh);this.c.bo.push(this.hh)},le:function(){Q.remove(this.c.fk,this.ff);Q.remove(this.c.hk,
this.gf);Q.remove(this.c.gk,this.vg);Q.remove(this.c.ho,this.ff);Q.remove(this.c.jo,this.gf);Q.remove(this.c.io,this.vg);Q.remove(this.c.ao,this.gh);Q.remove(this.c.bo,this.hh)},Yv:function(a){this.sc.add(a)},BD:function(a){this.sc.iL(a)},qp:function(a){this.yt.push(a)},uG:function(a){Q.remove(this.yt,a)},Fq:function(a,b,c,d,e,f,g){null==e&&(e=1);null==d&&(d=!1);this.Ql(a);null==g&&(g=new wf(this,a,b,c,d,e,f));null!=a.Xa&&g.Mz(a,a.Xa);if(null!=a.FI){a=a.FI();for(var h=0,k=a.length;h<k;){var l=h++;
this.Fq(a[l],b,c,d,e,f,g)}}g.reset();return g},EI:function(a){for(var b=0,c=this.Xe.length;b<c;){var d=b++;if(this.Xe[d].target==a)return this.Xe[d]}return null},Ql:function(a,b){var c=this.EI(a);null!=c&&c.stop(b)},Cs:function(){if(this.Lz&&0!=this.Xe.length){if(-1==this.Ds){if(0<this.yt.length)return;this.Ds=1E3*((new Date).getTime()/1E3-ga.ce)|0}for(var a=(1E3*((new Date).getTime()/1E3-ga.ce)|0)-this.Ds,b=0,c=this.Xe.length;b<c;){var d=b++;null!=this.Xe[d]&&this.Xe[d].Cs(a)}}},hu:function(a){a.ig=
this.au++;this.Yb.push(a);this.xK.la(a)},Zv:function(a){var b=this.Yb.indexOf(a);-1!=b&&this.Yb.splice(b,1);this.tK.la(a);return b},nL:function(a){var b=this.ic.indexOf(a);-1!=b&&this.ic.splice(b,1);this.rK.la(a);return b},jL:function(a){var b=this.mf.indexOf(a);-1!=b&&this.mf.splice(b,1);b=this.un.indexOf(a);-1!=b&&this.un.splice(b,1);this.L==a&&(0<this.mf.length?this.L=this.mf[0]:this.L=null);this.bC.la(a);return b},gH:function(a){a.ig=this.au++;this.ic.push(a);this.wK.la(a)},eH:function(a){a.ig=
this.au++;this.mf.push(a);this.eC.la(a)},GA:function(a){for(var b=0,c=this.xf.length;b<c;){var d=b++;if(this.xf[d].id==a)return this.xf[d]}return null},FA:function(a){for(var b=0,c=this.xk.length;b<c;){var d=b++;if(this.xk[d].id==a)return this.xk[d]}return null},$K:function(a,b){null==b&&(b=!1);if(!b&&null!=this.FA(a.id))return!1;this.xk.push(a);this.vK.la(a);return!0},lL:function(a){var b=this.xk.indexOf(a);return-1<b?(this.xk.splice(b,1),this.pK.la(a),!0):!1},Vu:function(a){for(var b=0,c=this.Yb.length;b<
c;){var d=b++;if(this.Yb[d].id==a)return this.Yb[d]}return null},JI:function(a){for(var b=this.Yb.length-1;0<=b;){if(this.Yb[b].id==a)return this.Yb[b];--b}return null},KI:function(a){for(var b=this.Zr.length-1;0<=b;){if(this.Zr[b].id==a)return this.Zr[b];--b}return null},FF:function(){var a=this.L.Vg;a.length=0;a.Ka++;a=this.Vg;a.length=0;a.Ka++;this.pj.reset();a=this.Ht;a.length=0;a.Ka++;a=this.am;a.length=0;a.Ka++;a=this.gx;a.length=0;a.Ka++;a=this.nq;a.length=0;a.Ka++;this.cm.reset();a=this.Op;
a.length=0;a.Ka++;if(null==this.hj){for(var b=this.sb,a=[],c=0;6>c;)c++,a.push(new Sc(0,0,0,0));a[0].j.x=b.a[3]+b.a[2];a[0].j.y=b.a[7]+b.a[6];a[0].j.z=b.a[11]+b.a[10];a[0].d=b.a[15]+b.a[14];var c=a[0],d=Math.sqrt(c.j.x*c.j.x+c.j.y*c.j.y+c.j.z*c.j.z),e=0;0!=d&&(e=1/d);c.j.x*=e;c.j.y*=e;c.j.z*=e;c.d*=e;a[1].j.x=b.a[3]-b.a[2];a[1].j.y=b.a[7]-b.a[6];a[1].j.z=b.a[11]-b.a[10];a[1].d=b.a[15]-b.a[14];c=a[1];d=Math.sqrt(c.j.x*c.j.x+c.j.y*c.j.y+c.j.z*c.j.z);e=0;0!=d&&(e=1/d);c.j.x*=e;c.j.y*=e;c.j.z*=e;c.d*=
e;a[2].j.x=b.a[3]+b.a[0];a[2].j.y=b.a[7]+b.a[4];a[2].j.z=b.a[11]+b.a[8];a[2].d=b.a[15]+b.a[12];c=a[2];d=Math.sqrt(c.j.x*c.j.x+c.j.y*c.j.y+c.j.z*c.j.z);e=0;0!=d&&(e=1/d);c.j.x*=e;c.j.y*=e;c.j.z*=e;c.d*=e;a[3].j.x=b.a[3]-b.a[0];a[3].j.y=b.a[7]-b.a[4];a[3].j.z=b.a[11]-b.a[8];a[3].d=b.a[15]-b.a[12];c=a[3];d=Math.sqrt(c.j.x*c.j.x+c.j.y*c.j.y+c.j.z*c.j.z);e=0;0!=d&&(e=1/d);c.j.x*=e;c.j.y*=e;c.j.z*=e;c.d*=e;a[4].j.x=b.a[3]-b.a[1];a[4].j.y=b.a[7]-b.a[5];a[4].j.z=b.a[11]-b.a[9];a[4].d=b.a[15]-b.a[13];c=a[4];
d=Math.sqrt(c.j.x*c.j.x+c.j.y*c.j.y+c.j.z*c.j.z);e=0;0!=d&&(e=1/d);c.j.x*=e;c.j.y*=e;c.j.z*=e;c.d*=e;a[5].j.x=b.a[3]+b.a[1];a[5].j.y=b.a[7]+b.a[5];a[5].j.z=b.a[11]+b.a[9];a[5].d=b.a[15]+b.a[13];b=a[5];c=Math.sqrt(b.j.x*b.j.x+b.j.y*b.j.y+b.j.z*b.j.z);d=0;0!=c&&(d=1/c);b.j.x*=d;b.j.y*=d;b.j.z*=d;b.d*=d;this.hj=a}else a=this.sb,b=this.hj,b[0].j.x=a.a[3]+a.a[2],b[0].j.y=a.a[7]+a.a[6],b[0].j.z=a.a[11]+a.a[10],b[0].d=a.a[15]+a.a[14],c=b[0],d=Math.sqrt(c.j.x*c.j.x+c.j.y*c.j.y+c.j.z*c.j.z),e=0,0!=d&&(e=1/
d),c.j.x*=e,c.j.y*=e,c.j.z*=e,c.d*=e,b[1].j.x=a.a[3]-a.a[2],b[1].j.y=a.a[7]-a.a[6],b[1].j.z=a.a[11]-a.a[10],b[1].d=a.a[15]-a.a[14],c=b[1],d=Math.sqrt(c.j.x*c.j.x+c.j.y*c.j.y+c.j.z*c.j.z),e=0,0!=d&&(e=1/d),c.j.x*=e,c.j.y*=e,c.j.z*=e,c.d*=e,b[2].j.x=a.a[3]+a.a[0],b[2].j.y=a.a[7]+a.a[4],b[2].j.z=a.a[11]+a.a[8],b[2].d=a.a[15]+a.a[12],c=b[2],d=Math.sqrt(c.j.x*c.j.x+c.j.y*c.j.y+c.j.z*c.j.z),e=0,0!=d&&(e=1/d),c.j.x*=e,c.j.y*=e,c.j.z*=e,c.d*=e,b[3].j.x=a.a[3]-a.a[0],b[3].j.y=a.a[7]-a.a[4],b[3].j.z=a.a[11]-
a.a[8],b[3].d=a.a[15]-a.a[12],c=b[3],d=Math.sqrt(c.j.x*c.j.x+c.j.y*c.j.y+c.j.z*c.j.z),e=0,0!=d&&(e=1/d),c.j.x*=e,c.j.y*=e,c.j.z*=e,c.d*=e,b[4].j.x=a.a[3]-a.a[1],b[4].j.y=a.a[7]-a.a[5],b[4].j.z=a.a[11]-a.a[9],b[4].d=a.a[15]-a.a[13],c=b[4],d=Math.sqrt(c.j.x*c.j.x+c.j.y*c.j.y+c.j.z*c.j.z),e=0,0!=d&&(e=1/d),c.j.x*=e,c.j.y*=e,c.j.z*=e,c.d*=e,b[5].j.x=a.a[3]+a.a[1],b[5].j.y=a.a[7]+a.a[5],b[5].j.z=a.a[11]+a.a[9],b[5].d=a.a[15]+a.a[13],a=b[5],b=Math.sqrt(a.j.x*a.j.x+a.j.y*a.j.y+a.j.z*a.j.z),c=0,0!=b&&(c=
1/b),a.j.x*=c,a.j.y*=c,a.j.z*=c,a.d*=c;if(null!=this.iz){a=this.iz;b=this.hj;c=a.Sd;c.length=0;c.Ka++;c=0;for(d=a.hc.length;c<d;)e=c++,a.hc[e].select(b,a.Sd,!1);b=a.Sd;c=a.Uq;d=0;for(e=c.length;d<e;){var f=d++;b.ag(c[f])}b=a.Sd;a=b.data;c=b.length}else c=this.Yb.length,a=this.Yb;for(b=0;b<c;)if(d=b++,d=a[d],!d.hr()&&(this.yg+=d.Qf(),d.pa()&&d.isEnabled()&&(d.Wd(),null!=d.ka&&d.ka.XI([11,12])&&this.cq.ag(d),e=d.er(this.L),null!=e&&(d.Zm(),d.Aq||d.hd&&0<d.Ei()&&0!=(d.tb&this.L.tb)&&d.Li(this.hj)))))f=
this.Vg,f.data[f.length++]=d,d.yb[f.eb]=f.Ka,f=this.L.Vg,f.data[f.length++]=d,d.yb[f.eb]=f.Ka,d.ys(this.Pa),this.UE(d,e);if(this.nC)for(a=0,b=this.Pe.length;a<b;)c=a++,c=this.Pe[c],c.qq&&(null==c.Gd.position||null!=c.Gd&&c.Gd.isEnabled())&&(d=this.am,d.data[d.length++]=c,c.yb[d.eb]=d.Ka,c.ku())},UE:function(a,b){null!=b.gd()&&this.rw&&(this.gx.ag(b.gd())&&b.gd().Hl(),b.nf||this.nq.ag(b));if(a.zo||this.yI){var c=this.cm.lc,d=a.fd().zc;c.data[c.length++]=d;d.yb[c.eb]=c.Ka}null!=a.Np&&(c=this.Op,d=a.Np,
c.data[c.length++]=d,d.yb[c.eb]=c.Ka);if(null!=b&&null!=b.Ha){var e;if(null!=b.hn&&b.Jw){c=b.hn;d=this.hj;e=c.Sd;e.length=0;e.Ka++;e=0;for(var f=c.hc.length;e<f;){var g=e++;c.hc[g].select(d,c.Sd,!1)}d=c.Sd;e=c.Uq;f=0;for(g=e.length;f<g;){var h=f++;d.ag(e[h])}c=c.Sd;e=c.length;c=c.data}else c=b.Ha,e=c.length;for(d=0;d<e;)if(f=d++,f=c[f],b.Aq||1==b.Ha.length?g=!0:(g=this.hj,g=(f.Rf()?f.ta.fd():f.ra).Li(g)),g&&(Aa.D=f.Of(),b.Ao&&(g=this.cm.lc,h=(f.Rf()?f.ta.fd():f.ra).zc,g.data[g.length++]=h,h.yb[g.eb]=
g.Ka),null!=Aa.D)){if(null!=Aa.D.IA&&(g=this.Ht,h=g.data.indexOf(Aa.D),-1==(h>=g.length?-1:h))){g=this.Ht;h=Aa.D;g.data[g.length++]=h;h.yb[g.eb]=g.Ka;for(var g=this.hf,h=Aa.D.IA(),k=0,l=h.length;k<l;){var m=k++;g.ag(h.data[m])}}this.op+=f.Ug;this.pj.pf(f)}}},Wy:function(a){var b=this.c;this.L=a;if(null==this.L)throw new ja("Active camera not set");var c=this.L.viewport,d=b.Wb(),e=b.Lb(),f=c.x,g=c.y;b.af=c;b.b.viewport(f*d|0,g*e|0,d*c.width|0,e*c.height|0);this.$e=null;this.Pa++;c=this.L.rf();d=this.L.Pf(!1);
this.Aa=c;this.Va=d;this.Aa.qa(this.Va,this.sb.a,0);this.hK.la(this.L);this.FF();c=0;for(d=this.nq.length;c<d;)e=c++,e=this.nq.data[e],e.kH(e.gd());e=!1;if(this.Nr&&0<this.hf.length){this.qm=!0;c=0;for(d=this.hf.length;c<d;)e=c++,e=this.hf.data[e],e.qh()&&(this.Pa++,e.hb(null!=e.L&&e.L!=this.L));this.qm=!1;this.Pa++;e=!0}d=this.c.rb.Rk;c=!1;if(this.Nr&&null!=this.tf&&0<this.tf.length){this.qm=!0;f=0;for(g=this.tf.length;f<g;){var h=f++,h=this.tf[h];h.gD()&&(null==h.pl()||0==h.pl().Rb&&a==h.pl()||
0!=h.pl().Rb&&-1<h.pl().ma.indexOf(a))&&(c=!0,h=h.Qd,h.qh()&&(this.Pa++,h.hb(!1),e=!0))}this.qm=!1;this.Pa++}if(e){b.pg=null;null!=b.uc&&(b.b.bindFramebuffer(36160,null),b.uc=null);var e=b.af,f=b.Wb(),g=b.Lb(),h=e.x,k=e.y;b.af=e;b.b.viewport(h*f|0,k*g|0,f*e.width|0,g*e.height|0);b.Xl()}this.Gl.Qy();if(0<this.Jg.length){b.G.Re(!1);e=0;for(f=this.Jg.length;e<f;)g=e++,g=this.Jg[g],g.pJ&&g.hb();b.G.Re(!0)}c&&this.c.rb.yo(!0);this.pj.hb(null,null,!0,!0);c&&this.c.rb.yo(d);this.cm.hb();d=0;for(e=this.Op.length;d<
e;)f=d++,this.Op.data[f].hb();if(this.zB)for(d=0,e=this.xB.length;d<e;)f=d++,f=this.xB[f],0!=(a.tb&f.tb)&&f.hb();if(0<this.Jg.length){b.G.Re(!1);d=0;for(e=this.Jg.length;d<e;)f=d++,f=this.Jg[f],f.pJ||f.hb();b.G.Re(!0)}if(c){b.G.Re(!1);c=0;for(d=this.tf.length;c<d;)e=c++,this.tf[e].gD()&&this.tf[e].hb();b.G.Re(!0)}this.Gl.Xx(a.pv);this.L.wz();a=this.hf;a.length=0;a.Ka++;this.fK.la(this.L)},Sy:function(a){if(0==a.Rb)this.Wy(a);else{for(var b=0,c=a.ma.length;b<c;){var d=b++;this.Wy(a.ma[d])}this.L=a;
a=this.L.rf();b=this.L.Pf(!1);this.Aa=a;this.Va=b;this.Aa.qa(this.Va,this.sb.a,0);this.L.wz()}},lF:function(){for(var a=0,b=this.cq.length;a<b;)for(var c=a++,c=this.cq.data[c],d=0,e=c.ka.lf.length;d<e;){var f=d++,f=c.ka.lf[f];if(11==f.hg||12==f.hg){var g=f.SG,h=v.D(g,ka)?g:g.Zc,g=h.kJ(c,g.TP),k=c.eh.indexOf(h);g&&-1==k?11==f.hg?(f.Ws(ia.g(c)),c.eh.push(h)):12==f.hg&&c.eh.push(h):!g&&-1<k&&12==f.hg&&(12==f.hg&&f.Ws(ia.g(c)),c.ka.hv(12)&&12!=f.hg||c.eh.splice(k,1))}}},hb:function(){this.c.Kp=0;var a=
this.cq;a.length=0;a.Ka++;this.$e=null;null!=this.ka&&this.ka.ec(10,null);this.hD.gw||this.hD.zh();a=Math.max(Aa.Za,Math.min(this.c.el,Aa.Ta));this.ix=.06*a;this.Cs();null!=this.ie&&this.ie.CG(a/1E3);this.sc.la(this);var a=this.c,b=this.L;if(this.Nr){for(var c=0,d=this.Du.length;c<d;){var e=c++,e=this.Du[e];if(e.qh()){this.Pa++;this.L=null!=e.L?e.L:this.L;if(null==this.L)throw new ja("Active camera not set");var f=this.L.viewport,g=a.Wb(),h=a.Lb(),k=f.x,l=f.y;a.af=f;a.b.viewport(k*g|0,l*h|0,g*f.width|
0,h*f.height|0);f=this.L.rf();g=this.L.Pf(!1);this.Aa=f;this.Va=g;this.Aa.qa(this.Va,this.sb.a,0);e.hb(b!=this.L)}}this.Pa++}0<this.Du.length&&(a.pg=null,null!=a.uc&&(a.b.bindFramebuffer(36160,null),a.uc=null),c=a.af,d=a.Wb(),e=a.Lb(),f=c.x,g=c.y,a.af=c,a.b.viewport(f*d|0,g*e|0,d*c.width|0,e*c.height|0),a.Xl());this.L=b;if(this.XK&&0<this.hq.length)for(a=0,b=this.hq;a<b.length;)c=b[a],++a,c.qh()&&c.hb();a=this.c;b=this.clearColor;c=this.Dq||this.Pu||this.Ou;a.G.apply(a.b);a.rb.apply(a.b);a.J.apply(a.b);
d=0;c&&(v.D(b,ca)?a.b.clearColor(b.r,b.v,b.m,b.W):a.b.clearColor(b.r,b.v,b.m,1),d|=16384);a.b.clearDepth(1);d|=256;a.b.clearStencil(0);a.b.clear(d|1024);if(this.Yr)for(a=0,b=this.ic.length;a<b;)c=a++,d=this.ic[c],c=d.fr(),d.isEnabled()&&null!=c&&-1!=c.Ok.f.Sl.indexOf(c.Ok)&&(d=this.hf,c=c.Ok,d.data[d.length++]=c,c.yb[d.eb]=d.Ka);null!=this.Rs&&(a=this.hf,b=this.Rs.zF,a.data[a.length++]=b,b.yb[a.eb]=a.Ka);this.VK.update();if(0<this.un.length)for(a=0,b=this.un.length;a<b;)c=a++,0<c&&(d=this.c,d.G.apply(d.b),
d.rb.apply(d.b),d.J.apply(d.b),e=0,d.b.clearDepth(1),e|=256,d.b.clearStencil(0),e|=1024,d.b.clear(e)),this.Sy(this.un[c]);else{if(null==this.L)throw new ja("No camera defined");this.Sy(this.L)}this.lF();this.Lc.la(this);a=0;for(b=this.mn.length;a<b;)c=a++,d=this.mn.data[c],null!=d&&d.dispose(),this.mn.data[c]=null;a=this.mn;a.length=0;a.Ka++;this.rA&&(this.rA=!1)},dispose:function(){this.VC(null);this.SC(null);this.Zr=[];this.cm.dispose();null!=this.Rs&&this.Rs.dispose();this.Nb.la(this);this.le();
this.Nb.clear();this.sc.clear();this.Lc.clear();for(var a=0,b=this.mf.length;a<b;){var c=a++;this.mf[c].le(this)}for(;0<this.ic.length;)this.ic[0].dispose();for(;0<this.Yb.length;)this.Yb[0].dispose(!0);for(;0<this.mf.length;)this.mf[0].dispose();for(;0<this.xf.length;)this.xf[0].dispose();for(;0<this.Pe.length;)a=this.Pe[0],null!=a.F&&(a.F.dispose(),a.F=null),null!=a.wa&&(b=a.wa,b.ia--,0==b.ia&&a.c.b.deleteBuffer(b.buffer),a.wa=null),null!=a.Ld&&(a.Ld.dispose(),a.Ld=null),Q.remove(a.f.Pe,a),a.Nb.la(a),
a.Nb.clear();for(;0<this.gg.length;)this.gg[0].dispose();for(;0<this.Jg.length;)this.Jg[0].dispose();for(;0<this.tf.length;)this.tf[0].dispose();for(;0<this.Sl.length;)this.Sl[0].dispose();this.Gl.dispose();null!=this.ie&&this.dI();Q.remove(this.c.Wi,this);this.c.Xl()},Oq:function(a,b,c,d,e){null==e&&(e=!1);var f=this.c;if(null==d){if(null==this.L)throw new ja("Active camera not set");d=this.L}var g=d.viewport,h,k;k=f.Wb();var l=f.Lb();h=g.x*k;f=g.y*l;k=g.width*k;g=g.height*l;a=a/this.c.yk-h;b=b/
this.c.yk-(this.c.Lb()-f-g);null==c&&(c=new r,c.a[0]=1,c.a[1]=0,c.a[2]=0,c.a[3]=0,c.a[4]=0,c.a[5]=1,c.a[6]=0,c.a[7]=0,c.a[8]=0,c.a[9]=0,c.a[10]=1,c.a[11]=0,c.a[12]=0,c.a[13]=0,c.a[14]=0,c.a[15]=1);e?(e=new r,e.a[0]=1,e.a[1]=0,e.a[2]=0,e.a[3]=0,e.a[4]=0,e.a[5]=1,e.a[6]=0,e.a[7]=0,e.a[8]=0,e.a[9]=0,e.a[10]=1,e.a[11]=0,e.a[12]=0,e.a[13]=0,e.a[14]=0,e.a[15]=1):e=d.rf();return Na.$a(a,b,k,g,c,e,d.Pf(!1))},Au:function(a,b,c){var d=this.c;if(null==c){if(null==this.L)throw new ja("Active camera not set");
c=this.L}var e=c.viewport,f,g;g=d.Wb();var h=d.Lb();f=e.x*g;d=e.y*h;g=e.width*g;e=e.height*h;h=new r;h.a[0]=1;h.a[1]=0;h.a[2]=0;h.a[3]=0;h.a[4]=0;h.a[5]=1;h.a[6]=0;h.a[7]=0;h.a[8]=0;h.a[9]=0;h.a[10]=1;h.a[11]=0;h.a[12]=0;h.a[13]=0;h.a[14]=0;h.a[15]=1;a=a/this.c.yk-f;b=b/this.c.yk-(this.c.Lb()-d-e);return Na.$a(a,b,g,e,h,h,c.Pf(!1))},rm:function(a,b,c){null==c&&(c=!1);for(var d=null,e=0,f=this.Yb.length;e<f;){var g=e++,g=this.Yb[g];if(null!=b){if(!b(g))continue}else if(!g.isEnabled()||!g.hd||!g.Di())continue;
var h=g.va(),h=a(h),g=g.Ki(h,c);if(null!=g&&g.uf&&(c||null==d||!(g.Sb>=d.Sb))&&(d=g,c))break}return null!=d?d:new Cd},gt:function(a,b,c,d){null==c&&(c=!1);var e=new Cd;null==d&&(d=this.L);if(0<this.gg.length)for(var f=0,g=this.gg.length;f<g;){var h=f++,h=this.gg[h];if(h.vr&&(h=h.Ki(a,d,b,c),null!=h&&h.uf&&(c||null==e||!(h.Sb>=e.Sb))&&(e=h,c)))break}return e},PK:function(a,b,c){null==c&&(c=!1);var d=this;return this.rm(function(b){if(null==d.zt){var c=new r;c.a[0]=1;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=
0;c.a[5]=1;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=1;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=1;d.zt=c}var c=d.zt,g=b.a[0],h=b.a[1],k=b.a[2],l=b.a[3],m=b.a[4],w=b.a[5],C=b.a[6],u=b.a[7],y=b.a[8],V=b.a[9],z=b.a[10],ea=b.a[11],M=b.a[12],p=b.a[13],x=b.a[14],q=b.a[15];b=z*q-ea*x;var t=V*q-ea*p,D=V*x-z*p,$b=y*q-ea*M,P=y*x-z*M,N=y*p-V*M,E=w*b-C*t+u*D,O=-(m*b-C*$b+u*P),Tb=m*t-w*$b+u*N,H=-(m*D-w*P+C*N),v=1/(g*E+h*O+k*Tb+l*H),A=C*q-u*x,B=w*q-u*p,I=w*x-C*p,q=m*q-u*M,x=m*x-C*M,M=m*p-w*M,p=C*ea-u*
z,F=w*ea-u*V,L=w*z-C*V,u=m*ea-u*y,C=m*z-C*y,m=m*V-w*y;c.a[0]=E*v;c.a[4]=O*v;c.a[8]=Tb*v;c.a[12]=H*v;c.a[1]=-(h*b-k*t+l*D)*v;c.a[5]=(g*b-k*$b+l*P)*v;c.a[9]=-(g*t-h*$b+l*N)*v;c.a[13]=(g*D-h*P+k*N)*v;c.a[2]=(h*A-k*B+l*I)*v;c.a[6]=-(g*A-k*q+l*x)*v;c.a[10]=(g*B-h*q+l*M)*v;c.a[14]=-(g*I-h*x+k*M)*v;c.a[3]=-(h*p-k*F+l*L)*v;c.a[7]=(g*p-k*u+l*C)*v;c.a[11]=-(g*F-h*u+l*m)*v;c.a[15]=(g*L-h*C+k*m)*v;c=d.zt;l=a.origin;g=new n(0,0,0);h=l.x;k=l.y;l=l.z;m=c.a;w=h*m[1]+k*m[5]+l*m[9]+m[13];y=h*m[2]+k*m[6]+l*m[10]+m[14];
V=h*m[3]+k*m[7]+l*m[11]+m[15];g.x=(h*m[0]+k*m[4]+l*m[8]+m[12])/V;g.y=w/V;g.z=y/V;h=a.direction;k=new n(0,0,0);k.x=h.x*c.a[0]+h.y*c.a[4]+h.z*c.a[8];k.y=h.x*c.a[1]+h.y*c.a[5]+h.z*c.a[9];k.z=h.x*c.a[2]+h.y*c.a[6]+h.z*c.a[10];return new Na(g,k,a.length)},b,c)},RC:function(a){this.jh!=a&&(null!=this.jh&&null!=this.jh.ka&&this.jh.ka.ec(9,ia.g(this.jh)),this.jh=a,null!=this.jh&&null!=this.jh.ka&&this.jh.ka.ec(8,ia.g(this.jh)))},jw:function(a){this.kh!=a&&(null!=this.kh&&null!=this.kh.ka&&this.kh.ka.ec(9,
ia.D(this.kh,this)),this.kh=a,null!=this.kh&&null!=this.kh.ka&&this.kh.ka.ec(8,ia.D(this.kh,this)))},lI:function(a,b){if(null!=this.ie)return!0;this.ie=new xf(b);if(!this.ie.isSupported())return this.ie=null,!1;this.ie.ft(a);return!0},dI:function(){null!=this.ie&&(this.ie.dispose(),this.ie=null)},l:Aa,ha:{Sn:"get_pointerY",Rn:"get_pointerX",kr:"get_meshUnderPointer",$u:"get_SelectionOctree",eD:"set_workerCollisions",nr:"get_workerCollisions",SC:"set_afterRender",VC:"set_beforeRender"}};var Yf=J.BABYLON.Action=
function(){};q["com.babylonhx.actions.Action"]=Yf;Yf.i=["com","babylonhx","actions","Action"];Yf.prototype={Ws:function(a){if(null!=this.pi.pF){var b=this.pi.pF,c=this.xs.f.Pa;if(b.GF==c){if(!b.Px)return}else b.GF=c,b.Px=!0}this.pi.Ej(a);this.UL()},Ej:function(){},UL:function(){null!=this.pi.Gs?(null==this.pi.Gs.xs&&(this.pi.Gs.xs=this.xs),this.pi=this.pi.Gs):this.pi=this},l:Yf};var ia=J.BABYLON.ActionEvent=function(a,b,c,d,e){this.source=a;this.VL=e};q["com.babylonhx.actions.ActionEvent"]=ia;ia.i=
["com","babylonhx","actions","ActionEvent"];ia.g=function(a){var b=a.f;return new ia(a,b.Rn(),b.Sn(),b.kr(),void 0)};ia.D=function(a,b){return new ia(a,b.Rn(),b.Sn(),b.kr(),void 0,void 0)};ia.aa=function(a,b){return new ia(null,a.Rn(),a.Sn(),a.kr(),b)};ia.prototype={l:ia};var Zf=J.BABYLON.ActionManager=function(){this.lf=[]};q["com.babylonhx.actions.ActionManager"]=Zf;Zf.i=["com","babylonhx","actions","ActionManager"];Zf.prototype={dispose:function(){var a=this.f.dx.indexOf(this);-1<a&&this.f.dx.splice(a,
1)},XI:function(a){for(var b=0,c=this.lf.length;b<c;){var d=b++;if(-1<a.indexOf(this.lf[d].hg))return!0}return!1},hv:function(a){for(var b=0,c=this.lf.length;b<c;){var d=b++;if(this.lf[d].hg==a)return!0}return!1},bv:function(){for(var a=0,b=this.lf.length;a<b;){var c=a++,c=this.lf[c];if(1<=c.hg&&6>=c.hg)return!0}return!1},ec:function(a,b){for(var c=0,d=this.lf.length;c<d;){var e=c++,e=this.lf[e];if(e.hg==a){if(14==a||13==a){var f=e.SG;if(null!=f&&Qf.Vc(b.VL)!=f)continue}e.Ws(b)}}},l:Zf,ha:{bv:"get_hasPickTriggers"}};
var $f=J.BABYLON.Condition=function(){this.Px=!1};q["com.babylonhx.actions.Condition"]=$f;$f.i=["com","babylonhx","actions","Condition"];$f.prototype={l:$f};var wf=J.BABYLON.Animatable=function(a,b,c,d,e,f,g,h){null==f&&(f=1);null==e&&(e=!1);null==d&&(d=100);null==c&&(c=0);this.mG=!1;this.tp=[];this.Ek=this.Ik=-1;this.target=b;this.BI=c;this.iM=d;this.FJ=e;this.XL=f;this.ko=g;null!=h&&this.Mz(b,h);this.f=a;a.Xe.push(this)};q["com.babylonhx.animations.Animatable"]=wf;wf.i=["com","babylonhx","animations",
"Animatable"];wf.prototype={Mz:function(a,b){for(var c=0,d=b.length;c<d;){var e=c++,e=b[e];e.sq=a;this.tp.push(e)}},reset:function(){for(var a=this.tp,b=0,c=a.length;b<c;){var d=b++;a[d].reset()}this.Ik=this.Ek=-1},stop:function(a){if(-1<this.f.Xe.indexOf(this)){for(var b=this.tp,c=0,d=b.length-1;0<=d;)if(null==a||b[d].name==a)b[d].reset(),b.splice(d,1),++c,--d;b.length==c&&(this.f.Xe.splice(d,1),null!=this.ko&&this.ko())}},Cs:function(a){if(this.mG)return-1==this.Ik&&(this.Ik=a),!0;-1==this.Ek?this.Ek=
a:-1!=this.Ik&&(this.Ek+=a-this.Ik,this.Ik=-1);for(var b=!1,c=this.tp,d=0,e=c.length;d<e;){var f=d++,f=c[f].ku(a-this.Ek,this.BI,this.iM,this.FJ,this.XL);b?b=!0:b=f}b||this.f.Xe.splice(this.f.Xe.indexOf(this),1);b||null==this.ko||(this.ko(),this.ko=null);return b},l:wf};var Hb=J.BABYLON.Animation=function(a,b,c,d,e,f){null==f&&(f=!1);null==e&&(e=-1);this.Hf=new W;this.wH=.01;this.fj=[];this.aj=0;this.sj=!1;this.Rp=[];this.ug=[];this.name=a;this.pD=b;this.Uh=b.split(".");this.$q=c;this.dataType=d;
this.wv=-1==e?1:e;this.kI=f};q["com.babylonhx.animations.Animation"]=Hb;Hb.i=["com","babylonhx","animations","Animation"];Hb.ab=function(a){for(var b=new Hb(a.name,a.ZK,a.$q,a.dataType,a.GJ),c=a.dataType,d=[],e,f=0,g=a.keys.length;f<g;){var h=f++,h=a.keys[h];switch(c){case 0:e=h.values[0];break;case 1:e=h.values;e=new n(e[0],e[1],e[2]);break;case 2:e=h.values;e=new da(e[0],e[1],e[2],e[3]);break;case 3:e=h.values;for(var k=new r,l=0;16>l;){var m=l++;k.a[m]=e[m]}e=k;break;case 4:e=h.values;e=new L(e[0],
e[1],e[2]);break;default:e=h.values,e=new n(e[0],e[1],e[2])}d.push({frame:h.frame,value:e})}b.HL(d);if(null!=a.Ui)for(c=0,d=a.Ui.length;c<d;)f=c++,e=a.Ui[f],b.createRange(e.name,e.from,e.Tl);return b};Hb.ya=function(a,b){if(null!=a.Xa){b.Xa=[];for(var c=0,d=a.Xa.length;c<d;){var e=c++;b.Xa.push(a.Xa[e].S())}}};Hb.prototype={createRange:function(a,b,c){var d=this.Hf;(null!=t[a]?d.Id(a):d.h.hasOwnProperty(a))||(b=new ke(a,b,c),c=this.Hf,null!=t[a]?c.C(a,b):c.h[a]=b)},reset:function(){this.ug=[];this.Rp=
[];this.aj=0;this.eq=null},HL:function(a){this.ba=a.slice(0);this.ug=[];this.Rp=[]},ay:function(a){return X.us(a)?a():a},ht:function(a,b,c,d,e){if(2==c&&0<b&&null!=e)return null!=e.clone?e.clone():e;e=Math.max(0,Math.min(this.ba.length-1,Math.floor(this.ba.length*(a-this.ba[0].frame)/(this.ba[this.ba.length-1].frame-this.ba[0].frame))-1))|0;if(this.ba[e].frame>=a)for(;0<=e-1&&this.ba[e].frame>=a;)--e;for(var f=e,g=this.ba.length;f<g;)if(e=f++,null!=this.ba[e+1]&&this.ba[e+1].frame>=a){var h=this.ba[e].value,
k=this.ba[e+1].value;e=(a-this.ba[e].frame)/(this.ba[e+1].frame-this.ba[e].frame);null!=this.CF&&(e=this.CF.cO(e));switch(this.dataType){case 0:switch(c){case 0:return c=h,d*b+(c+(k-c)*e);case 1:case 2:return b=h,b+(k-b)*e}break;case 1:switch(c){case 0:return e=n.D(h,k,e),b=d.scale(b),new n(e.x+b.x,e.y+b.y,e.z+b.z);case 1:case 2:return n.D(h,k,e)}break;case 2:a=null;switch(c){case 0:e=da.Ib(h,k,e);b=d.scale(b);a=new da(e.x+b.x,e.y+b.y,e.z+b.z,e.o+b.o);break;case 1:case 2:a=da.Ib(h,k,e)}return a;case 3:switch(c){case 0:return h;
case 1:case 2:b=h;d=k;k=new r;k.a[0]=0;k.a[1]=0;k.a[2]=0;k.a[3]=0;k.a[4]=0;k.a[5]=0;k.a[6]=0;k.a[7]=0;k.a[8]=0;k.a[9]=0;k.a[10]=0;k.a[11]=0;k.a[12]=0;k.a[13]=0;k.a[14]=0;for(c=k.a[15]=0;16>c;)a=c++,k.a[a]=b.a[a]*(1-e)+d.a[a]*e;return k}break;case 4:switch(c){case 0:return c=h,h=k,a=c.v+(h.v-c.v)*e,k=c.m+(h.m-c.m)*e,e=c.r+(h.r-c.r)*e,c=a,b=d.scale(b),new L(e+b.r,c+b.v,k+b.m);case 1:case 2:return b=h,d=k,new L(b.r+(d.r-b.r)*e,b.v+(d.v-b.v)*e,b.m+(d.m-b.m)*e)}break;case 5:switch(c){case 0:return c=h,
a=k,k=c.y+(a.y-c.y)*e,e=c.x+(a.x-c.x)*e,b=d.scale(b),new K(e+b.x,k+b.y);case 1:case 2:return b=h,d=k,new K(b.x+(d.x-b.x)*e,b.y+(d.y-b.y)*e)}break;case 6:switch(c){case 0:return fb.Vc(h,k,e).add(d.scale(b));case 1:case 2:return fb.Vc(h,k,e)}}}return this.ay(this.ba[this.ba.length-1].value)},ku:function(a,b,c,d,e){if(null==this.Uh||1>this.Uh.length)return this.sj=!0,!1;var f=!0;0!=this.ba[0].frame&&this.ba.unshift({frame:0,value:this.ba[0].value});if(b<this.ba[0].frame||b>this.ba[this.ba.length-1].frame)b=
this.ba[0].frame;if(c<this.ba[0].frame||c>this.ba[this.ba.length-1].frame)c=this.ba[this.ba.length-1].frame;b==c&&++b;var g=c-b,h=null;a=a*this.$q*e/1E3;if(a>g&&!d)f=!1,d=this.ay(this.ba[this.ba.length-1].value);else if(d=0,1!=this.wv){h=c+b;if(this.ug.length>h){e=this.ht(b,0,1);d=this.ht(c,0,1);switch(this.dataType){case 0:this.ug[h]=d-e;break;case 1:var k=v.g(d,n);e=v.g(e,n);this.ug[h]=new n(k.x-e.x,k.y-e.y,k.z-e.z);break;case 2:k=v.g(d,da);e=v.g(e,da);this.ug[h]=new da(k.x-e.x,k.y-e.y,k.z-e.z,
k.o-e.o);break;case 4:k=v.g(d,L);e=v.g(e,L);this.ug[h]=new L(k.r-e.r,k.v-e.v,k.m-e.m);break;case 5:k=v.g(d,K);e=v.g(e,K);this.ug[h]=new K(k.x-e.x,k.y-e.y);break;case 6:this.ug[h]=v.g(d,fb).aM(e)}this.Rp[h]=d}d=this.Rp[h];h=this.ug[h]}if(null==h)switch(this.dataType){case 0:h=0;break;case 1:h=new n(0,0,0);break;case 2:h=new da(0,0,0,0);break;case 4:h=new L(0,0,0);break;case 5:h=new K(0,0);break;case 6:h=fb.ve()}b=f?b+a%g:c;g=this.ht(b,a/g|0,this.wv,h,d);if(1<this.Uh.length){c=X.Fa(this.sq,this.Uh[0]);
a=1;for(h=this.Uh.length-1;a<h;)d=a++,c=X.Fa(c,this.Uh[d]);a=this.Uh[this.Uh.length-1]}else a=this.Uh[0],c=this.sq;if(this.kI&&1>=this.aj){null==this.eq&&(this.eq="_matrix"==a?c.$p.clone():X.Fa(c,a));if("_matrix"==a){a=this.eq;h=this.aj;d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;for(e=d.a[15]=0;16>e;)k=e++,d.a[k]=a.a[k]*(1-h)+g.a[k]*h;c.$p=d}else c[a]=this.eq*(1-this.aj)+this.aj*g;this.aj+=this.wH}else c[a]=
g;null!=this.sq.JJ&&this.sq.JJ(this.pD);for(g=0;g<this.fj.length;)b>=this.fj[g].frame?(c=this.fj[g],c.ur||(c.FK&&(this.fj.splice(g,1),--g),c.ur=!0,c.action())):this.fj[g].ur&&!this.fj[g].FK&&(this.fj[g].ur=!1),++g;f||(this.sj=!0);return f},S:function(){var a={};a.name=this.name;a.ZK=this.pD;a.$q=this.$q;a.dataType=this.dataType;a.GJ=this.wv;var b=this.dataType;a.keys=[];for(var c=this.ba,d=0,e=c.length;d<e;){var f=d++,f=c[f],g={};g.frame=f.frame;switch(b){case 0:g.values=[f.value];break;case 1:case 2:case 3:case 4:g.values=
f.value.mH()}a.keys.push(g)}a.Ui=[];for(b=this.Hf.keys();b.Ca();)c=b.next(),d={},d.name=c,e=this.Hf,d.from=(null!=t[c]?e.H(c):e.h[c]).from,e=this.Hf,d.Tl=(null!=t[c]?e.H(c):e.h[c]).Tl,a.Ui.push(d);return a},l:Hb};q["com.babylonhx.animations.AnimationEvent"]=Tf;Tf.i=["com","babylonhx","animations","AnimationEvent"];Tf.prototype={l:Tf};q["com.babylonhx.animations.AnimationRange"]=ke;ke.i=["com","babylonhx","animations","AnimationRange"];ke.prototype={l:ke};var ag=J.BABYLON.IEasingFunction=function(){};
q["com.babylonhx.animations.easing.IEasingFunction"]=ag;ag.i=["com","babylonhx","animations","easing","IEasingFunction"];ag.prototype={l:ag};var Bg=J.BABYLON.Sound=function(){};q["com.babylonhx.audio.Sound"]=Bg;Bg.i=["com","babylonhx","audio","Sound"];var uf=J.BABYLON.SoundTrack=function(a,b){this.WF=!1;this.id=-1;this.f=a;this.Da=b;Yb.lE(this.WF)||(this.f.kD.push(this),this.id=this.f.kD.length-1)};q["com.babylonhx.audio.SoundTrack"]=uf;uf.i=["com","babylonhx","audio","SoundTrack"];uf.prototype={l:uf};
var Ce=J.BABYLON.Bone=function(){this.qy=new r;this.np=new r;this.$G=new r;this.children=[]};q["com.babylonhx.bones.Bone"]=Ce;Ce.i=["com","babylonhx","bones","Bone"];Ce.xb=[Qb];Ce.U=fa;Ce.prototype=F(fa.prototype,{va:function(){return this.$G},vz:function(a){null==a&&(a=this.ZE);if(null!=this.wt)a.qa(this.wt.np,this.np.a,0);else for(var b=this.np,c=0;16>c;){var d=c++;b.a[d]=a.a[d]}var e=this.np;a=this.qy;var b=e.a[0],c=e.a[1],d=e.a[2],f=e.a[3],g=e.a[4],h=e.a[5],k=e.a[6],l=e.a[7],m=e.a[8],w=e.a[9],
C=e.a[10],u=e.a[11],y=e.a[12],n=e.a[13],z=e.a[14],ea=e.a[15],e=C*ea-u*z,M=w*ea-u*n,p=w*z-C*n,x=m*ea-u*y,r=m*z-C*y,q=m*n-w*y,t=h*e-k*M+l*p,$b=-(g*e-k*x+l*r),P=g*M-h*x+l*q,N=-(g*p-h*r+k*q),E=1/(b*t+c*$b+d*P+f*N),O=k*ea-l*z,v=h*ea-l*n,H=h*z-k*n,ea=g*ea-l*y,z=g*z-k*y,y=g*n-h*y,n=k*u-l*C,A=h*u-l*w,B=h*C-k*w,l=g*u-l*m,k=g*C-k*m,g=g*w-h*m;a.a[0]=t*E;a.a[4]=$b*E;a.a[8]=P*E;a.a[12]=N*E;a.a[1]=-(c*e-d*M+f*p)*E;a.a[5]=(b*e-d*x+f*r)*E;a.a[9]=-(b*M-c*x+f*q)*E;a.a[13]=(b*p-c*r+d*q)*E;a.a[2]=(c*O-d*v+f*H)*E;a.a[6]=
-(b*O-d*ea+f*z)*E;a.a[10]=(b*v-c*ea+f*y)*E;a.a[14]=-(b*H-c*z+d*y)*E;a.a[3]=-(c*n-d*A+f*B)*E;a.a[7]=(b*n-d*l+f*k)*E;a.a[11]=-(b*A-c*l+f*g)*E;a.a[15]=(b*B-c*k+d*g)*E;a=0;for(b=this.children.length;a<b;)c=a++,this.children[c].vz()},l:Ce});var yf=J.BABYLON.Skeleton=function(){this.yb=[];var a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=1;this.RF=a;this.Jm=[];this.zm=!0;this.Pi=!1};q["com.babylonhx.bones.Skeleton"]=
yf;yf.i=["com","babylonhx","bones","Skeleton"];yf.xb=[$a];yf.prototype={sG:function(a){this.Jm.push(a)},VG:function(a){a=this.Jm.indexOf(a);-1<a&&this.Jm.splice(a,1)},Kx:function(a,b){for(var c=0,d=this.Ie.length;c<d;){var e=c++,f=this.Ie[e],g=f.wt;if(null!=g)f.$p.qa(g.va(),f.va().a,0);else if(null!=b)f.$p.qa(b,f.va().a,0);else for(var g=f.va(),h=f.$p,k=0;16>k;){var l=k++;g.a[l]=h.a[l]}f.qy.qa(f.va(),a,16*e)}c=this.RF;d=16*this.Ie.length;for(e=0;16>e;)f=e++,a[d+f]=c.a[f]},Hl:function(){if(this.zm){if(this.Pi)for(var a=
0,b=this.Jm.length;a<b;){var c=a++,c=this.Jm[c];if(null==c.ee||c.ee.length!=16*(this.Ie.length+1))c.ee=new ib(16*(this.Ie.length+1));for(var d=c.At,e=0,f=this.Ie.length;e<f;){var g=e++,g=this.Ie[g];null==g.wt&&(g.ZE.qa(d,ba.Ra[0].a,0),g.vz(ba.Ra[0]))}this.Kx(c.ee,d)}else{if(null==this.Fe||this.Fe.length!=16*(this.Ie.length+1))this.Fe=new ib(16*(this.Ie.length+1));this.Kx(this.Fe,null)}this.zm=!1;this.f.ex+=this.Ie.length}},l:yf};var Zb=J.BABYLON.ArcRotateCamera=function(a,b,c,d,e,f){this.oi=new n(0,
0,0);this.Fx=new n(0,0,0);this.pG=new n(0,0,0);this.dj=new ob;this.HH=new n(.5,.5,.5);this.uy=this.VF=this.vh=!1;new n(1,1,0);this.hh=function(){};this.gh=function(){};this.ba=[];this.SK=this.zq=!0;this.Vh=new K(0,0);this.WM=1;this.Oj=[39];this.Nj=[37];this.Mj=[40];this.Pj=[38];this.Hi=this.Ii=0;this.Rv=50;this.TK=2;this.Pw=3;this.ju=this.Kz=1E3;this.zv=this.Gw=null;this.Fw=Math.PI;this.yv=.01;this.xv=this.Ew=null;this.Jd=this.Yd=this.Uf=0;aa.call(this,a,new n(0,0,0),f);this.alpha=b;this.beta=c;this.P=
d;this.target=null!=e?null!=e.position?e.position.clone():e.clone():new n(0,0,0);this.rf()};q["com.babylonhx.cameras.ArcRotateCamera"]=Zb;Zb.i=["com","babylonhx","cameras","ArcRotateCamera"];Zb.U=aa;Zb.prototype=F(aa.prototype,{lm:function(){return null!=this.target.Ci?this.target.Ci():this.target},dh:function(){aa.prototype.dh.call(this);this.K.target=new n(Infinity,Infinity,Infinity);this.K.alpha=null;this.K.beta=null;this.K.P=null;this.K.Vh=null},uj:function(a){null==a&&(a=!1);a||aa.prototype.uj.call(this);
a=this.K.target;var b=this.lm();a.x=b.x;a.y=b.y;a.z=b.z;this.K.alpha=this.alpha;this.K.beta=this.beta;this.K.P=this.P;a=this.Vh;a=new K(a.x,a.y);this.K.Vh=a},jj:function(){if(!aa.prototype.jj.call(this))return!1;var a=this.K.target,b=this.lm();return null!=b&&a.x==b.x&&a.y==b.y&&a.z==b.z&&this.K.alpha==this.alpha&&this.K.beta==this.beta&&this.K.P==this.P?(a=this.K.Vh,b=this.Vh,null!=b&&a.x==b.x?a.y==b.y:!1):!1},attachControl:function(a,b,c,d){null==d&&(d=!0);null==c&&(c=!0);null==b&&(b=!1);var e=
this,f,g=0,h=new zf;if(null==this.vp){this.vp=a;var k=this.f.c;null==this.ff&&(this.ff=function(a){e.uy=2==a.button;var c={bO:"dummy"};h.add(null!=a.pointerId?a.pointerId:c,{x:a.clientX,y:a.clientY,type:a.pointerType});f=h.item(null!=a.pointerId?a.pointerId:c);b||a.preventDefault()},this.gf=function(a){f=null;g=0;h.empty();b||a.preventDefault()},this.Ky=function(a){a.preventDefault()},this.vg=function(a){b||a.preventDefault();switch(h.count){case 1:if(0!=e.Rv&&(e.VF&&c||!c&&e.uy))e.Hi+=-(a.clientX-
f.x)/e.Rv,e.Ii+=(a.clientY-f.y)/e.Rv;else{var d=a.clientY-f.y;e.Jd-=(a.clientX-f.x)/e.ju;e.Yd-=d/e.Kz}f.x=a.clientX;f.y=a.clientY;break;case 2:h.item(a.pointerId).x=a.clientX;h.item(a.pointerId).y=a.clientY;a=e.SK?1:-1;var d=h.dr(0).x-h.dr(1).x,k=h.dr(0).y-h.dr(1).y,d=d*d+k*k;if(0==g){g=d;break}d!=g&&(e.Uf+=(d-g)/(e.TK*e.Pw*e.ju*a),g=d);break;default:null!=h.item(a.pointerId)&&(h.item(a.pointerId).x=a.clientX,h.item(a.pointerId).y=a.clientY)}},this.lj=function(a){if(k.wr){var c=a.aP||a.cP||a.YP||
a.eP||0;e.Jd-=(a.$O||a.bP||a.XP||a.dP||0)/e.ju;e.Yd-=c/e.Kz;b||a.preventDefault()}},this.wq=function(a){var c=0;null!=a.wheelDelta?c=a.wheelDelta/(40*e.Pw):null!=a.detail&&(c=-a.detail/e.Pw);0!=c&&(e.Uf+=c);null!=a.preventDefault&&(b||a.preventDefault())},d&&(this.gh=function(a){-1==e.Pj.indexOf(a)&&-1==e.Mj.indexOf(a)&&-1==e.Nj.indexOf(a)&&-1==e.Oj.indexOf(a)||-1!=e.ba.indexOf(a)||e.ba.push(a)},this.hh=function(a){if(-1!=e.Pj.indexOf(a)||-1!=e.Mj.indexOf(a)||-1!=e.Nj.indexOf(a)||-1!=e.Oj.indexOf(a))a=
e.ba.indexOf(a),0<=a&&e.ba.splice(a,1)}),this.Gk=function(){e.ba=[];h.empty();g=0;f=null},this.Mk=function(){e.ba=[];e.Jd=0;e.Yd=0;e.Uf=0;h.empty();g=0;f=null});a=this.f.c.fc;c||a.addEventListener("contextmenu",this.Ky,!1);a.addEventListener(this.Hd+"down",this.ff,!1);a.addEventListener(this.Hd+"up",this.gf,!1);a.addEventListener(this.Hd+"out",this.gf,!1);a.addEventListener(this.Hd+"move",this.vg,!1);a.addEventListener("mousemove",this.lj,!1);a.addEventListener("mousewheel",this.wq,!1);a.addEventListener("DOMMouseScroll",
this.wq,!1);ga.qs([{name:"keydown",Rc:this.gh},{name:"keyup",Rc:this.hh},{name:"blur",Rc:this.Gk}])}},le:function(a){this.vp==a&&(a=this.f.c.fc,a.removeEventListener("contextmenu",this.Ky,!1),a.removeEventListener(this.Hd+"down",this.ff,!1),a.removeEventListener(this.Hd+"up",this.gf,!1),a.removeEventListener(this.Hd+"out",this.gf,!1),a.removeEventListener(this.Hd+"move",this.vg,!1),a.removeEventListener("mousemove",this.lj,!1),a.removeEventListener("mousewheel",this.wq,!1),a.removeEventListener("DOMMouseScroll",
this.wq,!1),ga.Oo([{name:"keydown",Rc:this.gh},{name:"keyup",Rc:this.hh},{name:"blur",Rc:this.Gk}]),this.vp=null,null!=this.Mk&&this.Mk())},fe:function(){if(!this.Ex){for(var a=0,b=this.ba.length;a<b;){var c=a++,c=this.ba[c];-1!=this.Nj.indexOf(c)?this.Jd-=.01:-1!=this.Pj.indexOf(c)?this.Yd-=.01:-1!=this.Oj.indexOf(c)?this.Jd+=.01:-1!=this.Mj.indexOf(c)&&(this.Yd+=.01)}if(0!=this.Jd||0!=this.Yd||0!=this.Uf)this.alpha+=0>=this.beta?-this.Jd:this.Jd,this.beta+=this.Yd,this.P-=this.Uf,this.Jd*=this.vf,
this.Yd*=this.vf,this.Uf*=this.vf,.001>Math.abs(this.Jd)&&(this.Jd=0),.001>Math.abs(this.Yd)&&(this.Yd=0),.001>Math.abs(this.Uf)&&(this.Uf=0);if(0!=this.Hi||0!=this.Ii){null==this.sg&&(this.sg=new n(0,0,0),this.Td=new n(0,0,0));this.Hi*=this.vf;this.Ii*=this.vf;.001>Math.abs(this.Hi)&&(this.Hi=0);.001>Math.abs(this.Ii)&&(this.Ii=0);a=this.sg;a.x=this.Hi;a.y=this.Ii;a.z=0;var d=this.Aa,a=this.Ap,b=d.a[0],c=d.a[1],e=d.a[2],f=d.a[3],g=d.a[4],h=d.a[5],k=d.a[6],l=d.a[7],m=d.a[8],w=d.a[9],C=d.a[10],u=d.a[11],
y=d.a[12],V=d.a[13],z=d.a[14],p=d.a[15],d=C*p-u*z,M=w*p-u*V,r=w*z-C*V,x=m*p-u*y,q=m*z-C*y,t=m*V-w*y,D=h*d-k*M+l*r,$b=-(g*d-k*x+l*q),P=g*M-h*x+l*t,N=-(g*r-h*q+k*t),E=1/(b*D+c*$b+e*P+f*N),O=k*p-l*z,v=h*p-l*V,H=h*z-k*V,p=g*p-l*y,z=g*z-k*y,y=g*V-h*y,V=k*u-l*C,A=h*u-l*w,B=h*C-k*w,l=g*u-l*m,k=g*C-k*m,g=g*w-h*m;a.a[0]=D*E;a.a[4]=$b*E;a.a[8]=P*E;a.a[12]=N*E;a.a[1]=-(c*d-e*M+f*r)*E;a.a[5]=(b*d-e*x+f*q)*E;a.a[9]=-(b*M-c*x+f*t)*E;a.a[13]=(b*r-c*q+e*t)*E;a.a[2]=(c*O-e*v+f*H)*E;a.a[6]=-(b*O-e*p+f*z)*E;a.a[10]=
(b*v-c*p+f*y)*E;a.a[14]=-(b*H-c*z+e*y)*E;a.a[3]=-(c*V-e*A+f*B)*E;a.a[7]=(b*V-e*l+f*k)*E;a.a[11]=-(b*A-c*l+f*g)*E;a.a[15]=(b*B-c*k+e*g)*E;a=this.sg;b=this.Ap;c=this.Td;c.x=a.x*b.a[0]+a.y*b.a[4]+a.z*b.a[8];c.y=a.x*b.a[1]+a.y*b.a[5]+a.z*b.a[9];c.z=a.x*b.a[2]+a.y*b.a[6]+a.z*b.a[10];null!=this.target.Ci()&&this.target.Gz(this.Td)}this.Dx();aa.prototype.fe.call(this)}},Dx:function(){null==this.yv?this.zq&&this.beta>Math.PI&&(this.beta-=2*Math.PI):this.beta<this.yv&&(this.beta=this.yv);null==this.Fw?this.zq&&
this.beta<-Math.PI&&(this.beta+=2*Math.PI):this.beta>this.Fw&&(this.beta=this.Fw);null!=this.xv&&this.alpha<this.xv&&(this.alpha=this.xv);null!=this.Ew&&this.alpha>this.Ew&&(this.alpha=this.Ew);null!=this.zv&&this.P<this.zv&&(this.P=this.zv);null!=this.Gw&&this.P>this.Gw&&(this.P=this.Gw)},AC:function(){var a,b,c;a=this.position;var d=this.lm();c=a.x-d.x;b=a.y-d.y;a=a.z-d.z;this.P=Math.sqrt(c*c+b*b+a*a);this.alpha=Math.acos(c/Math.sqrt(Math.pow(c,2)+Math.pow(a,2)));0>a&&(this.alpha=2*Math.PI-this.alpha);
this.beta=Math.acos(b/this.P);this.Dx()},setPosition:function(a){var b=this.position;if(null==a||b.x!=a.x||b.y!=a.y||b.z!=a.z)this.position=a,this.AC()},Ol:function(a){this.target.hO(a)||(this.target=a,this.AC())},ct:function(){var a=Math.cos(this.alpha),b=Math.sin(this.alpha),c=Math.cos(this.beta),d=Math.sin(this.beta);0==d&&(d=1E-4);var e=this.lm(),a=this.P*a*d,c=this.P*c,b=this.P*b*d,d=this.oi;d.x=e.x+a;d.y=e.y+c;d.z=e.z+b;this.f.wu&&this.vh?(this.dj.P=this.HH,a=this.oi,b=this.position,d=this.Fx,
d.x=a.x-b.x,d.y=a.y-b.y,d.z=a.z-b.z,this.Ex=!0,this.f.Dn.HA(this.position,this.Fx,this.dj,3,null,B(this,this.st),this.ig)):(a=this.position,b=this.oi,a.x=b.x,a.y=b.y,a.z=b.z,a=this.Bf,this.zq&&0>this.beta&&(a=new n(a.x,a.y,a.z),a=new n(-a.x,-a.y,-a.z)),this.f.Kw?r.jB(this.position,e,a,this.Aa):r.$c(this.position,e,a,this.Aa),this.Aa.a[12]+=this.Vh.x,this.Aa.a[13]+=this.Vh.y);this.ye=e;return this.Aa},st:function(a,b,c){this.f.nr()&&this.vh&&(a=this.dj.P,b.x*=a.x,b.y*=a.y,b.z*=a.z);null!=c?(b=this.pG,
c=this.position,b.x=c.x,b.y=c.y,b.z=c.z):(this.setPosition(b),null!=this.Mv&&this.Mv(c));c=Math.cos(this.alpha);a=Math.sin(this.alpha);var d=Math.cos(this.beta),e=Math.sin(this.beta);b=this.lm();c=this.P*c*e;d*=this.P;a=this.P*a*e;e=this.oi;e.x=b.x+c;e.y=b.y+d;e.z=b.z+a;c=this.position;a=this.oi;c.x=a.x;c.y=a.y;c.z=a.z;c=this.Bf;this.zq&&0>this.beta&&(c=new n(c.x,c.y,c.z),c=new n(-c.x,-c.y,-c.z));r.$c(this.position,b,c,this.Aa);this.Aa.a[12]+=this.Vh.x;this.Aa.a[13]+=this.Vh.y;this.Ex=!1},bQ:function(a,
b){null==b&&(b=!1);null==a&&(a=this.f.Yb);var c=S.g(a),d=c.Gb,e=c.Mb,f=d.x-e.x,g=d.y-e.y,d=d.z-e.z,f=Math.sqrt(f*f+g*g+d*d);this.P=f*this.WM;this.wI({min:c.Gb,max:c.Mb,Sb:f},b)},wI:function(a,b){null==b&&(b=!1);var c,d;if(null==a.Gb){c=null!=a?a:this.f.Yb;c=S.g(c);var e=c.Gb,f=c.Mb;d=e.x-f.x;var g=e.y-f.y,e=e.z-f.z;d=Math.sqrt(d*d+g*g+e*e)}else c=a,d=a.Sb;this.target.position=S.$b(c);b||(this.Fb=2*d)},wh:function(a,b){var c=0;switch(this.Rb){case 12:c=this.Ja.Sg*(0==b?-1:1);break;case 10:case 11:case 13:case 20:c=
this.Ja.Sg*(0==b?1:-1)}c=new Zb(a,this.alpha+c,this.beta,this.P,this.target,this.f);c.Ja={};return c},vj:function(){var a=this.ma[0],b=this.ma[1];a.beta=b.beta=this.beta;a.P=b.P=this.P;switch(this.Rb){case 12:a.alpha=this.alpha+this.Ja.Sg;b.alpha=this.alpha-this.Ja.Sg;break;case 10:case 11:case 13:case 20:a.alpha=this.alpha-this.Ja.Sg,b.alpha=this.alpha+this.Ja.Sg}aa.prototype.vj.call(this)},S:function(){var a=aa.prototype.S.call(this);v.D(this.target,n)&&(a.target=this.target.mH());null!=this.target&&
null!=this.target.id&&(a.vv=this.target.id);a.vh=this.vh;a.alpha=this.alpha;a.beta=this.beta;a.P=this.P;return a},l:Zb});var Qc=J.BABYLON.AnaglyphArcRotateCamera=function(a,b,c,d,e,f,g){Zb.call(this,a,b,c,d,e,g);this.gj=f*Math.PI/180;this.ki=new Zb(a+"_left",b-this.gj,c,d,e,g);this.qj=new Zb(a+"_right",b+this.gj,c,d,e,g);Qc.Ta(this,a)};q["com.babylonhx.cameras.AnaglyphArcRotateCamera"]=Qc;Qc.i=["com","babylonhx","cameras","AnaglyphArcRotateCamera"];Qc.Ta=function(a,b){a.ki.pv=!0;a.oD.push(a.ki);a.oD.push(a.qj);
a.cG=new kc(b+"_leftTexture",1,a.ki);a.WE=new zd(b+"_anaglyph",1,a.qj);a.WE.hP=function(b){var d=a.cG,e=b.c;b=b.Rd.indexOf("leftSampler");0<d.ob.length&&(d=d.ob.data[d.$g].data,0<=b&&(b=33984+b,e.I!=b-33984&&(e.b.activeTexture(b),e.I=b-33984),e.O[e.I]!=d&&(e.b.bindTexture(3553,d),e.O[e.I]=d)))};a.ed()};Qc.U=Zb;Qc.prototype=F(Zb.prototype,{ed:function(){this.pn(this.ki);this.pn(this.qj);this.ki.alpha=this.alpha-this.gj;this.qj.alpha=this.alpha+this.gj;Zb.prototype.ed.call(this)},pn:function(a){a.beta=
this.beta;a.P=this.P;a.Tb=this.Tb;a.Fb=this.Fb;a.Sa=this.Sa;a.target=this.target},l:Qc});var qa=J.BABYLON.FreeCamera=function(a,b,c){this.oi=new n(0,0,0);this.Ts=new n(0,0,0);this.rt=new n(0,0,0);this.iG=!0;this.dj=new ob;this.ba=[];this.wn=2E3;this.vh=this.lu=!1;this.Oj=[39,68];this.Nj=[37,65];this.Mj=[40,83];this.Pj=[38,87];this.Ai=new n(.5,1,.5);aa.call(this,a,b,c)};q["com.babylonhx.cameras.FreeCamera"]=qa;qa.i=["com","babylonhx","cameras","FreeCamera"];qa.U=aa;qa.prototype=F(aa.prototype,{attachControl:function(a,
b,c,d){null==d&&(d=!0);null==c&&(c=!0);null==b&&(b=!1);var e=this,f=null,g=this.f.c;this.vp=a;null==this.tt&&(this.tt=function(a,b){f={x:a,y:b}},this.ut=function(){f=null},this.lj=function(a,b){if(null!=f||g.wr){var c=0,d=0;g.wr||(c=a-f.x,d=b-f.y);e.Vb.y+=c/e.wn;e.Vb.x+=d/e.wn;f={x:a,y:b}}},d&&(this.gh=function(a){a=a.keyCode;-1==e.Pj.indexOf(a)&&-1==e.Mj.indexOf(a)&&-1==e.Nj.indexOf(a)&&-1==e.Oj.indexOf(a)||-1!=e.ba.indexOf(a)||e.ba.push(a)},this.hh=function(a){a=a.keyCode;if(-1!=e.Pj.indexOf(a)||
-1!=e.Mj.indexOf(a)||-1!=e.Nj.indexOf(a)||-1!=e.Oj.indexOf(a))a=e.ba.indexOf(a),0<=a&&e.ba.splice(a,1)}),this.Gk=function(){e.ba=[]},this.Mk=function(){e.ba=[];f=null;e.Gc=new n(0,0,0);e.Vb=new K(0,0)});this.f.c.fc.addEventListener(this.Hd+"down",function(a){e.tt(a.clientX,a.clientY)},!1);this.f.c.fc.addEventListener(this.Hd+"up",function(){e.ut()},!1);this.f.c.fc.addEventListener(this.Hd+"move",function(a){e.lj(a.clientX,a.clientY)},!1);this.f.c.fc.addEventListener("mousemove",function(a){e.lj(a.clientX,
a.clientY)},!1);ga.qs([{name:"keydown",Rc:this.gh},{name:"keyup",Rc:this.hh},{name:"blur",Rc:this.Gk}])},le:function(){this.f.c.fc.removeEventListener(this.Hd+"down",this.tt,!1);this.f.c.fc.removeEventListener(this.Hd+"up",this.ut,!1);this.f.c.fc.removeEventListener(this.Hd+"out",this.ut,!1);this.f.c.fc.removeEventListener(this.Hd+"move",this.lj,!1);this.f.c.fc.removeEventListener("mousemove",this.lj,!1);ga.Oo([{name:"keydown",Rc:this.gh},{name:"keyup",Rc:this.hh},{name:"blur",Rc:this.Gk}]);null!=
this.Mk&&this.Mk()},Dp:function(a){var b;if(null!=this.ca){var c=this.position,d=this.ca.va();b=new n(0,0,0);var e=c.x,f=c.y,c=c.z,d=d.a,g=e*d[1]+f*d[5]+c*d[9]+d[13],h=e*d[2]+f*d[6]+c*d[10]+d[14],k=e*d[3]+f*d[7]+c*d[11]+d[15];b.x=(e*d[0]+f*d[4]+c*d[8]+d[12])/k;b.y=g/k;b.z=h/k}else b=this.position;e=this.rt;e.x=b.x;e.y=b.y-this.Ai.y;e.z=b.z;this.dj.P=this.Ai;b=a;this.lu&&(b=this.f.Vn,b=new n(a.x+b.x,a.y+b.y,a.z+b.z));this.f.Dn.HA(this.rt,b,this.dj,3,null,B(this,this.st),this.ig)},st:function(a,b,c){this.f.nr()&&
(a=this.dj.P,b.x*=a.x,b.y*=a.y,b.z*=a.z);a=this.oi;a.x=b.x;a.y=b.y;a.z=b.z;b=this.oi;a=this.rt;var d=this.Ts;d.x=b.x-a.x;d.y=b.y-a.y;d.z=b.z-a.z;b=this.Ts;Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z)>p.lb&&(b=this.position,a=this.Ts,b.x+=a.x,b.y+=a.y,b.z+=a.z,null!=this.Mv&&null!=c&&this.Mv(c))},fe:function(){null==this.sg&&(this.sg=new n(0,0,0),this.Td=new n(0,0,0));for(var a=0,b=this.ba.length;a<b;){var c=a++,d=this.ba[c],c=this.f.c,c=this.speed*Math.sqrt(c.el/(100*c.Yq));-1!=this.Nj.indexOf(d)?(d=this.sg,
d.x=-c,d.y=0,d.z=0):-1!=this.Pj.indexOf(d)?(d=this.sg,d.x=0,d.y=0,d.z=c):-1!=this.Oj.indexOf(d)?(d=this.sg,d.x=c,d.y=0,d.z=0):-1!=this.Mj.indexOf(d)&&(d=this.sg,d.x=0,d.y=0,d.z=-c);var e=this.rf(),c=this.Ap,d=e.a[0],f=e.a[1],g=e.a[2],h=e.a[3],k=e.a[4],l=e.a[5],m=e.a[6],w=e.a[7],C=e.a[8],u=e.a[9],y=e.a[10],V=e.a[11],z=e.a[12],p=e.a[13],M=e.a[14],r=e.a[15],e=y*r-V*M,x=u*r-V*p,q=u*M-y*p,t=C*r-V*z,D=C*M-y*z,$b=C*p-u*z,P=l*e-m*x+w*q,N=-(k*e-m*t+w*D),E=k*x-l*t+w*$b,O=-(k*q-l*D+m*$b),v=1/(d*P+f*N+g*E+h*
O),H=m*r-w*M,A=l*r-w*p,B=l*M-m*p,r=k*r-w*z,M=k*M-m*z,z=k*p-l*z,p=m*V-w*y,I=l*V-w*u,F=l*y-m*u,w=k*V-w*C,m=k*y-m*C,k=k*u-l*C;c.a[0]=P*v;c.a[4]=N*v;c.a[8]=E*v;c.a[12]=O*v;c.a[1]=-(f*e-g*x+h*q)*v;c.a[5]=(d*e-g*t+h*D)*v;c.a[9]=-(d*x-f*t+h*$b)*v;c.a[13]=(d*q-f*D+g*$b)*v;c.a[2]=(f*H-g*A+h*B)*v;c.a[6]=-(d*H-g*r+h*M)*v;c.a[10]=(d*A-f*r+h*z)*v;c.a[14]=-(d*B-f*M+g*z)*v;c.a[3]=-(f*p-g*I+h*F)*v;c.a[7]=(d*p-g*w+h*m)*v;c.a[11]=-(d*I-f*w+h*k)*v;c.a[15]=(d*F-f*m+g*k)*v;c=this.sg;d=this.Ap;f=this.Td;f.x=c.x*d.a[0]+
c.y*d.a[4]+c.z*d.a[8];f.y=c.x*d.a[1]+c.y*d.a[5]+c.z*d.a[9];f.z=c.x*d.a[2]+c.y*d.a[6]+c.z*d.a[10];c=this.Gc;d=this.Td;c.x+=d.x;c.y+=d.y;c.z+=d.z}aa.prototype.fe.call(this)},Ns:function(){return this.iG||0<Math.abs(this.Gc.x)||0<Math.abs(this.Gc.y)?!0:0<Math.abs(this.Gc.z)},xz:function(){if(this.vh&&this.f.wu)this.Dp(this.Gc);else{var a=this.position,b=this.Gc;a.x+=b.x;a.y+=b.y;a.z+=b.z}},l:qa});var te=J.BABYLON.AnaglyphFreeCamera=function(a,b,c,d){qa.call(this,a,b,d);this.gj=c*Math.PI/180;this.sb=
new r;this.ki=new qa(a+"_left",new n(b.x,b.y,b.z),d);this.qj=new qa(a+"_right",new n(b.x,b.y,b.z),d);Qc.Ta(this,a)};q["com.babylonhx.cameras.AnaglyphFreeCamera"]=te;te.i=["com","babylonhx","cameras","AnaglyphFreeCamera"];te.U=qa;te.prototype=F(qa.prototype,{cy:function(a,b){var c=this.ye,d=-c.x,e=-c.y,f=-c.z,g=new r;g.a[0]=1;g.a[1]=0;g.a[2]=0;g.a[3]=0;g.a[4]=0;g.a[5]=1;g.a[6]=0;g.a[7]=0;g.a[8]=0;g.a[9]=0;g.a[10]=1;g.a[11]=0;g.a[12]=0;g.a[13]=0;g.a[14]=0;g.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,d,e,f,g);d=
new r;e=Math.sin(a);f=Math.cos(a);d.a[5]=1;d.a[15]=1;d.a[0]=f;d.a[2]=-e;d.a[8]=e;d.a[10]=f;d.a[1]=0;d.a[3]=0;d.a[4]=0;d.a[6]=0;d.a[7]=0;d.a[9]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;g.qa(d,this.sb.a,0);g=this.sb;d=c.x;e=c.y;f=c.z;c=new r;c.a[0]=1;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=0;c.a[5]=1;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=1;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,d,e,f,c);d=new r;g.qa(c,d.a,0);this.sb=d;var d=this.position,c=d.x,g=d.y,d=d.z,e=this.sb.a,
f=c*e[1]+g*e[5]+d*e[9]+e[13],h=c*e[2]+g*e[6]+d*e[10]+e[14],k=c*e[3]+g*e[7]+d*e[11]+e[15];b.x=(c*e[0]+g*e[4]+d*e[8]+e[12])/k;b.y=f/k;b.z=h/k},ed:function(){this.cy(-this.gj,this.ki.position);this.cy(this.gj,this.qj.position);this.pn(this.ki);this.pn(this.qj);qa.prototype.ed.call(this)},pn:function(a){a.Tb=this.Tb;a.Fb=this.Fb;a.Sa=this.Sa;a.viewport=this.viewport;a.Ol(this.ye)},l:te});var xd=J.BABYLON.FollowCamera=function(a,b,c){this.yf=50;this.su=.05;this.iv=30;this.dw=0;this.P=12;aa.call(this,a,
b,c)};q["com.babylonhx.cameras.FollowCamera"]=xd;xd.i=["com","babylonhx","cameras","FollowCamera"];xd.U=aa;xd.prototype=F(aa.prototype,{kO:function(a){var b=this.dw*Math.PI/180+a.Kb.y,c=(a.position.x+Math.sin(b)*this.P-this.position.x)*this.su*2,d=(a.position.y+this.iv-this.position.y)*this.su,b=(a.position.z+Math.cos(b)*this.P-this.position.z)*this.su*2;if(c>this.yf||c<-this.yf)1>c?c=-this.yf:c=this.yf;if(d>this.yf||d<-this.yf)1>d?d=-this.yf:d=this.yf;if(b>this.yf||b<-this.yf)1>b?b=-this.yf:b=this.yf;
this.position.x+=c;this.position.y+=d;this.position.z+=b;this.Ol(a.position)},l:xd});var ue=J.BABYLON.TouchCamera=function(a,b,c){this.YJ=500;this.Kk=[];this.Nm=this.Om=-Infinity;qa.call(this,a,b,c);this.wn=2E5};q["com.babylonhx.cameras.TouchCamera"]=ue;ue.i=["com","babylonhx","cameras","TouchCamera"];ue.U=qa;ue.prototype=F(qa.prototype,{attachControl:function(a,b,c,d){null==d&&(d=!0);null==c&&(c=!0);null==b&&(b=!1);var e=this,f=null;null==this.ff&&(this.ff=function(a,b,c){e.Kk.push(c);1==e.Kk.length&&
(f={x:a,y:b})},this.gf=function(a,b,c){a=e.Kk.indexOf(c);-1!=a&&(e.Kk.splice(a,1),0==a&&(f=null,e.Nm=-Infinity,e.Om=-Infinity))},this.vg=function(a,b,c,d,m){null!=f&&0==e.Kk.indexOf(m)&&(e.Nm=a-f.x,e.Om=-(b-f.y))},this.Gk=function(){e.Nm=-Infinity;e.Om=-Infinity});this.f.c.fk.push(this.ff);this.f.c.hk.push(this.gf);this.f.c.gk.push(this.vg)},le:function(){Q.remove(this.f.c.fk,this.ff);Q.remove(this.f.c.hk,this.gf);Q.remove(this.f.c.gk,this.vg)},fe:function(){if(-Infinity!=this.Nm)if(this.Vb.y+=this.Nm/
this.wn,1<this.Kk.length)this.Vb.x+=-this.Om/this.wn;else{var a=this.f.c,a=this.speed*Math.sqrt(a.el/(100*a.Yq))*this.Om/this.YJ,b=r.Ta,c=.5*this.rotation.x,d=.5*this.rotation.y,e=Math.sin(0),f=Math.cos(0),g=Math.sin(c),c=Math.cos(c),h=Math.sin(d),d=Math.cos(d);b.x=d*g*f+h*c*e;b.y=h*c*f-d*g*e;b.z=d*c*e-h*g*f;b.o=d*c*f+h*g*e;r.Ta.Af(this.gi);b=this.Gc;f=this.gi;e=new n(0,0,0);f=f.a;g=0*f[1]+0*f[5]+a*f[9]+f[13];d=0*f[2]+0*f[6]+a*f[10]+f[14];c=0*f[3]+0*f[7]+a*f[11]+f[15];e.x=(0*f[0]+0*f[4]+a*f[8]+f[12])/
c;e.y=g/c;e.z=d/c;b.x+=e.x;b.y+=e.y;b.z+=e.z}qa.prototype.fe.call(this)},l:ue});var ad=J.BABYLON.VRCameraMetrics=function(){this.xu=!0};q["com.babylonhx.cameras.VRCameraMetrics"]=ad;ad.i=["com","babylonhx","cameras","VRCameraMetrics"];ad.os=function(){var a=new ad;a.UI=1280;a.HM=800;a.or=.149759993;a.IM=.0935999975;a.UP=.0467999987;a.sI=.0410000011;a.AB=.063500002;a.nB=.064000003;a.fI=[1,.219999999,.239999995,0];a.WN=[.995999992,-.00400000019,1.01400006,0];a.Sv=1.714605507808412;a.wJ=.151976421;return a};
ad.prototype={xj:function(){return this.UI/(2*this.HM)},nH:function(){return 2*Math.atan(this.Sv*this.IM/(2*this.sI))},TA:function(){var a=4*(this.or/4-this.AB/2)/this.or,b=new r;b.a[0]=1;b.a[1]=0;b.a[2]=0;b.a[3]=0;b.a[4]=0;b.a[5]=1;b.a[6]=0;b.a[7]=0;b.a[8]=0;b.a[9]=0;b.a[10]=1;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0;b.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,a,0,0,b);return b},aB:function(){var a=4*(this.or/4-this.AB/2)/this.or,b=new r;b.a[0]=1;b.a[1]=0;b.a[2]=0;b.a[3]=0;b.a[4]=0;b.a[5]=1;b.a[6]=0;b.a[7]=
0;b.a[8]=0;b.a[9]=0;b.a[10]=1;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0;b.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,-a,0,0,b);return b},UA:function(){var a=.5*this.nB,b=new r;b.a[0]=1;b.a[1]=0;b.a[2]=0;b.a[3]=0;b.a[4]=0;b.a[5]=1;b.a[6]=0;b.a[7]=0;b.a[8]=0;b.a[9]=0;b.a[10]=1;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0;b.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,a,0,0,b);return b},bB:function(){var a=-.5*this.nB,b=new r;b.a[0]=1;b.a[1]=0;b.a[2]=0;b.a[3]=0;b.a[4]=0;b.a[5]=1;b.a[6]=0;b.a[7]=0;b.a[8]=0;b.a[9]=0;b.a[10]=1;b.a[11]=
0;b.a[12]=0;b.a[13]=0;b.a[14]=0;b.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,a,0,0,b);return b},l:ad,ha:{bB:"get_rightPreViewMatrix",UA:"get_leftPreViewMatrix",aB:"get_rightHMatrix",TA:"get_leftHMatrix"}};var we=J.BABYLON.VRDeviceOrientationFreeCamera=function(a,b,c,d){null==d&&(d=!0);this.hx=this.nx=this.wk=0;qa.call(this,a,b,c);a=ad.os();a.xu=d;this.Nl(20,{Nw:a})};q["com.babylonhx.cameras.VRDeviceOrientationFreeCamera"]=we;we.i=["com","babylonhx","cameras","VRDeviceOrientationFreeCamera"];we.U=qa;we.prototype=
F(qa.prototype,{Ly:function(a){this.hx=+a.alpha|0;this.nx=+a.beta|0;this.wk=+a.gamma|0;this.wk=0>this.wk?90+this.wk:270-this.wk;this.rotation.x=this.wk/180*Math.PI;this.rotation.y=-this.hx/180*Math.PI;this.rotation.z=this.nx/180*Math.PI},attachControl:function(a,b){null==b&&(b=!1);qa.prototype.attachControl.call(this,a,b);window.addEventListener("deviceorientation",B(this,this.Ly))},le:function(a){qa.prototype.le.call(this,a);window.removeEventListener("deviceorientation",B(this,this.Ly))},l:we});
var ve=J.BABYLON.WebVRFreeCamera=function(a,b,c,d){null==d&&(d=!0);this.bu=!1;this.xp=new n(0,0,0);this.px=new da;this.zk=this.bn=this.dm=null;qa.call(this,a,b,c);a=ad.os();a.xu=d;this.Nl(20,{Nw:a})};q["com.babylonhx.cameras.WebVRFreeCamera"]=ve;ve.i=["com","babylonhx","cameras","WebVRFreeCamera"];ve.U=qa;ve.prototype=F(qa.prototype,{fy:function(a){var b=a.length,c=0;for(this.zk=this.bn=null;c<b&&null==this.zk;){var d=a[c];"HMDVRDevice"==Eb.VD(null==d?null:v.Bh(d))&&(this.zk=a[c]);++c}for(c=0;c<b&&
null==this.bn;)d=a[c],"PositionSensorVRDevice"==Eb.VD(null==d?null:v.Bh(d))&&(null!=this.zk?a[c].VI==this.zk.VI:1)&&(this.bn=a[c]),++c;this.bu=null!=this.bn&&null!=this.zk},fe:function(){if(this.bu){this.dm=this.bn.tO();var a=this.px;a.x=this.dm.orientation.x;a.y=this.dm.orientation.y;a.z=this.dm.orientation.z;a.o=this.dm.orientation.o;this.px.hM(this.xp);this.rotation.x=-this.xp.x;this.rotation.y=-this.xp.y;this.rotation.z=this.xp.z}qa.prototype.fe.call(this)},attachControl:function(a,b){null==b&&
(b=!1);qa.prototype.attachControl.call(this,a,b);var c=window.navigator;null!=c.g?c.g().then(B(this,this.fy)):null!=c.aa&&c.aa(B(this,this.fy))},le:function(a){qa.prototype.le.call(this,a);this.bu=!1},l:ve});var ob=J.BABYLON.Collider=function(){this.Us=new n(0,0,0);this.Pk=new n(0,0,0);this.Fp=new n(0,0,0);this.Ye=new n(0,0,0);this.Wc=new n(0,0,0);this.Uk=new n(0,0,0);this.Yt=new n(0,0,0);this.Xt=new n(0,0,0);this.je=new n(0,0,0);this.fq=new n(0,0,0);this.og=new n(0,0,0);this.SB=new n(0,0,0);this.PD=
new n(0,0,0);this.Eq=new n(0,0,0);this.bw=0;this.P=new n(1,1,1)};q["com.babylonhx.collisions.Collider"]=ob;ob.i=["com","babylonhx","collisions","Collider"];ob.TM=function(a,b,c,d){return a.x>c.x+d||c.x-d>b.x||a.y>c.y+d||c.y-d>b.y||a.z>c.z+d||c.z-d>b.z?!1:!0};ob.Cf=function(a,b,c,d){var e=b*b-4*a*c;c={root:0,Bi:!1};if(0>e)return c;var f=Math.sqrt(e),e=(-b-f)/(2*a);a=(-b+f)/(2*a);e>a&&(b=a,a=e,e=b);if(0<e&&e<d)return c.root=e,c.Bi=!0,c;0<a&&a<d&&(c.root=a,c.Bi=!0);return c};ob.prototype={ft:function(a,
b,c){this.Ue=b;var d=this.SB;d.x=b.x;d.y=b.y;d.z=b.z;d.normalize();this.th=a;var d=this.P,e=this.Eq;e.x=a.x*d.x;e.y=a.y*d.y;e.z=a.z*d.z;a=this.P;d=this.PD;d.x=b.x*a.x;d.y=b.y*a.y;d.z=b.z*a.z;b=this.PD;this.Mw=Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z);this.pI=c;this.Mq=!1},mF:function(a,b,c,d,e){var f=this.je;f.x=b.x-a.x;f.y=b.y-a.y;f.z=b.z-a.z;b=this.Xt;b.x=c.x-a.x;b.y=c.y-a.y;b.z=c.z-a.z;c=this.je;b=this.Xt;f=this.Uk;f.x=c.y*b.z-c.z*b.y;f.y=c.z*b.x-c.x*b.z;f.z=c.x*b.y-c.y*b.x;c=this.Uk;c=c.x*e.x+c.y*e.y+
c.z*e.z;if(0>c)return!1;c=this.Yt;c.x=d.x-a.x;c.y=d.y-a.y;c.z=d.z-a.z;a=this.Xt;d=this.Yt;c=this.Uk;c.x=a.y*d.z-a.z*d.y;c.y=a.z*d.x-a.x*d.z;c.z=a.x*d.y-a.y*d.x;a=this.Uk;c=a.x*e.x+a.y*e.y+a.z*e.z;if(0>c)return!1;a=this.Yt;d=this.je;c=this.Uk;c.x=a.y*d.z-a.z*d.y;c.y=a.z*d.x-a.x*d.z;c.z=a.x*d.y-a.y*d.x;a=this.Uk;c=a.x*e.x+a.y*e.y+a.z*e.z;return 0<=c},zx:function(a,b,c,d){var e=this.Eq,f=e.x-a.x,g=e.y-a.y;a=e.z-a.z;e=Math.max(Math.max(this.P.x,this.P.y),this.P.z);return Math.sqrt(f*f+g*g+a*a)>this.Mw+
e+b||!ob.TM(c,d,this.Eq,this.Mw+e)?!1:!0},PG:function(a,b,c,d,e){var f=0,g=!1;null==b.tj&&(b.tj=[]);if(null==b.tj[a]){b.tj[a]=new Sc(0,0,0,0);var h=b.tj[a],k=d.x-c.x,l=d.y-c.y,m=d.z-c.z,w=e.x-c.x,C=e.y-c.y,u=e.z-c.z,y=l*u-m*C,V=m*w-k*u,z=k*C-l*w,p=Math.sqrt(y*y+V*V+z*z),M;M=0!=p?1/p:0;h.j.x=y*M;h.j.y=V*M;h.j.z=z*M;h.d=-(h.j.x*c.x+h.j.y*c.y+h.j.z*c.z)}var r=b.tj[a],x;if(null==b.Of()){var q=this.SB,t=r.j;x=!(0>=t.x*q.x+t.y*q.y+t.z*q.z)}else x=!1;if(!x){var D=this.th,$b=r.j,P=D.x*$b.x+D.y*$b.y+D.z*$b.z+
r.d,v=r.j,E=this.Ue,O=v.x*E.x+v.y*E.y+v.z*E.z;if(0==O){if(1<=Math.abs(P))return;g=!0;f=0}else{var f=(-1-P)/O,A=(1-P)/O;if(f>A)var H=A,A=f,f=H;if(1<f||0>A)return;0>f&&(f=0);1<f&&(f=1)}var B=this.og;B.x=0;B.y=0;B.z=0;var I=!1,F=1;if(!g){var L=this.th,S=r.j,K=this.fq;K.x=L.x-S.x;K.y=L.y-S.y;K.z=L.z-S.z;var T=this.Ue,Q=this.je;Q.x=T.x*f;Q.y=T.y*f;Q.z=T.z*f;var da=this.fq,W=this.je;da.x+=W.x;da.y+=W.y;da.z+=W.z;if(this.mF(this.fq,c,d,e,r.j)){var I=!0,F=f,Dd=this.og,Vd=this.fq;Dd.x=Vd.x;Dd.y=Vd.y;Dd.z=
Vd.z}}if(!I){var Fb=this.Ue,R=Fb.x*Fb.x+Fb.y*Fb.y+Fb.z*Fb.z,ba=R,Da=this.th,Va=this.je;Va.x=Da.x-c.x;Va.y=Da.y-c.y;Va.z=Da.z-c.z;var ca=this.Ue,U=this.je,X=2*(ca.x*U.x+ca.y*U.y+ca.z*U.z),la=this.je,Z=la.x*la.x+la.y*la.y+la.z*la.z-1,oc=ob.Cf(ba,X,Z,F);if(oc.Bi){var F=oc.root,I=!0,ja=this.og;ja.x=c.x;ja.y=c.y;ja.z=c.z}var ga=this.th,ha=this.je;ha.x=ga.x-d.x;ha.y=ga.y-d.y;ha.z=ga.z-d.z;var ma=this.Ue,Y=this.je,X=2*(ma.x*Y.x+ma.y*Y.y+ma.z*Y.z),ka=this.je,Z=ka.x*ka.x+ka.y*ka.y+ka.z*ka.z-1,oc=ob.Cf(ba,
X,Z,F);if(oc.Bi){var F=oc.root,I=!0,aa=this.og;aa.x=d.x;aa.y=d.y;aa.z=d.z}var ia=this.th,na=this.je;na.x=ia.x-e.x;na.y=ia.y-e.y;na.z=ia.z-e.z;var fa=this.Ue,qa=this.je,X=2*(fa.x*qa.x+fa.y*qa.y+fa.z*qa.z),De=this.je,Z=De.x*De.x+De.y*De.y+De.z*De.z-1,oc=ob.Cf(ba,X,Z,F);if(oc.Bi){var F=oc.root,I=!0,Ra=this.og;Ra.x=e.x;Ra.y=e.y;Ra.z=e.z}var pa=this.Wc;pa.x=d.x-c.x;pa.y=d.y-c.y;pa.z=d.z-c.z;var ra=this.th,oa=this.Ye;oa.x=c.x-ra.x;oa.y=c.y-ra.y;oa.z=c.z-ra.z;var Ta=this.Wc,bb=Ta.x*Ta.x+Ta.y*Ta.y+Ta.z*Ta.z,
rg=this.Wc,sa=this.Ue,Ha=rg.x*sa.x+rg.y*sa.y+rg.z*sa.z,sg=this.Wc,ua=this.Ye,cd=sg.x*ua.x+sg.y*ua.y+sg.z*ua.z,ba=bb*-R+Ha*Ha,ta=this.Ue,cb=this.Ye,X=2*bb*(ta.x*cb.x+ta.y*cb.y+ta.z*cb.z)-2*Ha*cd,ya=this.Ye,Z=bb*(1-(ya.x*ya.x+ya.y*ya.y+ya.z*ya.z))+cd*cd,oc=ob.Cf(ba,X,Z,F);if(oc.Bi){var va=(Ha*oc.root-cd)/bb;if(0<=va&&1>=va){var F=oc.root,I=!0,wa=this.Wc;wa.x*=va;wa.y*=va;wa.z*=va;var Ea=this.Wc,Ja=this.og;Ja.x=c.x+Ea.x;Ja.y=c.y+Ea.y;Ja.z=c.z+Ea.z}}var Ua=this.Wc;Ua.x=e.x-d.x;Ua.y=e.y-d.y;Ua.z=e.z-d.z;
var Aa=this.th,za=this.Ye;za.x=d.x-Aa.x;za.y=d.y-Aa.y;za.z=d.z-Aa.z;var Hc=this.Wc,bb=Hc.x*Hc.x+Hc.y*Hc.y+Hc.z*Hc.z,Ga=this.Wc,Oa=this.Ue,Ha=Ga.x*Oa.x+Ga.y*Oa.y+Ga.z*Oa.z,Fa=this.Wc,be=this.Ye,cd=Fa.x*be.x+Fa.y*be.y+Fa.z*be.z,ba=bb*-R+Ha*Ha,Ma=this.Ue,Wd=this.Ye,X=2*bb*(Ma.x*Wd.x+Ma.y*Wd.y+Ma.z*Wd.z)-2*Ha*cd,od=this.Ye,Z=bb*(1-(od.x*od.x+od.y*od.y+od.z*od.z))+cd*cd,oc=ob.Cf(ba,X,Z,F);if(oc.Bi){var Tc=(Ha*oc.root-cd)/bb;if(0<=Tc&&1>=Tc){var F=oc.root,I=!0,Pa=this.Wc;Pa.x*=Tc;Pa.y*=Tc;Pa.z*=Tc;var Ba=
this.Wc,Na=this.og;Na.x=d.x+Ba.x;Na.y=d.y+Ba.y;Na.z=d.z+Ba.z}}var Ic=this.Wc;Ic.x=c.x-e.x;Ic.y=c.y-e.y;Ic.z=c.z-e.z;var yc=this.th,xa=this.Ye;xa.x=e.x-yc.x;xa.y=e.y-yc.y;xa.z=e.z-yc.z;var Ib=this.Wc,bb=Ib.x*Ib.x+Ib.y*Ib.y+Ib.z*Ib.z,pb=this.Wc,La=this.Ue,Ha=pb.x*La.x+pb.y*La.y+pb.z*La.z,Ee=this.Wc,Ed=this.Ye,cd=Ee.x*Ed.x+Ee.y*Ed.y+Ee.z*Ed.z,ba=bb*-R+Ha*Ha,Ab=this.Ue,dd=this.Ye,X=2*bb*(Ab.x*dd.x+Ab.y*dd.y+Ab.z*dd.z)-2*Ha*cd,Jc=this.Ye,Z=bb*(1-(Jc.x*Jc.x+Jc.y*Jc.y+Jc.z*Jc.z))+cd*cd,oc=ob.Cf(ba,X,Z,F);
if(oc.Bi){var Dc=(Ha*oc.root-cd)/bb;if(0<=Dc&&1>=Dc){var F=oc.root,I=!0,db=this.Wc;db.x*=Dc;db.y*=Dc;db.z*=Dc;var Xd=this.Wc,Fd=this.og;Fd.x=e.x+Xd.x;Fd.y=e.y+Xd.y;Fd.z=e.z+Xd.z}}}if(I){var zc=this.Ue,kd=F*Math.sqrt(zc.x*zc.x+zc.y*zc.y+zc.z*zc.z);if(!this.Mq||kd<this.PB){if(null==this.vl){var Yd=this.og;this.vl=new n(Yd.x,Yd.y,Yd.z)}else{var Kc=this.vl,wc=this.og;Kc.x=wc.x;Kc.y=wc.y;Kc.z=wc.z}this.PB=kd;this.Mq=!0;this.vu=b.ta}}}},l:ob};var Af=J.BABYLON.ICollisionCoordinator=function(){};q["com.babylonhx.collisions.ICollisionCoordinator"]=
Af;Af.i=["com","babylonhx","collisions","ICollisionCoordinator"];Af.prototype={l:Af};var Be=J.BABYLON.CollisionCoordinatorLegacy=function(){this.Zs=new n(0,0,0);this.Rt=new n(0,0,0);this.Qt=new n(0,0,0)};q["com.babylonhx.collisions.CollisionCoordinatorLegacy"]=Be;Be.i=["com","babylonhx","collisions","CollisionCoordinatorLegacy"];Be.xb=[Af];Be.prototype={Yn:function(a){this.f=a},destroy:function(){},HA:function(a,b,c,d,e,f,g){var h=c.P,k=this.Qt;k.x=a.x/h.x;k.y=a.y/h.y;k.z=a.z/h.z;a=c.P;h=this.Rt;
h.x=b.x/a.x;h.y=b.y/a.y;h.z=b.z/a.z;c.vu=null;c.bw=0;c.NO=this.Rt;c.MO=this.Qt;this.Dp(this.Qt,this.Rt,c,d,this.Zs,e);b=this.Zs;d=c.P;b.x*=d.x;b.y*=d.y;b.z*=d.z;f(g,this.Zs,c.vu)},Dp:function(a,b,c,d,e,f){var g=10*p.lb;if(c.bw>=d)e.x=a.x,e.y=a.y,e.z=a.z;else{c.ft(a,b,g);for(var h=0,k=this.f.Yb;h<k.length;){var l=k[h];++h;l.isEnabled()&&l.ql()&&null!=l.Ha&&l!=f&&l.kF(c)}if(c.Mq){if(0!=b.x||0!=b.y||0!=b.z){h=c.Fp;h.x=a.x+b.x;h.y=a.y+b.y;h.z=a.z+b.z;h=c.PB/Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z);b.x*=h;b.y*=
h;b.z*=h;h=c.th;a.x=h.x+b.x;a.y=h.y+b.y;a.z=h.z+b.z;h=c.vl;k=c.Pk;k.x=a.x-h.x;k.y=a.y-h.y;k.z=a.z-h.z;c.Pk.normalize();h=c.Pk;k=c.pI;l=c.Us;l.x=h.x*k;l.y=h.y*k;l.z=h.z*k;h=c.Us;a.x+=h.x;a.y+=h.y;a.z+=h.z;h=c.vl;k=c.Us;h.x+=k.x;h.y+=k.y;h.z+=k.z;var h=c.Pk,k=c.vl,l=c.Pk,m=c.Fp,k=m.x*l.x+m.y*l.y+m.z*l.z+-(l.x*k.x+l.y*k.y+l.z*k.z);h.x*=k;h.y*=k;h.z*=k;h=c.Fp;k=c.Pk;h.x-=k.x;h.y-=k.y;h.z-=k.z;h=c.Fp;k=c.vl;b.x=h.x-k.x;b.y=h.y-k.y;b.z=h.z-k.z}Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z)<=g?(e.x=a.x,e.y=a.y,e.z=
a.z):(c.bw++,this.Dp(a,b,c,d,e,f))}else e.x=a.x+b.x,e.y=a.y+b.y,e.z=a.z+b.z}},l:Be};var Fe=J.BABYLON.IntersectionInfo=function(a,b,c){this.Xq=this.Tg=0;this.qu=a;this.ru=b;this.Sb=c};q["com.babylonhx.collisions.IntersectionInfo"]=Fe;Fe.i=["com","babylonhx","collisions","IntersectionInfo"];Fe.prototype={l:Fe};var Cd=J.BABYLON.PickingInfo=function(){this.Zb=null;this.Tg=0;this.Xq=-1;this.qu=this.ru=0;this.RK=this.ib=null;this.Sb=0;this.uf=!1};q["com.babylonhx.collisions.PickingInfo"]=Cd;Cd.i=["com",
"babylonhx","collisions","PickingInfo"];Cd.prototype={l:Cd};var la=J.BABYLON.BoundingBox=function(a,b){this.yb=[];this.jg=Array(8);this.w=Array(3);this.Ab=Array(8);this.Gb=a;this.Mb=b;var c=this.Gb;this.Ab[0]=new n(c.x,c.y,c.z);c=this.Mb;this.Ab[1]=new n(c.x,c.y,c.z);c=this.Gb;this.Ab[2]=new n(c.x,c.y,c.z);this.Ab[2].x=this.Mb.x;c=this.Gb;this.Ab[3]=new n(c.x,c.y,c.z);this.Ab[3].y=this.Mb.y;c=this.Gb;this.Ab[4]=new n(c.x,c.y,c.z);this.Ab[4].z=this.Mb.z;c=this.Mb;this.Ab[5]=new n(c.x,c.y,c.z);this.Ab[5].z=
this.Gb.z;c=this.Mb;this.Ab[6]=new n(c.x,c.y,c.z);this.Ab[6].x=this.Gb.x;c=this.Mb;this.Ab[7]=new n(c.x,c.y,c.z);this.Ab[7].y=this.Gb.y;var c=this.Mb,d=this.Gb;this.oa=new n(.5*(c.x+d.x),.5*(c.y+d.y),.5*(c.z+d.z));c=this.Mb;d=this.Gb;this.M=new n(.5*(c.x-d.x),.5*(c.y-d.y),.5*(c.z-d.z));this.w=[new n(0,0,0),new n(0,0,0),new n(0,0,0)].slice(0);c=0;for(d=this.Ab.length;c<d;){var e=c++;this.jg[e]=new n(0,0,0)}this.ea=new n(0,0,0);this.da=new n(0,0,0);c=new r;c.a[0]=1;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=
0;c.a[5]=1;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=1;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=1;d=this.ea;d.x=Infinity;d.y=Infinity;d.z=Infinity;d=this.da;d.x=-Infinity;d.y=-Infinity;d.z=-Infinity;for(var f,g,h,d=0,e=this.Ab.length;d<e;){f=d++;la.g=this.jg[f];var k=this.Ab[f];f=la.g;g=k.x;h=k.y;var k=k.z,l=c.a,m=g*l[1]+h*l[5]+k*l[9]+l[13],w=g*l[2]+h*l[6]+k*l[10]+l[14],C=g*l[3]+h*l[7]+k*l[11]+l[15];f.x=(g*l[0]+h*l[4]+k*l[8]+l[12])/C;f.y=m/C;f.z=w/C;f=la.g.x;g=la.g.y;h=la.g.z;f<this.ea.x&&
(this.ea.x=f);g<this.ea.y&&(this.ea.y=g);h<this.ea.z&&(this.ea.z=h);f>this.da.x&&(this.da.x=f);g>this.da.y&&(this.da.y=g);h>this.da.z&&(this.da.z=h)}d=this.da;e=this.ea;f=this.oa;f.x=d.x+e.x;f.y=d.y+e.y;f.z=d.z+e.z;d=this.oa;d.x*=.5;d.y*=.5;d.z*=.5;d=c.a;e=this.w[0];e.x=d[0];e.y=d[1];e.z=d[2];d=c.a;e=this.w[1];e.x=d[4];e.y=d[5];e.z=d[6];d=c.a;e=this.w[2];e.x=d[8];e.y=d[9];e.z=d[10];this.Ea=c};q["com.babylonhx.culling.BoundingBox"]=la;la.i=["com","babylonhx","culling","BoundingBox"];la.xb=[$a];la.Bb=
function(a,b){return a.da.x<b.ea.x||a.ea.x>b.da.x||a.da.y<b.ea.y||a.ea.y>b.da.y||a.da.z<b.ea.z||a.ea.z>b.da.z?!1:!0};la.ce=function(a,b){for(var c=0;6>c;){for(var d=c++,e=8,f=0;8>f;){var g=f++,h=b[d],g=a[g];if(0>h.j.x*g.x+h.j.y*g.y+h.j.z*g.z+h.d)--e;else break}if(0==e)return!1}return!0};la.prototype={l:la};var xb=J.BABYLON.BoundingInfo=function(a,b){this.Bk=!1;this.Gb=a;this.Mb=b;this.zc=new la(a,b);this.Pc=new de(a,b)};q["com.babylonhx.culling.BoundingInfo"]=xb;xb.i=["com","babylonhx","culling",
"BoundingInfo"];xb.prototype={Li:function(a){return this.Pc.Li(a)?la.ce(this.zc.jg,a):!1},Ki:function(a,b){null==b&&(b=!1);if(null==this.Pc.Hc||null==a.Pc.Hc||!de.Bb(this.Pc,a.Pc)||!la.Bb(this.zc,a.zc))return!1;if(b)return!0;var c=this.zc,d=a.zc,e=c.w[0],f,g,h=c.oa,k=h.x*e.x+h.y*e.y+h.z*e.z,l=c.w[0],m=c.w[1],w=c.w[2],C=Math.abs(l.x*e.x+l.y*e.y+l.z*e.z)*c.M.x+Math.abs(m.x*e.x+m.y*e.y+m.z*e.z)*c.M.y+Math.abs(w.x*e.x+w.y*e.y+w.z*e.z)*c.M.z;f=k-C;g=k+C;var u,y=d.oa,V=y.x*e.x+y.y*e.y+y.z*e.z,z=d.w[0],
p=d.w[1],M=d.w[2],r=Math.abs(z.x*e.x+z.y*e.y+z.z*e.z)*d.M.x+Math.abs(p.x*e.x+p.y*e.y+p.z*e.z)*d.M.y+Math.abs(M.x*e.x+M.y*e.y+M.z*e.z)*d.M.z;u=V-r;if(f>V+r||u>g)return!1;var x=c.w[1],q,t,D=c.oa,v=D.x*x.x+D.y*x.y+D.z*x.z,P=c.w[0],N=c.w[1],E=c.w[2],O=Math.abs(P.x*x.x+P.y*x.y+P.z*x.z)*c.M.x+Math.abs(N.x*x.x+N.y*x.y+N.z*x.z)*c.M.y+Math.abs(E.x*x.x+E.y*x.y+E.z*x.z)*c.M.z;q=v-O;t=v+O;var A,H=d.oa,B=H.x*x.x+H.y*x.y+H.z*x.z,I=d.w[0],F=d.w[1],L=d.w[2],S=Math.abs(I.x*x.x+I.y*x.y+I.z*x.z)*d.M.x+Math.abs(F.x*
x.x+F.y*x.y+F.z*x.z)*d.M.y+Math.abs(L.x*x.x+L.y*x.y+L.z*x.z)*d.M.z;A=B-S;if(q>B+S||A>t)return!1;var K=c.w[2],ba,da,T=c.oa,Q=T.x*K.x+T.y*K.y+T.z*K.z,Dd=c.w[0],Vd=c.w[1],Fb=c.w[2],R=Math.abs(Dd.x*K.x+Dd.y*K.y+Dd.z*K.z)*c.M.x+Math.abs(Vd.x*K.x+Vd.y*K.y+Vd.z*K.z)*c.M.y+Math.abs(Fb.x*K.x+Fb.y*K.y+Fb.z*K.z)*c.M.z;ba=Q-R;da=Q+R;var W,Da=d.oa,Va=Da.x*K.x+Da.y*K.y+Da.z*K.z,X=d.w[0],ca=d.w[1],U=d.w[2],ja=Math.abs(X.x*K.x+X.y*K.y+X.z*K.z)*d.M.x+Math.abs(ca.x*K.x+ca.y*K.y+ca.z*K.z)*d.M.y+Math.abs(U.x*K.x+U.y*
K.y+U.z*K.z)*d.M.z;W=Va-ja;if(ba>Va+ja||W>da)return!1;var Z=d.w[0],ga,ha,ka=c.oa,ma=ka.x*Z.x+ka.y*Z.y+ka.z*Z.z,Y=c.w[0],aa=c.w[1],ia=c.w[2],na=Math.abs(Y.x*Z.x+Y.y*Z.y+Y.z*Z.z)*c.M.x+Math.abs(aa.x*Z.x+aa.y*Z.y+aa.z*Z.z)*c.M.y+Math.abs(ia.x*Z.x+ia.y*Z.y+ia.z*Z.z)*c.M.z;ga=ma-na;ha=ma+na;var fa,qa=d.oa,pa=qa.x*Z.x+qa.y*Z.y+qa.z*Z.z,oa=d.w[0],sa=d.w[1],Ra=d.w[2],ua=Math.abs(oa.x*Z.x+oa.y*Z.y+oa.z*Z.z)*d.M.x+Math.abs(sa.x*Z.x+sa.y*Z.y+sa.z*Z.z)*d.M.y+Math.abs(Ra.x*Z.x+Ra.y*Z.y+Ra.z*Z.z)*d.M.z;fa=pa-ua;
if(ga>pa+ua||fa>ha)return!1;var ra=d.w[1],ya,Ta,bb=c.oa,wa=bb.x*ra.x+bb.y*ra.y+bb.z*ra.z,va=c.w[0],Ha=c.w[1],ta=c.w[2],Ea=Math.abs(va.x*ra.x+va.y*ra.y+va.z*ra.z)*c.M.x+Math.abs(Ha.x*ra.x+Ha.y*ra.y+Ha.z*ra.z)*c.M.y+Math.abs(ta.x*ra.x+ta.y*ra.y+ta.z*ra.z)*c.M.z;ya=wa-Ea;Ta=wa+Ea;var Aa,za=d.oa,cb=za.x*ra.x+za.y*ra.y+za.z*ra.z,Ga=d.w[0],Oa=d.w[1],Fa=d.w[2],Ma=Math.abs(Ga.x*ra.x+Ga.y*ra.y+Ga.z*ra.z)*d.M.x+Math.abs(Oa.x*ra.x+Oa.y*ra.y+Oa.z*ra.z)*d.M.y+Math.abs(Fa.x*ra.x+Fa.y*ra.y+Fa.z*ra.z)*d.M.z;Aa=cb-
Ma;if(ya>cb+Ma||Aa>Ta)return!1;var Ja=d.w[2],Ua,Na,La=c.oa,Hc=La.x*Ja.x+La.y*Ja.y+La.z*Ja.z,ib=c.w[0],xb=c.w[1],lb=c.w[2],be=Math.abs(ib.x*Ja.x+ib.y*Ja.y+ib.z*Ja.z)*c.M.x+Math.abs(xb.x*Ja.x+xb.y*Ja.y+xb.z*Ja.z)*c.M.y+Math.abs(lb.x*Ja.x+lb.y*Ja.y+lb.z*Ja.z)*c.M.z;Ua=Hc-be;Na=Hc+be;var Xa,Wd=d.oa,od=Wd.x*Ja.x+Wd.y*Ja.y+Wd.z*Ja.z,Tc=d.w[0],Pa=d.w[1],Ba=d.w[2],sb=Math.abs(Tc.x*Ja.x+Tc.y*Ja.y+Tc.z*Ja.z)*d.M.x+Math.abs(Pa.x*Ja.x+Pa.y*Ja.y+Pa.z*Ja.z)*d.M.y+Math.abs(Ba.x*Ja.x+Ba.y*Ja.y+Ba.z*Ja.z)*d.M.z;Xa=
od-sb;if(Ua>od+sb||Xa>Na)return!1;var Ic=c.w[0],yc=d.w[0],xa=new n(0,0,0);xa.x=Ic.y*yc.z-Ic.z*yc.y;xa.y=Ic.z*yc.x-Ic.x*yc.z;xa.z=Ic.x*yc.y-Ic.y*yc.x;var Ib,pb,wb=c.oa,Ee=wb.x*xa.x+wb.y*xa.y+wb.z*xa.z,Ed=c.w[0],Ab=c.w[1],dd=c.w[2],Jc=Math.abs(Ed.x*xa.x+Ed.y*xa.y+Ed.z*xa.z)*c.M.x+Math.abs(Ab.x*xa.x+Ab.y*xa.y+Ab.z*xa.z)*c.M.y+Math.abs(dd.x*xa.x+dd.y*xa.y+dd.z*xa.z)*c.M.z;Ib=Ee-Jc;pb=Ee+Jc;var Dc,db=d.oa,Xd=db.x*xa.x+db.y*xa.y+db.z*xa.z,Fd=d.w[0],zc=d.w[1],kd=d.w[2],Yd=Math.abs(Fd.x*xa.x+Fd.y*xa.y+Fd.z*
xa.z)*d.M.x+Math.abs(zc.x*xa.x+zc.y*xa.y+zc.z*xa.z)*d.M.y+Math.abs(kd.x*xa.x+kd.y*xa.y+kd.z*xa.z)*d.M.z;Dc=Xd-Yd;if(Ib>Xd+Yd||Dc>pb)return!1;var Kc=c.w[0],wc=d.w[1],Wa=new n(0,0,0);Wa.x=Kc.y*wc.z-Kc.z*wc.y;Wa.y=Kc.z*wc.x-Kc.x*wc.z;Wa.z=Kc.x*wc.y-Kc.y*wc.x;var Cg,ce,yb=c.oa,Cb=yb.x*Wa.x+yb.y*Wa.y+yb.z*Wa.z,tg=c.w[0],pd=c.w[1],fb=c.w[2],mb=Math.abs(tg.x*Wa.x+tg.y*Wa.y+tg.z*Wa.z)*c.M.x+Math.abs(pd.x*Wa.x+pd.y*Wa.y+pd.z*Wa.z)*c.M.y+Math.abs(fb.x*Wa.x+fb.y*Wa.y+fb.z*Wa.z)*c.M.z;Cg=Cb-mb;ce=Cb+mb;var Rb,
ob=d.oa,gc=ob.x*Wa.x+ob.y*Wa.y+ob.z*Wa.z,rb=d.w[0],nb=d.w[1],Ub=d.w[2],Bb=Math.abs(rb.x*Wa.x+rb.y*Wa.y+rb.z*Wa.z)*d.M.x+Math.abs(nb.x*Wa.x+nb.y*Wa.y+nb.z*Wa.z)*d.M.y+Math.abs(Ub.x*Wa.x+Ub.y*Wa.y+Ub.z*Wa.z)*d.M.z;Rb=gc-Bb;if(Cg>gc+Bb||Rb>ce)return!1;var Sa=c.w[0],kb=d.w[2],jb=new n(0,0,0);jb.x=Sa.y*kb.z-Sa.z*kb.y;jb.y=Sa.z*kb.x-Sa.x*kb.z;jb.z=Sa.x*kb.y-Sa.y*kb.x;var Ka,Ca,qb=c.oa,ac=qb.x*jb.x+qb.y*jb.y+qb.z*jb.z,Sb=c.w[0],ed=c.w[1],fd=c.w[2],Dg=Math.abs(Sb.x*jb.x+Sb.y*jb.y+Sb.z*jb.z)*c.M.x+Math.abs(ed.x*
jb.x+ed.y*jb.y+ed.z*jb.z)*c.M.y+Math.abs(fd.x*jb.x+fd.y*jb.y+fd.z*jb.z)*c.M.z;Ka=ac-Dg;Ca=ac+Dg;var Eg,ug=d.oa,qd=ug.x*jb.x+ug.y*jb.y+ug.z*jb.z,ld=d.w[0],vg=d.w[1],Ya=d.w[2],Ia=Math.abs(ld.x*jb.x+ld.y*jb.y+ld.z*jb.z)*d.M.x+Math.abs(vg.x*jb.x+vg.y*jb.y+vg.z*jb.z)*d.M.y+Math.abs(Ya.x*jb.x+Ya.y*jb.y+Ya.z*jb.z)*d.M.z;Eg=qd-Ia;if(Ka>qd+Ia||Eg>Ca)return!1;var md=c.w[1],nd=d.w[0],Qa=new n(0,0,0);Qa.x=md.y*nd.z-md.z*nd.y;Qa.y=md.z*nd.x-md.x*nd.z;Qa.z=md.x*nd.y-md.y*nd.x;var Za,Fg,Eb=c.oa,$a=Eb.x*Qa.x+Eb.y*
Qa.y+Eb.z*Qa.z,Zb=c.w[0],wg=c.w[1],Hb=c.w[2],gb=Math.abs(Zb.x*Qa.x+Zb.y*Qa.y+Zb.z*Qa.z)*c.M.x+Math.abs(wg.x*Qa.x+wg.y*Qa.y+wg.z*Qa.z)*c.M.y+Math.abs(Hb.x*Qa.x+Hb.y*Qa.y+Hb.z*Qa.z)*c.M.z;Za=$a-gb;Fg=$a+gb;var hb,Wb=d.oa,Mb=Wb.x*Qa.x+Wb.y*Qa.y+Wb.z*Qa.z,cc=d.w[0],ec=d.w[1],Vb=d.w[2],Ob=Math.abs(cc.x*Qa.x+cc.y*Qa.y+cc.z*Qa.z)*d.M.x+Math.abs(ec.x*Qa.x+ec.y*Qa.y+ec.z*Qa.z)*d.M.y+Math.abs(Vb.x*Qa.x+Vb.y*Qa.y+Vb.z*Qa.z)*d.M.z;hb=Mb-Ob;if(Za>Mb+Ob||hb>Fg)return!1;var vb=c.w[1],Gb=d.w[1],eb=new n(0,0,0);eb.x=
vb.y*Gb.z-vb.z*Gb.y;eb.y=vb.z*Gb.x-vb.x*Gb.z;eb.z=vb.x*Gb.y-vb.y*Gb.x;var ic,jc,ab=c.oa,qc=ab.x*eb.x+ab.y*eb.y+ab.z*eb.z,ub=c.w[0],Xb=c.w[1],zb=c.w[2],Bc=Math.abs(ub.x*eb.x+ub.y*eb.y+ub.z*eb.z)*c.M.x+Math.abs(Xb.x*eb.x+Xb.y*eb.y+Xb.z*eb.z)*c.M.y+Math.abs(zb.x*eb.x+zb.y*eb.y+zb.z*eb.z)*c.M.z;ic=qc-Bc;jc=qc+Bc;var Db,Qb=d.oa,kc=Qb.x*eb.x+Qb.y*eb.y+Qb.z*eb.z,pc=d.w[0],dc=d.w[1],fc=d.w[2],Ac=Math.abs(pc.x*eb.x+pc.y*eb.y+pc.z*eb.z)*d.M.x+Math.abs(dc.x*eb.x+dc.y*eb.y+dc.z*eb.z)*d.M.y+Math.abs(fc.x*eb.x+
fc.y*eb.y+fc.z*eb.z)*d.M.z;Db=kc-Ac;if(ic>kc+Ac||Db>jc)return!1;var Nb=c.w[1],Ge=d.w[2],tb=new n(0,0,0);tb.x=Nb.y*Ge.z-Nb.z*Ge.y;tb.y=Nb.z*Ge.x-Nb.x*Ge.z;tb.z=Nb.x*Ge.y-Nb.y*Ge.x;var nc,Fc,uc=c.oa,Oc=uc.x*tb.x+uc.y*tb.y+uc.z*tb.z,lc=c.w[0],Lc=c.w[1],Mc=c.w[2],sc=Math.abs(lc.x*tb.x+lc.y*tb.y+lc.z*tb.z)*c.M.x+Math.abs(Lc.x*tb.x+Lc.y*tb.y+Lc.z*tb.z)*c.M.y+Math.abs(Mc.x*tb.x+Mc.y*tb.y+Mc.z*tb.z)*c.M.z;nc=Oc-sc;Fc=Oc+sc;var Pc,Qc=d.oa,ad=Qc.x*tb.x+Qc.y*tb.y+Qc.z*tb.z,rc=d.w[0],Vc=d.w[1],Wc=d.w[2],Xc=Math.abs(rc.x*
tb.x+rc.y*tb.y+rc.z*tb.z)*d.M.x+Math.abs(Vc.x*tb.x+Vc.y*tb.y+Vc.z*tb.z)*d.M.y+Math.abs(Wc.x*tb.x+Wc.y*tb.y+Wc.z*tb.z)*d.M.z;Pc=ad-Xc;if(nc>ad+Xc||Pc>Fc)return!1;var Yb=c.w[2],Pb=d.w[0],Jb=new n(0,0,0);Jb.x=Yb.y*Pb.z-Yb.z*Pb.y;Jb.y=Yb.z*Pb.x-Yb.x*Pb.z;Jb.z=Yb.x*Pb.y-Yb.y*Pb.x;var id,jd,Nc=c.oa,td=Nc.x*Jb.x+Nc.y*Jb.y+Nc.z*Jb.z,Zc=c.w[0],$c=c.w[1],Gc=c.w[2],vd=Math.abs(Zc.x*Jb.x+Zc.y*Jb.y+Zc.z*Jb.z)*c.M.x+Math.abs($c.x*Jb.x+$c.y*Jb.y+$c.z*Jb.z)*c.M.y+Math.abs(Gc.x*Jb.x+Gc.y*Jb.y+Gc.z*Jb.z)*c.M.z;id=
td-vd;jd=td+vd;var wd,bd=d.oa,Ad=bd.x*Jb.x+bd.y*Jb.y+bd.z*Jb.z,vc=d.w[0],Rc=d.w[1],Sc=d.w[2],Cd=Math.abs(vc.x*Jb.x+vc.y*Jb.y+vc.z*Jb.z)*d.M.x+Math.abs(Rc.x*Jb.x+Rc.y*Jb.y+Rc.z*Jb.z)*d.M.y+Math.abs(Sc.x*Jb.x+Sc.y*Jb.y+Sc.z*Jb.z)*d.M.z;wd=Ad-Cd;if(id>Ad+Cd||wd>jd)return!1;var bc=c.w[2],mc=d.w[1],Kb=new n(0,0,0);Kb.x=bc.y*mc.z-bc.z*mc.y;Kb.y=bc.z*mc.x-bc.x*mc.z;Kb.z=bc.x*mc.y-bc.y*mc.x;var Id,Ld,Uc=c.oa,Md=Uc.x*Kb.x+Uc.y*Kb.y+Uc.z*Kb.z,xc=c.w[0],gd=c.w[1],hd=c.w[2],Nd=Math.abs(xc.x*Kb.x+xc.y*Kb.y+xc.z*
Kb.z)*c.M.x+Math.abs(gd.x*Kb.x+gd.y*Kb.y+gd.z*Kb.z)*c.M.y+Math.abs(hd.x*Kb.x+hd.y*Kb.y+hd.z*Kb.z)*c.M.z;Id=Md-Nd;Ld=Md+Nd;var Od,Ec=d.oa,Pd=Ec.x*Kb.x+Ec.y*Kb.y+Ec.z*Kb.z,Yc=d.w[0],rd=d.w[1],sd=d.w[2],Qd=Math.abs(Yc.x*Kb.x+Yc.y*Kb.y+Yc.z*Kb.z)*d.M.x+Math.abs(rd.x*Kb.x+rd.y*Kb.y+rd.z*Kb.z)*d.M.y+Math.abs(sd.x*Kb.x+sd.y*Kb.y+sd.z*Kb.z)*d.M.z;Od=Pd-Qd;if(Id>Pd+Qd||Od>Ld)return!1;var hc=c.w[2],tc=d.w[2],Lb=new n(0,0,0);Lb.x=hc.y*tc.z-hc.z*tc.y;Lb.y=hc.z*tc.x-hc.x*tc.z;Lb.z=hc.x*tc.y-hc.y*tc.x;var Rd,Sd,
ud=c.oa,Td=ud.x*Lb.x+ud.y*Lb.y+ud.z*Lb.z,xd=c.w[0],zd=c.w[1],Bd=c.w[2],Ud=Math.abs(xd.x*Lb.x+xd.y*Lb.y+xd.z*Lb.z)*c.M.x+Math.abs(zd.x*Lb.x+zd.y*Lb.y+zd.z*Lb.z)*c.M.y+Math.abs(Bd.x*Lb.x+Bd.y*Lb.y+Bd.z*Lb.z)*c.M.z;Rd=Td-Ud;Sd=Td+Ud;var Zd,Gd=d.oa,$d=Gd.x*Lb.x+Gd.y*Lb.y+Gd.z*Lb.z,Hd=d.w[0],Jd=d.w[1],Kd=d.w[2],ae=Math.abs(Hd.x*Lb.x+Hd.y*Lb.y+Hd.z*Lb.z)*d.M.x+Math.abs(Jd.x*Lb.x+Jd.y*Lb.y+Jd.z*Lb.z)*d.M.y+Math.abs(Kd.x*Lb.x+Kd.y*Lb.y+Kd.z*Lb.z)*d.M.z;Zd=$d-ae;return Rd>$d+ae||Zd>Sd?!1:!0},l:xb};var de=
J.BABYLON.BoundingSphere=function(a,b){this.Eb=new n(0,0,0);var c=a.x-b.x,d=a.y-b.y,e=a.z-b.z,c=Math.sqrt(c*c+d*d+e*e);this.oa=n.D(a,b,.5);this.P=.5*c;this.Hc=new n(0,0,0);c=new r;c.a[0]=1;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=0;c.a[5]=1;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=1;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=1;var d=Math.max,e=Math.abs,f=this.oa,g=this.Hc,h=f.x,k=f.y,f=f.z,l=c.a,m=h*l[1]+k*l[5]+f*l[9]+l[13],w=h*l[2]+k*l[6]+f*l[10]+l[14],C=h*l[3]+k*l[7]+f*l[11]+l[15];g.x=(h*l[0]+
k*l[4]+f*l[8]+l[12])/C;g.y=m/C;g.z=w/C;g=this.Eb;g.x=c.a[0]+c.a[4]+c.a[8];g.y=c.a[1]+c.a[5]+c.a[9];g.z=c.a[2]+c.a[6]+c.a[10];this.bg=d(d(e(this.Eb.x),e(this.Eb.y)),e(this.Eb.z))*this.P};q["com.babylonhx.culling.BoundingSphere"]=de;de.i=["com","babylonhx","culling","BoundingSphere"];de.Bb=function(a,b){var c=a.Hc.x-b.Hc.x,d=a.Hc.y-b.Hc.y,e=a.Hc.z-b.Hc.z;return a.bg+b.bg<Math.sqrt(c*c+d*d+e*e)?!1:!0};de.prototype={Li:function(a){for(var b=0;6>b;){var c=b++,c=a[c],d=this.Hc;if(c.j.x*d.x+c.j.y*d.y+c.j.z*
d.z+c.d<=-this.bg)return!1}return!0},l:de};var Na=J.BABYLON.Ray=function(a,b,c){this.origin=a;this.direction=b;this.length=null!=c?c:Infinity};q["com.babylonhx.culling.Ray"]=Na;Na.i=["com","babylonhx","culling","Ray"];Na.$a=function(a,b,c,d,e,f,g){var h=n.Za(new n(a,b,0),c,d,e,f,g);a=n.Za(new n(a,b,1),c,d,e,f,g);a=new n(a.x-h.x,a.y-h.y,a.z-h.z);a.normalize();return new Na(h,a)};Na.prototype={rr:function(a,b){var c=0,d=Infinity,e,f,g;if(1E-7>Math.abs(this.direction.x)){if(this.origin.x<a.x||this.origin.x>
b.x)return!1}else if(e=1/this.direction.x,f=(a.x-this.origin.x)*e,e*=b.x-this.origin.x,-Infinity==e&&(e=Infinity),f>e&&(g=f,f=e,e=g),c=Math.max(f,c),d=Math.min(e,d),c>d)return!1;if(1E-7>Math.abs(this.direction.y)){if(this.origin.y<a.y||this.origin.y>b.y)return!1}else if(e=1/this.direction.y,f=(a.y-this.origin.y)*e,e*=b.y-this.origin.y,-Infinity==e&&(e=Infinity),f>e&&(g=f,f=e,e=g),c=Math.max(f,c),d=Math.min(e,d),c>d)return!1;if(1E-7>Math.abs(this.direction.z)){if(this.origin.z<a.z||this.origin.z>b.z)return!1}else if(e=
1/this.direction.z,f=(a.z-this.origin.z)*e,e*=b.z-this.origin.z,-Infinity==e&&(e=Infinity),f>e&&(g=f,f=e,e=g),c=Math.max(f,c),d=Math.min(e,d),c>d)return!1;return!0},lJ:function(a){var b=a.oa.x-this.origin.x,c=a.oa.y-this.origin.y,d=a.oa.z-this.origin.z,e=b*b+c*c+d*d;a=a.P*a.P;if(e<=a)return!0;b=b*this.direction.x+c*this.direction.y+d*this.direction.z;return 0>b?!1:e-b*b<=a},mJ:function(a,b,c){null==this.Lp&&(this.Lp=new n(0,0,0),this.Mp=new n(0,0,0),this.It=new n(0,0,0),this.Zt=new n(0,0,0),this.iq=
new n(0,0,0));var d=this.Lp;d.x=b.x-a.x;d.y=b.y-a.y;d.z=b.z-a.z;b=this.Mp;b.x=c.x-a.x;b.y=c.y-a.y;b.z=c.z-a.z;c=this.direction;b=this.Mp;d=this.It;d.x=c.y*b.z-c.z*b.y;d.y=c.z*b.x-c.x*b.z;d.z=c.x*b.y-c.y*b.x;c=this.Lp;b=this.It;c=c.x*b.x+c.y*b.y+c.z*b.z;if(0==c)return null;c=1/c;b=this.origin;d=this.Zt;d.x=b.x-a.x;d.y=b.y-a.y;d.z=b.z-a.z;a=this.Zt;b=this.It;a=(a.x*b.x+a.y*b.y+a.z*b.z)*c;if(0>a||1<a)return null;b=this.Zt;var d=this.Lp,e=this.iq;e.x=b.y*d.z-b.z*d.y;e.y=b.z*d.x-b.x*d.z;e.z=b.x*d.y-b.y*
d.x;b=this.direction;d=this.iq;b=(b.x*d.x+b.y*d.y+b.z*d.z)*c;if(0>b||1<a+b)return null;d=this.Mp;e=this.iq;if((d.x*e.x+d.y*e.y+d.z*e.z)*c>this.length)return null;d=this.Mp;e=this.iq;return new Fe(a,b,(d.x*e.x+d.y*e.y+d.z*e.z)*c)},jJ:function(a,b,c){var d,e,f,g=this.origin,h;h=this.direction;f=h.x*Na.Fa;e=h.y*Na.Fa;h=h.z*Na.Fa;f=g.x+f;e=g.y+e;d=g.z+h;h=b.x-a.x;g=b.y-a.y;b=b.z-a.z;var k,l;k=this.origin;l=f-k.x;f=e-k.y;k=d-k.z;var m=this.origin;d=a.x-m.x;e=a.y-m.y;a=a.z-m.z;var w=h*h+g*g+b*b,C=h*l+g*
f+b*k,u=l*l+f*f+k*k,y=h*d+g*e+b*a,n=l*d+f*e+k*a,z=w*u-C*C,p,r=z,m=z;z<Na.Ta?(p=0,r=1,z=n,m=u):(p=C*n-u*y,z=w*n-C*y,0>p?(p=0,z=n,m=u):p>r&&(p=r,z=n+C,m=u));0>z?(z=0,0>-y?p=0:-y>w?p=r:(p=-y,r=w)):z>m&&(z=m,0>-y+C?p=0:-y+C>w?p=r:(p=-y+C,r=w));w=Math.abs(p)<Na.Ta?0:p/r;m=Math.abs(z)<Na.Ta?0:z/m;l*=m;f*=m;k*=m;h=d+h*w-l;g=e+g*w-f;b=a+b*w-k;return 0<m&&m<=this.length&&h*h+g*g+b*b<c*c?Math.sqrt(l*l+f*f+k*k):-1},l:Na};var He=J.BABYLON.IOctreeContainer=function(){};q["com.babylonhx.culling.octrees.IOctreeContainer"]=
He;He.i=["com","babylonhx","culling","octrees","IOctreeContainer"];He.prototype={l:He};var Zd=J.BABYLON.Octree=function(){this.Uq=[]};q["com.babylonhx.culling.octrees.Octree"]=Zd;Zd.i=["com","babylonhx","culling","octrees","Octree"];Zd.xb=[He];Zd.cH=function(a,b,c,d,e,f,g,h){g.hc=[];var k,l=(b.x-a.x)/2;k=(b.y-a.y)/2;b=(b.z-a.z)/2;for(var m=0;2>m;)for(var w=m++,C=0;2>C;)for(var u=C++,y=0;2>y;){var V=y++,z=new n(a.x+l*w,a.y+k*u,a.z+b*V),V=new n(a.x+l*(w+1),a.y+k*(u+1),a.z+b*(V+1)),z=new Ie(z,V,d,e+
1,f,h);z.fH(c);g.hc.push(z)}};Zd.prototype={hu:function(a){for(var b=0,c=this.hc.length;b<c;){var d=b++;this.hc[d].fu(a)}},sr:function(a){var b=this.Sd;b.length=0;b.Ka++;for(var b=0,c=this.hc.length;b<c;){var d=b++;this.hc[d].sr(a,this.Sd)}a=this.Sd;b=this.Uq;c=0;for(d=b.length;c<d;){var e=c++;a.ag(b[e])}return this.Sd},l:Zd};var Ie=J.BABYLON.OctreeBlock=function(a,b,c,d,e,f){this.Od=Array(8);this.entries=[];this.bj=c;this.Tx=d;this.Cy=e;this.Lx=f;this.ot=a;this.mt=b;this.Od[0]=new n(a.x,a.y,a.z);
this.Od[1]=new n(b.x,b.y,b.z);this.Od[2]=new n(a.x,a.y,a.z);this.Od[2].x=b.x;this.Od[3]=new n(a.x,a.y,a.z);this.Od[3].y=b.y;this.Od[4]=new n(a.x,a.y,a.z);this.Od[4].z=b.z;this.Od[5]=new n(b.x,b.y,b.z);this.Od[5].z=a.z;this.Od[6]=new n(b.x,b.y,b.z);this.Od[6].x=a.x;this.Od[7]=new n(b.x,b.y,b.z);this.Od[7].y=a.y};q["com.babylonhx.culling.octrees.OctreeBlock"]=Ie;Ie.i=["com","babylonhx","culling","octrees","OctreeBlock"];Ie.xb=[He];Ie.prototype={NA:function(){return this.bj},fu:function(a){if(null!=
this.hc)for(var b=0,c=this.hc.length;b<c;){var d=b++;this.hc[d].fu(a)}else this.Lx(a,this),this.entries.length>this.NA()&&this.Tx<this.Cy&&this.SH()},fH:function(a){for(var b=0,c=a.length;b<c;){var d=b++;this.fu(a[d])}},select:function(a,b,c){null==c&&(c=!1);if(la.ce(this.Od,a))if(null!=this.hc)for(var d=0,e=this.hc.length;d<e;){var f=d++;this.hc[f].select(a,b,c)}else if(c)for(a=this.entries,c=0,d=a.length;c<d;)e=c++,e=a[e],b.data[b.length++]=e;else for(a=this.entries,c=0,d=a.length;c<d;)e=c++,b.ag(a[e])},
Ki:function(a,b,c,d){null==d&&(d=!1);var e=this.ot,f=this.mt,g=a.x;g>f.x&&(g=f.x);g<e.x&&(g=e.x);var h=a.y;h>f.y&&(h=f.y);h<e.y&&(h=e.y);var k=a.z;k>f.z&&(k=f.z);k<e.z&&(k=e.z);ba.Ec[0]=new n(g,h,k);g=ba.Ec[0];e=a.x-g.x;f=a.y-g.y;g=a.z-g.z;if(e*e+f*f+g*g<=b*b)if(null!=this.hc)for(e=0,f=this.hc.length;e<f;)g=e++,this.hc[g].Ki(a,b,c,d);else if(d)for(a=this.entries,b=0,d=a.length;b<d;)e=b++,e=a[e],c.data[c.length++]=e;else for(a=this.entries,b=0,d=a.length;b<d;)e=b++,c.ag(a[e])},sr:function(a,b){if(a.rr(this.ot,
this.mt))if(null!=this.hc)for(var c=0,d=this.hc.length;c<d;){var e=c++;this.hc[e].sr(a,b)}else for(c=this.entries,d=0,e=c.length;d<e;){var f=d++;b.ag(c[f])}},SH:function(){Zd.cH(this.ot,this.mt,this.entries,this.bj,this.Tx,this.Cy,this,this.Lx)},l:Ie,ha:{NA:"get_capacity"}};q["com.babylonhx.d2.events.EventDispatcher"]=Sf;Sf.i=["com","babylonhx","d2","events","EventDispatcher"];q["com.babylonhx.d2.display.DisplayObject"]=Qd;Qd.i=["com","babylonhx","d2","display","DisplayObject"];Qd.U=Sf;Qd.prototype=
F(Sf.prototype,{l:Qd});q["com.babylonhx.d2.display.InteractiveObject"]=sd;sd.i=["com","babylonhx","d2","display","InteractiveObject"];sd.U=Qd;sd.prototype=F(Qd.prototype,{l:sd});q["com.babylonhx.d2.display.DisplayObjectContainer"]=rd;rd.i=["com","babylonhx","d2","display","DisplayObjectContainer"];rd.U=sd;rd.prototype=F(sd.prototype,{l:rd});q["com.babylonhx.d2.display.Graphics"]=Ag;Ag.i=["com","babylonhx","d2","display","Graphics"];q["com.babylonhx.d2.display.Stage"]=df;df.i=["com","babylonhx","d2",
"display","Stage"];df.U=rd;df.prototype=F(rd.prototype,{l:df});var ca=J.BABYLON.Color4=function(a,b,c,d){null==d&&(d=1);null==c&&(c=0);null==b&&(b=0);null==a&&(a=0);this.r=a;this.v=b;this.m=c;this.W=d};q["com.babylonhx.math.Color4"]=ca;ca.i=["com","babylonhx","math","Color4"];ca.xh=function(a){return"#"!=a.substring(0,1)||9!=a.length?(console.log("Color4.FromHexString must be called with a string like #FFFFFFFF"),new ca(0,0,0,0)):ca.be(na.$a("0x"+a.substring(1,3)),na.$a("0x"+a.substring(3,5)),na.$a("0x"+
a.substring(5,7)),na.$a("0x"+a.substring(7,9)))};ca.Ah=function(a,b,c){var d=new ca(0,0,0,0);ca.tc(a,b,c,d);return d};ca.tc=function(a,b,c,d){d.r=a.r+(b.r-a.r)*c;d.v=a.v+(b.v-a.v)*c;d.m=a.m+(b.m-a.m)*c;d.W=a.W+(b.W-a.W)*c};ca.ae=function(a,b){null==b&&(b=0);return new ca(a[b],a[b+1],a[b+2],a[b+3])};ca.be=function(a,b,c,d){return new ca(a/255,b/255,c/255,d/255)};ca.Vc=function(a,b){if(a.length==3*b){for(var c=[],d=0;d<a.length;){var e=d/3*4|0;c[e]=a[d];c[e+1]=a[d+1];c[e+2]=a[d+2];c[e+3]=1;d+=3}return c}return a};
ca.prototype={Gz:function(a){this.r+=a.r;this.v+=a.v;this.m+=a.m;this.W+=a.W;return this},ww:function(a,b){b.r=this.r-a.r;b.v=this.v-a.v;b.m=this.m-a.m;b.W=this.W-a.W;return this},iw:function(a,b){b.r=this.r*a;b.v=this.v*a;b.m=this.m*a;b.W=this.W*a;return this},Iv:function(a,b){b.r=this.r*a.r;b.v=this.v*a.v;b.m=this.m*a.m;b.W=this.W*a.W;return b},clone:function(){return new ca(this.r,this.v,this.m,this.W)},$z:function(a){this.r=a.r;this.v=a.v;this.m=a.m;this.W=a.W;return this},l:ca};q["com.babylonhx.layer.HighlightLayer"]=
Gb;Gb.i=["com","babylonhx","layer","HighlightLayer"];Gb.prototype={pl:function(){return this.Da.Vz},WH:function(){function a(a){var c=a.ph,d=b.f,e=d.c,f=a.Of().xn,w=e.Dg?1029:1028;if(e.G.Sf()!=f||e.G.Fg()!=w)f?(e.G.mw(w),e.G.fg(!0)):e.G.fg(!1);e.G.Qh(0);f=c.Zx(a.eb);if(!f.Br&&null==b.vk.h[c.ig]){var w=null!=e.T.Kc&&null!=f.Nd[a.eb]&&null!=f.Nd[a.eb],C=b.wc.h[c.ig],u=a.Of(),n=null;null!=C&&C.yO&&null!=u&&(n=u.Fd);if(b.pa(a,w,n)){var V=b.Ae,z=V.zd;e.vc!=z&&(e.b.useProgram(z),e.vc=z);e.Ff=V;null!=V.Tc&&
V.Tc(V);c.wp(a,b.Ae,0);e=b.Ae;d=d.sb;e.Wa("viewProjection",d)&&(V=e.c,e=e.u.get("viewProjection"),V.b.uniformMatrix4fv(e,!1,d.a));null!=C?(d=b.Ae,e=C.color.r,V=C.color.v,C=C.color.m,d.Oa("color",e,V,C,1)&&d.c.Ub(d.u.get("color"),e,V,C,1)):(C=b.Ae,d=Gb.Eh.r,e=Gb.Eh.v,V=Gb.Eh.m,z=Gb.Eh.W,C.Oa("color",d,e,V,z)&&C.c.Ub(C.u.get("color"),d,e,V,z));null!=u&&u.Yf()&&(C=u.br(),b.Ae.Hb("diffuseSampler",C),u=b.Ae,C=C.Le(),u.Wa("diffuseMatrix",C)&&(d=u.c,u=u.u.get("diffuseMatrix"),d.b.uniformMatrix4fv(u,!1,C.a)));
null!=n&&(b.Ae.Hb("emissiveSampler",n),u=b.Ae,n=n.Le(),u.Wa("emissiveMatrix",n)&&(C=u.c,u=u.u.get("emissiveMatrix"),C.b.uniformMatrix4fv(u,!1,n.a)));c.Hg()&&c.nf&&(n=b.Ae,u=c.gd(),u.Pi&&null!=c.ee?u=c.ee:(null==u.Fe&&u.Hl(),u=u.Fe),n.Qa.set("mBones",null),C=n.c,n=n.u.get("mBones"),C.b.uniformMatrix4fv(n,!1,u));c.Gt(a,b.Ae,0,f,w,function(a,c){var d=b.Ae;if(d.Wa("world",c)){var e=d.c,d=d.u.get("world");e.b.uniformMatrix4fv(d,!1,c.a)}})}else b.Qd.HC()}}for(var b=this,c=this.he.width*this.Da.Tz|0,d=this.he.height*
this.Da.Tz|0,e=this.aq,f=1;f*=2,f<c;);f>e&&(f=e);c=f;e=this.aq;for(f=1;f*=2,f<d;);f>e&&(f=e);d=f;this.Qd=new nb("HighlightLayerMainRTT",{width:this.he.width,height:this.he.height},this.f,!1,!0,0);this.Qd.L=this.Da.Vz;this.Qd.kg=0;this.Qd.lg=0;this.Qd.Cq=1;this.Qd.DD(2);this.Qd.aw=!1;this.Qd.lc=null;this.Xg=new nb("HighlightLayerBlurRTT",{width:c,height:d},this.f,!1,!0,0);this.Xg.kg=0;this.Xg.lg=0;this.Xg.Cq=16;this.Xg.DD(3);this.Xg.aw=!1;this.gm=new kc("HighlightLayerPPP",this.Da.Tz,null,2,this.f.c);
this.gm.Ne.add(function(a){a.Hb("textureSampler",b.Qd)});2==this.Da.iu?(e=this.f.c,this.nm=new Od("HighlightLayerHBP",new K(1,0),this.Da.xH,1,null,2,e),this.nm.Ne.add(function(a){if(a.Jb("screenSize",c,d)){var b=a.c;a=a.u.get("screenSize");b.b.uniform2f(a,c,d)}}),e=this.f.c,this.sn=new Od("HighlightLayerVBP",new K(0,1),this.Da.zH,1,null,2,e),this.sn.Ne.add(function(a){if(a.Jb("screenSize",c,d)){var b=a.c;a=a.u.get("screenSize");b.b.uniform2f(a,c,d)}})):(e=this.f.c,this.nm=new Gd("HighlightLayerHBP",
new K(1,0),this.Da.xH,1,null,2,e),this.nm.Ne.add(function(a){if(a.Jb("screenSize",c,d)){var b=a.c;a=a.u.get("screenSize");b.b.uniform2f(a,c,d)}}),e=this.f.c,this.sn=new Gd("HighlightLayerVBP",new K(0,1),this.Da.zH,1,null,2,e),this.sn.Ne.add(function(a){if(a.Jb("screenSize",c,d)){var b=a.c;a=a.u.get("screenSize");b.b.uniform2f(a,c,d)}}));this.Qd.WB.add(function(){b.YB.la(b);b.f.Gl.cI([b.gm,b.nm,b.sn],b.Xg.fa);b.eK.la(b)});this.Qd.ZH=function(c,d,e){b.$B.la(b);for(var f=0,m=c.length;f<m;){var w=f++;
a(c.data[w])}c=0;for(f=d.length;c<f;)m=c++,a(d.data[m]);d=0;for(c=e.length;d<c;)f=d++,a(e.data[f])};this.Qd.Lv.add(function(a){var b=Gb.Eh;a.G.apply(a.b);a.rb.apply(a.b);a.J.apply(a.b);var c=0;v.D(b,ca)?a.b.clearColor(b.r,b.v,b.m,b.W):a.b.clearColor(b.r,b.v,b.m,1);c|=16384;a.b.clearDepth(1);c|=256;a.b.clearStencil(0);a.b.clear(c|1024)})},pa:function(a,b,c){if(!a.Of().pa(a.ta,b))return!1;var d=[],e=["position"],f=a.ta,g=a.Of(),h=a=!1;null!=g&&g.Yf()&&(g=g.br(),null!=g&&(d.push("#define ALPHATEST"),
f.fb("uv2")&&1==g.Lf?(d.push("#define DIFFUSEUV2"),h=!0):f.fb("uv")&&(d.push("#define DIFFUSEUV1"),a=!0)));null!=c&&(d.push("#define EMISSIVE"),f.fb("uv2")&&1==c.Lf?(d.push("#define EMISSIVEUV2"),h=!0):f.fb("uv")&&(d.push("#define EMISSIVEUV1"),a=!0));a&&(e.push("uv"),d.push("#define UV1"));h&&(e.push("uv2"),d.push("#define UV2"));f.Hg()&&f.nf?(e.push("matricesIndices"),e.push("matricesWeights"),4<f.Me&&(e.push("matricesIndicesExtra"),e.push("matricesWeightsExtra")),d.push("#define NUM_BONE_INFLUENCERS "+
f.Me),d.push("#define BonesPerMesh "+(f.gd().Ie.length+1))):d.push("#define NUM_BONE_INFLUENCERS 0");b&&(d.push("#define INSTANCES"),e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3"));b=d.join("\n");this.Yg!=b&&(this.Yg=b,this.Ae=this.f.c.Aj("glowMapGeneration",e,"world mBones viewProjection diffuseMatrix color emissiveMatrix".split(" "),["diffuseSampler","emissiveSampler"],b));return this.Ae.Nc},hb:function(){var a=this.BN;if(a.Nc&&this.Xg.pa()){var b=this.f.c;this.ZB.la(this);
var c=a.zd;b.vc!=c&&(b.b.useProgram(c),b.vc=c);b.Ff=a;null!=a.Tc&&a.Tc(a);c=b.Dg?1029:1028;0==b.G.Sf()&&b.G.Fg()==c||b.G.fg(!1);b.G.Qh(0);var c=b.rb.Rk,d=b.rb.fn,e=b.rb.gn,f=b.bb;a.Hb("textureSampler",this.Xg);var g=this.ua,h=this.wa;if(b.qb!=g||b.Qb!=a){b.qb=g;b.Qb=a;p.sa=a.we;for(var k=0,l=p.sa.length;k<l;){var m=k++;p.g=a.sa[m];0<=p.g&&(m=p.sa[m],p.F=null!=t[m]?g.H(m):g.h[m],null==p.F?b.na[p.g]&&(b.b.disableVertexAttribArray(p.g),b.na[p.g]=!1):(b.na[p.g]||(b.b.enableVertexAttribArray(p.g),b.na[p.g]=
!0),m=p.F.R.R,b.vertexAttribPointer(m,p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(b.T.Kc.vertexAttribDivisorANGLE(p.g,1),b.ad.push(p.g),b.td.push(m))))}}null!=h&&b.kb!=h&&(b.kb=h,b.V.get(34963)!=h&&(b.b.bindBuffer(34963,null==h?null:h.buffer),b.V.set(34963,null==h?null:h)),b.Ud=h.Sc);g=this.Da.iu;if(b.bb!=g){switch(g){case 0:b.J.za(!1);break;case 1:b.J.Ya(770,1,0,1);b.J.za(!0);break;case 2:b.J.Ya(770,771,1,1);b.J.za(!0);break;case 3:b.J.Ya(0,769,1,1);b.J.za(!0);break;case 4:b.J.Ya(774,0,1,1);
b.J.za(!0);break;case 5:b.J.Ya(770,769,1,1);b.J.za(!0);break;case 6:b.J.Ya(1,1,0,1),b.J.za(!0)}b.G.vb(0==g);b.bb=g}b.rb.pw(0);b.rb.yo(!0);b.rb.$C(this.TF);if(this.HK){g=a.Qa.get("offset");if(null==g||0!=g[0])a.Qa.set("offset",[0]),g=a.c,h=a.u.get("offset"),g.b.uniform1f(h,0);b.rb.Ur(517);b.Ic(!0,0,6)}if(this.gJ){g=a.Qa.get("offset");if(null==g||1!=g[0])a.Qa.set("offset",[1]),g=a.c,a=a.u.get("offset"),g.b.uniform1f(a,1);b.rb.Ur(514);b.Ic(!0,0,6)}b.rb.Ur(d);b.rb.pw(e);if(b.bb!=f){switch(f){case 0:b.J.za(!1);
break;case 1:b.J.Ya(770,1,0,1);b.J.za(!0);break;case 2:b.J.Ya(770,771,1,1);b.J.za(!0);break;case 3:b.J.Ya(0,769,1,1);b.J.za(!0);break;case 4:b.J.Ya(774,0,1,1);b.J.za(!0);break;case 5:b.J.Ya(770,769,1,1);b.J.za(!0);break;case 6:b.J.Ya(1,1,0,1),b.J.za(!0)}b.G.vb(0==f);b.bb=f}b.rb.yo(c);this.VB.la(this);b=this.Qd.Yu();this.IL();if(b.width!=this.he.width||b.height!=this.he.height)this.Ri.la(this),this.oA(),this.WH()}},kL:function(a){var b=this.vk.h[a.ig];null!=b&&(a.sc.remove(b.yn),a.Lc.remove(b.iH));
this.vk.h[a.ig]=null},Zv:function(a){var b=this.wc.h[a.ig];null!=b&&(a.sc.remove(b.cK),a.Lc.remove(b.bK));this.wc.h[a.ig]=null;this.qh=!1;for(a=this.wc.keys();a.Ca();)if(b=a.next(),null!=this.wc.h[b]){this.qh=!0;break}},gD:function(){return this.isEnabled?this.qh:!1},IL:function(){if(null!=this.Da.HB)this.he.width=this.Da.HB,this.he.height=this.Da.HB;else{this.he.width=this.c.fc.width*this.Da.HJ|0;this.he.height=this.c.fc.height*this.Da.HJ|0;for(var a=this.he.width,b=this.aq,c=1;c*=2,c<a;);c>b&&(c=
b);this.he.width=c;a=this.he.height;b=this.aq;for(c=1;c*=2,c<a;);c>b&&(c=b);this.he.height=c}},oA:function(){this.Xg.dispose();this.Qd.dispose();this.gm.dispose();this.nm.dispose();this.sn.dispose()},dispose:function(){var a=this.ua,a=null!=t.position?a.H("position"):a.h.position;null!=a&&(a.Gf&&a.R.dispose(),a=this.ua,null!=t.position?a.C("position",null):a.h.position=null);null!=this.wa&&(a=this.wa,a.ia--,0==a.ia&&this.f.c.b.deleteBuffer(a.buffer),this.wa=null);this.oA();for(a=this.wc.keys();a.Ca();){var b=
a.next(),b=this.wc.h[b];null!=b&&null!=b.Zc&&(b.Zc.sc.remove(b.cK),b.Zc.Lc.remove(b.bK))}this.wc=null;for(a=this.vk.keys();a.Ca();)b=a.next(),b=this.vk.h[b],null!=b&&(b.Zc.sc.remove(b.yn),b.Zc.Lc.remove(b.iH));this.vk=null;a=this.f.tf.indexOf(this);-1<a&&this.f.tf.splice(a,1);this.Nb.la(this);this.Nb.clear();this.$B.clear();this.YB.clear();this.ZB.clear();this.VB.clear();this.Ri.clear()},l:Gb,ha:{pl:"get_camera"}};var bg=J.BABYLON.Layer=function(){this.Lc=new R;this.sc=new R;this.Nb=new R;this.Jz=
!1;this.iu=2;this.offset=new K(0,0);this.scale=new K(1,1)};q["com.babylonhx.layer.Layer"]=bg;bg.i=["com","babylonhx","layer","Layer"];bg.prototype={hb:function(){var a=this.Jz?this.zN:this.s;if(a.Nc&&null!=this.ek&&this.ek.pa()){var b=this.f.c;this.sc.la(this);var c=a.zd;b.vc!=c&&(b.b.useProgram(c),b.vc=c);b.Ff=a;null!=a.Tc&&a.Tc(a);c=b.Dg?1029:1028;0==b.G.Sf()&&b.G.Fg()==c||b.G.fg(!1);b.G.Qh(0);a.Hb("textureSampler",this.ek);c=this.ek.Le();if(a.Wa("textureMatrix",c)){var d=a.c,e=a.u.get("textureMatrix");
d.b.uniformMatrix4fv(e,!1,c.a)}var c=this.color.r,d=this.color.v,e=this.color.m,f=this.color.W;a.Oa("color",c,d,e,f)&&a.c.Ub(a.u.get("color"),c,d,e,f);c=this.offset;a.Jb("offset",c.x,c.y)&&(d=a.c,e=a.u.get("offset"),d.b.uniform2f(e,c.x,c.y));c=this.scale;a.Jb("scale",c.x,c.y)&&(d=a.c,e=a.u.get("scale"),d.b.uniform2f(e,c.x,c.y));c=this.ua;d=this.wa;if(b.qb!=c||b.Qb!=a)for(b.qb=c,b.Qb=a,p.sa=a.we,e=0,f=p.sa.length;e<f;){var g=e++;p.g=a.sa[g];0<=p.g&&(g=p.sa[g],p.F=null!=t[g]?c.H(g):c.h[g],null==p.F?
b.na[p.g]&&(b.b.disableVertexAttribArray(p.g),b.na[p.g]=!1):(b.na[p.g]||(b.b.enableVertexAttribArray(p.g),b.na[p.g]=!0),g=p.F.R.R,b.vertexAttribPointer(g,p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(b.T.Kc.vertexAttribDivisorANGLE(p.g,1),b.ad.push(p.g),b.td.push(g))))}null!=d&&b.kb!=d&&(b.kb=d,b.V.get(34963)!=d&&(b.b.bindBuffer(34963,null==d?null:d.buffer),b.V.set(34963,null==d?null:d)),b.Ud=d.Sc);if(this.Jz){a=this.iu;if(b.bb!=a){switch(a){case 0:b.J.za(!1);break;case 1:b.J.Ya(770,1,0,1);b.J.za(!0);
break;case 2:b.J.Ya(770,771,1,1);b.J.za(!0);break;case 3:b.J.Ya(0,769,1,1);b.J.za(!0);break;case 4:b.J.Ya(774,0,1,1);b.J.za(!0);break;case 5:b.J.Ya(770,769,1,1);b.J.za(!0);break;case 6:b.J.Ya(1,1,0,1),b.J.za(!0)}b.G.vb(0==a);b.bb=a}b.Ic(!0,0,6);0!=b.bb&&(b.J.za(!1),b.G.vb(!0),b.bb=0)}else b.Ic(!0,0,6);this.Lc.la(this)}},dispose:function(){var a=this.ua,a=null!=t.position?a.H("position"):a.h.position;null!=a&&(a.Gf&&a.R.dispose(),a=this.ua,null!=t.position?a.C("position",null):a.h.position=null);null!=
this.wa&&(a=this.wa,a.ia--,0==a.ia&&this.f.c.b.deleteBuffer(a.buffer),this.wa=null);null!=this.ek&&(this.ek.dispose(),this.ek=null);this.f.Jg.splice(this.f.Jg.indexOf(this),1);this.Nb.la(this);this.Nb.clear();this.Lc.clear();this.sc.clear()},l:bg};var cg=J.BABYLON.LensFlare=function(){};q["com.babylonhx.lensflare.LensFlare"]=cg;cg.i=["com","babylonhx","lensflare","LensFlare"];cg.prototype={l:cg};var dg=J.BABYLON.LensFlareSystem=function(){this.Vp=!0;this.ua=new W;this.tb=268435455;this.od=0;this.Kf=
300;this.yB=[]};q["com.babylonhx.lensflare.LensFlareSystem"]=dg;dg.i=["com","babylonhx","lensflare","LensFlareSystem"];dg.prototype={MH:function(a){var b=null!=this.ii.Ci?this.ii.Ci():this.ii.position,c=new r;c.a[0]=1;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=0;c.a[5]=1;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=1;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=1;var d=this.f.sb,e=a.width,f=a.height,g=ba.Ra[0];r.aa(e/2,0,0,0,-f/2,0,0,0,1,a.x+e/2,f/2+a.y,0,g);e=ba.Ra[1];c.qa(d,e.a,0);e.qa(g,e.a,0);var c=
new n(0,0,0),d=b.x,g=b.y,b=b.z,e=e.a,f=d*e[1]+g*e[5]+b*e[9]+e[13],h=d*e[2]+g*e[6]+b*e[10]+e[14],k=d*e[3]+g*e[7]+b*e[11]+e[15];c.x=(d*e[0]+g*e[4]+b*e[8]+e[12])/k;c.y=f/k;c.z=h/k;b=c;this.lh=b.x;this.mh=b.y;g=null!=this.ii.Ci?this.ii.Ci():this.ii.position;e=this.f.Aa;b=new n(0,0,0);c=g.x;d=g.y;g=g.z;e=e.a;f=c*e[1]+d*e[5]+g*e[9]+e[13];h=c*e[2]+d*e[6]+g*e[10]+e[14];k=c*e[3]+d*e[7]+g*e[11]+e[15];b.x=(c*e[0]+d*e[4]+g*e[8]+e[12])/k;b.y=f/k;b.z=h/k;0<this.od&&(a.x-=this.od,a.y-=this.od,a.width+=2*this.od,
a.height+=2*this.od,b.x+=this.od,b.y+=this.od,this.lh+=this.od,this.mh+=this.od);return 0<b.z?!0:!1},ZF:function(){if(!this.Vp)return!1;var a=null!=this.ii.Ci?this.ii.Ci():this.ii.position,b=this.f.L.Dh(),b=new n(a.x-b.x,a.y-b.y,a.z-b.z),a=Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z);b.normalize();b=new Na(this.f.L.Dh(),b);b=this.f.PK(b,this.ZO,!0);return b.uf?b.Sb>a:!0},hb:function(){if(!this.s.Nc)return!1;var a=this.f.c,b=this.f.L.viewport,c=a.Wb(!0),d=a.Lb(!0),b=new wd(b.x*c,b.y*d,b.width*c,b.height*d);
if(!this.MH(b)||!this.ZF())return!1;d=c=0;this.lh<this.Kf+b.x?c=this.Kf+b.x-this.lh:this.lh>b.x+b.width-this.Kf?c=this.lh-b.x-b.width+this.Kf:c=0;this.mh<this.Kf+b.y?d=this.Kf+b.y-this.mh:this.mh>b.y+b.height-this.Kf?d=this.mh-b.y-b.height+this.Kf:d=0;c=(c>d?c:d)-this.od;c>this.Kf&&(c=this.Kf);c=1-c/this.Kf;if(0>c)return!1;1<c&&(c=1);0<this.od&&(b.x+=this.od,b.y+=this.od,b.width-=2*this.od,b.height-=2*this.od,this.lh-=this.od,this.mh-=this.od);var d=b.x+b.width/2,e=b.y+b.height/2,f=d-this.lh,g=e-
this.mh,h=this.s,k=h.zd;a.vc!=k&&(a.b.useProgram(k),a.vc=k);a.Ff=h;null!=h.Tc&&h.Tc(h);h=a.Dg?1029:1028;0==a.G.Sf()&&a.G.Fg()==h||a.G.fg(!1);a.G.Qh(0);a.G.Re(!1);6!=a.bb&&(a.J.Ya(1,1,0,1),a.J.za(!0),a.G.vb(!1),a.bb=6);var h=this.ua,k=this.wa,l=this.s;if(a.qb!=h||a.Qb!=l){a.qb=h;a.Qb=l;p.sa=l.we;for(var m=0,w=p.sa.length;m<w;){var C=m++;p.g=l.sa[C];0<=p.g&&(C=p.sa[C],p.F=null!=t[C]?h.H(C):h.h[C],null==p.F?a.na[p.g]&&(a.b.disableVertexAttribArray(p.g),a.na[p.g]=!1):(a.na[p.g]||(a.b.enableVertexAttribArray(p.g),
a.na[p.g]=!0),C=p.F.R.R,a.vertexAttribPointer(C,p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(a.T.Kc.vertexAttribDivisorANGLE(p.g,1),a.ad.push(p.g),a.td.push(C))))}}null!=k&&a.kb!=k&&(a.kb=k,a.V.get(34963)!=k&&(a.b.bindBuffer(34963,null==k?null:k.buffer),a.V.set(34963,null==k?null:k)),a.Ud=k.Sc);h=0;for(k=this.yB.length;h<k;){var l=h++,l=this.yB[l],m=l.size,w=l.size*a.ll(this.f.L,!0),C=(d-f*l.position)/b.width*2-1,u=1-(e-g*l.position)/b.height*2,n=new r;n.a[0]=m/2;n.a[1]=0;n.a[2]=0;n.a[3]=0;n.a[4]=
0;n.a[5]=w/2;n.a[6]=0;n.a[7]=0;n.a[8]=0;n.a[9]=0;n.a[10]=1;n.a[11]=0;n.a[12]=C;n.a[13]=u;n.a[14]=0;n.a[15]=1;m=n;C=this.s;C.Wa("viewportMatrix",m)&&(w=C.c,C=C.u.get("viewportMatrix"),w.b.uniformMatrix4fv(C,!1,m.a));this.s.Hb("textureSampler",l.ek);m=this.s;w=l.color.r*c;C=l.color.v*c;l=l.color.m*c;m.Oa("color",w,C,l,1)&&m.c.Ub(m.u.get("color"),w,C,l,1);a.Ic(!0,0,6)}a.G.Re(!0);0!=a.bb&&(a.J.za(!1),a.G.vb(!0),a.bb=0);return!0},l:dg};var Ea=J.BABYLON.Light=function(a,b){this.om=[];this.hm=[];this.Mn=
this.sv=0;this.Dj=[];this.Jj=[];this.Xn=0;this.Wv=Infinity;this.qr=1;this.as=new L(1,1,1);this.Gu=new L(1,1,1);fa.call(this,a,b);this.nn="LIGHT";b.gH(this)};q["com.babylonhx.lights.Light"]=Ea;Ea.i=["com","babylonhx","lights","Light"];Ea.Cg=function(a,b,c){switch(a){case 0:return function(){return new $d(b,new n(0,0,0),c)};case 1:return function(){return new Hd(b,new n(0,0,0),c)};case 2:return function(){var a=new n(0,0,0);return new bc(b,a,new n(0,0,0),0,0,c)};case 3:return function(){return new Lc(b,
new n(0,0,0),c)}}return null};Ea.ab=function(a,b){var c=cf.ab(Ea.Cg(a.type,a.name,b),a,b);null!=a.qI&&(c.hm=a.qI);null!=a.cJ&&(c.om=a.cJ);null!=a.Fl&&(c.Cz=a.Fl);if(null!=a.Xa){for(var d=0,e=a.Xa.length;d<e;){var f=d++;c.Xa.push(Hb.ab(a.Xa[f]))}fa.aa(c,a)}null!=a.nu&&1==a.nu&&(d=a.QN,b.Fq(c,a.Oz,a.Qz,a.Pz,null!=d?d:1));return c};Ea.U=fa;Ea.prototype=F(fa.prototype,{fv:function(){return this.nn},fr:function(){return this.Tt},Yi:function(){},mm:function(){var a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=
0;a.a[4]=0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=1;return a},va:function(){this.ud=this.f.Pa;var a=this.mm();if(null!=this.ca&&null!=this.ca.va()){if(null==this.xt){var b=new r;b.a[0]=1;b.a[1]=0;b.a[2]=0;b.a[3]=0;b.a[4]=0;b.a[5]=1;b.a[6]=0;b.a[7]=0;b.a[8]=0;b.a[9]=0;b.a[10]=1;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0;b.a[15]=1;this.xt=b}a.qa(this.ca.va(),this.xt.a,0);this.Wm=this.ca.ud;return this.xt}return a},dispose:function(){null!=
this.Tt&&(this.Tt.dispose(),this.Tt=null);this.f.Ql(this);this.f.nL(this);fa.prototype.dispose.call(this)},l:Ea,ha:F(fa.prototype.ha,{fv:"get_type"})});var mc=J.BABYLON.IShadowLight=function(){};q["com.babylonhx.lights.IShadowLight"]=mc;mc.i=["com","babylonhx","lights","IShadowLight"];mc.prototype={l:mc};var Hd=J.BABYLON.DirectionalLight=function(a,b,c){this.Qm=Infinity;this.Rm=this.Sm=-Infinity;this.Hk=Infinity;this.pH=!0;this.Xr=.5;Ea.call(this,a,c);this.nn="DIRLIGHT";this.direction=b;this.position=
new n(-1*b.x,-1*b.y,-1*b.z)};q["com.babylonhx.lights.DirectionalLight"]=Hd;Hd.i=["com","babylonhx","lights","DirectionalLight"];Hd.xb=[mc];Hd.U=Ea;Hd.prototype=F(Ea.prototype,{kw:function(a,b,c){var d=this.f.L;if(this.pH||Infinity==this.Hk){var e,f;this.Hk=Infinity;this.Sm=this.Rm=-Infinity;this.Qm=Infinity;for(var g=0,h=c.length;g<h;){var k=g++,k=c[k];if(null!=k&&(k=k.fd(),null!=k))for(var k=k.zc,l=0,m=k.jg.length;l<m;){f=l++;var w=k.jg[f];f=w.x;e=w.y;var n=w.z,u=b.a,w=f*u[1]+e*u[5]+n*u[9]+u[13],
y=f*u[3]+e*u[7]+n*u[11]+u[15];f=(f*u[0]+e*u[4]+n*u[8]+u[12])/y;e=w/y;f<this.Hk&&(this.Hk=f);e<this.Qm&&(this.Qm=e);f>this.Rm&&(this.Rm=f);e>this.Sm&&(this.Sm=e)}}}b=this.Rm-this.Hk;c=this.Sm-this.Qm;r.Rj(this.Hk-b*this.Xr,this.Rm+b*this.Xr,this.Qm-c*this.Xr,this.Sm+c*this.Xr,-d.Fb,d.Fb,a)},Do:function(){return!0},Kv:function(){return!0},Jv:function(){return!1},Xu:function(){return this.direction},En:function(){if(null!=this.ca&&null!=(mb=this.ca,B(mb,mb.va))){null==this.$d&&(this.$d=new n(0,0,0));
var a=this.position,b=this.ca.va(),c=this.$d,d=a.x,e=a.y,a=a.z,b=b.a,f=d*b[1]+e*b[5]+a*b[9]+b[13],g=d*b[2]+e*b[6]+a*b[10]+b[14],h=d*b[3]+e*b[7]+a*b[11]+b[15];c.x=(d*b[0]+e*b[4]+a*b[8]+b[12])/h;c.y=f/h;c.z=g/h;return!0}return!1},Yi:function(a,b){if(null!=this.ca&&null!=(mb=this.ca,B(mb,mb.va))){null==this.Td&&(this.Td=new n(0,0,0));var c=this.direction,d=this.ca.va(),e=this.Td;e.x=c.x*d.a[0]+c.y*d.a[4]+c.z*d.a[8];e.y=c.x*d.a[1]+c.y*d.a[5]+c.z*d.a[9];e.z=c.x*d.a[2]+c.y*d.a[6]+c.z*d.a[10];c=this.Td.x;
d=this.Td.y;e=this.Td.z;a.Oa(b,c,d,e,1)&&a.c.Ub(a.u.get(b),c,d,e,1)}else c=this.direction.x,d=this.direction.y,e=this.direction.z,a.Oa(b,c,d,e,1)&&a.c.Ub(a.u.get(b),c,d,e,1)},mm:function(){if(null==this.Ea){var a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=1;this.Ea=a}r.aa(1,0,0,0,1,0,0,0,1,this.position.x,this.position.y,this.position.z,this.Ea);return this.Ea},l:Hd});var Lc=J.BABYLON.HemisphericLight=
function(a,b,c){this.TI=new L(0,0,0);Ea.call(this,a,c);this.nn="HEMILIGHT";this.direction=b};q["com.babylonhx.lights.HemisphericLight"]=Lc;Lc.i=["com","babylonhx","lights","HemisphericLight"];Lc.U=Ea;Lc.prototype=F(Ea.prototype,{fr:function(){return null},Yi:function(a,b,c){var d=this.direction,e=new n(0,0,0);e.x=d.x;e.y=d.y;e.z=d.z;e.normalize();Lc.ya=e;var d=Lc.ya.x,e=Lc.ya.y,f=Lc.ya.z;a.Oa(b,d,e,f,0)&&a.c.Ub(a.u.get(b),d,e,f,0);b=this.TI.scale(this.qr);a.xe(c,b.r,b.v,b.m)&&(d=a.c,a=a.u.get(c),
d.b.uniform3f(a,b.r,b.v,b.m))},mm:function(){if(null==this.Ea){var a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=1;this.Ea=a}return this.Ea},l:Lc});var $d=J.BABYLON.PointLight=function(a,b,c){Ea.call(this,a,c);this.nn="POINTLIGHT";this.position=b};q["com.babylonhx.lights.PointLight"]=$d;$d.i=["com","babylonhx","lights","PointLight"];$d.xb=[mc];$d.U=Ea;$d.prototype=F(Ea.prototype,{En:function(){if(null!=
this.ca&&null!=this.ca.va()){null==this.$d&&(this.$d=new n(0,0,0));var a=this.position,b=this.ca.va(),c=this.$d,d=a.x,e=a.y,a=a.z,b=b.a,f=d*b[1]+e*b[5]+a*b[9]+b[13],g=d*b[2]+e*b[6]+a*b[10]+b[14],h=d*b[3]+e*b[7]+a*b[11]+b[15];c.x=(d*b[0]+e*b[4]+a*b[8]+b[12])/h;c.y=f/h;c.z=g/h;return!0}return!1},Yi:function(a,b){if(null!=this.ca&&null!=this.ca.va()){this.En();var c=this.$d.x,d=this.$d.y,e=this.$d.z}else c=this.position.x,d=this.position.y,e=this.position.z;a.Oa(b,c,d,e,0)&&a.c.Ub(a.u.get(b),c,d,e,0)},
Jv:function(){return!0},Do:function(){return!1},Kv:function(){return!1},Xu:function(a){switch(a){case 0:return new n(1,0,0);case 1:return new n(-1,0,0);case 2:return new n(0,-1,0);case 3:return new n(0,1,0);case 4:return new n(0,0,1);case 5:return new n(0,0,-1)}return new n(0,0,0)},kw:function(a){var b=this.f.L;r.Ag(Math.PI/2,1,b.Tb,b.Fb,a)},mm:function(){if(null==this.Ea){var a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=
0;a.a[13]=0;a.a[14]=0;a.a[15]=1;this.Ea=a}r.aa(1,0,0,0,1,0,0,0,1,this.position.x,this.position.y,this.position.z,this.Ea);return this.Ea},l:$d});var bc=J.SpotLight=function(a,b,c,d,e,f){Ea.call(this,a,f);this.nn="SPOTLIGHT";this.position=b;this.direction=c;this.Cd=d;this.Mu=e};q["com.babylonhx.lights.SpotLight"]=bc;bc.i=["com","babylonhx","lights","SpotLight"];bc.xb=[mc];bc.U=Ea;bc.prototype=F(Ea.prototype,{kw:function(a){var b=this.f.L;r.Ag(this.Cd,1,b.Tb,b.Fb,a)},Jv:function(){return!1},Do:function(){return!0},
Kv:function(){return!1},Xu:function(){return this.direction},En:function(){if(null!=this.ca&&null!=this.ca.va()){null==this.$d&&(this.$d=new n(0,0,0));var a=this.position,b=this.ca.va(),c=this.$d,d=a.x,e=a.y,a=a.z,b=b.a,f=d*b[1]+e*b[5]+a*b[9]+b[13],g=d*b[2]+e*b[6]+a*b[10]+b[14],h=d*b[3]+e*b[7]+a*b[11]+b[15];c.x=(d*b[0]+e*b[4]+a*b[8]+b[12])/h;c.y=f/h;c.z=g/h;return!0}return!1},Yi:function(a,b,c){var d;if(null!=this.ca&&null!=this.ca.va()){null==this.Td&&(this.Td=new n(0,0,0));this.En();var e=this.direction;
d=this.ca.va();var f=this.Td;f.x=e.x*d.a[0]+e.y*d.a[4]+e.z*d.a[8];f.y=e.x*d.a[1]+e.y*d.a[5]+e.z*d.a[9];f.z=e.x*d.a[2]+e.y*d.a[6]+e.z*d.a[10];e=this.$d.x;d=this.$d.y;var f=this.$d.z,g=this.Mu;a.Oa(b,e,d,f,g)&&a.c.Ub(a.u.get(b),e,d,f,g);b=this.Td;e=new n(0,0,0);e.x=b.x;e.y=b.y;e.z=b.z}else e=this.position.x,d=this.position.y,f=this.position.z,g=this.Mu,a.Oa(b,e,d,f,g)&&a.c.Ub(a.u.get(b),e,d,f,g),b=this.direction,e=new n(0,0,0),e.x=b.x,e.y=b.y,e.z=b.z;e.normalize();d=e;b=d.x;e=d.y;d=d.z;f=Math.cos(.5*
this.Cd);a.Oa(c,b,e,d,f)&&a.c.Ub(a.u.get(c),b,e,d,f)},mm:function(){if(null==this.Ea){var a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=1;this.Ea=a}r.aa(1,0,0,0,1,0,0,0,1,this.position.x,this.position.y,this.position.z,this.Ea);return this.Ea},l:bc});var Bb=J.BABYLON.ShadowGenerator=function(){this.Ms=this.Nx=0;var a=new r;a.a[0]=0;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=0;a.a[6]=0;a.a[7]=
0;a.a[8]=0;a.a[9]=0;a.a[10]=0;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=0;this.sb=a;a=new r;a.a[0]=0;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=0;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=0;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=0;this.Va=a;a=new r;a.a[0]=0;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=0;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=0;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=0;this.Aa=a;this.xF=0;this.Dk=new n(0,0,0);this.$E=5E-5;this.yH=2;this.JF=Bb.rE};q["com.babylonhx.lights.shadows.ShadowGenerator"]=
Bb;Bb.i=["com","babylonhx","lights","shadows","ShadowGenerator"];Bb.prototype={LA:function(){return this.$E},rl:function(){return this.JF},gB:function(){return this.rl()==Bb.Xz?this.li.Do():!1},fB:function(){return this.rl()!=Bb.tE?this.li.Do()?!1:this.rl()!=Bb.Xz?this.rl()==Bb.Sz:!0:!0},dB:function(){return this.rl()==Bb.Sz?this.li.Do():!1},OI:function(){return null!=this.Ut?this.Ut:this.Ok},RI:function(){var a=this.f;if(this.rF==a.Pa&&this.Nx==this.Ms)return this.sb;this.rF=a.Pa;this.Nx=this.Ms;
var a=this.li.position,b=this.li.Xu(this.Ms),c=this.Dk;c.x=b.x;c.y=b.y;c.z=b.z;c.normalize();b=this.Dk;1==Math.abs(0*b.x+1*b.y+0*b.z)&&(this.Dk.z=1E-13);this.li.En()&&(a=this.li.$d);this.li.Kv()||null==this.rx||null==this.qx?b=!0:(b=this.rx,b=!(null!=b&&a.x==b.x&&a.y==b.y&&a.z==b.z));b?b=!0:(b=this.Dk,c=this.qx,b=!(null!=c&&b.x==c.x&&b.y==c.y&&b.z==c.z));b&&(this.rx=new n(a.x,a.y,a.z),b=this.Dk,this.qx=new n(b.x,b.y,b.z),b=this.Dk,r.$c(a,new n(a.x+b.x,a.y+b.y,a.z+b.z),new n(0,1,0),this.Aa),this.li.kw(this.Va,
this.Aa,this.Ok.lc),this.Aa.qa(this.Va,this.sb.a,0));return this.sb},dispose:function(){this.Ok.dispose();null!=this.Ut&&this.Ut.dispose();null!=this.gm&&this.gm.dispose();null!=this.aF&&this.aF.dispose()},l:Bb,ha:{dB:"get_useBlurVarianceShadowMap",fB:"get_usePoissonSampling",gB:"get_useVarianceShadowMap",rl:"get_filter",LA:"get_bias"}};var eg=J.BABYLON.SceneLoader=function(){};q["com.babylonhx.loading.SceneLoader"]=eg;eg.i=["com","babylonhx","loading","SceneLoader"];q["js.Boot"]=v;v.i=["js","Boot"];
v.Bh=function(a){if(a instanceof Array&&null==a.jb)return Array;var b=a.l;if(null!=b)return b;a=v.oC(a);return null!=a?v.hI(a):null};v.Ve=function(a,b){if(null==a)return"null";if(5<=b.length)return"<...>";var c=typeof a;"function"==c&&(a.i||a.$i)&&(c="object");switch(c){case "function":return"<function>";case "object":if(a instanceof Array){if(a.jb){if(2==a.length)return a[0];c=a[0]+"(";b+="\t";for(var d=2,e=a.length;d<e;)var f=d++,c=2!=f?c+(","+v.Ve(a[f],b)):c+v.Ve(a[f],b);return c+")"}c=a.length;
d="[";b+="\t";for(e=0;e<c;)f=e++,d+=(0<f?",":"")+v.Ve(a[f],b);return d+"]"}try{d=a.toString}catch(g){return"???"}if(null!=d&&d!=Object.toString&&"function"==typeof d&&(c=a.toString(),"[object Object]"!=c))return c;c=null;d="{\n";b+="\t";e=null!=a.hasOwnProperty;for(c in a)e&&!a.hasOwnProperty(c)||"prototype"==c||"__class__"==c||"__super__"==c||"__interfaces__"==c||"__properties__"==c||(2!=d.length&&(d+=", \n"),d+=b+c+" : "+v.Ve(a[c],b));b=b.substring(1);return d+("\n"+b+"}");case "string":return a;
default:return String(a)}};v.Po=function(a,b){if(null==a)return!1;if(a==b)return!0;var c=a.xb;if(null!=c)for(var d=0,e=c.length;d<e;){var f=d++,f=c[f];if(f==b||v.Po(f,b))return!0}return v.Po(a.U,b)};v.D=function(a,b){if(null==b)return!1;switch(b){case Array:return a instanceof Array?null==a.jb:!1;case xg:return"boolean"==typeof a;case Mg:return!0;case yg:return"number"==typeof a;case qg:return"number"==typeof a?(a|0)===a:!1;case String:return"string"==typeof a;default:if(null!=a)if("function"==typeof b){if(a instanceof
b||v.Po(v.Bh(a),b))return!0}else{if("object"==typeof b&&v.$H(b)&&a instanceof b)return!0}else return!1;return b==Ng&&null!=a.i||b==Og&&null!=a.$i?!0:a.jb==b}};v.g=function(a,b){if(v.D(a,b))return a;throw new ja("Cannot cast "+na.Pb(a)+" to "+na.Pb(b));};v.oC=function(a){a=v.tI.call(a).slice(8,-1);return"Object"==a||"Function"==a||"Math"==a||"JSON"==a?null:a};v.$H=function(a){return null!=v.oC(a)};v.hI=function(a){return Nf[a]};var Je=J.BABYLON.IGetSetVerticesData=function(){};q["com.babylonhx.mesh.IGetSetVerticesData"]=
Je;Je.i=["com","babylonhx","mesh","IGetSetVerticesData"];Je.prototype={l:Je};var qc=J.BABYLON.Geometry=function(a,b,c,d,e){null==d&&(d=!1);this.nz=0;this.bc=[];this.Ma=this.yg=0;this.id=a;this.c=b.c;this.wc=[];this.f=b;this.ua=new W;this.bh=[];null!=c?this.GL(c,d):this.yg=0;null!=e&&(v.D(e,pc)&&(this.WC(new K(0,v.g(e,pc).cv())),this.Vl()),this.dc(e),e.Wd(!0))};q["com.babylonhx.mesh.Geometry"]=qc;qc.i=["com","babylonhx","mesh","Geometry"];qc.xb=[Je];qc.ya=function(a,b){var c=b.f,d=a.nO;if(null!=d)d=
c.FA(d),null!=d&&d.dc(b);else if(null!=a.Na&&null!=a.gb&&null!=a.pb){b.Ga("position",a.Na,!1);b.Ga("normal",a.gb,!1);null!=a.zb&&b.Ga("uv",a.zb,!1);null!=a.CM&&b.Ga("uv2",a.CM,!1);null!=a.DM&&b.Ga("uv3",a.DM,!1);null!=a.EM&&b.Ga("uv4",a.EM,!1);null!=a.FM&&b.Ga("uv5",a.FM,!1);null!=a.GM&&b.Ga("uv6",a.GM,!1);null!=a.ke&&b.Ga("color",ca.Vc(a.ke,a.Na.length/3|0),!1);if(null!=a.Kd)if(a.Kd.jt)a.Kd.jt=null,b.Ga("matricesIndices",a.Kd,!1);else{for(var d=[],e=0,f=a.Kd.length;e<f;){var g=e++,g=a.Kd[g];d.push(g&
255);d.push((g&65280)>>8);d.push((g&16711680)>>16);d.push(g>>24)}b.Ga("matricesIndices",d,!1)}if(null!=a.oe)if(a.oe.jt)a.Kd.jt=null,b.Ga("matricesIndicesExtra",a.oe,!1);else{d=[];e=0;for(f=a.oe.length;e<f;)g=e++,g=a.oe[g],d.push(g&255),d.push((g&65280)>>8),d.push((g&16711680)>>16),d.push(g>>24);b.Ga("matricesIndicesExtra",d,!1)}null!=a.Wf&&b.Ga("matricesWeights",a.Wf,!1);null!=a.Xf&&b.Ga("matricesWeightsExtra",a.Xf,!1);b.$j(a.pb)}if(null!=a.Ha)for(b.Ha=[],d=0,e=a.Ha.length;d<e;)f=d++,f=a.Ha[f],new Rb(f.wf,
f.te,f.Ug,f.Xb,f.Xd,b);b.lz&&(b.OH(),b.lz=!1);b.Wd(!0);null!=c.$u()&&c.$u().hu(b)};qc.prototype={MA:function(){return this.Es},WC:function(a){var b;null!=this.Es?(b=this.Es,b=null!=a&&b.x==a.x?b.y==a.y:!1):b=!1;if(b)return a;this.Es=new K(a.x,a.y);this.Vl();return a},GL:function(a,b){null==b&&(b=!1);a.lH(this,b);this.Dr()},Ga:function(a,b,c,d){null==c&&(c=!1);a=new Id(this.c,b,a,c,0==this.wc.length,d);this.ak(a)},ak:function(a){var b=a.aG,c=this.ua;null!=(null!=t[b]?c.H(b):c.h[b])&&(c=this.ua,c=null!=
t[b]?c.H(b):c.h[b],c.Gf&&c.R.dispose());c=this.ua;null!=t[b]?c.C(b,a):c.h[b]=a;if("position"==b){c=a.R.qg;a=a.Bd;this.yg=c.length/a|0;this.Vl(c,a);a=this.wc;for(var c=0,d=a.length;c<d;){var e=c++,e=a[e];e.nh=null;e.ra=new xb(this.ah.Gb,this.ah.Mb);e.Js();e.Wd(!0)}}this.Dr(b)},Yh:function(a,b,c){null==c&&(c=!1);var d=this.Ch(a);null!=d&&(d.create(b),"position"==a&&(this.yg=b.length/d.Bd,c&&this.Vl(b),this.pM(c,b)),this.Dr(a))},pM:function(a,b){a&&this.Vl(b);for(var c=this.wc,d=0,e=c.length;d<e;){var f=
d++,f=c[f];f.nh=null;if(a){f.ra=new xb(this.ah.Gb,this.ah.Mb);for(var g=0,h=f.Ha.length;g<h;){var k=g++;f.Ha[k].Xv()}}}},Qf:function(){return 1!=this.Ma&&0!=this.Ma?0:this.yg},Ba:function(a,b){null==b&&(b=!1);var c=this.Ch(a);if(null==c)return null;c=c.R.qg;if(b&&1!=this.wc.length){for(var d=[],e=0,f=c.length;e<f;){var g=e++;d.push(c[g])}return d}return c},Ch:function(a){if(1!=this.Ma&&0!=this.Ma)return null;var b=this.ua;return null!=t[a]?b.H(a):b.h[a]},Pn:function(){return 1!=this.Ma&&0!=this.Ma?
null:this.ua},fb:function(a){if(null==this.ua)return null!=this.bc?-1!=this.bc.indexOf(a):!1;var b=this.ua;return null!=(null!=t[a]?b.H(a):b.h[a])},Zu:function(){var a=[];if(null==this.ua&&null!=this.bc)for(var b=0,c=this.bc;b<c.length;){var d=c[b];++b;a.push(d)}else for(b=this.ua.keys();b.Ca();)c=b.next(),a.push(c);return a},$j:function(a,b){null==b&&(b=-1);if(null!=this.wa){var c=this.wa;c.ia--;0==c.ia&&this.c.b.deleteBuffer(c.buffer)}this.bh=a;if(0!=this.wc.length&&null!=this.bh){var c=this.c,
d=this.bh,e=c.b.createBuffer(),e=new ub(e);c.V.get(34963)!=e&&(c.b.bindBuffer(34963,null==e?null:e.buffer),c.V.set(34963,null==e?null:e));var f=null,g=!1;if(c.T.Ul){for(var h=0,k=d.length;h<k;){var l=h++;if(65535<d[l]){g=!0;break}}g?f=new Int32Array(d):f=new Int16Array(d)}else f=new Int16Array(d);c.b.bufferData(34963,f,35044);null!=c.V.get(34963)&&(c.b.bindBuffer(34963,null),c.V.set(34963,null));c.kb=null;e.ia=1;e.Sc=g;this.wa=e}-1!=b&&(this.yg=b);c=this.wc;d=0;for(e=c.length;d<e;)f=d++,c[f].Js();
this.Dr()},On:function(){return 1!=this.Ma&&0!=this.Ma?0:this.bh.length},Bc:function(a){null==a&&(a=!1);if(1!=this.Ma&&0!=this.Ma)return null;var b=this.bh;if(a&&1!=this.wc.length){a=[];for(var c=0,d=b.length;c<d;){var e=c++;a.push(b[e])}return a}return b},ml:function(){return 1!=this.Ma&&0!=this.Ma?null:this.wa},Kr:function(a,b){null==b&&(b=!1);var c=this.wc,d=c.indexOf(a);if(-1!=d){for(var e=this.ua.keys();e.Ca();){var f=e.next(),g=this.ua,f=null!=t[f]?g.H(f):g.h[f];f.Gf&&f.R.dispose()}null!=this.wa?
(e=this.wa,e.ia--,0==e.ia?(this.c.b.deleteBuffer(e.buffer),e=!0):e=!1):e=!1;e&&(this.wa=null);c.splice(d,1);a.xa=null;0==c.length&&b&&this.dispose()}},dc:function(a){if(a.xa!=this){var b=a.xa;null!=b&&b.Kr(a);b=this.wc;a.xa=this;this.f.$K(this);b.push(a);1==this.Ma||0==this.Ma?this.XE(a):a.ra=this.ra}},Vl:function(a,b){if(null==a){var c=this.ua;a=(null!=t.position?c.H("position"):c.h.position).R.qg}var c=this.yg,d=this.MA(),e=new n(Infinity,Infinity,Infinity),f=new n(-Infinity,-Infinity,-Infinity),
g;new n(0,0,0);for(var h=0;h<c;){g=h++;g=new n(a[g*b],a[g*b+1],a[g*b+2]);var k=new n(g.x,g.y,g.z);e.x<k.x&&(k.x=e.x);e.y<k.y&&(k.y=e.y);e.z<k.z&&(k.z=e.z);e=k;g=new n(g.x,g.y,g.z);f.x>g.x&&(g.x=f.x);f.y>g.y&&(g.y=f.y);f.z>g.z&&(g.z=f.z);f=g}null!=d&&(e.x-=e.x*d.x+d.y,e.y-=e.y*d.x+d.y,e.z-=e.z*d.x+d.y,f.x+=f.x*d.x+d.y,f.y+=f.y*d.x+d.y,f.z+=f.z*d.x+d.y);this.ah={Gb:e,Mb:f}},XE:function(a){for(var b=this.wc.length,c=this.ua.keys();c.Ca();){var d=c.next();if(1==b){var e=this.ua;(null!=t[d]?e.H(d):e.h[d]).create()}e=
this.ua;(null!=t[d]?e.H(d):e.h[d]).R.R.ia=b;if("position"==d){a.nh=null;null==this.ah&&(e=this.ua,this.Vl((null!=t[d]?e.H(d):e.h[d]).R.qg));a.ra=new xb(this.ah.Gb,this.ah.Mb);a.Js();a.ra=null==a.ra?new xb(a.sf(),a.sf()):a.ra;e=a.ra;d=a.me();if(!e.Bk){var f=e.zc,g=f.ea;g.x=Infinity;g.y=Infinity;g.z=Infinity;g=f.da;g.x=-Infinity;g.y=-Infinity;g.z=-Infinity;for(var h,k,l,g=0,m=f.Ab.length;g<m;){h=g++;la.g=f.jg[h];var w=f.Ab[h];h=la.g;k=w.x;l=w.y;var w=w.z,n=d.a,u=k*n[1]+l*n[5]+w*n[9]+n[13],y=k*n[2]+
l*n[6]+w*n[10]+n[14],V=k*n[3]+l*n[7]+w*n[11]+n[15];h.x=(k*n[0]+l*n[4]+w*n[8]+n[12])/V;h.y=u/V;h.z=y/V;h=la.g.x;k=la.g.y;l=la.g.z;h<f.ea.x&&(f.ea.x=h);k<f.ea.y&&(f.ea.y=k);l<f.ea.z&&(f.ea.z=l);h>f.da.x&&(f.da.x=h);k>f.da.y&&(f.da.y=k);l>f.da.z&&(f.da.z=l)}g=f.da;m=f.ea;h=f.oa;h.x=g.x+m.x;h.y=g.y+m.y;h.z=g.z+m.z;g=f.oa;g.x*=.5;g.y*=.5;g.z*=.5;g=d.a;m=f.w[0];m.x=g[0];m.y=g[1];m.z=g[2];g=d.a;m=f.w[1];m.x=g[4];m.y=g[5];m.z=g[6];g=d.a;m=f.w[2];m.x=g[8];m.y=g[9];m.z=g[10];f.Ea=d;e=e.Pc;f=Math.max;g=Math.abs;
l=e.oa;m=e.Hc;h=l.x;k=l.y;l=l.z;w=d.a;n=h*w[1]+k*w[5]+l*w[9]+w[13];u=h*w[2]+k*w[6]+l*w[10]+w[14];y=h*w[3]+k*w[7]+l*w[11]+w[15];m.x=(h*w[0]+k*w[4]+l*w[8]+w[12])/y;m.y=n/y;m.z=u/y;m=e.Eb;m.x=d.a[0]+d.a[4]+d.a[8];m.y=d.a[1]+d.a[5]+d.a[9];m.z=d.a[2]+d.a[6]+d.a[10];e.bg=f(f(g(e.Eb.x),g(e.Eb.y)),g(e.Eb.z))*e.P}a.Wk(a.me())}}if(1==b&&null!=this.bh&&0<this.bh.length){a=this.c;c=this.bh;d=a.b.createBuffer();d=new ub(d);a.V.get(34963)!=d&&(a.b.bindBuffer(34963,null==d?null:d.buffer),a.V.set(34963,null==d?null:
d));e=null;f=!1;if(a.T.Ul){g=0;for(m=c.length;g<m;)if(h=g++,65535<c[h]){f=!0;break}f?e=new Int32Array(c):e=new Int16Array(c)}else e=new Int16Array(c);a.b.bufferData(34963,e,35044);null!=a.V.get(34963)&&(a.b.bindBuffer(34963,null),a.V.set(34963,null));a.kb=null;d.ia=1;d.Sc=f;this.wa=d}null!=this.wa&&(this.wa.ia=b)},Dr:function(a){null!=this.qK&&this.qK(this,a)},load:function(a,b){2!=this.Ma&&(1==this.Ma||0==this.Ma?null!=b&&b():(this.Ma=2,a.qp(this)))},dispose:function(){for(var a=this.wc,b=0,c=a.length;b<
c;){var d=b++;this.Kr(a[d])}this.wc=[];for(a=this.ua.keys();a.Ca();)b=a.next(),c=this.ua,b=null!=t[b]?c.H(b):c.h[b],b.Gf&&b.R.dispose();this.ua=new W;this.yg=0;null!=this.wa&&(a=this.wa,a.ia--,0==a.ia&&this.c.b.deleteBuffer(a.buffer));this.wa=null;this.bh=[];this.Ma=0;this.Os=this.cl=null;this.bc=[];this.ra=null;this.f.lL(this)},yu:function(a){for(var b=new I,c=this.Bc(),d=0,e=c.length;d<e;){var f=d++;b.pb.push(c[f])}d=c=!1;for(e=this.ua.keys();e.Ca();)f=e.next(),b.set(this.Ba(f).slice(),f),d||(c=
this.Ch(f).R.rh,d=!c);a=new qc(a,this.f,b,c,null);a.Ma=this.Ma;a.cl=this.cl;a.Os=this.Os;b=0;for(c=this.bc;b<c.length;)d=c[b],++b,a.bc=null!=a.bc?a.bc:[],a.bc.push(d);a.ra=new xb(this.ah.Gb,this.ah.Mb);return a},l:qc,ha:{WC:"set_boundingBias",MA:"get_boundingBias"}};var ka=J.BABYLON.AbstractMesh=function(a,b){this.$F=this.$t=!1;this.eh=[];this.Pa=0;var c=new r;c.a[0]=1;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=0;c.a[5]=1;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=1;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=
0;c.a[15]=1;this.nj=c;this.zm=!1;c=new r;c.a[0]=0;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=0;c.a[5]=0;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=0;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=0;this.Gx=c;c=new r;c.a[0]=0;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=0;c.a[5]=0;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=0;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=0;this.Hx=c;this.ws=new n(0,0,0);var d=Math.PI,c=new r,e=Math.sin(d),d=Math.cos(d);c.a[5]=1;c.a[15]=1;c.a[0]=d;c.a[2]=-e;c.a[8]=e;c.a[10]=d;c.a[1]=
0;c.a[3]=0;c.a[4]=0;c.a[6]=0;c.a[7]=0;c.a[9]=0;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;this.BG=c;c=new r;c.a[0]=0;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=0;c.a[5]=0;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=0;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=0;this.Ea=c;c=new r;c.a[0]=0;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=0;c.a[5]=0;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=0;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=0;this.mi=c;this.Ju=new ca(1,0,0,1);this.Vq=1;this.tA=new n(0,0,0);this.Ai=new n(.5,
1,.5);this.Aq=this.Bx=!1;this.tb=268435455;this.Jw=this.Iw=this.Hw=!0;this.Me=4;this.to=1;this.Lw=this.sh=this.nf=!0;this.ul=!1;this.Pv=.5;this.Qv=new L(1,0,0);this.$v=!1;this.outlineWidth=.02;this.outlineColor=new L(1,0,0);this.Ty=this.Lr=!1;this.dg=0;this.ty=this.zo=this.Ao=this.qB=!1;this.hd=!0;this.Ji=!1;this.Yk=Infinity;this.Bz=1;this.De=new n(1,1,1);this.Kb=new n(0,0,0);this.Dd=ka.D;this.position=new n(0,0,0);this.hA=!0;this.XB=new R;this.nK=new R;this.mK=new R;this.Nb=new R;fa.call(this,a,
b);b.hu(this);Object.defineProperty(this,"visibility",{get:this.Ei,set:this.Vr});Object.defineProperty(this,"isPickable",{get:this.Di,set:this.Rr});Object.defineProperty(this,"skeleton",{get:this.gd,set:this.Tr});Object.defineProperty(this,"material",{get:this.Gg,set:this.ld});Object.defineProperty(this,"receiveShadows",{get:this.Gj,set:this.Sr});Object.defineProperty(this,"positions",{get:this.mr,set:this.GP});Object.defineProperty(this,"useBones",{get:this.Hg,set:this.HP});Object.defineProperty(this,
"isBlocked",{get:this.hr,set:this.EP});Object.defineProperty(this,"worldMatrixFromCache",{get:this.me});Object.defineProperty(this,"absolutePosition",{get:this.sf});Object.defineProperty(this,"isWorldMatrixFrozen",{get:this.wO})};q["com.babylonhx.mesh.AbstractMesh"]=ka;ka.i=["com","babylonhx","mesh","AbstractMesh"];ka.xb=[ze];ka.U=fa;ka.prototype=F(fa.prototype,{Ei:function(){return this.Bz},Vr:function(a){return this.Bz=a},Di:function(){return this.ty},Rr:function(a){return this.ty=a},Gg:function(){return this.Ce},
ld:function(a){return this.Ce=a},Gj:function(){return this.Ty},Sr:function(a){return this.Ty=a},mr:function(){return this.nh},Hg:function(){return null!=this.gd()&&this.f.rw&&this.fb("matricesIndices")?this.fb("matricesWeights"):!1},gd:function(){return this.cn},Tr:function(a){null!=this.cn&&this.cn.Pi&&this.cn.VG(this);null!=a&&a.Pi&&a.sG(this);this.cn=a;null==this.cn&&(this.ee=null);return a},Pl:function(a){this.Ad=a;var b;null!=a?(b=this.Kb,b=0<Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z)):b=!1;b&&(b=this.Kb,
b.x=0,b.y=0,b.z=0);return a},rO:function(){return this.At},hr:function(){return!1},er:function(){return this},Qf:function(){return 0},Bc:function(){return null},Ba:function(){return null},fb:function(){return!1},fd:function(){if(null!=this.Fk)return this.Fk.fd();null==this.ra&&this.WG();return this.ra},Zm:function(){},Oy:function(){},ys:function(a){this.Pa=a},va:function(){if(null!=this.Fk)return this.Fk.va();this.ud!=this.f.Pa&&this.Wd();return this.Ea},me:function(){return this.Ea},sf:function(){return this.ws},
rotate:function(a,b,c){a.normalize();if(null==this.Ad){var d=this.Kb.y,e=this.Kb.x,f=this.Kb.z,g=new da,f=.5*f,h=.5*e,e=.5*d,d=Math.sin(f),f=Math.cos(f),k=Math.sin(h),h=Math.cos(h),l=Math.sin(e),e=Math.cos(e);g.x=e*k*f+l*h*d;g.y=l*h*f-e*k*d;g.z=e*h*d-l*k*f;g.o=e*h*f+l*k*d;this.Pl(g);this.Kb=new n(0,0,0)}if(null==c||0==c)c=ka.Fa,g=Math.sin(b/2),a.normalize(),c.o=Math.cos(b/2),c.x=a.x*g,c.y=a.y*g,c.z=a.z*g,a=this.Ad,b=ka.Fa;else{if(null!=this.ca){c=this.ca.va();var g=c.a[0],d=c.a[1],e=c.a[2],f=c.a[3],
k=c.a[4],h=c.a[5],l=c.a[6],m=c.a[7],w=c.a[8],C=c.a[9],u=c.a[10],y=c.a[11],V=c.a[12],z=c.a[13],p=c.a[14],M=c.a[15];c=new r;c.a[0]=g;c.a[1]=d;c.a[2]=e;c.a[3]=f;c.a[4]=k;c.a[5]=h;c.a[6]=l;c.a[7]=m;c.a[8]=w;c.a[9]=C;c.a[10]=u;c.a[11]=y;c.a[12]=V;c.a[13]=z;c.a[14]=p;c.a[15]=M;var g=c.a[0],d=c.a[1],e=c.a[2],f=c.a[3],q=c.a[4],x=c.a[5],t=c.a[6],G=c.a[7],D=c.a[8],v=c.a[9],P=c.a[10],N=c.a[11],E=c.a[12],O=c.a[13],A=c.a[14],H=c.a[15],k=P*H-N*A,h=v*H-N*O,l=v*A-P*O,m=D*H-N*E,w=D*A-P*E,C=D*O-v*E,u=x*k-t*h+G*l,y=
-(q*k-t*m+G*w),V=q*h-x*m+G*C,z=-(q*l-x*w+t*C),p=1/(g*u+d*y+e*V+f*z),M=t*H-G*A,B=x*H-G*O,I=x*A-t*O,H=q*H-G*E,A=q*A-t*E,E=q*O-x*E,O=t*N-G*P,F=x*N-G*v,K=x*P-t*v,G=q*N-G*D,t=q*P-t*D,q=q*v-x*D;c.a[0]=u*p;c.a[4]=y*p;c.a[8]=V*p;c.a[12]=z*p;c.a[1]=-(d*k-e*h+f*l)*p;c.a[5]=(g*k-e*m+f*w)*p;c.a[9]=-(g*h-d*m+f*C)*p;c.a[13]=(g*l-d*w+e*C)*p;c.a[2]=(d*M-e*B+f*I)*p;c.a[6]=-(g*M-e*H+f*A)*p;c.a[10]=(g*B-d*H+f*E)*p;c.a[14]=-(g*I-d*A+e*E)*p;c.a[3]=-(d*O-e*F+f*K)*p;c.a[7]=(g*O-e*G+f*t)*p;c.a[11]=-(g*F-d*G+f*q)*p;c.a[15]=
(g*K-d*t+e*q)*p;g=new n(0,0,0);g.x=a.x*c.a[0]+a.y*c.a[4]+a.z*c.a[8];g.y=a.x*c.a[1]+a.y*c.a[5]+a.z*c.a[9];g.z=a.x*c.a[2]+a.y*c.a[6]+a.z*c.a[10];a=g}c=ka.Fa;g=Math.sin(b/2);a.normalize();c.o=Math.cos(b/2);c.x=a.x*g;c.y=a.y*g;c.z=a.z*g;a=ka.Fa;b=this.Ad}c=this.Ad;g=-a.x*b.z+a.y*b.o+a.z*b.x+a.o*b.y;d=a.x*b.y-a.y*b.x+a.z*b.o+a.o*b.z;e=-a.x*b.x-a.y*b.y-a.z*b.z+a.o*b.o;c.x=a.x*b.o+a.y*b.z-a.z*b.y+a.o*b.x;c.y=g;c.z=d;c.o=e},translate:function(a,b,c){var d,e=a.x*b;d=a.y*b;a=a.z*b;if(null==c||0==c){this.Wd();
c=this.mi;b=c.a[0];var f=c.a[1],g=c.a[2],h=c.a[3],k=c.a[4],l=c.a[5],m=c.a[6],w=c.a[7],C=c.a[8],u=c.a[9],y=c.a[10],V=c.a[11],z=c.a[12],p=c.a[13],M=c.a[14],q=c.a[15];c=new r;c.a[0]=b;c.a[1]=f;c.a[2]=g;c.a[3]=h;c.a[4]=k;c.a[5]=l;c.a[6]=m;c.a[7]=w;c.a[8]=C;c.a[9]=u;c.a[10]=y;c.a[11]=V;c.a[12]=z;c.a[13]=p;c.a[14]=M;c.a[15]=q;b=c.a[0];var f=c.a[1],g=c.a[2],h=c.a[3],x=c.a[4],t=c.a[5],G=c.a[6],D=c.a[7],v=c.a[8],P=c.a[9],N=c.a[10],E=c.a[11],O=c.a[12],A=c.a[13],H=c.a[14],B=c.a[15],k=N*B-E*H,l=P*B-E*A,m=P*H-
N*A,w=v*B-E*O,C=v*H-N*O,u=v*A-P*O,y=t*k-G*l+D*m,V=-(x*k-G*w+D*C),z=x*l-t*w+D*u,p=-(x*m-t*C+G*u),M=1/(b*y+f*V+g*z+h*p),q=G*B-D*H,I=t*B-D*A,F=t*H-G*A,B=x*B-D*O,H=x*H-G*O,O=x*A-t*O,A=G*E-D*N,K=t*E-D*P,L=t*N-G*P,D=x*E-D*v,G=x*N-G*v,x=x*P-t*v;c.a[0]=y*M;c.a[4]=V*M;c.a[8]=z*M;c.a[12]=p*M;c.a[1]=-(f*k-g*l+h*m)*M;c.a[5]=(b*k-g*w+h*C)*M;c.a[9]=-(b*l-f*w+h*u)*M;c.a[13]=(b*m-f*C+g*u)*M;c.a[2]=(f*q-g*I+h*F)*M;c.a[6]=-(b*q-g*B+h*H)*M;c.a[10]=(b*I-f*B+h*O)*M;c.a[14]=-(b*F-f*H+g*O)*M;c.a[3]=-(f*A-g*K+h*L)*M;c.a[7]=
(b*A-g*D+h*G)*M;c.a[11]=-(b*K-f*D+h*x)*M;c.a[15]=(b*L-f*G+g*x)*M;f=this.position;b=new n(0,0,0);b.x=f.x*c.a[0]+f.y*c.a[4]+f.z*c.a[8];b.y=f.x*c.a[1]+f.y*c.a[5]+f.z*c.a[9];b.z=f.x*c.a[2]+f.y*c.a[6]+f.z*c.a[10];e=b.x+e;d=b.y+d;a=b.z+a;this.Wd();c=this.mi;b=new n(0,0,0);b.x=e*c.a[0]+d*c.a[4]+a*c.a[8];b.y=e*c.a[1]+d*c.a[5]+a*c.a[9];b.z=e*c.a[2]+d*c.a[6]+a*c.a[10];this.position=b}else this.Wd(),c=this.ws,this.FL(new n(c.x+e,c.y+d,c.z+a))},FL:function(a){if(null!=a){var b,c,d;if(a instanceof Array&&null==
a.jb){if(3>a.length)return;b=a[0];c=a[1];d=a[2]}else b=a.x,c=a.y,d=a.z;if(null!=this.ca){a=this.ca.va();var e=a.a[0],f=a.a[1],g=a.a[2],h=a.a[3],k=a.a[4],l=a.a[5],m=a.a[6],w=a.a[7],C=a.a[8],u=a.a[9],y=a.a[10],V=a.a[11],z=a.a[12],p=a.a[13],q=a.a[14],t=a.a[15];a=new r;a.a[0]=e;a.a[1]=f;a.a[2]=g;a.a[3]=h;a.a[4]=k;a.a[5]=l;a.a[6]=m;a.a[7]=w;a.a[8]=C;a.a[9]=u;a.a[10]=y;a.a[11]=V;a.a[12]=z;a.a[13]=p;a.a[14]=q;a.a[15]=t;var e=a.a[0],f=a.a[1],g=a.a[2],h=a.a[3],x=a.a[4],v=a.a[5],G=a.a[6],D=a.a[7],A=a.a[8],
P=a.a[9],N=a.a[10],E=a.a[11],O=a.a[12],B=a.a[13],H=a.a[14],I=a.a[15],k=N*I-E*H,l=P*I-E*B,m=P*H-N*B,w=A*I-E*O,C=A*H-N*O,u=A*B-P*O,y=v*k-G*l+D*m,V=-(x*k-G*w+D*C),z=x*l-v*w+D*u,p=-(x*m-v*C+G*u),q=1/(e*y+f*V+g*z+h*p),t=G*I-D*H,F=v*I-D*B,K=v*H-G*B,I=x*I-D*O,H=x*H-G*O,O=x*B-v*O,B=G*E-D*N,L=v*E-D*P,S=v*N-G*P,D=x*E-D*A,G=x*N-G*A,x=x*P-v*A;a.a[0]=y*q;a.a[4]=V*q;a.a[8]=z*q;a.a[12]=p*q;a.a[1]=-(f*k-g*l+h*m)*q;a.a[5]=(e*k-g*w+h*C)*q;a.a[9]=-(e*l-f*w+h*u)*q;a.a[13]=(e*m-f*C+g*u)*q;a.a[2]=(f*t-g*F+h*K)*q;a.a[6]=
-(e*t-g*I+h*H)*q;a.a[10]=(e*F-f*I+h*O)*q;a.a[14]=-(e*K-f*H+g*O)*q;a.a[3]=-(f*B-g*L+h*S)*q;a.a[7]=(e*B-g*D+h*G)*q;a.a[11]=-(e*L-f*D+h*x)*q;a.a[15]=(e*S-f*G+g*x)*q;e=new n(0,0,0);a=a.a;f=b*a[1]+c*a[5]+d*a[9]+a[13];g=b*a[2]+c*a[6]+d*a[10]+a[14];h=b*a[3]+c*a[7]+d*a[11]+a[15];e.x=(b*a[0]+c*a[4]+d*a[8]+a[12])/h;e.y=f/h;e.z=g/h;this.position=e}else this.position.x=b,this.position.y=c,this.position.z=d}},Dm:function(){if(this.zm||this.Dd!=this.K.Dd||this.Dd!=ka.D||this.K.po||this.Ji)return!1;var a=this.K.position,
b=this.position;if(null==b||a.x!=b.x||a.y!=b.y||a.z!=b.z||null!=this.Ad&&(a=this.K.ub,b=this.Ad,null==b||a.x!=b.x||a.y!=b.y||a.z!=b.z||a.o!=b.o))return!1;a=this.K.rotation;b=this.Kb;if(null==b||a.x!=b.x||a.y!=b.y||a.z!=b.z)return!1;a=this.K.Ml;b=this.De;return null==b||a.x!=b.x||a.y!=b.y||a.z!=b.z?!1:!0},dh:function(){fa.prototype.dh.call(this);this.K.VO=!1;this.K.position=new n(0,0,0);this.K.Ml=new n(0,0,0);this.K.rotation=new n(0,0,0);this.K.ub=new da(0,0,0,0);this.K.Dd=-1},WG:function(){var a=
this.ra=null==this.ra?new xb(this.sf(),this.sf()):this.ra,b=this.me();if(!a.Bk){var c=a.zc,d=c.ea;d.x=Infinity;d.y=Infinity;d.z=Infinity;d=c.da;d.x=-Infinity;d.y=-Infinity;d.z=-Infinity;for(var e,f,g,d=0,h=c.Ab.length;d<h;){e=d++;la.g=c.jg[e];var k=c.Ab[e];e=la.g;f=k.x;g=k.y;var k=k.z,l=b.a,m=f*l[1]+g*l[5]+k*l[9]+l[13],w=f*l[2]+g*l[6]+k*l[10]+l[14],n=f*l[3]+g*l[7]+k*l[11]+l[15];e.x=(f*l[0]+g*l[4]+k*l[8]+l[12])/n;e.y=m/n;e.z=w/n;e=la.g.x;f=la.g.y;g=la.g.z;e<c.ea.x&&(c.ea.x=e);f<c.ea.y&&(c.ea.y=f);
g<c.ea.z&&(c.ea.z=g);e>c.da.x&&(c.da.x=e);f>c.da.y&&(c.da.y=f);g>c.da.z&&(c.da.z=g)}d=c.da;h=c.ea;e=c.oa;e.x=d.x+h.x;e.y=d.y+h.y;e.z=d.z+h.z;d=c.oa;d.x*=.5;d.y*=.5;d.z*=.5;d=b.a;h=c.w[0];h.x=d[0];h.y=d[1];h.z=d[2];d=b.a;h=c.w[1];h.x=d[4];h.y=d[5];h.z=d[6];d=b.a;h=c.w[2];h.x=d[8];h.y=d[9];h.z=d[10];c.Ea=b;a=a.Pc;c=Math.max;d=Math.abs;g=a.oa;h=a.Hc;e=g.x;f=g.y;g=g.z;k=b.a;l=e*k[1]+f*k[5]+g*k[9]+k[13];m=e*k[2]+f*k[6]+g*k[10]+k[14];w=e*k[3]+f*k[7]+g*k[11]+k[15];h.x=(e*k[0]+f*k[4]+g*k[8]+k[12])/w;h.y=
l/w;h.z=m/w;h=a.Eb;h.x=b.a[0]+b.a[4]+b.a[8];h.y=b.a[1]+b.a[5]+b.a[9];h.z=b.a[2]+b.a[6]+b.a[10];a.bg=c(c(d(a.Eb.x),d(a.Eb.y)),d(a.Eb.z))*a.P}this.Wk(this.me())},Wk:function(a){if(null!=this.Ha)for(var b=0,c=this.Ha;b<c.length;){var d=c[b];++b;if(!d.Rf()&&(null==(d.Rf()?d.ta.fd():d.ra)&&d.Xv(),d=d.Rf()?d.ta.fd():d.ra,!d.Bk)){var e=d.zc,f=e.ea;f.x=Infinity;f.y=Infinity;f.z=Infinity;f=e.da;f.x=-Infinity;f.y=-Infinity;f.z=-Infinity;for(var g,h,k,f=0,l=e.Ab.length;f<l;){g=f++;la.g=e.jg[g];var m=e.Ab[g];
g=la.g;h=m.x;k=m.y;var m=m.z,w=a.a,n=h*w[1]+k*w[5]+m*w[9]+w[13],u=h*w[2]+k*w[6]+m*w[10]+w[14],y=h*w[3]+k*w[7]+m*w[11]+w[15];g.x=(h*w[0]+k*w[4]+m*w[8]+w[12])/y;g.y=n/y;g.z=u/y;g=la.g.x;h=la.g.y;k=la.g.z;g<e.ea.x&&(e.ea.x=g);h<e.ea.y&&(e.ea.y=h);k<e.ea.z&&(e.ea.z=k);g>e.da.x&&(e.da.x=g);h>e.da.y&&(e.da.y=h);k>e.da.z&&(e.da.z=k)}f=e.da;l=e.ea;g=e.oa;g.x=f.x+l.x;g.y=f.y+l.y;g.z=f.z+l.z;f=e.oa;f.x*=.5;f.y*=.5;f.z*=.5;f=a.a;l=e.w[0];l.x=f[0];l.y=f[1];l.z=f[2];f=a.a;l=e.w[1];l.x=f[4];l.y=f[5];l.z=f[6];f=
a.a;l=e.w[2];l.x=f[8];l.y=f[9];l.z=f[10];e.Ea=a;d=d.Pc;e=Math.max;f=Math.abs;k=d.oa;l=d.Hc;g=k.x;h=k.y;k=k.z;m=a.a;w=g*m[1]+h*m[5]+k*m[9]+m[13];n=g*m[2]+h*m[6]+k*m[10]+m[14];u=g*m[3]+h*m[7]+k*m[11]+m[15];l.x=(g*m[0]+h*m[4]+k*m[8]+m[12])/u;l.y=w/u;l.z=n/u;l=d.Eb;l.x=a.a[0]+a.a[4]+a.a[8];l.y=a.a[1]+a.a[5]+a.a[9];l.z=a.a[2]+a.a[6]+a.a[10];d.bg=e(e(f(d.Eb.x),f(d.Eb.y)),f(d.Eb.z))*d.P}}},Wd:function(a){null==a&&(a=!1);if(this.$F)return this.Ea;var b;if(a)b=!1;else if(this.ud!=this.f.Pa){var c=this.iB(),
c=(c=c?!0:!this.rv())?!0:!this.Dm();this.Aw(!0);b=!c}else b=!0;if(b)return this.ud=this.f.Pa,this.Ea;var d=this.K.position,e=this.position;d.x=e.x;d.y=e.y;d.z=e.z;var f=this.K.Ml,g=this.De;f.x=g.x;f.y=g.y;f.z=g.z;this.K.po=!1;this.K.Dd=this.Dd;this.ud=this.f.Pa;this.zm=!1;var h=ba.Ra[1];h.a[0]=this.De.x*this.to;h.a[1]=0;h.a[2]=0;h.a[3]=0;h.a[4]=0;h.a[5]=this.De.y*this.to;h.a[6]=0;h.a[7]=0;h.a[8]=0;h.a[9]=0;h.a[10]=this.De.z*this.to;h.a[11]=0;h.a[12]=0;h.a[13]=0;h.a[14]=0;h.a[15]=1;if(null!=this.Ad){var k=
this.Kb;if(0!=Math.sqrt(k.x*k.x+k.y*k.y+k.z*k.z)){var l=this.Ad,m=this.Kb.y,w=this.Kb.x,C=this.Kb.z,u=new da,y=.5*C,V=.5*w,z=.5*m,p=Math.sin(y),q=Math.cos(y),t=Math.sin(V),x=Math.cos(V),v=Math.sin(z),G=Math.cos(z);u.x=G*t*q+v*x*p;u.y=v*x*q-G*t*p;u.z=G*x*p-v*t*q;u.o=G*x*q+v*t*p;var D=-l.x*u.z+l.y*u.o+l.z*u.x+l.o*u.y,A=l.x*u.y-l.y*u.x+l.z*u.o+l.o*u.z,P=-l.x*u.x-l.y*u.y-l.z*u.z+l.o*u.o;l.x=l.x*u.o+l.y*u.z-l.z*u.y+l.o*u.x;l.y=D;l.z=A;l.o=P;var N=this.Kb;N.x=0;N.y=0;N.z=0}}if(null!=this.Ad){this.Ad.Af(ba.Ra[0]);
var E=this.K.ub,O=this.Ad;E.x=O.x;E.y=O.y;E.z=O.z;E.o=O.o}else{var B=ba.Ra[0],H=r.Ta,I=.5*this.Kb.z,F=.5*this.Kb.x,K=.5*this.Kb.y,L=Math.sin(I),S=Math.cos(I),T=Math.sin(F),Q=Math.cos(F),R=Math.sin(K),W=Math.cos(K);H.x=W*T*S+R*Q*L;H.y=R*Q*S-W*T*L;H.z=W*Q*L-R*T*S;H.o=W*Q*S+R*T*L;r.Ta.Af(B);var X=this.K.rotation,Dd=this.Kb;X.x=Dd.x;X.y=Dd.y;X.z=Dd.z}if(this.Ji&&null==this.ca){var Vd=this.f.L;if(null!=Vd){var Fb=Vd.va();r.aa(1,0,0,0,1,0,0,0,1,this.position.x+Fb.a[12],this.position.y+Fb.a[13],this.position.z+
Fb.a[14],ba.Ra[2])}}else r.aa(1,0,0,0,1,0,0,0,1,this.position.x,this.position.y,this.position.z,ba.Ra[2]);this.nj.qa(ba.Ra[1],ba.Ra[4].a,0);ba.Ra[4].qa(ba.Ra[0],ba.Ra[5].a,0);if(this.Dd!=ka.D&&null!=this.f.L){var ca=ba.Ec[0],U=this.position;ca.x=U.x;ca.y=U.y;ca.z=U.z;var Da=ba.Ec[0];if(null!=this.ca&&null!=this.ca.va()){this.Wm=this.ca.ud;var Va=null;null!=this.nt?(this.ca.va().qa(this.nt.va(),ba.Ra[6].a,0),Va=ba.Ra[6]):Va=this.ca.va();var ja=ba.Ec[1];ja.x=Da.x*Va.a[0]+Da.y*Va.a[4]+Da.z*Va.a[8];ja.y=
Da.x*Va.a[1]+Da.y*Va.a[5]+Da.z*Va.a[9];ja.z=Da.x*Va.a[2]+Da.y*Va.a[6]+Da.z*Va.a[10];Da=ba.Ec[1]}var ga=this.f.L.Dh(),ha=new n(ga.x,ga.y,ga.z);if(null!=this.ca&&Object.prototype.hasOwnProperty.call(this.ca,"position")){var ma=this.ca.position;Da.x+=ma.x;Da.y+=ma.y;Da.z+=ma.z;r.aa(1,0,0,0,1,0,0,0,1,Da.x,Da.y,Da.z,ba.Ra[2])}(this.Dd&ka.pd)!=ka.pd&&(0!=(this.Dd&ka.Df)&&(ha.x=Da.x+.001),0!=(this.Dd&ka.Cf)&&(ha.y=Da.y+.001),0!=(this.Dd&ka.Ag)&&(ha.z=Da.z+.001));r.$c(Da,ha,new n(0,1,0),ba.Ra[3]);ba.Ra[3].a[12]=
0;ba.Ra[3].a[13]=0;ba.Ra[3].a[14]=0;var Z=ba.Ra[3],Y=Z.a[0],aa=Z.a[1],ia=Z.a[2],na=Z.a[3],fa=Z.a[4],qa=Z.a[5],oa=Z.a[6],sa=Z.a[7],pa=Z.a[8],ua=Z.a[9],ya=Z.a[10],va=Z.a[11],wa=Z.a[12],Ra=Z.a[13],ta=Z.a[14],ra=Z.a[15],za=ya*ra-va*ta,Ta=ua*ra-va*Ra,bb=ua*ta-ya*Ra,Ea=pa*ra-va*wa,Aa=pa*ta-ya*wa,Ha=pa*Ra-ua*wa,Ga=qa*za-oa*Ta+sa*bb,Oa=-(fa*za-oa*Ea+sa*Aa),Fa=fa*Ta-qa*Ea+sa*Ha,La=-(fa*bb-qa*Aa+oa*Ha),cb=1/(Y*Ga+aa*Oa+ia*Fa+na*La),Ma=oa*ra-sa*ta,Na=qa*ra-sa*Ra,ib=qa*ta-oa*Ra,Sa=fa*ra-sa*wa,Ja=fa*ta-oa*wa,
Ua=fa*Ra-qa*wa,kb=oa*va-sa*ya,lb=qa*va-sa*ua,Hc=qa*ya-oa*ua,wb=fa*va-sa*pa,yb=fa*ya-oa*pa,Xa=fa*ua-qa*pa;Z.a[0]=Ga*cb;Z.a[4]=Oa*cb;Z.a[8]=Fa*cb;Z.a[12]=La*cb;Z.a[1]=-(aa*za-ia*Ta+na*bb)*cb;Z.a[5]=(Y*za-ia*Ea+na*Aa)*cb;Z.a[9]=-(Y*Ta-aa*Ea+na*Ha)*cb;Z.a[13]=(Y*bb-aa*Aa+ia*Ha)*cb;Z.a[2]=(aa*Ma-ia*Na+na*ib)*cb;Z.a[6]=-(Y*Ma-ia*Sa+na*Ja)*cb;Z.a[10]=(Y*Na-aa*Sa+na*Ua)*cb;Z.a[14]=-(Y*ib-aa*Ja+ia*Ua)*cb;Z.a[3]=-(aa*kb-ia*lb+na*Hc)*cb;Z.a[7]=(Y*kb-ia*wb+na*yb)*cb;Z.a[11]=-(Y*lb-aa*wb+na*Xa)*cb;Z.a[15]=(Y*
Hc-aa*yb+ia*Xa)*cb;ba.Ra[5].qa(ba.Ra[3],this.mi.a,0);this.BG.qa(this.mi,ba.Ra[5].a,0)}ba.Ra[5].qa(ba.Ra[2],this.mi.a,0);if(null!=this.ca&&this.Dd==ka.D)this.Wm=this.ca.ud,null!=this.nt?(this.mi.qa(this.ca.va(),ba.Ra[6].a,0),ba.Ra[6].qa(this.nt.va(),this.Ea.a,0)):this.mi.qa(this.ca.va(),this.Ea.a,0);else for(var be=this.Ea,vb=this.mi,Wd=0;16>Wd;){var od=Wd++;be.a[od]=vb.a[od]}var Tc=this.ra=null==this.ra?new xb(this.sf(),this.sf()):this.ra,Pa=this.me();if(!Tc.Bk){var Ba=Tc.zc,fb=Ba.ea;fb.x=Infinity;
fb.y=Infinity;fb.z=Infinity;var Ic=Ba.da;Ic.x=-Infinity;Ic.y=-Infinity;Ic.z=-Infinity;for(var yc=0,xa=0,Ib=0,pb=0,Gb=Ba.Ab.length;pb<Gb;){var sb=pb++;la.g=Ba.jg[sb];var Ed=Ba.Ab[sb],Ab=la.g,dd=Ed.x,Jc=Ed.y,Dc=Ed.z,db=Pa.a,Xd=dd*db[1]+Jc*db[5]+Dc*db[9]+db[13],Fd=dd*db[2]+Jc*db[6]+Dc*db[10]+db[14],zc=dd*db[3]+Jc*db[7]+Dc*db[11]+db[15];Ab.x=(dd*db[0]+Jc*db[4]+Dc*db[8]+db[12])/zc;Ab.y=Xd/zc;Ab.z=Fd/zc;yc=la.g.x;xa=la.g.y;Ib=la.g.z;yc<Ba.ea.x&&(Ba.ea.x=yc);xa<Ba.ea.y&&(Ba.ea.y=xa);Ib<Ba.ea.z&&(Ba.ea.z=
Ib);yc>Ba.da.x&&(Ba.da.x=yc);xa>Ba.da.y&&(Ba.da.y=xa);Ib>Ba.da.z&&(Ba.da.z=Ib)}var kd=Ba.da,Yd=Ba.ea,Kc=Ba.oa;Kc.x=kd.x+Yd.x;Kc.y=kd.y+Yd.y;Kc.z=kd.z+Yd.z;var wc=Ba.oa;wc.x*=.5;wc.y*=.5;wc.z*=.5;var Wa=Pa.a,ob=Ba.w[0];ob.x=Wa[0];ob.y=Wa[1];ob.z=Wa[2];var ce=Pa.a,Cb=Ba.w[1];Cb.x=ce[4];Cb.y=ce[5];Cb.z=ce[6];var rb=Pa.a,mb=Ba.w[2];mb.x=rb[8];mb.y=rb[9];mb.z=rb[10];Ba.Ea=Pa;var pd=Tc.Pc,nb=Math.max,Rb=Math.abs,Nb=pd.oa,gc=pd.Hc,qb=Nb.x,Ya=Nb.y,Eb=Nb.z,Ub=Pa.a,Zb=qb*Ub[1]+Ya*Ub[5]+Eb*Ub[9]+Ub[13],Hb=qb*
Ub[2]+Ya*Ub[6]+Eb*Ub[10]+Ub[14],Bb=qb*Ub[3]+Ya*Ub[7]+Eb*Ub[11]+Ub[15];gc.x=(qb*Ub[0]+Ya*Ub[4]+Eb*Ub[8]+Ub[12])/Bb;gc.y=Zb/Bb;gc.z=Hb/Bb;var jb=pd.Eb;jb.x=Pa.a[0]+Pa.a[4]+Pa.a[8];jb.y=Pa.a[1]+Pa.a[5]+Pa.a[9];jb.z=Pa.a[2]+Pa.a[6]+Pa.a[10];pd.bg=nb(nb(Rb(pd.Eb.x),Rb(pd.Eb.y)),Rb(pd.Eb.z))*pd.P}this.Wk(this.me());var Wb=this.ws,cc=this.Ea.a[13],ec=this.Ea.a[14];Wb.x=this.Ea.a[12];Wb.y=cc;Wb.z=ec;this.XB.la(this);if(null==this.At){var ac=this.Ea,Sb=new r,ed=ac.a[0],fd=ac.a[1],Ka=ac.a[2],Ca=ac.a[3],Ia=
ac.a[4],qd=ac.a[5],ld=ac.a[6],Za=ac.a[7],$a=ac.a[8],gb=ac.a[9],md=ac.a[10],nd=ac.a[11],Qa=ac.a[12],hb=ac.a[13],ab=ac.a[14],ub=ac.a[15],Xb=md*ub-nd*ab,Mb=gb*ub-nd*hb,Ob=gb*ab-md*hb,Yb=$a*ub-nd*Qa,zb=$a*ab-md*Qa,Pb=$a*hb-gb*Qa,ic=qd*Xb-ld*Mb+Za*Ob,jc=-(Ia*Xb-ld*Yb+Za*zb),Qb=Ia*Mb-qd*Yb+Za*Pb,bc=-(Ia*Ob-qd*zb+ld*Pb),Vb=1/(ed*ic+fd*jc+Ka*Qb+Ca*bc),mc=ld*ub-Za*ab,pc=qd*ub-Za*hb,qc=qd*ab-ld*hb,eb=Ia*ub-Za*Qa,dc=Ia*ab-ld*Qa,fc=Ia*hb-qd*Qa,Bc=ld*nd-Za*md,hc=qd*nd-Za*gb,Db=qd*md-ld*gb,tc=Ia*nd-Za*$a,uc=Ia*
md-ld*$a,kc=Ia*gb-qd*$a;Sb.a[0]=ic*Vb;Sb.a[4]=jc*Vb;Sb.a[8]=Qb*Vb;Sb.a[12]=bc*Vb;Sb.a[1]=-(fd*Xb-Ka*Mb+Ca*Ob)*Vb;Sb.a[5]=(ed*Xb-Ka*Yb+Ca*zb)*Vb;Sb.a[9]=-(ed*Mb-fd*Yb+Ca*Pb)*Vb;Sb.a[13]=(ed*Ob-fd*zb+Ka*Pb)*Vb;Sb.a[2]=(fd*mc-Ka*pc+Ca*qc)*Vb;Sb.a[6]=-(ed*mc-Ka*eb+Ca*dc)*Vb;Sb.a[10]=(ed*pc-fd*eb+Ca*fc)*Vb;Sb.a[14]=-(ed*qc-fd*dc+Ka*fc)*Vb;Sb.a[3]=-(fd*Bc-Ka*hc+Ca*Db)*Vb;Sb.a[7]=(ed*Bc-Ka*tc+Ca*uc)*Vb;Sb.a[11]=-(ed*hc-fd*tc+Ca*kc)*Vb;Sb.a[15]=(ed*Db-fd*uc+Ka*kc)*Vb;this.At=Sb}return this.Ea},Li:function(a){return this.ra.Li(a)},
kJ:function(a,b){null==b&&(b=!1);return null==this.ra||null==a.ra?!1:this.ra.Ki(a.ra,b)},KL:function(a,b){var c=this.f.ie;if(null==c)return null;null==a&&(a=0);Object.prototype.hasOwnProperty.call(a,"impostor")&&(b=a,a=a.KO);if(0==a)return c.UG(this),null;null==b?(b.xr=0,b.ar=.2,b.Or=.2):(null==b.xr&&(b.xr=0),null==b.ar&&(b.ar=.2),null==b.Or&&(b.Or=.2));return c.rG(this,a,b)},ql:function(){return this.Bx},xo:function(a){this.Bx=a;this.f.nr();return a},kF:function(a){var b=this.ra;if(a.zx(b.Pc.Hc,
b.Pc.bg,b.zc.ea,b.zc.da)){b=this.Gx;b.a[0]=1/a.P.x;b.a[1]=0;b.a[2]=0;b.a[3]=0;b.a[4]=0;b.a[5]=1/a.P.y;b.a[6]=0;b.a[7]=0;b.a[8]=0;b.a[9]=0;b.a[10]=1/a.P.z;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0;b.a[15]=1;this.me().qa(this.Gx,this.Hx.a,0);var b=this.Hx,c,d;if(null!=this.hn&&this.Hw){c=a.Mw+Math.max(Math.max(a.P.x,a.P.y),a.P.z);d=this.hn;var e=a.Eq,f=d.Sd;f.length=0;f.Ka++;for(var f=0,g=d.hc.length;f<g;){var h=f++;d.hc[h].Ki(e,c,d.Sd,!1)}c=d.Sd;e=d.Uq;f=0;for(g=e.length;f<g;)h=f++,c.ag(e[h]);c=d.Sd;
d=c.length;c=c.data}else c=this.Ha,d=c.length;e=0;for(f=d;e<f;)if(g=e++,g=c[g],1<d?(h=g.Rf()?g.ta.fd():g.ra,h=!a.zx(h.Pc.Hc,h.Pc.bg,h.zc.ea,h.zc.da)):h=!1,!h){this.km();null!=g.Xp?(h=g.bG,h=!(null!=b&&h.a[0]==b.a[0]&&h.a[1]==b.a[1]&&h.a[2]==b.a[2]&&h.a[3]==b.a[3]&&h.a[4]==b.a[4]&&h.a[5]==b.a[5]&&h.a[6]==b.a[6]&&h.a[7]==b.a[7]&&h.a[8]==b.a[8]&&h.a[9]==b.a[9]&&h.a[10]==b.a[10]&&h.a[11]==b.a[11]&&h.a[12]==b.a[12]&&h.a[13]==b.a[13]&&h.a[14]==b.a[14]&&h.a[15]==b.a[15])):h=!0;if(h){var h=b.a[0],k=b.a[1],
l=b.a[2],m=b.a[3],w=b.a[4],C=b.a[5],u=b.a[6],y=b.a[7],p=b.a[8],z=b.a[9],q=b.a[10],M=b.a[11],t=b.a[12],x=b.a[13],v=b.a[14],G=b.a[15],D=new r;D.a[0]=h;D.a[1]=k;D.a[2]=l;D.a[3]=m;D.a[4]=w;D.a[5]=C;D.a[6]=u;D.a[7]=y;D.a[8]=p;D.a[9]=z;D.a[10]=q;D.a[11]=M;D.a[12]=t;D.a[13]=x;D.a[14]=v;D.a[15]=G;g.bG=D;g.Xp=[];g.tj=[];h=g.te;for(k=g.te+g.Ug;h<k;)m=h++,l=g.Xp,u=this.nh[m],m=new n(0,0,0),w=u.x,C=u.y,u=u.z,y=b.a,p=w*y[1]+C*y[5]+u*y[9]+y[13],z=w*y[2]+C*y[6]+u*y[10]+y[14],q=w*y[3]+C*y[7]+u*y[11]+y[15],m.x=(w*
y[0]+C*y[4]+u*y[8]+y[12])/q,m.y=p/q,m.z=z/q,l.push(m)}h=g.Xp;k=this.Bc();l=g.Xb+g.Xd;m=g.te;for(w=g.Xb;w<l;)a.PG(w,g,h[k[w+2]-m],h[k[w+1]-m],h[k[w]-m]),w+=3;a.Mq&&(a.vu=this)}}},km:function(){return!1},Ki:function(a,b){null==b&&(b=!1);var c=new Cd,d;null!=this.Ha&&null!=this.ra&&a.lJ(this.ra.Pc)?(d=this.ra.zc,d=!a.rr(d.Gb,d.Mb)):d=!0;if(d||!this.km())return c;d=null;var e,f;if(null!=this.hn&&this.Iw){f=this.va();var g=a.origin;e=new n(0,0,0);var h=g.x,k=g.y,g=g.z,l=f.a,m=h*l[1]+k*l[5]+g*l[9]+l[13],
w=h*l[2]+k*l[6]+g*l[10]+l[14],C=h*l[3]+k*l[7]+g*l[11]+l[15];e.x=(h*l[0]+k*l[4]+g*l[8]+l[12])/C;e.y=m/C;e.z=w/C;h=a.direction;k=new n(0,0,0);k.x=h.x*f.a[0]+h.y*f.a[4]+h.z*f.a[8];k.y=h.x*f.a[1]+h.y*f.a[5]+h.z*f.a[9];k.z=h.x*f.a[2]+h.y*f.a[6]+h.z*f.a[10];f=new Na(e,k,a.length);e=this.hn.sr(f);f=e.length;e=e.data}else e=this.Ha,f=e.length;h=0;for(k=f;h<k;)if(g=h++,l=e[g],1<f?(m=(l.Rf()?l.ta.fd():l.ra).zc,m=!a.rr(m.Gb,m.Mb)):m=!1,!m){m=this.nh;w=this.Bc();C=null;null==m&&(m=l.ta.mr());if(v.D(l.ta,pc))for(var u=
l.ta,y=l.Xb;y<l.Xb+l.Xd;){var p=a.jJ(m[w[y]],m[w[y+1]],u.cv());if(!(0>p)&&(b||null==C||p<C.Sb)&&(C=new Fe(0,0,p),b))break;y+=2}else for(u=l.Xb;u<l.Xb+l.Xd;){y=a.mJ(m[w[u]],m[w[u+1]],m[w[u+2]]);if(null!=y){if(0>y.Sb){u+=3;continue}if(b||null==C||y.Sb<C.Sb)if(C=y,C.Xq=u/3|0,b)break}u+=3}l=C;if(null!=l&&(b||null==d||l.Sb<d.Sb)&&(d=l,d.Tg=g,b))break}null!=d&&(e=this.va(),g=a.origin,f=new n(0,0,0),h=g.x,k=g.y,g=g.z,l=e.a,m=h*l[1]+k*l[5]+g*l[9]+l[13],w=h*l[2]+k*l[6]+g*l[10]+l[14],C=h*l[3]+k*l[7]+g*l[11]+
l[15],f.x=(h*l[0]+k*l[4]+g*l[8]+l[12])/C,f.y=m/C,f.z=w/C,h=a.direction,h=new n(h.x,h.y,h.z),k=d.Sb,h=new n(h.x*k,h.y*k,h.z*k),k=new n(0,0,0),k.x=h.x*e.a[0]+h.y*e.a[4]+h.z*e.a[8],k.y=h.x*e.a[1]+h.y*e.a[5]+h.z*e.a[9],k.z=h.x*e.a[2]+h.y*e.a[6]+h.z*e.a[10],e=new n(f.x+k.x,f.y+k.y,f.z+k.z),c.uf=!0,h=f.x-e.x,k=f.y-e.y,f=f.z-e.z,c.Sb=Math.sqrt(h*h+k*k+f*f),c.RK=e,c.ib=this,c.qu=d.qu,c.ru=d.ru,c.Xq=d.Xq,c.Tg=d.Tg);return c},clone:function(){return null},qo:function(){if(null!=this.Ha)for(;0<this.Ha.length;)this.Ha[0].dispose();
else this.Ha=[]},dispose:function(a){null==a&&(a=!1);null!=this.ka&&(this.ka.dispose(),this.ka=null);this.Tr(null);this.f.Ql(this);for(var b=0,c=this.eh.length;b<c;){var d=b++,d=this.eh[d];d.eh.splice(d.eh.indexOf(this),1)}this.eh=[];b=this.f.ic;for(c=0;c<b.length;){d=b[c];++c;var e=d.Jj.indexOf(this);-1!=e&&d.Jj.splice(e,1);e=d.Dj.indexOf(this);-1!=e&&d.Dj.splice(e,1)}null!=this.Np&&(this.Np.dispose(),this.Np=null);this.qo();b=this.f.c;c=0;for(d=b.na.length;c<d;)e=c++,e>=b.T.IB||!b.na[e]||(b.b.disableVertexAttribArray(e),
b.na[e]=!1);this.f.Zv(this);if(a)for(a=this.HI(!0),b=0,c=a.length;b<c;)d=b++,d=a[d],d.ck(null),d.Wd(!0);else{for(a=0;a<this.f.Pe.length;)this.f.Pe[a].Gd==this&&(b=this.f.Pe[a],null!=b.F&&(b.F.dispose(),b.F=null),null!=b.wa&&(c=b.wa,c.ia--,0==c.ia&&b.c.b.deleteBuffer(c.buffer),b.wa=null),null!=b.Ld&&(b.Ld.dispose(),b.Ld=null),Q.remove(b.f.Pe,b),b.Nb.la(b),b.Nb.clear(),--a);a=[];this.at(a,!0,null);b=0;for(c=a.length;b<c;)d=b++,a[d].dispose()}fa.prototype.dispose.call(this);this.XB.clear();this.mK.clear();
this.nK.clear();this.Nb.la(this);this.Nb.clear()},l:ka,ha:F(fa.prototype.ha,{xo:"set_checkCollisions",ql:"get_checkCollisions",sf:"get_absolutePosition",me:"get_worldMatrixFromCache",hr:"get_isBlocked",Tr:"set_skeleton",gd:"get_skeleton",Hg:"get_useBones",mr:"get_positions",Sr:"set_receiveShadows",Gj:"get_receiveShadows",ld:"set_material",Gg:"get_material",Rr:"set_isPickable",Di:"get_isPickable",Vr:"set_visibility",Ei:"get_visibility",Pl:"set_rotationQuaternion"})});var S=J.BABYLON.Mesh=function(a,
b,c,d,e){null==e&&(e=!1);this.Hs=this.nF=!1;this.Vd=0;this.YE=!1;this.Ee=0;this.Ak=2048;this.Ze=new Bf;this.Xy=[];this.ng=[];this.Gh=[];this.Ma=0;this.iK=new R;this.Lc=new R;this.sc=new R;ka.call(this,a,b);if(null!=d){null!=d.xa&&d.xa.dc(this);S.Bb(d,this);this.ck(d.ca);this.nj=d.nj;this.K.po=!0;this.id=a+"."+d.id;this.ld(d.Gg());if(!e)for(var f=0,g=b.Yb.length;f<g;){var h=f++,h=b.Yb[h];h.ca==d&&h.clone(a+"."+h.name,this,e)}a=0;for(e=b.Pe.length;a<e;)f=a++,f=b.Pe[f],f.Gd==d&&f.clone(f.name,this);
this.Wd(!0)}null!=c&&this.ck(c)};q["com.babylonhx.mesh.Mesh"]=S;S.i=["com","babylonhx","mesh","Mesh"];S.xb=[Qb,Je];S.Bb=function(a,b){var c=a.position;b.position=new n(c.x,c.y,c.z);c=a.Kb;b.Kb=new n(c.x,c.y,c.z);null!=a.Ad&&(c=a.Ad,b.Pl(new da(c.x,c.y,c.z,c.o)));c=a.De;c=new n(c.x,c.y,c.z);b.De=c;b.Dd=a.Dd;b.Yk=a.Yk;b.Ji=a.Ji;b.hd=a.hd;b.zo=a.zo;b.Ao=a.Ao;b.qB=a.qB;b.dg=a.dg;b.ka=a.ka;b.Lr=a.Lr;c=a.outlineColor;b.outlineColor=new L(c.r,c.v,c.m);b.outlineWidth=a.outlineWidth;b.$v=a.$v;c=a.Qv;b.Qv=
new L(c.r,c.v,c.m);b.Pv=a.Pv;b.ul=a.ul;b.Lw=a.Lw;b.sh=a.sh;b.Jw=a.Jw;b.Iw=a.Iw;b.Hw=a.Hw;b.tb=a.tb;c=a.Ai;b.Ai=new n(c.x,c.y,c.z);c=a.tA;b.tA=new n(c.x,c.y,c.z);b.state=a.state;b.hA=a.hA;b.Xa=a.Xa.slice();b.Vr(a.Ei());b.Rr(a.Di());b.Sr(a.Gj());b.nf=a.nf;b.to=a.to;b.Me=a.Me;b.Aq=a.Aq;b.Vq=a.Vq;b.Ju=a.Ju.clone();b.Ma=a.Ma;b.Ee=a.Ee;b.xo(a.ql());b.yb=a.yb.slice()};S.Fa=function(a,b,c,d,e,f,g,h){var k=0;null==g&&(g=0);null==f&&(f=!1);null==k&&(k=0);null==d&&(d=!1);null==c&&(c=!1);return A.Df(a,{Qg:b,
$k:c,closePath:d,offset:k,Ig:h,$:g,Ia:f},e)};S.Ag=function(a,b,c,d,e,f){null==f&&(f=0);null==e&&(e=!1);return A.$o(a,{P:b,Md:c,$:f,Ia:e},d)};S.ve=function(a,b,c,d,e){null==e&&(e=0);null==d&&(d=!1);return A.yh(a,{width:b,height:b,depth:b,$:e,Ia:d},c)};S.mc=function(a,b,c){var d,e;null==e&&(e=0);null==d&&(d=!1);return A.gp("capsuleSphereTop",{PC:a,jA:b,kA:b,lA:b,$:e,Ia:d},c)};S.pd=function(a,b,c,d,e){b>c&&(c=b/2);a=(2*d|0)+4;var f=A.yh("tempbox",{width:b,height:c,depth:b},e);d=S.mc(d,b,e);d.position.y=
c/2;var g=Wb.sA(d),h=Wb.sA(f);g.bM(h);f.dispose();d.dispose();f=g.jM("test",e.Rq,e,!1);d=f.clone("tempsphereclone");d.position.y=-c/2;d.Kb.x=Math.PI;b=A.Jl("capsuleCylinder",{height:c,Jn:b,In:b,Md:a,Uc:6,Lu:!1},e);b=S.lb([b,f,d]);b.ld(e.Rq);return b};S.Ve=function(a,b,c,d,e,f,g,h,k){null==k&&(k=0);null==h&&(h=!1);return A.Jl(a,{height:b,Jn:c,In:d,Md:e,Uc:f,$:k,Ia:h,Lu:!0},g)};S.Ni=function(a,b,c,d,e,f,g){null==g&&(g=0);null==f&&(f=!1);return A.ip(a,{Fu:b,vD:c,Md:d,$:g,Ia:f},e)};S.Lj=function(a,b,
c,d,e,f,g,h,k,l){null==l&&(l=0);null==k&&(k=!1);return A.jp(a,{P:b,yD:c,yC:d,zD:e,p:f,q:g,$:l,Ia:k},h)};S.Ah=function(a,b,c,d,e){null==d&&(d=!1);return A.aL(a,{Ir:b,Ia:d,Ig:e},c)};S.Df=function(a,b,c,d,e,f,g,h){null==g&&(g=!1);return A.Zo(a,{Ir:b,Cj:c,il:d,eA:e,Ia:g,Ig:h},f)};S.Rj=function(a,b,c,d,e,f,g,h,k,l){null==k&&(k=0);null==h&&(h=!1);null==f&&(f=0);null==e&&(e=0);null==d&&(d=1);return A.AL(a,{shape:b,path:c,scale:d,rotation:e,Vd:f,$:k,Nu:l,Ia:h},g)};S.Tj=function(a,b,c,d,e,f,g,h,k,l,m,w){null==
m&&(m=0);null==l&&(l=!1);null==h&&(h=0);null==g&&(g=!1);null==f&&(f=!1);return A.cM(a,{shape:b,path:c,OC:d,MC:e,JC:f,KC:g,Vd:h,$:m,Nu:w,Ia:l},k)};S.yh=function(a,b,c,d,e,f,g){null==g&&(g=0);null==f&&(f=!1);null==d&&(d=0);null==c&&(c=1);return A.NK(a,{shape:b,P:c,KP:d,$:g,Ia:f},e)};S.Bh=function(a,b,c,d,e){null==e&&(e=0);null==d&&(d=!1);return A.ep(a,{width:b,height:b,$:e,Ia:d},c)};S.Bg=function(a,b,c,d,e,f){null==f&&(f=!1);return A.ap(a,{width:b,height:c,Uc:d,Ia:f},e)};S.Gi=function(a,b,c,d,e,f,g,
h,k){null==k&&(k=!1);return A.hp(a,{RM:b,VM:c,QM:d,UM:e,Uc:f,precision:g,Ia:k},h)};S.Cg=function(a,b,c,d,e,f,g,h,k,l){null==k&&(k=!1);return A.bp(a,b,{width:c,height:d,Uc:e,minHeight:f,maxHeight:g,Ia:k,Nv:l},h)};S.Qj=function(a,b,c,d,e,f,g,h,k,l){null==k&&(k=0);null==h&&(h=!1);return A.dL(a,{path:b,P:c,Md:d,bL:e,arc:1,Vd:f,Ia:h,$:k,Ig:l},g)};S.Eh=function(a,b,c){return A.fp(a,b,c)};S.xh=function(a,b,c){return A.cp(a,b,c)};S.Cf=function(a,b,c,d,e,f){null==f&&(f=0);return A.dK(a,b,{position:c,j:d,size:e,
Cd:f})};S.g=function(a){for(var b=null,c=null,d=0;d<a.length;){var e=a[d];++d;e=e.fd().zc;if(null==b)b=e.ea,c=e.da;else{var f=e.ea;f.x<b.x&&(b.x=f.x);f.y<b.y&&(b.y=f.y);f.z<b.z&&(b.z=f.z);e=e.da;e.x>c.x&&(c.x=e.x);e.y>c.y&&(c.y=e.y);e.z>c.z&&(c.z=e.z)}}return{Gb:b,Mb:c}};S.$b=function(a){var b=a instanceof Array&&null==a.jb?S.g(a):a;a=b.Gb;b=b.Mb;a=new n(a.x+b.x,a.y+b.y,a.z+b.z);a.x*=.5;a.y*=.5;a.z*=.5;return a};S.lb=function(a){var b,c,d=!0;null==b&&(b=!1);null==d&&(d=!0);if(!b)for(var e=b=0,f=a.length;e<
f;){var g=e++;if(null!=a[g]&&(b+=a[g].Qf(),65536<b))return console.log("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),null}for(var f=b=null,g=0,h=a.length;g<h;){var k=g++;if(null!=a[k]){a[k].Wd(!0);var e=I.oE(a[k]),l=a[k].va();if(null!=e.Na)for(var m,w,n,u=0;u<e.Na.length;){var y=e.Na;n=y[u];w=y[u+1];m=y[u+2];var y=I.pd,p=l.a,z=n*p[1]+w*p[5]+m*p[9]+p[13],q=n*p[2]+w*p[6]+m*p[10]+p[14],r=n*p[3]+w*p[7]+m*p[11]+
p[15];y.x=(n*p[0]+w*p[4]+m*p[8]+p[12])/r;y.y=z/r;y.z=q/r;e.Na[u]=I.pd.x;e.Na[u+1]=I.pd.y;e.Na[u+2]=I.pd.z;u+=3}if(null!=e.gb)for(n=0;n<e.gb.length;)w=e.gb,y=w[n],u=w[n+1],w=w[n+2],m=I.pd,m.x=y*l.a[0]+u*l.a[4]+w*l.a[8],m.y=y*l.a[1]+u*l.a[5]+w*l.a[9],m.z=y*l.a[2]+u*l.a[6]+w*l.a[10],e.gb[n]=I.pd.x,e.gb[n+1]=I.pd.y,e.gb[n+2]=I.pd.z,n+=3;null!=b?b.TJ(e):(b=e,f=a[k])}}null==c&&(c=new S(f.name+"_merged",f.f));b.dc(c);c.ld(f.Gg());c.xo(f.ql());if(d)for(d=0,b=a.length;d<b;)e=d++,null!=a[e]&&a[e].dispose();
return c};S.ab=function(a,b,c){var d=new S(a.name,b);d.id=a.id;za.ae(d,a.Rl);var e=a.position;d.position=new n(e[0],e[1],e[2]);null!=a.zr&&(d.zr=a.zr);null!=a.ub?(e=a.ub,d.Pl(new da(e[0],e[1],e[2],e[3]))):null!=a.rotation&&(e=a.rotation,d.Kb=new n(e[0],e[1],e[2]));e=a.Ml;e=new n(e[0],e[1],e[2]);d.De=e;if(null!=a.EJ){for(var e=a.EJ,f=new r,g=0;16>g;){var h=g++;f.a[h]=e[h]}d.nj=f;d.K.po=!0}else if(null!=a.UK){e=a.UK;f=new r;for(g=0;16>g;)h=g++,f.a[h]=e[h];d.nj=f;d.K.po=!0}d.Vp=a.isEnabled;d.hd=a.hd;
d.Ji=a.Ji;d.zo=a.zo;d.Ao=a.Ao;null!=a.sh&&a.sh&&(d.sh=a.sh);null!=a.QK&&d.Rr(a.QK);null!=a.Yk&&(d.Yk=a.Yk);d.Sr(a.rP);d.Dd=a.Dd;null!=a.visibility&&d.Vr(a.visibility);d.xo(a.vh);d.lz=a.RP;null!=a.AI&&(d.MN=a.AI);null!=a.Fl&&(d.Cz=a.Fl);null!=a.lf&&(d.LN=a.lf);d.ul=a.ul;null!=a.cl&&1==a.cl?(d.Ma=4,d.cl=c+na.Pb(a.cl),c=a.TN,c=new n(c[0],c[1],c[2]),e=a.SN,d.ra=new xb(c,new n(e[0],e[1],e[2])),null!=a.ox&&(d.ox=a.ox),d.bc=[],a.DO&&d.bc.push("uv"),a.EO&&d.bc.push("uv2"),a.FO&&d.bc.push("uv3"),a.GO&&d.bc.push("uv4"),
a.HO&&d.bc.push("uv5"),a.IO&&d.bc.push("uv6"),a.zO&&d.bc.push("color"),a.AO&&d.bc.push("matricesIndices"),a.BO&&d.bc.push("matricesWeights"),d.Os=qc.ya,eg.vE&&d.Cx()):qc.ya(a,d);null!=a.KJ?d.JL(a.KJ):d.ld(null);-1<a.TL&&(d.Tr(b.KI(a.TL)),null!=a.Me&&(d.Me=a.Me));null!=a.OK&&(null==b.ie&&b.lI(),c=new Cf,c.xr=a.mP,c.ar=a.lP,c.Or=a.nP,d.KL(a.OK,c));if(null!=a.Xa){c=0;for(e=a.Xa.length;c<e;)f=c++,d.Xa.push(Hb.ab(a.Xa[f]));fa.aa(d,a)}null!=a.nu&&b.Fq(d,a.Oz,a.Qz,a.Pz,1);d.tb=null!=a.tb?Math.abs(a.tb)|
0:-1;if(null!=a.Gh)for(b=0,c=a.Gh.length;b<c;)if(e=b++,f=a.Gh[e],e=d.bl(f.name),za.ae(e,f.Rl),g=f.position,e.position=new n(g[0],g[1],g[2]),null!=f.ub?(g=f.ub,e.Pl(new da(g[0],g[1],g[2],g[3]))):null!=f.rotation&&(g=f.rotation,e.Kb=new n(g[0],g[1],g[2])),f=f.Ml,f=new n(f[0],f[1],f[2]),e.De=f,e.xo(d.ql()),null!=a.Xa){f=0;for(g=a.Xa.length;f<g;)h=f++,e.Xa.push(Hb.ab(a.Xa[h]));fa.aa(e,a)}return d};S.U=ka;S.prototype=F(ka.prototype,{LG:function(){this.ng.sort(function(a,b){return a.Sb<b.Sb?1:a.Sb>b.Sb?
-1:0})},Hz:function(a,b){if(null!=b&&null!=b.Fk)return console.log("You cannot use a mesh as LOD level twice"),this;var c=new Df(a,b);this.ng.push(c);null!=b&&(b.Fk=this);this.LG();return this},er:function(a,b){if(null==this.ng||0==this.ng.length)return this;var c,d,e;c=(null!=b?b:this.fd().Pc).Hc;var f=a.position;e=c.x-f.x;d=c.y-f.y;c=c.z-f.z;d=Math.sqrt(e*e+d*d+c*c);if(this.ng[this.ng.length-1].Sb>d)return null!=this.oo&&this.oo(d,this,this.ng[this.ng.length-1].Zc),this;e=0;for(c=this.ng.length;e<
c;)if(f=e++,f=this.ng[f],f.Sb<d)return null!=f.Zc&&(f.Zc.Zm(),f.Zc.Wk(this.me())),null!=this.oo&&this.oo(d,this,f.Zc),f.Zc;null!=this.oo&&this.oo(d,this,this);return this},sl:function(){return this.xa},Qf:function(){return null==this.xa?0:this.xa.Qf()},Ba:function(a,b){null==b&&(b=!1);return null==this.xa?null:this.xa.Ba(a,b)},Ch:function(a){return null==this.xa?null:this.xa.Ch(a)},fb:function(a){return null==this.xa?null!=this.bc?-1!=this.bc.indexOf(a):!1:this.xa.fb(a)},Zu:function(){if(null==this.xa){var a=
[];if(null!=this.bc)for(var b=0,c=this.bc;b<c.length;){var d=c[b];++b;a.push(d)}return a}return this.xa.Zu()},On:function(){return null==this.xa?0:this.xa.On()},Bc:function(a){null==a&&(a=!1);return null==this.xa?[]:this.xa.Bc(a)},hr:function(){return null!=this.Fk},pa:function(){return 2==this.Ma?!1:ka.prototype.pa.call(this)},Zm:function(){var a=this.f.Pa;this.nG!=a&&(this.nG=a,this.Ge=null)},Oy:function(a){null!=this.Ge&&(this.Ge.mB=a)},qG:function(a,b){null==this.Ge&&(this.Ge=new Ef(b,this.Pa));
this.Ge.map.h.hasOwnProperty(b)||(this.Ge.map.h[b]=[]);this.Ge.map.h[b].push(a)},Js:function(){var a=this.Qf();if(0==a||null==this.Bc())return null;this.qo();return new Rb(0,0,a,0,this.On(),this)},Ga:function(a,b,c,d){null==c&&(c=!1);null==this.xa?(d=new I,d.set(b,a),a=this.f,b=function(a){var b=15;null==b&&(b=61);var c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),d=[];for(61<b&&(b=61);0<a--;)d.push(c[Math.floor((b+1)*Math.random())]);return d.join("")},new qc(b(8)+"-"+
b(4)+"-4"+b(3)+"-"+Math.floor(4*Math.random())+b(3)+"-"+b(12),a,d,c,this)):this.xa.Ga(a,b,c,d)},ak:function(a){if(null==this.xa){var b=this.f,c=function(a){var b=15;null==b&&(b=61);var c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),g=[];for(61<b&&(b=61);0<a--;)g.push(c[Math.floor((b+1)*Math.random())]);return g.join("")};(new qc(c(8)+"-"+c(4)+"-4"+c(3)+"-"+Math.floor(4*Math.random())+c(3)+"-"+c(12),b)).dc(this)}this.xa.ak(a)},Yh:function(a,b,c,d){null==d&&(d=!1);null==
c&&(c=!1);null!=this.xa&&(d?(this.IJ(),this.Yh(a,b,c,!1)):this.xa.Yh(a,b,c))},CD:function(a,b){null==b&&(b=!0);var c=this.Ba("position");a(c);this.Yh("position",c,!1,!1);if(b){var d=this.Bc(),e=this.Ba("normal");I.be(c,d,e);this.Yh("normal",e,!1,!1)}},IJ:function(){if(null!=this.xa){var a=this.xa,b=function(a){var b=15;null==b&&(b=61);var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),f=[];for(61<b&&(b=61);0<a--;)f.push(e[Math.floor((b+1)*Math.random())]);return f.join("")},
b=this.xa.yu(b(8)+"-"+b(4)+"-4"+b(3)+"-"+Math.floor(4*Math.random())+b(3)+"-"+b(12));a.Kr(this,!0);b.dc(this)}},$j:function(a,b){null==b&&(b=-1);if(null==this.xa){var c=new I;c.pb=a;var d=this.f,e=function(a){var b=15;null==b&&(b=61);var c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),d=[];for(61<b&&(b=61);0<a--;)d.push(c[Math.floor((b+1)*Math.random())]);return d.join("")};new qc(e(8)+"-"+e(4)+"-4"+e(3)+"-"+Math.floor(4*Math.random())+e(3)+"-"+e(12),d,c,!1,this)}else this.xa.$j(a,
b)},wp:function(a,b,c){var d=this.f.c,e=null;if(!this.$t)switch(c){case 0:e=this.xa.ml();break;case 1:c=this.Bc();if(null==a.Fm){for(var e=[],f=a.Xb;f<a.Xb+a.Xd;)e.push(c[f]),e.push(c[f+1]),e.push(c[f+1]),e.push(c[f+2]),e.push(c[f+2]),e.push(c[f]),f+=3;c=d.b.createBuffer();c=new ub(c);d.V.get(34963)!=c&&(d.b.bindBuffer(34963,null==c?null:c.buffer),d.V.set(34963,null==c?null:c));var f=null,g=!1;if(d.T.Ul){for(var h=0,k=e.length;h<k;){var l=h++;if(65535<e[l]){g=!0;break}}g?f=new Int32Array(e):f=new Int16Array(e)}else f=
new Int16Array(e);d.b.bufferData(34963,f,35044);null!=d.V.get(34963)&&(d.b.bindBuffer(34963,null),d.V.set(34963,null));d.kb=null;c.ia=1;c.Sc=g;a.Fm=c;a.DB=e.length}e=a.Fm;break;case 2:e=null}a=this.xa.Pn();if(d.qb!=a||d.Qb!=b)for(d.qb=a,d.Qb=b,p.sa=b.we,c=0,f=p.sa.length;c<f;)g=c++,p.g=b.sa[g],0<=p.g&&(g=p.sa[g],p.F=null!=t[g]?a.H(g):a.h[g],null==p.F?d.na[p.g]&&(d.b.disableVertexAttribArray(p.g),d.na[p.g]=!1):(d.na[p.g]||(d.b.enableVertexAttribArray(p.g),d.na[p.g]=!0),g=p.F.R.R,d.vertexAttribPointer(g,
p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(d.T.Kc.vertexAttribDivisorANGLE(p.g,1),d.ad.push(p.g),d.td.push(g))));null!=e&&d.kb!=e&&(d.kb=e,d.V.get(34963)!=e&&(d.b.bindBuffer(34963,null==e?null:e.buffer),d.V.set(34963,null==e?null:e)),d.Ud=e.Sc)},Jp:function(a,b,c){null==c&&(c=0);if(null!=this.xa&&null!=this.xa.Pn()&&null!=this.xa.ml()){this.iK.la(this);var d=this.f.c;switch(b){case 1:this.$t?d.qA(!1,a.te,a.Ug,c):d.Ic(!1,0,0<c?a.DB/2:a.DB,c);break;case 2:d.gI(a.te,a.Ug,c);break;default:this.$t?
d.qA(!0,a.te,a.Ug,c):d.Ic(!0,a.Xb,a.Xd,c)}}},Zx:function(a){var b=this.f;this.Ze.Br=!1;this.Ze.Mr[a]=this.isEnabled()&&this.hd;this.Ze.Nd[a]=null;if(null!=this.Ge){var c=b.Pa,b=b.qm?this.Ge.mB:this.Ge.gA;this.Ze.Nd[a]=this.Ge.map.h[c];var d=this.Pa;null==this.Ze.Nd[a]&&0<b&&(this.Ze.Nd[a]=this.Ge.map.h[b],c=Math.max(b,c),d=Math.max(this.Ge.BL,c));if(null!=this.Ze.Nd[a]&&0<this.Ze.Nd[a].length){if(this.Xy[a]==c)return this.Ze.Br=!0,this.Ze;c!=d&&(this.Ze.Mr[a]=!1)}this.Xy[a]=c}return this.Ze},AG:function(a,
b,c,d,e){for(var f=c.Nd[a.eb],g=64*(f.length+1)|0,h=this.Ak,k=this.Tp;this.Ak<g;)this.Ak*=2;if(null==this.pm||h!=this.Ak)this.pm=[];var l=0,g=0,m=this.va();if(c.Mr[a.eb]){c=this.pm;for(var w=0;16>w;){var n=w++;c[l+n]=m.a[n]}l+=16;++g}if(null!=f)for(m=0,c=f.length;m<c;){for(var w=m++,w=f[w].va(),n=this.pm,u=0;16>u;){var y=u++;n[l+y]=w.a[y]}l+=16;++g}null==k||h!=this.Ak?(null!=k&&k.dispose(),this.Tp=k=new jd(e,this.pm,!0,16,!1,!0),this.ak(k.Bj("world0",0,4)),this.ak(k.Bj("world1",4,4)),this.ak(k.Bj("world2",
8,4)),this.ak(k.Bj("world3",12,4))):k.qM(this.pm,0,g);f=this.sl().Pn();h=this.sl().ml();if(e.qb!=f||e.Qb!=d)for(e.qb=f,e.Qb=d,p.sa=d.we,k=0,l=p.sa.length;k<l;)m=k++,p.g=d.sa[m],0<=p.g&&(m=p.sa[m],p.F=null!=t[m]?f.H(m):f.h[m],null==p.F?e.na[p.g]&&(e.b.disableVertexAttribArray(p.g),e.na[p.g]=!1):(e.na[p.g]||(e.b.enableVertexAttribArray(p.g),e.na[p.g]=!0),m=p.F.R.R,e.vertexAttribPointer(m,p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(e.T.Kc.vertexAttribDivisorANGLE(p.g,1),e.ad.push(p.g),e.td.push(m))));
null!=h&&e.kb!=h&&(e.kb=h,e.V.get(34963)!=h&&(e.b.bindBuffer(34963,null==h?null:h.buffer),e.V.set(34963,null==h?null:h)),e.Ud=h.Sc);this.Jp(a,b,g);e.mM()},Gt:function(a,b,c,d,e,f,g){var h=this.f.c;if(e)this.AG(a,c,d,b,h);else if(d.Mr[a.eb]&&(null!=f&&f(!1,this.va(),g),this.Jp(a,c,this.GN)),null!=d.Nd[a.eb])for(b=0,e=d.Nd[a.eb].length;b<e;)h=b++,h=d.Nd[a.eb][h].va(),null!=f&&f(!0,h,g),this.Jp(a,c)},hb:function(a,b){var c=this.f,d=this.Zx(a.eb);if(!d.Br&&null!=this.xa&&null!=this.xa.Pn()&&null!=this.xa.ml()){this.sc.la(this);
var e=c.c,f=null!=e.T.Kc&&null!=d.Nd[a.eb]&&d.Nd.length>a.eb&&null!=d.Nd[a.eb],g=a.Of();if(null!=g&&g.pa(this,f)){var h=e.G.gr();this.Lr&&(e.G.vb(!1),c.vt.hb(a,d),e.G.vb(h));g.Ct();var k=g.s,l=c.Ou?2:c.Pu?1:g.av();this.wp(a,k,l);var m=this.va();g.bind(m,this);if(b&&(m=g.Iz,e.bb!=m)){switch(m){case 0:e.J.za(!1);break;case 1:e.J.Ya(770,1,0,1);e.J.za(!0);break;case 2:e.J.Ya(770,771,1,1);e.J.za(!0);break;case 3:e.J.Ya(0,769,1,1);e.J.za(!0);break;case 4:e.J.Ya(774,0,1,1);e.J.za(!0);break;case 5:e.J.Ya(770,
769,1,1);e.J.za(!0);break;case 6:e.J.Ya(1,1,0,1),e.J.za(!0)}e.G.vb(0==m);e.bb=m}this.Gt(a,k,l,d,f,B(this,this.kG),g);g.Io();this.Lr&&h&&(e.G.vb(!0),e.b.colorMask(!1,!1,!1,!1),c.vt.hb(a,d),e.b.colorMask(!0,!0,!0,!0));if(this.$v&&(f=e.bb,2!=e.bb&&(e.J.Ya(770,771,1,1),e.J.za(!0),e.G.vb(!1),e.bb=2),c.vt.hb(a,d,!0),e.bb!=f)){switch(f){case 0:e.J.za(!1);break;case 1:e.J.Ya(770,1,0,1);e.J.za(!0);break;case 2:e.J.Ya(770,771,1,1);e.J.za(!0);break;case 3:e.J.Ya(0,769,1,1);e.J.za(!0);break;case 4:e.J.Ya(774,
0,1,1);e.J.za(!0);break;case 5:e.J.Ya(770,769,1,1);e.J.za(!0);break;case 6:e.J.Ya(1,1,0,1),e.J.za(!0)}e.G.vb(0==f);e.bb=f}this.Lc.la(this)}}},kG:function(a,b,c){a&&null!=c&&c.zn(b)},Cx:function(){var a=this.f;null!=this.xa?this.xa.load(a):4==this.Ma&&(this.Ma=2,a.qp(this))},Li:function(a){if(2==this.Ma||!ka.prototype.Li.call(this,a))return!1;this.Cx();return!0},JL:function(a){for(var b=this.f.xf,c=0,d=b.length;c<d;){var e=c++;if(b[e].id==a){this.ld(b[e]);return}}b=this.f.NB;c=0;for(d=b.length;c<d;)if(e=
c++,b[e].id==a){this.ld(b[e]);break}},km:function(){if(null!=this.nh)return!0;this.nh=[];var a=this.Ba("position");if(null==a)return!1;for(var b=0;b<a.length;)this.nh.push(new n(a[b],a[b+1],a[b+2])),b+=3;return!0},clone:function(a,b,c){null==c&&(c=!1);return new S(a,this.f,b,this,c)},dispose:function(a){null==a&&(a=!1);null!=this.xa&&this.xa.Kr(this,!0);null!=this.Tp&&(this.Tp.dispose(),this.Tp=null);for(;0<this.Gh.length;)this.Gh[0].dispose();for(var b=this.f.tf,c=0,d=b.length;c<d;){var e=c++,e=
b[e];null!=e&&(e.Zv(this),e.kL(this))}ka.prototype.dispose.call(this,a)},OH:function(){for(var a=this.Zu(),b=new W,c=new W,d=new W,e=!1,f=0;f<a.length;){var g=a[f],h=this.Ch(g);"normal"==g?(e=h.R.rh,a.splice(f,1),--f):(null!=t[g]?b.C(g,h):b.h[g]=h,h=(null!=t[g]?b.H(g):b.h[g]).R.qg,null!=t[g]?c.C(g,h):c.h[g]=h,h=[],null!=t[g]?d.C(g,h):d.h[g]=h,++f)}if(null!=this.Ha){for(var f=this.Ha.slice(0),g=this.Bc(),h=this.On(),k=0;k<h;)for(var l=k++,l=g[l],m=0,w=a.length;m<w;)for(var C=m++,C=a[C],u=(null!=t[C]?
b.H(C):b.h[C]).Bd,y=0,p=u;y<p;){var z=y++;(null!=t[C]?d.H(C):d.h[C]).push((null!=t[C]?c.H(C):c.h[C])[l*u+z])}c=[];k=null!=t.position?d.H("position"):d.h.position;for(l=0;l<h;){g[l]=l;g[l+1]=l+1;g[l+2]=l+2;var q,m=3*l,C=k[m],z=k[m+1];q=k[m+2];var m=3*(l+1),u=k[m],w=k[m+1],m=k[m+2],r,y=3*(l+2);r=k[y];p=k[y+1];y=k[y+2];C-=u;z-=w;q-=m;u=r-u;w=p-w;m=y-m;y=new n(0,0,0);y.x=z*m-q*w;y.y=q*u-C*m;y.z=C*w-z*u;m=y;w=new n(0,0,0);w.x=m.x;w.y=m.y;w.z=m.z;w.normalize();m=w;for(w=0;3>w;)w++,c.push(m.x),c.push(m.y),
c.push(m.z);l+=3}this.$j(g);this.Ga("normal",c,e);e=0;for(g=a.length;e<g;)h=e++,h=a[h],this.Ga(h,null!=t[h]?d.H(h):d.h[h],(null!=t[h]?b.H(h):b.h[h]).R.rh);this.qo();a=0;for(b=f.length;a<b;)d=a++,d=f[d],new Rb(d.wf,d.Xb,d.Xd,d.Xb,d.Xd,this);a=0;for(b=this.Gh.length;a<b;)if(d=a++,d=this.Gh[d],d.qo(),null!=d.gc.Ha)for(f=0,e=d.gc.Ha.length;f<e;)g=f++,d.gc.Ha[g].clone(d,d.gc)}},bl:function(a){return new Jd(a,this)},kH:function(a){if(null==this.sl())return this;var b=this.f.Pa;if(this.sl().nz==b)return this;
b=this.f.Pa;this.sl().nz=b;if(!(this.fb("position")&&this.fb("normal")&&this.fb("matricesIndices")&&this.fb("matricesWeights")))return this;null==this.pq&&(this.pq=b=this.Ba("position"),this.Ch("position").R.rh||this.Ga("position",b,!0));null==this.oq&&(this.oq=b=this.Ba("normal"),this.Ch("normal").R.rh||this.Ga("normal",b,!0));var b=this.Ba("position"),c=this.Ba("normal"),d=this.Ba("matricesIndices"),e=this.Ba("matricesWeights"),f=4<this.Me,g=f?this.Ba("matricesIndicesExtra"):null,h=f?this.Ba("matricesWeightsExtra"):
null;a.Pi&&null!=this.ee?a=this.ee:(null==a.Fe&&a.Hl(),a=a.Fe);for(var k,l,m,w=new r,n=new ib([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),u=0,y=0;y<b.length;){for(m=0;4>m;)if(k=m++,l=e[u+k],0<l){k=16*d[u+k];for(var p=0;16>p;){var z=p++;n[z]=a[z+k]*l}for(l=0;16>l;)k=l++,w.a[k]+=n[k]}else break;u+=4;if(f)for(m=0;4>m;)if(p=m++,l=h[u+p],0<l){k=new ib(a);p=16*g[u+p];for(z=0;16>z;){var q=z++;n[q]=k[q+p]*l}for(l=0;16>l;)k=l++,w.a[k]+=n[k]}else break;m=this.pq[y];z=this.pq[y+1];q=this.pq[y+2];l=m*w.a[1]+z*w.a[5]+
q*w.a[9]+w.a[13];k=m*w.a[2]+z*w.a[6]+q*w.a[10]+w.a[14];p=m*w.a[3]+z*w.a[7]+q*w.a[11]+w.a[15];m=(m*w.a[0]+z*w.a[4]+q*w.a[8]+w.a[12])/p;l/=p;k/=p;b[y]=m;b[y+1]=l;b[y+2]=k;k=this.oq[y];p=this.oq[y+1];z=this.oq[y+2];m=k*w.a[0]+p*w.a[4]+z*w.a[8];l=k*w.a[1]+p*w.a[5]+z*w.a[9];k=k*w.a[2]+p*w.a[6]+z*w.a[10];c[y]=m;c[y+1]=l;c[y+2]=k;for(m=0;16>m;)l=m++,w.a[l]=0;y+=3}this.Yh("position",b);this.Yh("normal",c);return this},l:S,ha:F(ka.prototype.ha,{sl:"get_geometry"})});var pc=J.BABYLON.LinesMesh=function(a,b,
c,d,e){null==e&&(e=!1);this.Bt=new W;this.alpha=1;this.color=new L(1,1,1);this.Cj=this.il=0;S.call(this,a,b,c,d,e);null!=d&&(a=d.color,this.color=new L(a.r,a.v,a.m),this.alpha=d.alpha);this.UF=.1;this.sd=new rc("colorShader",b,"color",{attributes:["position"],wb:["worldViewProjection","color"],Oi:!0});b=this.Bt;null!=t.position?b.C("position",null):b.h.position=null};q["com.babylonhx.mesh.LinesMesh"]=pc;pc.i=["com","babylonhx","mesh","LinesMesh"];pc.U=S;pc.prototype=F(S.prototype,{cv:function(){return this.UF},
Gg:function(){return this.sd},ql:function(){return!1},bl:function(){console.log("LinesMeshes do not support createInstance.");return null},wp:function(){var a=this.f.c,b=this.xa.Ch("position"),c=this.Bt;null!=t.position?c.C("position",b):c.h.position=b;var b=this.Bt,c=this.xa.ml(),d=this.sd.s;if(a.qb!=b||a.Qb!=d){a.qb=b;a.Qb=d;p.sa=d.we;for(var e=0,f=p.sa.length;e<f;){var g=e++;p.g=d.sa[g];0<=p.g&&(g=p.sa[g],p.F=null!=t[g]?b.H(g):b.h[g],null==p.F?a.na[p.g]&&(a.b.disableVertexAttribArray(p.g),a.na[p.g]=
!1):(a.na[p.g]||(a.b.enableVertexAttribArray(p.g),a.na[p.g]=!0),g=p.F.R.R,a.vertexAttribPointer(g,p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(a.T.Kc.vertexAttribDivisorANGLE(p.g,1),a.ad.push(p.g),a.td.push(g))))}}null!=c&&a.kb!=c&&(a.kb=c,a.V.get(34963)!=c&&(a.b.bindBuffer(34963,null==c?null:c.buffer),a.V.set(34963,null==c?null:c)),a.Ud=c.Sc);a=this.sd;b=this.color;b=new ca(b.r,b.v,b.m,this.alpha);-1==a.Da.wb.indexOf("color")&&a.Da.wb.push("color");a.Zg.set("color",b)},Jp:function(a){null!=this.xa&&
null!=this.xa.Pn()&&null!=this.xa.ml()&&this.f.c.Ic(!1,a.Xb,a.Xd)},dispose:function(a){null==a&&(a=!1);this.sd.dispose();S.prototype.dispose.call(this,a)},clone:function(a,b,c){null==c&&(c=!1);return new pc(a,this.f,b,this,c)},l:pc,ha:F(S.prototype.ha,{cv:"get_intersectionThreshold"})});var K=J.BABYLON.Vector2=function(a,b){this.x=a;this.y=b};q["com.babylonhx.math.Vector2"]=K;K.i=["com","babylonhx","math","Vector2"];K.ve=function(){return new K(0,0)};K.El=function(a,b){null==b&&(b=0);return new K(a[b],
a[b+1])};K.Jl=function(a,b,c){c.x=a[b];c.y=a[b+1];return c};K.Ni=function(a,b,c,d,e){var f=e*e,g=e*f;return new K(.5*(2*b.x+(-a.x+c.x)*e+(2*a.x-5*b.x+4*c.x-d.x)*f+(-a.x+3*b.x-3*c.x+d.x)*g),.5*(2*b.y+(-a.y+c.y)*e+(2*a.y-5*b.y+4*c.y-d.y)*f+(-a.y+3*b.y-3*c.y+d.y)*g))};K.Qj=function(a,b,c){var d=a.x;d>c.x&&(d=c.x);d<b.x&&(d=b.x);a=a.y;a>c.y&&(a=c.y);a<b.y&&(a=b.y);return new K(d,a)};K.Kl=function(a,b,c,d,e){var f=e*e,g=e*f,h=2*g-3*f+1,k=-2*g+3*f;e=g-2*f+e;f=g-f;return new K(a.x*h+c.x*k+b.x*e+d.x*f,a.y*
h+c.y*k+b.y*e+d.y*f)};K.Vc=function(a,b,c){return new K(a.x+(b.x-a.x)*c,a.y+(b.y-a.y)*c)};K.Bl=function(a,b){return a.x*b.x+a.y*b.y};K.Ho=function(a){a=new K(a.x,a.y);a.normalize();return a};K.Fo=function(a,b){return new K(a.x<b.x?a.x:b.x,a.y<b.y?a.y:b.y)};K.Ll=function(a,b){return new K(a.x>b.x?a.x:b.x,a.y>b.y?a.y:b.y)};K.Eh=function(a,b){return new K(a.x*b.a[0]+a.y*b.a[4],a.x*b.a[1]+a.y*b.a[5])};K.Rj=function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)};K.Tj=function(a,b){var c=a.x-b.x,
d=a.y-b.y;return c*c+d*d};K.Lj=function(a,b){var c=new K(a.x+b.x,a.y+b.y);c.x*=.5;c.y*=.5;return c};K.xh=function(a,b,c){var d=b.x-c.x,e=b.y-c.y,e=d*d+e*e;if(0==e)return c=a.x-b.x,a=a.y-b.y,Math.sqrt(c*c+a*a);d=c.x-b.x;c=c.y-b.y;e=Math.max(0,Math.min(1,((a.x-b.x)*d+(a.y-b.y)*c)/e));d=a.x-(b.x+d*e);a=a.y-(b.y+c*e);return Math.sqrt(d*d+a*a)};K.prototype={normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y);if(0==a)return this;a=1/a;this.x*=a;this.y*=a;return this},l:K};var za=J.BABYLON.Tags=
function(){};q["com.babylonhx.tools.Tags"]=za;za.i=["com","babylonhx","tools","Tags"];za.mE=function(a){a.xi=null!=a.xi?a.xi:{};a.CO=function(){return za.CA(a)};a.ON=function(b){za.ae(a,b)};a.tP=function(b){za.ME(a,b)}};za.CA=function(a){return a.xi?!ga.FE(a.xi):!1};za.zE=function(a){return null==a.xi?null:a.xi};za.ae=function(a,b){null==b&&(b="");if(""!=b)for(var c=b.split(" "),d=0;d<c.length;){var e=c[d];++d;za.ZD(a,e)}};za.ZD=function(a,b){b=wa.Kl(b);if(""!=b&&"true"!=b&&"false"!=b){var c=new jc("^([!]|([|]|[&]){2})",
"");(new jc("[\\s]","")).match(b)||c.match(b)||(za.mE(a),X.$b(a.xi,b,!0))}};za.ME=function(a,b){if(za.CA(a))for(var c=b.split(" "),d=0;d<c.length;){var e=c[d];++d;za.FH(a,e)}};za.FH=function(a,b){a.xi.remove(b)};var ga=J.BABYLON.Tools=function(){};q["com.babylonhx.tools.Tools"]=ga;ga.i=["com","babylonhx","tools","Tools"];ga.Ah=function(a,b){var c=new vb(b);c.fw=function(){c.stop();a()}};ga.ps=function(){var a="pointer";window.navigator.ya||(a="mouse");return a};ga.qs=function(a){for(var b=0;b<a.length;){var c=
a[b];++b;window.addEventListener(c.name,c.Rc,!1);try{window.parent&&window.parent.addEventListener(c.name,c.Rc,!1)}catch(d){}}};ga.Oo=function(a){for(var b=0;b<a.length;){var c=a[b];++b;window.removeEventListener(c.name,c.Rc);try{window.parent&&window.parent.removeEventListener(c.name,c.Rc)}catch(d){}}};ga.Yw=function(a){return a=a.replace(RegExp("#","mg"),"%23")};ga.Lj=function(a,b,c,d){function e(){var d=new XMLHttpRequest,e=ga.eE+a;d.open("GET",e,!0);f&&(d.responseType="arraybuffer");d.onprogress=
c;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status)b(f?d.response:d.responseText);else throw new ja("Error status: "+d.status+" - Unable to load "+e);};d.send(null)}var f;null==f&&(f=!1);a=ga.Yw(a);-1==a.indexOf("file:")&&(null!=d&&d.gO?d.iP(function(){d.UO(a,b,c,e,f)},e):e())};ga.Qj=function(a,b){a=ga.Yw(a);var c=new Image;"data:"!=Q.substr(a,0,5)&&(c.crossOrigin="anonymous");c.onload=function(){var a=window.document.createElement("canvas");a.width=c.width;a.height=c.height;a=
a.getContext("2d",null);a.drawImage(c,0,0,c.width,c.height,0,0,c.width,c.height);a=a.getImageData(0,0,c.width,c.height).data;a=Array.prototype.slice.call(a);null!=b&&b(new Ye(new Ka(a),c.width,c.height))};c.src=a};ga.FE=function(a){if(a instanceof Array&&null==a.jb)for(a=v.g(a,Array);0<a.length;)return!1;return!0};var r=J.BABYLON.Matrix=function(){this.a=new ib([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])};q["com.babylonhx.math.Matrix"]=r;r.i=["com","babylonhx","math","Matrix"];r.aQ=function(a,b){null==b&&
(b=0);for(var c=new r,d=0;16>d;){var e=d++;c.a[e]=a[e+b]}return c};r.YM=function(a,b,c){for(var d=0;16>d;){var e=d++;c.a[e]=a[e+b]}};r.sN=function(a,b,c,d){for(var e=0;16>e;){var f=e++;d.a[f]=a[f+b]*c}};r.aa=function(a,b,c,d,e,f,g,h,k,l,m,w,n){n.a[0]=a;n.a[1]=b;n.a[2]=c;n.a[3]=0;n.a[4]=d;n.a[5]=e;n.a[6]=f;n.a[7]=0;n.a[8]=g;n.a[9]=h;n.a[10]=k;n.a[11]=0;n.a[12]=l;n.a[13]=m;n.a[14]=w;n.a[15]=1};r.uN=function(a,b,c,d,e,f,g,h,k,l,m,w,n,u,y,p){var z=new r;z.a[0]=a;z.a[1]=b;z.a[2]=c;z.a[3]=d;z.a[4]=e;z.a[5]=
f;z.a[6]=g;z.a[7]=h;z.a[8]=k;z.a[9]=l;z.a[10]=m;z.a[11]=w;z.a[12]=n;z.a[13]=u;z.a[14]=y;z.a[15]=p;return z};r.qN=function(a,b,c){var d=a.x,e=a.y;a=a.z;var f=new r;f.a[0]=d;f.a[1]=0;f.a[2]=0;f.a[3]=0;f.a[4]=0;f.a[5]=e;f.a[6]=0;f.a[7]=0;f.a[8]=0;f.a[9]=0;f.a[10]=a;f.a[11]=0;f.a[12]=0;f.a[13]=0;f.a[14]=0;f.a[15]=1;d=f;e=new r;e.a[0]=1;e.a[1]=0;e.a[2]=0;e.a[3]=0;e.a[4]=0;e.a[5]=1;e.a[6]=0;e.a[7]=0;e.a[8]=0;e.a[9]=0;e.a[10]=1;e.a[11]=0;e.a[12]=0;e.a[13]=0;e.a[14]=0;e.a[15]=1;b.Af(e);b=new r;d.qa(e,b.a,
0);d=b;d.a[12]=c.x;d.a[13]=c.y;d.a[14]=c.z;return d};r.ZM=function(){var a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=1;return a};r.NN=function(a){r.aa(1,0,0,0,1,0,0,0,1,0,0,0,a)};r.iN=function(){var a=new r;a.a[0]=0;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=0;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=0;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=0;return a};r.fP=function(a){var b=
new r,c=Math.sin(a);a=Math.cos(a);b.a[0]=1;b.a[15]=1;b.a[5]=a;b.a[10]=a;b.a[9]=-c;b.a[6]=c;b.a[1]=0;b.a[2]=0;b.a[3]=0;b.a[4]=0;b.a[7]=0;b.a[8]=0;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0;return b};r.RN=function(a){var b=new r,c=a.a[0],d=a.a[1],e=a.a[2],f=a.a[3],g=a.a[4],h=a.a[5],k=a.a[6],l=a.a[7],m=a.a[8],w=a.a[9],n=a.a[10],u=a.a[11],y=a.a[12],p=a.a[13],z=a.a[14],q=a.a[15];a=n*q-u*z;var t=w*q-u*p,Cc=w*z-n*p,x=m*q-u*y,v=m*z-n*y,G=m*p-w*y,D=h*a-k*t+l*Cc,A=-(g*a-k*x+l*v),P=g*t-h*x+l*G,N=-(g*Cc-h*v+k*G),
E=1/(c*D+d*A+e*P+f*N),O=k*q-l*z,B=h*q-l*p,H=h*z-k*p,q=g*q-l*y,z=g*z-k*y,y=g*p-h*y,p=k*u-l*n,I=h*u-l*w,F=h*n-k*w,l=g*u-l*m,k=g*n-k*m,g=g*w-h*m;b.a[0]=D*E;b.a[4]=A*E;b.a[8]=P*E;b.a[12]=N*E;b.a[1]=-(d*a-e*t+f*Cc)*E;b.a[5]=(c*a-e*x+f*v)*E;b.a[9]=-(c*t-d*x+f*G)*E;b.a[13]=(c*Cc-d*v+e*G)*E;b.a[2]=(d*O-e*B+f*H)*E;b.a[6]=-(c*O-e*q+f*z)*E;b.a[10]=(c*B-d*q+f*y)*E;b.a[14]=-(c*H-d*z+e*y)*E;b.a[3]=-(d*p-e*I+f*F)*E;b.a[7]=(c*p-e*l+f*k)*E;b.a[11]=-(c*I-d*l+f*g)*E;b.a[15]=(c*F-d*k+e*g)*E;return b};r.gP=function(a,
b){var c=Math.sin(a),d=Math.cos(a);b.a[0]=1;b.a[15]=1;b.a[5]=d;b.a[10]=d;b.a[9]=-c;b.a[6]=c;b.a[1]=0;b.a[2]=0;b.a[3]=0;b.a[4]=0;b.a[7]=0;b.a[8]=0;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0};r.kP=function(a){var b=new r,c=Math.sin(a);a=Math.cos(a);b.a[5]=1;b.a[15]=1;b.a[0]=a;b.a[2]=-c;b.a[8]=c;b.a[10]=a;b.a[1]=0;b.a[3]=0;b.a[4]=0;b.a[6]=0;b.a[7]=0;b.a[9]=0;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0;return b};r.pP=function(a,b){var c=Math.sin(a),d=Math.cos(a);b.a[5]=1;b.a[15]=1;b.a[0]=d;b.a[2]=-c;b.a[8]=
c;b.a[10]=d;b.a[1]=0;b.a[3]=0;b.a[4]=0;b.a[6]=0;b.a[7]=0;b.a[9]=0;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0};r.qP=function(a){var b=new r,c=Math.sin(a);a=Math.cos(a);b.a[10]=1;b.a[15]=1;b.a[0]=a;b.a[1]=c;b.a[4]=-c;b.a[5]=a;b.a[2]=0;b.a[3]=0;b.a[6]=0;b.a[7]=0;b.a[8]=0;b.a[9]=0;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0;return b};r.yP=function(a,b){var c=Math.sin(a),d=Math.cos(a);b.a[10]=1;b.a[15]=1;b.a[0]=d;b.a[1]=c;b.a[4]=-c;b.a[5]=d;b.a[2]=0;b.a[3]=0;b.a[6]=0;b.a[7]=0;b.a[8]=0;b.a[9]=0;b.a[11]=0;b.a[12]=
0;b.a[13]=0;b.a[14]=0};r.eN=function(a,b){var c=new r;c.a[0]=0;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=0;c.a[5]=0;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=0;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=0;r.kp(a,b,c);return c};r.kp=function(a,b,c){var d=Math.sin(-b);b=Math.cos(-b);var e=1-b;a.normalize();c.a[0]=a.x*a.x*e+b;c.a[1]=a.x*a.y*e-a.z*d;c.a[2]=a.x*a.z*e+a.y*d;c.a[3]=0;c.a[4]=a.y*a.x*e+a.z*d;c.a[5]=a.y*a.y*e+b;c.a[6]=a.y*a.z*e-a.x*d;c.a[7]=0;c.a[8]=a.z*a.x*e-a.y*d;c.a[9]=a.z*a.y*e+a.x*d;c.a[10]=
a.z*a.z*e+b;c.a[11]=0;c.a[15]=1};r.fN=function(a,b,c){var d=new r,e=r.Ta;c*=.5;var f=.5*b;b=.5*a;a=Math.sin(c);c=Math.cos(c);var g=Math.sin(f),f=Math.cos(f),h=Math.sin(b);b=Math.cos(b);e.x=b*g*c+h*f*a;e.y=h*f*c-b*g*a;e.z=b*f*a-h*g*c;e.o=b*f*c+h*g*a;r.Ta.Af(d);return d};r.gN=function(a,b,c,d){var e=r.Ta;c*=.5;var f=.5*b;b=.5*a;a=Math.sin(c);c=Math.cos(c);var g=Math.sin(f),f=Math.cos(f),h=Math.sin(b);b=Math.cos(b);e.x=b*g*c+h*f*a;e.y=h*f*c-b*g*a;e.z=b*f*a-h*g*c;e.o=b*f*c+h*g*a;r.Ta.Af(d)};r.JP=function(a,
b,c){var d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=0;d.a[0]=a;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=b;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=c;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=1;return d};r.OP=function(a,b,c,d){d.a[0]=a;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=b;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=c;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=1};
r.VP=function(a,b,c){var d=new r;d.a[0]=1;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=1;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=1;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,a,b,c,d);return d};r.WP=function(a,b,c,d){r.aa(1,0,0,0,1,0,0,0,1,a,b,c,d)};r.bN=function(a,b,c){var d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;for(var e=d.a[15]=0;16>e;){var f=e++;d.a[f]=a.a[f]*
(1-c)+b.a[f]*c}return d};r.rN=function(a,b,c){var d=new n(0,0,0),e=new da,f=new n(0,0,0);a.fA(d,e,f);var g=new n(0,0,0),h=new da;a=new n(0,0,0);b.fA(g,h,a);b=n.D(d,g,c);e=da.Ib(e,h,c);c=n.D(f,a,c);f=b.x;a=b.y;b=b.z;d=new r;d.a[0]=f;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=a;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=b;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=1;f=d;a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=
0;a.a[13]=0;a.a[14]=0;a.a[15]=1;e.Af(a);e=new r;f.qa(a,e.a,0);f=e;f.a[12]=c.x;f.a[13]=c.y;f.a[14]=c.z;return f};r.UN=function(a,b,c){var d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=0;r.$c(a,b,c,d);return d};r.$c=function(a,b,c,d){var e=r.Za;e.x=b.x-a.x;e.y=b.y-a.y;e.z=b.z-a.z;r.Za.normalize();b=r.Za;e=r.ya;e.x=c.y*b.z-c.z*b.y;e.y=c.z*b.x-c.x*b.z;e.z=c.x*b.y-c.y*b.x;c=r.ya;0==c.x*c.x+c.y*
c.y+c.z*c.z?r.ya.x=1:r.ya.normalize();c=r.Za;b=r.ya;e=r.Ib;e.x=c.y*b.z-c.z*b.y;e.y=c.z*b.x-c.x*b.z;e.z=c.x*b.y-c.y*b.x;r.Ib.normalize();c=r.ya;r.$I=-(c.x*a.x+c.y*a.y+c.z*a.z);c=r.Ib;r.rJ=-(c.x*a.x+c.y*a.y+c.z*a.z);c=r.Za;r.sJ=-(c.x*a.x+c.y*a.y+c.z*a.z);r.aa(r.ya.x,r.Ib.x,r.Za.x,r.ya.y,r.Ib.y,r.Za.y,r.ya.z,r.Ib.z,r.Za.z,r.$I,r.rJ,r.sJ,d)};r.YN=function(a,b,c){var d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=
0;d.a[14]=0;d.a[15]=0;r.jB(a,b,c,d);return d};r.jB=function(a,b,c,d){var e=r.Za;e.x=a.x-b.x;e.y=a.y-b.y;e.z=a.z-b.z;r.Za.normalize();b=r.Za;e=r.ya;e.x=c.y*b.z-c.z*b.y;e.y=c.z*b.x-c.x*b.z;e.z=c.x*b.y-c.y*b.x;c=r.ya;0==c.x*c.x+c.y*c.y+c.z*c.z?r.ya.x=1:r.ya.normalize();c=r.Za;b=r.ya;e=r.Ib;e.x=c.y*b.z-c.z*b.y;e.y=c.z*b.x-c.x*b.z;e.z=c.x*b.y-c.y*b.x;r.Ib.normalize();c=r.ya;b=r.Ib;e=r.Za;r.aa(r.ya.x,r.Ib.x,r.Za.x,r.ya.y,r.Ib.y,r.Za.y,r.ya.z,r.Ib.z,r.Za.z,-(c.x*a.x+c.y*a.y+c.z*a.z),-(b.x*a.x+b.y*a.y+b.z*
a.z),-(e.x*a.x+e.y*a.y+e.z*a.z),d)};r.dO=function(a,b,c,d){a=2/a;b=2/b;var e=1/(d-c);c/=c-d;d=new r;d.a[0]=a;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=b;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=e;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=c;d.a[15]=1;return d};r.iO=function(a,b,c,d,e,f){var g=new r;g.a[0]=0;g.a[1]=0;g.a[2]=0;g.a[3]=0;g.a[4]=0;g.a[5]=0;g.a[6]=0;g.a[7]=0;g.a[8]=0;g.a[9]=0;g.a[10]=0;g.a[11]=0;g.a[12]=0;g.a[13]=0;g.a[14]=0;g.a[15]=0;r.Rj(a,b,c,d,e,f,g);return g};r.Rj=function(a,b,c,d,
e,f,g){g=g.a;g[0]=2/(b-a);g[1]=0;g[2]=0;g[3]=0;g[5]=2/(d-c);g[4]=0;g[6]=0;g[7]=0;g[10]=1/(f-e);g[8]=0;g[9]=0;g[11]=0;g[12]=(a+b)/(a-b);g[13]=(d+c)/(c-d);g[14]=-e/(f-e);g[15]=1};r.mO=function(a,b,c,d,e,f){var g=new r;g.a[0]=0;g.a[1]=0;g.a[2]=0;g.a[3]=0;g.a[4]=0;g.a[5]=0;g.a[6]=0;g.a[7]=0;g.a[8]=0;g.a[9]=0;g.a[10]=0;g.a[11]=0;g.a[12]=0;g.a[13]=0;g.a[14]=0;g.a[15]=0;r.kB(a,b,c,d,e,f,g);return g};r.kB=function(a,b,c,d,e,f,g){r.Rj(a,b,c,d,e,f,g);g.a[10]*=-1};r.SO=function(a,b,c,d){var e=new r;e.a[0]=0;
e.a[1]=0;e.a[2]=0;e.a[3]=0;e.a[4]=0;e.a[5]=0;e.a[6]=0;e.a[7]=0;e.a[8]=0;e.a[9]=0;e.a[10]=0;e.a[11]=0;e.a[12]=0;e.a[13]=0;e.a[14]=0;e.a[15]=0;e.a[0]=2*c/a;e.a[1]=0;e.a[2]=0;e.a[3]=0;e.a[5]=2*c/b;e.a[4]=0;e.a[6]=0;e.a[7]=0;e.a[10]=-d/(c-d);e.a[8]=0;e.a[9]=0;e.a[11]=1;e.a[12]=0;e.a[13]=0;e.a[15]=0;e.a[14]=c*d/(c-d);return e};r.JO=function(a,b,c,d){var e=new r;e.a[0]=0;e.a[1]=0;e.a[2]=0;e.a[3]=0;e.a[4]=0;e.a[5]=0;e.a[6]=0;e.a[7]=0;e.a[8]=0;e.a[9]=0;e.a[10]=0;e.a[11]=0;e.a[12]=0;e.a[13]=0;e.a[14]=0;e.a[15]=
0;r.Ag(a,b,c,d,e);return e};r.Ag=function(a,b,c,d,e,f){null==f&&(f=!0);a=1/Math.tan(.5*a);e.a[0]=f?a/b:a;e.a[1]=0;e.a[2]=0;e.a[3]=0;e.a[5]=f?a:a*b;e.a[4]=0;e.a[6]=0;e.a[7]=0;e.a[8]=0;e.a[9]=0;e.a[10]=-d/(c-d);e.a[11]=1;e.a[12]=0;e.a[13]=0;e.a[15]=0;e.a[14]=c*d/(c-d)};r.QO=function(a,b,c,d){var e=new r;e.a[0]=0;e.a[1]=0;e.a[2]=0;e.a[3]=0;e.a[4]=0;e.a[5]=0;e.a[6]=0;e.a[7]=0;e.a[8]=0;e.a[9]=0;e.a[10]=0;e.a[11]=0;e.a[12]=0;e.a[13]=0;e.a[14]=0;e.a[15]=0;r.JB(a,b,c,d,e);return e};r.JB=function(a,b,c,d,
e,f){null==f&&(f=!0);a=1/Math.tan(.5*a);e.a[0]=f?a/b:a;e.a[1]=0;e.a[2]=0;e.a[3]=0;e.a[5]=f?a:a*b;e.a[4]=0;e.a[6]=0;e.a[7]=0;e.a[8]=0;e.a[9]=0;e.a[10]=d/(c-d);e.a[11]=-1;e.a[12]=0;e.a[13]=0;e.a[15]=0;e.a[14]=c*d/(c-d)};r.RO=function(a,b,c,d){var e=Math.tan(a.QP*Math.PI/180),f=Math.tan(a.$N*Math.PI/180),g=Math.tan(a.TO*Math.PI/180);a=Math.tan(a.vP*Math.PI/180);var h=2/(g+a),k=2/(e+f);d.a[0]=h;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=k;d.a[6]=0;d.a[7]=0;d.a[8]=(g-a)*h*.5;d.a[9]=-((e-f)*k*.5);d.a[10]=
-c/(b-c);d.a[11]=1;d.a[12]=0;d.a[13]=0;d.a[15]=0;d.a[14]=b*c/(b-c)};r.XM=function(a,b,c,d,e,f){var g=a.width,h=a.height,k=a.x,l=a.y;a=new r;a.a[0]=g/2;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=-h/2;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=f-e;a.a[11]=0;a.a[12]=k+g/2;a.a[13]=h/2+l;a.a[14]=e;a.a[15]=1;e=new r;b.qa(c,e.a,0);b=new r;e.qa(d,b.a,0);d=new r;b.qa(a,d.a,0);return d};r.wN=function(a){return new ib([a.a[0],a.a[1],a.a[4],a.a[5]])};r.xN=function(a){return new ib([a.a[0],a.a[1],a.a[2],a.a[4],
a.a[5],a.a[6],a.a[8],a.a[9],a.a[10]])};r.ZP=function(a){var b=new r;b.a[0]=a.a[0];b.a[1]=a.a[4];b.a[2]=a.a[8];b.a[3]=a.a[12];b.a[4]=a.a[1];b.a[5]=a.a[5];b.a[6]=a.a[9];b.a[7]=a.a[13];b.a[8]=a.a[2];b.a[9]=a.a[6];b.a[10]=a.a[10];b.a[11]=a.a[14];b.a[12]=a.a[3];b.a[13]=a.a[7];b.a[14]=a.a[11];b.a[15]=a.a[15];return b};r.YO=function(a){var b=new r;r.OB(a,b);return b};r.OB=function(a,b){var c=Math.sqrt(a.j.x*a.j.x+a.j.y*a.j.y+a.j.z*a.j.z),d=0;0!=c&&(d=1/c);a.j.x*=d;a.j.y*=d;a.j.z*=d;a.d*=d;var c=a.j.x,d=
a.j.y,e=a.j.z,f=-2*c,g=-2*d,h=-2*e;b.a[0]=f*c+1;b.a[1]=g*c;b.a[2]=h*c;b.a[3]=0;b.a[4]=f*d;b.a[5]=g*d+1;b.a[6]=h*d;b.a[7]=0;b.a[8]=f*e;b.a[9]=g*e;b.a[10]=h*e+1;b.a[11]=0;b.a[12]=f*a.d;b.a[13]=g*a.d;b.a[14]=h*a.d;b.a[15]=1};r.vN=function(a,b,c,d){d.a[0]=a.x;d.a[1]=a.y;d.a[2]=a.z;d.a[3]=0;d.a[4]=b.x;d.a[5]=b.y;d.a[6]=b.z;d.a[7]=0;d.a[8]=c.x;d.a[9]=c.y;d.a[10]=c.z;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=1};r.tN=function(a,b){var c=a.x*a.x,d=a.y*a.y,e=a.z*a.z,f=a.x*a.y,g=a.z*a.o,h=a.z*a.x,k=a.y*
a.o,l=a.y*a.z,m=a.x*a.o;b.a[0]=1-2*(d+e);b.a[1]=2*(f+g);b.a[2]=2*(h-k);b.a[3]=0;b.a[4]=2*(f-g);b.a[5]=1-2*(e+c);b.a[6]=2*(l+m);b.a[7]=0;b.a[8]=2*(h+k);b.a[9]=2*(l-m);b.a[10]=1-2*(d+c);b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0;b.a[15]=1};r.prototype={qa:function(a,b,c){var d=this.a[0],e=this.a[1],f=this.a[2],g=this.a[3],h=this.a[4],k=this.a[5],l=this.a[6],m=this.a[7],w=this.a[8],n=this.a[9],u=this.a[10],y=this.a[11],p=this.a[12],z=this.a[13],q=this.a[14],r=this.a[15],t=a.a[0],x=a.a[1],v=a.a[2],G=a.a[3],
D=a.a[4],A=a.a[5],P=a.a[6],N=a.a[7],E=a.a[8],O=a.a[9],B=a.a[10],H=a.a[11],I=a.a[12],F=a.a[13],K=a.a[14];a=a.a[15];b[c]=d*t+e*D+f*E+g*I;b[c+1]=d*x+e*A+f*O+g*F;b[c+2]=d*v+e*P+f*B+g*K;b[c+3]=d*G+e*N+f*H+g*a;b[c+4]=h*t+k*D+l*E+m*I;b[c+5]=h*x+k*A+l*O+m*F;b[c+6]=h*v+k*P+l*B+m*K;b[c+7]=h*G+k*N+l*H+m*a;b[c+8]=w*t+n*D+u*E+y*I;b[c+9]=w*x+n*A+u*O+y*F;b[c+10]=w*v+n*P+u*B+y*K;b[c+11]=w*G+n*N+u*H+y*a;b[c+12]=p*t+z*D+q*E+r*I;b[c+13]=p*x+z*A+q*O+r*F;b[c+14]=p*v+z*P+q*B+r*K;b[c+15]=p*G+z*N+q*H+r*a;return this},fA:function(a,
b,c){c.x=this.a[12];c.y=this.a[13];c.z=this.a[14];c=this.a[0]*this.a[1]*this.a[2]*this.a[3];var d=this.a[4]*this.a[5]*this.a[6]*this.a[7],e=this.a[8]*this.a[9]*this.a[10]*this.a[11];a.x=(0>(0==c?0:0<c?1:-1)?-1:1)*Math.sqrt(this.a[0]*this.a[0]+this.a[1]*this.a[1]+this.a[2]*this.a[2]);a.y=(0>(0==d?0:0<d?1:-1)?-1:1)*Math.sqrt(this.a[4]*this.a[4]+this.a[5]*this.a[5]+this.a[6]*this.a[6]);a.z=(0>(0==e?0:0<e?1:-1)?-1:1)*Math.sqrt(this.a[8]*this.a[8]+this.a[9]*this.a[9]+this.a[10]*this.a[10]);if(0==a.x||
0==a.y||0==a.z)return b.x=0,b.y=0,b.z=0,b.o=1,!1;r.aa(this.a[0]/a.x,this.a[1]/a.x,this.a[2]/a.x,this.a[4]/a.y,this.a[5]/a.y,this.a[6]/a.y,this.a[8]/a.z,this.a[9]/a.z,this.a[10]/a.z,0,0,0,ba.Ra[0]);da.$b(ba.Ra[0],b);return!0},l:r};var I=J.BABYLON.VertexData=function(){};q["com.babylonhx.mesh.VertexData"]=I;I.i=["com","babylonhx","mesh","VertexData"];I.oE=function(a){var b=!0;null==b&&(b=!1);return I.tH(a,b)};I.tH=function(a,b){null==b&&(b=!1);var c=new I;a.fb("position")&&(c.Na=a.Ba("position",b));
a.fb("normal")&&(c.gb=a.Ba("normal",b));a.fb("uv")&&(c.zb=a.Ba("uv",b));a.fb("uv2")&&(c.Zh=a.Ba("uv2",b));a.fb("uv3")&&(c.$h=a.Ba("uv3",b));a.fb("uv4")&&(c.ai=a.Ba("uv4",b));a.fb("uv5")&&(c.bi=a.Ba("uv5",b));a.fb("uv6")&&(c.ci=a.Ba("uv6",b));a.fb("color")&&(c.ke=a.Ba("color",b));a.fb("matricesIndices")&&(c.Kd=a.Ba("matricesIndices",b));a.fb("matricesWeights")&&(c.Wf=a.Ba("matricesWeights",b));a.fb("matricesIndicesExtra")&&(c.oe=a.Ba("matricesIndicesExtra",b));a.fb("matricesWeightsExtra")&&(c.Xf=a.Ba("matricesWeightsExtra",
b));c.pb=a.Bc(b);return c};I.Df=function(a){var b=a.Qg,c=null!=a.$k&&a.$k,d=null!=a.closePath&&a.closePath,e=Math.floor(b[0].length/2),f=null!=a.offset?a.offset:e,f=f>e?e:Math.floor(f),g=null!=a.$?a.$:0;a=[];var e=[],h=[],k=[],l=[],m=[],w=[],n=[],u,y=[],p=[],z=0,q;if(2>b.length){for(var r=[],t=[],x=0,v=b[0].length-f;x<v;){var G=x++;r.push(b[0][G]);t.push(b[0][G+f])}b=[r,t]}t=0;r=d?1:0;f=b[0].length;v=0;for(G=b.length;v<G;){var D=v++;w[D]=0;l[D]=[0];u=b[D];x=u.length;f<x||(f=x);for(q=0;q<x;){e.push(u[q].x);
e.push(u[q].y);e.push(u[q].z);if(0<q){var A,P,N;A=u[q];var E=u[q-1];N=A.x-E.x;P=A.y-E.y;A=A.z-E.z;P=Math.sqrt(N*N+P*P+A*A)+w[D];l[D].push(P);w[D]=P}++q}d&&(--q,e.push(u[0].x),e.push(u[0].y),e.push(u[0].z),P=u[q],N=u[0],q=P.x-N.x,u=P.y-N.y,P=P.z-N.z,u=Math.sqrt(q*q+u*u+P*P),u+=w[D],l[D].push(u),w[D]=u);y[D]=x+r;p[D]=t;t+=x+r}t=0;for(x=f+r;t<x;){v=t++;n[v]=0;m[v]=[0];G=0;for(D=b.length-1;G<D;)q=G++,u=b[q],q=b[q+1],v==f?(u=u[0],N=q[0]):(u=u[v],N=q[v]),P=N.x-u.x,q=N.y-u.y,u=N.z-u.z,u=Math.sqrt(P*P+q*
q+u*u),u+=n[v],m[v].push(u),n[v]=u;c&&(u=b[z],q=b[0],q=q[v],u=u[v],D=q.x-u.x,G=q.y-u.y,u=q.z-u.z,u=Math.sqrt(D*D+G*G+u*u),u+=n[v],n[v]=u)}t=0;for(x=b.length;t<x;)for(v=t++,G=0,D=f+r;G<D;)u=G++,z=l[v][u]/w[v],u=m[u][v]/n[u],k.push(z),k.push(u);l=z=0;w=y[z]-1;n=y[z+1]-1;w=w<n?w:n;m=p[1]-p[0];for(c=c?y.length:y.length-1;l<=w&&z<c;)a.push(l),a.push(l+m),a.push(l+1),a.push(l+m+1),a.push(l+1),a.push(l+m),++l,l==w&&(++z,z==y.length-1?(m=p[0]-p[z],w=y[z]-1,n=y[0]-1):(m=p[z+1]-p[z],w=y[z]-1,n=y[z+1]-1),l=
p[z],w=w<n?w+l:n+l);I.be(e,a,h);if(d)for(y=0,l=b.length;y<l;)m=y++,c=3*p[m],m=m+1<b.length?3*(p[m+1]-1):h.length-3,h[c]=.5*(h[c]+h[m]),h[c+1]=.5*(h[c+1]+h[m+1]),h[c+2]=.5*(h[c+2]+h[m+2]),h[m]=h[c],h[m+1]=h[c+1],h[m+2]=h[c+2];I.tc(g,e,a,h,k);b=new I;b.pb=a;b.Na=e;b.gb=h;b.zb=k;d&&(b.Sp=p);return b};I.yh=function(a){var b=[new n(0,0,1),new n(0,0,-1),new n(1,0,0),new n(-1,0,0),new n(0,1,0),new n(0,-1,0)],c=[],d=[],e=[],f=[],g=a.width,h=a.height,k=a.depth,l=null!=a.$?a.$:0,m=null!=a.Nn?a.Nn:[];a=a.Wq;
for(var w=[],p=0;6>p;){var u=p++;null==m[u]&&(m[u]=new Kd(0,0,1,1));null!=a&&null==a[u]&&(a[u]=new ca(1,1,1,1))}g/=2;h/=2;k/=2;m=0;for(p=b.length;m<p;){var u=m++,y=b[u],q,z,r=y.y;z=y.z;q=y.x;var t=new n(0,0,0);t.x=y.y*q-y.z*z;t.y=y.z*r-y.x*q;t.z=y.x*z-y.y*r;var v=d.length/3|0;c.push(v);c.push(v+1);c.push(v+2);c.push(v);c.push(v+2);c.push(v+3);v=new n((y.x-r-t.x)*g,(y.y-z-t.y)*h,(y.z-q-t.z)*k);d.push(v.x);d.push(v.y);d.push(v.z);e.push(y.x);e.push(y.y);e.push(y.z);f.push(1);f.push(1);null!=a&&(w.push(a[u].r),
w.push(a[u].v),w.push(a[u].m),w.push(a[u].W));v=new n((y.x-r+t.x)*g,(y.y-z+t.y)*h,(y.z-q+t.z)*k);d.push(v.x);d.push(v.y);d.push(v.z);e.push(y.x);e.push(y.y);e.push(y.z);f.push(0);f.push(1);null!=a&&(w.push(a[u].r),w.push(a[u].v),w.push(a[u].m),w.push(a[u].W));v=new n((y.x+r+t.x)*g,(y.y+z+t.y)*h,(y.z+q+t.z)*k);d.push(v.x);d.push(v.y);d.push(v.z);e.push(y.x);e.push(y.y);e.push(y.z);f.push(0);f.push(0);null!=a&&(w.push(a[u].r),w.push(a[u].v),w.push(a[u].m),w.push(a[u].W));v=new n((y.x+r-t.x)*g,(y.y+
z-t.y)*h,(y.z+q-t.z)*k);d.push(v.x);d.push(v.y);d.push(v.z);e.push(y.x);e.push(y.y);e.push(y.z);f.push(1);f.push(0);null!=a&&(w.push(a[u].r),w.push(a[u].v),w.push(a[u].m),w.push(a[u].W))}I.tc(l,d,c,e,f);b=new I;b.pb=c;b.Na=d;b.gb=e;b.zb=f;null!=a&&0<a.length&&(c=2==l?w.concat(w):w,b.ke=c);return b};I.gp=function(a){var b=[],c=[],d=[],e=[],f=null!=a.PC?a.PC:32,g=null!=a.lA?a.lA:1,h=null!=a.$?a.$:0,k=(null!=a.jA?a.jA:1)/2;a=(null!=a.kA?a.kA:1)/2;for(var g=g/2,f=2+f,l=2*f,m=0,w=f+1;m<w;){for(var p=m++,
u=p/f,y=u*Math.PI,q=0,z=l+1;q<z;){var t=q++/l,M=t*Math.PI*2,v=-y,x=new r,A=Math.sin(v),v=Math.cos(v);x.a[10]=1;x.a[15]=1;x.a[0]=v;x.a[1]=A;x.a[4]=-A;x.a[5]=v;x.a[2]=0;x.a[3]=0;x.a[6]=0;x.a[7]=0;x.a[8]=0;x.a[9]=0;x.a[11]=0;x.a[12]=0;x.a[13]=0;x.a[14]=0;A=new r;v=Math.sin(M);M=Math.cos(M);A.a[5]=1;A.a[15]=1;A.a[0]=M;A.a[2]=-v;A.a[8]=v;A.a[10]=M;A.a[1]=0;A.a[3]=0;A.a[4]=0;A.a[6]=0;A.a[7]=0;A.a[9]=0;A.a[11]=0;A.a[12]=0;A.a[13]=0;A.a[14]=0;var M=A,A=new n(0,0,0),x=x.a,v=0*x[1]+1*x[5]+0*x[9]+x[13],G=0*
x[2]+1*x[6]+0*x[10]+x[14],D=0*x[3]+1*x[7]+0*x[11]+x[15];A.x=(0*x[0]+1*x[4]+0*x[8]+x[12])/D;A.y=v/D;A.z=G/D;var G=A,x=new n(0,0,0),A=G.x,v=G.y,G=G.z,M=M.a,D=A*M[1]+v*M[5]+G*M[9]+M[13],B=A*M[2]+v*M[6]+G*M[10]+M[14],P=A*M[3]+v*M[7]+G*M[11]+M[15];x.x=(A*M[0]+v*M[4]+G*M[8]+M[12])/P;x.y=D/P;x.z=B/P;A=x;x=A.x*k;M=A.y*a;A=A.z*g;v=new n(0,0,0);v.x=x;v.y=M;v.z=A;v.normalize();c.push(x);c.push(M);c.push(A);d.push(v.x);d.push(v.y);d.push(v.z);e.push(t);e.push(u)}if(0<p)for(p=c.length/3,u=p-2*(l+1)|0;u+l+2<p;)b.push(u),
b.push(u+1),b.push(u+l+1),b.push(u+l+1),b.push(u+1),b.push(u+l+2),++u}I.tc(h,c,b,d,e);h=new I;h.pb=b;h.Na=c;h.gb=d;h.zb=e;return h};I.Jl=function(a){function b(a){var b=a?d/2:e/2;if(0!=b){var g,h=a?w[2]:w[0],k=null;null!=p&&(k=a?p[2]:p[0]);var m=z.length/3|0,u=a?c/2:-c/2;z.push(0);z.push(u);z.push(0);r.push(0);r.push(a?1:-1);r.push(0);t.push(h.x+.5*(h.z-h.x));t.push(h.y+.5*(h.o-h.y));null!=p&&(v.push(k.r),v.push(k.v),v.push(k.m),v.push(k.W));for(var y=0,x=f+1;y<x;){g=y++;g=2*Math.PI*g*l/f;var D=Math.cos(-g),
E=Math.sin(-g);g=new n(D*b,u,E*b);D=.5*D+.5;E=.5*E+.5;z.push(g.x);z.push(g.y);z.push(g.z);r.push(0);r.push(a?1:-1);r.push(0);t.push(h.x+(h.z-h.x)*D);t.push(h.y+(h.o-h.y)*E);null!=p&&(v.push(k.r),v.push(k.v),v.push(k.m),v.push(k.W))}for(b=0;b<f;)h=b++,a?(q.push(m),q.push(m+(h+2)),q.push(m+(h+1))):(q.push(m),q.push(m+(h+1)),q.push(m+(h+2)))}}var c=null!=a.height?a.height:2,d=null!=a.Jn?a.Jn:1,e=null!=a.In?a.In:1,f=null!=a.Md?a.Md:24,g=null!=a.Uc?a.Uc:1,h=null!=a.WI&&a.WI,k=null!=a.Lu&&a.Lu,l=null!=
a.arc?a.arc:1;if(0>=l||1<l)l=1;var m=null!=a.$?a.$:0,w=null!=a.Nn?a.Nn:[],p=null!=a.Wq?a.Wq:null;a=2+(1+(1!=l&&k?2:0))*(h?g:1);for(var u=0;u<a;){var y=u++;null!=p&&null==p[y]&&(p[y]=new ca(1,1,1,1))}for(u=0;u<a;)y=u++,null!=w&&null==w[y]&&(w[y]=new Kd(0,0,1,1));var q=[],z=[],r=[],t=[],v=[];a=2*Math.PI*l/f;for(var x=0,y=u=0,A=(e-d)/2/c,G,D=0,x=G=0,B=new n(0,0,0),P=new n(0,0,0),N=new n(0,0,0),E=new n(0,0,0),O=gb.Y,F=1,H=1,K=0,L=0,S=g+1;L<S;)for(var T=L++,u=T/g,y=(u*(d-e)+e)/2,F=h&&0!=T&&T!=g?2:1,Q=
0;Q<F;){var R=Q++;h&&(H+=R);k&&(H+=2*R);for(var R=0,ba=f+1;R<ba;){var W=R++,x=W*a,D=Math.cos(-x)*y;G=-c/2+u*c;x=Math.sin(-x)*y;0==d&&T==g?(B.x=r[r.length-3*(f+1)],B.y=r[r.length-3*(f+1)+1],B.z=r[r.length-3*(f+1)+2]):(B.x=D,B.z=x,B.y=Math.sqrt(B.x*B.x+B.z*B.z)*A,B.normalize());0==W&&(P.x=D,P.y=G,P.z=x,N.x=B.x,N.y=B.y,N.z=B.z);z.push(D);z.push(G);z.push(x);r.push(B.x);r.push(B.y);r.push(B.z);K=h?0!=H?w[H].y:w[H].o:w[H].y+(w[H].o-w[H].y)*u;t.push(w[H].x+(w[H].z-w[H].x)*W/f);t.push(K);null!=p&&(v.push(p[H].r),
v.push(p[H].v),v.push(p[H].m),v.push(p[H].W))}1!=l&&k&&(z.push(D),z.push(G),z.push(x),z.push(0),z.push(G),z.push(0),z.push(0),z.push(G),z.push(0),z.push(P.x),z.push(P.y),z.push(P.z),E.x=O.y*B.z-O.z*B.y,E.y=O.z*B.x-O.x*B.z,E.z=O.x*B.y-O.y*B.x,E.normalize(),r.push(E.x),r.push(E.y),r.push(E.z),r.push(E.x),r.push(E.y),r.push(E.z),E.x=N.y*O.z-N.z*O.y,E.y=N.z*O.x-N.x*O.z,E.z=N.x*O.y-N.y*O.x,E.normalize(),r.push(E.x),r.push(E.y),r.push(E.z),r.push(E.x),r.push(E.y),r.push(E.z),K=h?0!=H?w[H+1].y:w[H+1].o:
w[H+1].y+(w[H+1].o-w[H+1].y)*u,t.push(w[H+1].x),t.push(K),t.push(w[H+1].z),t.push(K),K=h?0!=H?w[H+2].y:w[H+2].o:w[H+2].y+(w[H+2].o-w[H+2].y)*u,t.push(w[H+2].x),t.push(K),t.push(w[H+2].z),t.push(K),0<p.length&&(v.push(p[H+1].r),v.push(p[H+1].v),v.push(p[H+1].m),v.push(p[H+1].W),v.push(p[H+1].r),v.push(p[H+1].v),v.push(p[H+1].m),v.push(p[H+1].W),v.push(p[H+2].r),v.push(p[H+2].v),v.push(p[H+2].m),v.push(p[H+2].W),v.push(p[H+2].r),v.push(p[H+2].v),v.push(p[H+2].m),v.push(p[H+2].W)))}a=1!=l&&k?f+4:f;for(D=
N=G=A=y=u=0;D<g;){D++;B=0;for(P=f;B<P;)N=B++,y=u*(a+1)+N,A=(u+1)*(a+1)+N,G=u*(a+1)+(N+1),N=(u+1)*(a+1)+(N+1),q.push(y),q.push(A),q.push(G),q.push(N),q.push(G),q.push(A);1!=l&&k&&(q.push(y+2),q.push(A+2),q.push(G+2),q.push(N+2),q.push(G+2),q.push(A+2),q.push(y+4),q.push(A+4),q.push(G+4),q.push(N+4),q.push(G+4),q.push(A+4));h?u+=2:++u}k&&(b(!1),b(!0));I.tc(m,z,q,r,t);g=new I;g.pb=q;g.Na=z;g.gb=r;g.zb=t;null!=p&&(g.ke=v);return g};I.ip=function(a){var b=[],c=[],d=[],e=[],f=null!=a.Fu?a.Fu:1,g=null!=
a.vD?a.vD:.5,h=null!=a.Md?a.Md:16;a=null!=a.$?a.$:0;for(var k=h+1,l=0,m=h+1;l<m;){var w=l++,p=w/h,u=w*Math.PI*2/h-Math.PI/2,y=new r;y.a[0]=1;y.a[1]=0;y.a[2]=0;y.a[3]=0;y.a[4]=0;y.a[5]=1;y.a[6]=0;y.a[7]=0;y.a[8]=0;y.a[9]=0;y.a[10]=1;y.a[11]=0;y.a[12]=0;y.a[13]=0;y.a[14]=0;y.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,f/2,0,0,y);var q=new r,z=Math.sin(u),u=Math.cos(u);q.a[5]=1;q.a[15]=1;q.a[0]=u;q.a[2]=-z;q.a[8]=z;q.a[10]=u;q.a[1]=0;q.a[3]=0;q.a[4]=0;q.a[6]=0;q.a[7]=0;q.a[9]=0;q.a[11]=0;q.a[12]=0;q.a[13]=0;q.a[14]=
0;u=new r;y.qa(q,u.a,0);y=0;for(q=h+1;y<q;){var z=y++,t=1-z/h,v=z*Math.PI*2/h+Math.PI,v=new n(Math.cos(v),Math.sin(v),0),A=g/2,x=new n(v.x*A,v.y*A,v.z*A),A=p,B=new n(0,0,0),G=x.x,D=x.y,x=x.z,F=u.a,P=G*F[1]+D*F[5]+x*F[9]+F[13],N=G*F[2]+D*F[6]+x*F[10]+F[14],E=G*F[3]+D*F[7]+x*F[11]+F[15];B.x=(G*F[0]+D*F[4]+x*F[8]+F[12])/E;B.y=P/E;B.z=N/E;x=B;B=new n(0,0,0);B.x=v.x*u.a[0]+v.y*u.a[4]+v.z*u.a[8];B.y=v.x*u.a[1]+v.y*u.a[5]+v.z*u.a[9];B.z=v.x*u.a[2]+v.y*u.a[6]+v.z*u.a[10];v=B;c.push(x.x);c.push(x.y);c.push(x.z);
d.push(v.x);d.push(v.y);d.push(v.z);e.push(A);e.push(t);v=(w+1)%k;A=(z+1)%k;b.push(w*k+z);b.push(w*k+A);b.push(v*k+z);b.push(w*k+A);b.push(v*k+A);b.push(v*k+z)}}I.tc(a,c,b,d,e);f=new I;f.pb=b;f.Na=c;f.gb=d;f.zb=e;return f};I.js=function(a){var b=[],c=[];a=a.CB;for(var d=0,e=0,f=a.length;e<f;)for(var g=e++,g=a[g],h=0,k=g.length;h<k;){var l=h++;c.push(g[l].x);c.push(g[l].y);c.push(g[l].z);0<l&&(b.push(d-1),b.push(d));++d}a=new I;a.pb=b;a.Na=c;return a};I.Zo=function(a){var b=[],c=[],d=null!=a.Cj?a.Cj:
3,e=null!=a.il?a.il:1,f=null!=a.eA?a.eA:200;a=a.Ir;for(var g=new n(0,0,0),h=0,k,l,m=0,w=0,p=a.length-1;w<p;)l=w++,k=a[l+1],l=a[l],g.x=k.x-l.x,g.y=k.y-l.y,g.z=k.z-l.z,h+=Math.sqrt(g.x*g.x+g.y*g.y+g.z*g.z);f=h/f;d=d*f/(d+e);e=0;for(h=a.length-1;e<h;)for(w=e++,p=a[w+1],k=a[w],g.x=p.x-k.x,g.y=p.y-k.y,g.z=p.z-k.z,k=Math.floor(Math.sqrt(g.x*g.x+g.y*g.y+g.z*g.z)/f),g.normalize(),p=0;p<k;)l=p++,l*=f,b.push(a[w].x+l*g.x),b.push(a[w].y+l*g.y),b.push(a[w].z+l*g.z),b.push(a[w].x+(l+d)*g.x),b.push(a[w].y+(l+d)*
g.y),b.push(a[w].z+(l+d)*g.z),c.push(m),c.push(m+1),m+=2;a=new I;a.Na=b;a.pb=c;return a};I.ap=function(a){var b=[],c=[],d=[],e=[],f=null!=a.width?a.width:1,g=null!=a.height?a.height:1,h=null!=a.uw?a.uw:null!=a.Uc?a.Uc:1;a=null!=a.vw?a.vw:null!=a.Uc?a.Uc:1;for(var k=0,l=a+1;k<l;)for(var m=k++,n=0,p=h+1;n<p;){var u=n++,y,q=u*f/h-f/2;y=(a-m)*g/a-g/2;c.push(q);c.push(0);c.push(y);d.push(0);d.push(1);d.push(0);e.push(u/h);e.push(1-m/h)}for(f=0;f<a;)for(g=f++,k=0,l=h;k<l;)m=k++,b.push(m+1+(g+1)*(h+1)),
b.push(m+1+g*(h+1)),b.push(m+g*(h+1)),b.push(m+(g+1)*(h+1)),b.push(m+1+(g+1)*(h+1)),b.push(m+g*(h+1));h=new I;h.pb=b;h.Na=c;h.gb=d;h.zb=e;return h};I.hp=function(a){var b=a.RM,c=a.VM,d=a.QM,e=a.UM,f=null!=a.$L?a.$L:{o:1,h:1},g=null!=a.precision?a.precision:{o:1,h:1};a=[];var h=[],k=[],l=[];f.h=1>f.h?1:f.h;f.o=1>f.o?1:f.o;g.o=1>g.o?1:g.o;g.h=1>g.h?1:g.h;for(var d=(d-b)/f.o,e=(e-c)/f.h,m=0,n=f.h;m<n;)for(var p=m++,u=0,y=f.o;u<y;){for(var q=u++,r=b+q*d,t=c+p*e,q=b+(q+1)*d,v=c+(p+1)*e,A=h.length/3,x=
g.o+1,B=0,G=g.h;B<G;)for(var D=B++,F=0,P=g.o;F<P;){var N=F++,E=A+N+D*x|0,O=A+(N+1)+D*x|0,K=A+(N+1)+(D+1)*x|0,N=A+N+(D+1)*x|0;a.push(O);a.push(K);a.push(N);a.push(E);a.push(O);a.push(N)}B=0;for(G=g.h+1;B<G;)for(D=B++,A=D*(v-t)/g.h+t,F=0,P=g.o+1;F<P;)E=F++,x=E*(q-r)/g.o+r,h.push(x),h.push(0),h.push(A),k.push(0),k.push(1),k.push(0),l.push(E/g.o),l.push(D/g.h)}b=new I;b.pb=a;b.Na=h;b.gb=k;b.zb=l;return b};I.bp=function(a){var b=a.width,c=a.height,d=a.Uc,e=a.minHeight,f=a.maxHeight,g=a.buffer,h=a.CH,k=
a.AH;a=[];for(var l=[],m=[],n=[],p=0,u=d+1;p<u;)for(var y=p++,q=0,r=d+1;q<r;){var t=q++,v,A,x=t*b/d-b/2;v=(d-y)*c/d-c/2;A=4*(((x+b/2)/b*(h-1)|0)+((1-(v+c/2)/c)*(k-1)|0)*h)|0;A=e+(f-e)*(g[A]/255*.3+g[A+1]/255*.59+g[A+2]/255*.11);l.push(x);l.push(A);l.push(v);m.push(0);m.push(0);m.push(0);n.push(t/d);n.push(1-y/d)}for(b=0;b<d;)for(c=b++,e=0,f=d;e<f;)g=e++,a.push(g+1+(c+1)*(d+1)),a.push(g+1+c*(d+1)),a.push(g+c*(d+1)),a.push(g+(c+1)*(d+1)),a.push(g+1+(c+1)*(d+1)),a.push(g+c*(d+1));I.be(l,a,m);d=new I;
d.pb=a;d.Na=l;d.gb=m;d.zb=n;return d};I.ep=function(a){var b=[],c=[],d=[],e=[],f=null!=a.$?a.$:0,g=(null!=a.width?a.width:1)/2;a=(null!=a.height?a.height:1)/2;c.push(-g);c.push(-a);c.push(0);d.push(0);d.push(0);d.push(-1);e.push(0);e.push(0);c.push(g);c.push(-a);c.push(0);d.push(0);d.push(0);d.push(-1);e.push(1);e.push(0);c.push(g);c.push(a);c.push(0);d.push(0);d.push(0);d.push(-1);e.push(1);e.push(1);c.push(-g);c.push(a);c.push(0);d.push(0);d.push(0);d.push(-1);e.push(0);e.push(1);b.push(0);b.push(1);
b.push(2);b.push(0);b.push(2);b.push(3);I.tc(f,c,b,d,e);f=new I;f.pb=b;f.Na=c;f.gb=d;f.zb=e;return f};I.$o=function(a){var b=[],c=[],d=[],e=[],f=null!=a.P?a.P:.5,g=null!=a.Md?a.Md:64;a=null!=a.$?a.$:0;c.push(0);c.push(0);c.push(0);e.push(.5);e.push(.5);for(var g=2*Math.PI/g,h=0;h<2*Math.PI;){var k=Math.cos(h),l=Math.sin(h),m=(k+1)/2,n=(1-l)/2;c.push(f*k);c.push(f*l);c.push(0);e.push(m);e.push(n);h+=g}c.push(c[3]);c.push(c[4]);c.push(c[5]);e.push(e[2]);e.push(e[3]);f=1;for(g=(c.length/3|0)-1;f<g;)h=
f++,b.push(h+1),b.push(0),b.push(h);I.be(c,b,d);I.tc(a,c,b,d,e);a=new I;a.pb=b;a.Na=c;a.gb=d;a.zb=e;return a};I.cp=function(a){var b=a.$,c=null!=a.P?a.P:1,d=null==a.vI?!0:a.vI,e=null!=a.Uc?a.Uc:4,f=null!=a.radiusX?a.radiusX:c,g=null!=a.radiusY?a.radiusY:c,h=null!=a.cL?a.cL:c;a=(1+Math.sqrt(5))/2;a=[-1,a,0,1,a,0,-1,-a,0,1,-a,0,0,-1,-a,0,1,-a,0,-1,a,0,1,a,a,0,1,a,0,-1,-a,0,1,-a,0,-1];for(var k=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,
4,11,6,2,10,8,6,7,9,8,1],l=[4,1,2,1,6,3,5,4,4,3,3,2,7,4,3,0,1,0,0,1,5,0,5,2],m=[],w=[],p=[],u=[],y=0,q=[],r=[],t=0;3>t;){var v=t++;q[v]=new n(0,0,0);r[v]=new K(0,0)}for(t=0;20>t;){for(var v=t++,A=0;3>A;){var x=A++,B=k[3*v+x],G=q[x];G.x=a[3*B];G.y=a[3*B+1];G.z=a[3*B+2];G=q[x].normalize();G.x*=c;G.y*=c;G.z*=c;G=0;5==v&&2==x&&(G=1);15==v&&1==x&&(G=2);10==v&&1==x&&(G=3);14==v&&2==x&&(G=4);4==v&&1==x&&(G=1);7==v&&1==x&&(G=2);17==v&&2==x&&(G=3);8==v&&0==x&&(G=4);8==v&&1==x&&(G=5);18==v&&0==x&&(G=5);13==
v&&2==x&&(G=5);14==v&&1==x&&(G=5);18==v&&2==x&&(G=5);x=r[x];x.x=.0947265625*(l[2*B]+G)+.048828125;x.y=.1640625*(l[2*B+1]+G)+.0498046875}v=function(a,b,c,k){var l=n.D(q[0],q[2],b/e),t=n.D(q[1],q[2],b/e),l=e==b?q[2]:n.D(l,t,a/(e-b));l.normalize();l.x*=f;l.y*=g;l.z*=h;if(d){var t=n.D(q[0],q[2],k/e),x=n.D(q[1],q[2],k/e);c=n.D(t,x,c/(e-k));k=new n(0,0,0);k.x=c.x;k.y=c.y;k.z=c.z;k.normalize();c=k}else c=new n(0,0,0),c.x=l.x,c.y=l.y,c.z=l.z,c.normalize();var t=r[0],x=r[2],v=b/e;k=t.y+(x.y-t.y)*v;var t=t.x+
(x.x-t.x)*v,v=r[1],A=r[2],M=b/e,x=v.y+(A.y-v.y)*M,v=v.x+(A.x-v.x)*M;e==b?a=r[2]:(a/=e-b,a=new K(t+(v-t)*a,k+(x-k)*a));w.push(l.x);w.push(l.y);w.push(l.z);p.push(c.x);p.push(c.y);p.push(c.z);u.push(a.x);u.push(a.y);m.push(y);y+=1};A=0;for(B=e;A<B;)for(x=A++,G=0;G+x<e;)v(G,x,G+.3333333333333333,x+.3333333333333333),v(G+1,x,G+.3333333333333333,x+.3333333333333333),v(G,x+1,G+.3333333333333333,x+.3333333333333333),G+x+1<e&&(v(G+1,x,G+.6666666666666666,x+.6666666666666666),v(G+1,x+1,G+.6666666666666666,
x+.6666666666666666),v(G,x+1,G+.6666666666666666,x+.6666666666666666)),++G}I.tc(b,w,m,p,u);b=new I;b.pb=m;b.Na=w;b.gb=p;b.zb=u;return b};I.fp=function(a){var b=[{vertex:[[0,0,1.732051],[1.632993,0,-.5773503],[-.8164966,1.414214,-.5773503],[-.8164966,-1.414214,-.5773503]],face:[[0,1,2],[0,2,3],[0,3,1],[1,3,2]]},{vertex:[[0,0,1.414214],[1.414214,0,0],[0,1.414214,0],[-1.414214,0,0],[0,-1.414214,0],[0,0,-1.414214]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,1],[1,4,5],[1,5,2],[2,5,3],[3,5,4]]},{vertex:[[0,0,
1.070466],[.7136442,0,.7978784],[-.3568221,.618034,.7978784],[-.3568221,-.618034,.7978784],[.7978784,.618034,.3568221],[.7978784,-.618034,.3568221],[-.9341724,.381966,.3568221],[.1362939,1,.3568221],[.1362939,-1,.3568221],[-.9341724,-.381966,.3568221],[.9341724,.381966,-.3568221],[.9341724,-.381966,-.3568221],[-.7978784,.618034,-.3568221],[-.1362939,1,-.3568221],[-.1362939,-1,-.3568221],[-.7978784,-.618034,-.3568221],[.3568221,.618034,-.7978784],[.3568221,-.618034,-.7978784],[-.7136442,0,-.7978784],
[0,0,-1.070466]],face:[[0,1,4,7,2],[0,2,6,9,3],[0,3,8,5,1],[1,5,11,10,4],[2,7,13,12,6],[3,9,15,14,8],[4,10,16,13,7],[5,8,14,17,11],[6,12,18,15,9],[10,11,17,19,16],[12,13,16,19,18],[14,15,18,19,17]]},{vertex:[[0,0,1.175571],[1.051462,0,.5257311],[.3249197,1,.5257311],[-.8506508,.618034,.5257311],[-.8506508,-.618034,.5257311],[.3249197,-1,.5257311],[.8506508,.618034,-.5257311],[.8506508,-.618034,-.5257311],[-.3249197,1,-.5257311],[-1.051462,0,-.5257311],[-.3249197,-1,-.5257311],[0,0,-1.175571]],face:[[0,
1,2],[0,2,3],[0,3,4],[0,4,5],[0,5,1],[1,5,7],[1,7,6],[1,6,2],[2,6,8],[2,8,3],[3,8,9],[3,9,4],[4,9,10],[4,10,5],[5,10,7],[6,7,11],[6,11,8],[7,10,11],[8,11,9],[9,11,10]]},{vertex:[[0,0,1.070722],[.7148135,0,.7971752],[-.104682,.7071068,.7971752],[-.6841528,.2071068,.7971752],[-.104682,-.7071068,.7971752],[.6101315,.7071068,.5236279],[1.04156,.2071068,.1367736],[.6101315,-.7071068,.5236279],[-.3574067,1,.1367736],[-.7888348,-.5,.5236279],[-.9368776,.5,.1367736],[-.3574067,-1,.1367736],[.3574067,1,-.1367736],
[.9368776,-.5,-.1367736],[.7888348,.5,-.5236279],[.3574067,-1,-.1367736],[-.6101315,.7071068,-.5236279],[-1.04156,-.2071068,-.1367736],[-.6101315,-.7071068,-.5236279],[.104682,.7071068,-.7971752],[.6841528,-.2071068,-.7971752],[.104682,-.7071068,-.7971752],[-.7148135,0,-.7971752],[0,0,-1.070722]],face:[[0,2,3],[1,6,5],[4,9,11],[7,15,13],[8,16,10],[12,14,19],[17,22,18],[20,21,23],[0,1,5,2],[0,3,9,4],[0,4,7,1],[1,7,13,6],[2,5,12,8],[2,8,10,3],[3,10,17,9],[4,11,15,7],[5,6,14,12],[6,13,20,14],[8,12,19,
16],[9,17,18,11],[10,16,22,17],[11,18,21,15],[13,15,21,20],[14,20,23,19],[16,19,23,22],[18,22,23,21]]},{vertex:[[0,0,1.322876],[1.309307,0,.1889822],[-.9819805,.8660254,.1889822],[.1636634,-1.299038,.1889822],[.3273268,.8660254,-.9449112],[-.8183171,-.4330127,-.9449112]],face:[[0,3,1],[2,4,5],[0,1,4,2],[0,2,5,3],[1,3,5,4]]},{vertex:[[0,0,1.159953],[1.013464,0,.5642542],[-.3501431,.9510565,.5642542],[-.7715208,-.6571639,.5642542],[.6633206,.9510565,-.03144481],[.8682979,-.6571639,-.3996071],[-1.121664,
.2938926,-.03144481],[-.2348831,-1.063314,-.3996071],[.5181548,.2938926,-.9953061],[-.5850262,-.112257,-.9953061]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,9,7],[5,7,9,8],[0,3,7,5,1],[2,4,8,9,6]]},{vertex:[[0,0,1.118034],[.8944272,0,.6708204],[-.2236068,.8660254,.6708204],[-.7826238,-.4330127,.6708204],[.6708204,.8660254,.2236068],[1.006231,-.4330127,-.2236068],[-1.006231,.4330127,.2236068],[-.6708204,-.8660254,-.2236068],[.7826238,.4330127,-.6708204],[.2236068,-.8660254,-.6708204],[-.8944272,0,-.6708204],
[0,0,-1.118034]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,10,7],[5,9,11,8],[7,10,11,9],[0,3,7,9,5,1],[2,4,8,11,10,6]]},{vertex:[[-.729665,.670121,.319155],[-.655235,-.29213,-.754096],[-.093922,-.607123,.537818],[.702196,.595691,.485187],[.776626,-.36656,-.588064]],face:[[1,4,2],[0,1,2],[3,0,2],[4,3,2],[4,1,0,3]]},{vertex:[[-.868849,-.100041,.61257],[-.329458,.976099,.28078],[-.26629,-.013796,-.477654],[-.13392,-1.034115,.229829],[.738834,.707117,-.307018],[.859683,-.535264,-.338508]],face:[[3,0,2],
[5,3,2],[4,5,2],[1,4,2],[0,1,2],[0,3,5,4,1]]},{vertex:[[-.610389,.243975,.531213],[-.187812,-.48795,-.664016],[-.187812,.9759,-.664016],[.187812,-.9759,.664016],[.798201,.243975,.132803]],face:[[1,3,0],[3,4,0],[3,1,4],[0,2,1],[0,4,2],[2,4,1]]},{vertex:[[-1.028778,.392027,-.048786],[-.640503,-.646161,.621837],[-.125162,-.395663,-.540059],[.004683,.888447,-.651988],[.125161,.395663,.540059],[.632925,-.791376,.433102],[1.031672,.157063,-.354165]],face:[[3,2,0],[2,1,0],[2,5,1],[0,4,3],[0,1,4],[4,1,5],
[2,3,6],[3,4,6],[5,2,6],[4,5,6]]},{vertex:[[-.669867,.334933,-.529576],[-.669867,.334933,.529577],[-.4043,1.212901,0],[-.334933,-.669867,-.529576],[-.334933,-.669867,.529577],[.334933,.669867,-.529576],[.334933,.669867,.529577],[.4043,-1.212901,0],[.669867,-.334933,-.529576],[.669867,-.334933,.529577]],face:[[8,9,7],[6,5,2],[3,8,7],[5,0,2],[4,3,7],[0,1,2],[9,4,7],[1,6,2],[9,8,5,6],[8,3,0,5],[3,4,1,0],[4,9,6,1]]},{vertex:[[-.931836,.219976,-.264632],[-.636706,.318353,.692816],[-.613483,-.735083,-.264632],
[-.326545,.979634,0],[-.318353,-.636706,.692816],[-.159176,.477529,-.856368],[.159176,-.477529,-.856368],[.318353,.636706,.692816],[.326545,-.979634,0],[.613482,.735082,-.264632],[.636706,-.318353,.692816],[.931835,-.219977,-.264632]],face:[[11,10,8],[7,9,3],[6,11,8],[9,5,3],[2,6,8],[5,0,3],[4,2,8],[0,1,3],[10,4,8],[1,7,3],[10,11,9,7],[11,6,5,9],[6,2,0,5],[2,4,1,0],[4,10,7,1]]},{vertex:[[-.93465,.300459,-.271185],[-.838689,-.260219,-.516017],[-.711319,.717591,.128359],[-.710334,-.156922,.080946],
[-.599799,.556003,-.725148],[-.503838,-.004675,-.969981],[-.487004,.26021,.48049],[-.460089,-.750282,-.512622],[-.376468,.973135,-.325605],[-.331735,-.646985,.084342],[-.254001,.831847,.530001],[-.125239,-.494738,-.966586],[.029622,.027949,.730817],[.056536,-.982543,-.262295],[.08085,1.087391,.076037],[.125583,-.532729,.485984],[.262625,.599586,.780328],[.391387,-.726999,-.716259],[.513854,-.868287,.139347],[.597475,.85513,.326364],[.641224,.109523,.783723],[.737185,-.451155,.538891],[.848705,-.612742,
-.314616],[.976075,.365067,.32976],[1.072036,-.19561,.084927]],face:[[15,18,21],[12,20,16],[6,10,2],[3,0,1],[9,7,13],[2,8,4,0],[0,4,5,1],[1,5,11,7],[7,11,17,13],[13,17,22,18],[18,22,24,21],[21,24,23,20],[20,23,19,16],[16,19,14,10],[10,14,8,2],[15,9,13,18],[12,15,21,20],[6,12,16,10],[3,6,2,0],[9,3,1,7],[9,15,12,6,3],[22,17,11,5,4,8,14,19,23,24]]}],c=null!=a.type?a.type:0;0>c&&(c=0);c>=b.length&&(c=b.length-1);var d=null!=a.size?a.size:1,e=null!=a.QL?a.QL:d,f=null!=a.RL?a.RL:d,d=null!=a.SL?a.SL:d,c=
null!=a.YH?a.YH:b[c],g=c.face.length,h=null!=a.Nn?a.Nn:[],b=null!=a.Wq?a.Wq:[],k=null!=a.$?a.$:0;a=[];for(var l=[],m=[],n=[],p=[],u=0,q=0,r=[],z,t,v,A,x,B=0;B<g;){var G=B++;null!=b&&null==b[G]&&(b[G]=new ca(1,1,1,1));null!=h&&null==h[G]&&(h[G]=new Kd(0,0,1,1))}for(B=0;B<g;){var D=B++,G=c.face[D].length;v=2*Math.PI/G;A=.5*Math.tan(v/2);x=.5;for(var F=0,P=G;F<P;)z=F++,a.push(c.vertex[c.face[D][z]][0]*e),a.push(c.vertex[c.face[D][z]][1]*f),a.push(c.vertex[c.face[D][z]][2]*d),r.push(u),++u,z=h[D].x+(h[D].z-
h[D].x)*(.5+A),t=h[D].y+(h[D].o-h[D].y)*(x-.5),n.push(z),n.push(t),z=A*Math.cos(v)-x*Math.sin(v),x=A*Math.sin(v)+x*Math.cos(v),A=z,null!=b[D]&&(p.push(b[D].r),p.push(b[D].v),p.push(b[D].m),p.push(b[D].W));v=0;for(A=G-2;v<A;)x=v++,l.push(r[q]),l.push(r[x+2+q]),l.push(r[x+1+q]);q+=G}I.be(a,l,m);I.tc(k,a,l,m,n);e=new I;e.Na=a;e.pb=l;e.gb=m;e.zb=n;0<b.length&&(e.ke=p);return e};I.jp=function(a){function b(a){var b=w/m*a,c=Math.cos(b);return new n(g*(2+c)*.5*Math.cos(a),g*(2+c)*Math.sin(a)*.5,g*Math.sin(b)*
.5)}var c=[],d=[],e=[],f=[],g=null!=a.P?a.P:2,h=null!=a.yD?a.yD:.5,k=null!=a.yC?a.yC:32,l=null!=a.zD?a.zD:32,m=null!=a.p?a.p:2,w=null!=a.q?a.q:3;a=null!=a.$?a.$:0;for(var p=0,u=k+1;p<u;){var q=p++,r=q%k/k*2*m*Math.PI,t=b(r),r=b(r+.01),v,A,B=r.x-t.x;A=r.y-t.y;v=r.z-t.z;var r=new n(r.x+t.x,r.y+t.y,r.z+t.z),x=new n(0,0,0);x.x=A*r.z-v*r.y;x.y=v*r.x-B*r.z;x.z=B*r.y-A*r.x;r=new n(0,0,0);r.x=x.y*v-x.z*A;r.y=x.z*B-x.x*v;r.z=x.x*A-x.y*B;x.normalize();r.normalize();v=0;for(A=l;v<A;){var B=v++,F=B%l/l*2*Math.PI,
G=-h*Math.cos(F),F=h*Math.sin(F);d.push(t.x+G*r.x+F*x.x);d.push(t.y+G*r.y+F*x.y);d.push(t.z+G*r.z+F*x.z);f.push(q/k);f.push(B/l)}}for(h=0;h<k;)for(p=h++,u=0,q=l;u<q;)x=u++,r=(x+1)%l,t=p*l+x,x=(p+1)*l+x,v=(p+1)*l+r,r=p*l+r,c.push(r),c.push(x),c.push(t),c.push(r),c.push(v),c.push(x);I.be(d,c,e);I.tc(a,d,c,e,f);k=new I;k.pb=c;k.Na=d;k.gb=e;k.zb=f;return k};I.be=function(a,b,c){var d,e,f,g,h,k,l,m,n,p;l=0;for(f=a.length;l<f;)m=l++,c[m]=0;for(var u=0,q=b.length/3|0;u<q;)l=u++,m=b[3*l],n=b[3*l+1],p=b[3*
l+2],d=a[3*m]-a[3*n],e=a[3*m+1]-a[3*n+1],f=a[3*m+2]-a[3*n+2],g=a[3*p]-a[3*n],h=a[3*p+1]-a[3*n+1],k=a[3*p+2]-a[3*n+2],l=e*k-f*h,f=f*g-d*k,d=d*h-e*g,e=Math.sqrt(l*l+f*f+d*d),0==e&&(e=1),l/=e,f/=e,d/=e,c[3*m]+=l,c[3*m+1]+=f,c[3*m+2]+=d,c[3*n]+=l,c[3*n+1]+=f,c[3*n+2]+=d,c[3*p]+=l,c[3*p+1]+=f,c[3*p+2]+=d;a=0;for(b=c.length/3|0;a<b;)m=a++,l=c[3*m],f=c[3*m+1],d=c[3*m+2],e=Math.sqrt(l*l+f*f+d*d),0==e&&(e=1),l/=e,f/=e,d/=e,c[3*m]=l,c[3*m+1]=f,c[3*m+2]=d};I.tc=function(a,b,c,d,e){null==a&&(a=0);var f=c.length,
g=d.length;switch(a){case 1:for(b=0;b<f;)e=c[b],c[b]=c[b+2],c[b+2]=e,b+=3;for(e=0;e<g;)c=e++,d[c]=-d[c];break;case 2:var h=b.length;a=h/3|0;for(var k=0;k<h;){var l=k++;b[h+l]=b[l]}for(b=0;b<f;)c[b+f]=c[b+2]+a,c[b+1+f]=c[b+1]+a,c[b+2+f]=c[b]+a,b+=3;for(c=0;c<g;)f=c++,d[g+f]=-d[f];d=e.length;for(g=0;g<d;)c=g++,e[c+d]=e[c]}};I.prototype={set:function(a,b){switch(b){case "color":this.ke=a;break;case "matricesIndices":this.Kd=a;break;case "matricesIndicesExtra":this.oe=a;break;case "matricesWeights":this.Wf=
a;break;case "matricesWeightsExtra":this.Xf=a;break;case "normal":this.gb=a;break;case "position":this.Na=a;break;case "uv":this.zb=a;break;case "uv2":this.Zh=a;break;case "uv3":this.$h=a;break;case "uv4":this.ai=a;break;case "uv5":this.bi=a;break;case "uv6":this.ci=a}},dc:function(a,b){null==b&&(b=!1);this.kx(a,b)},lH:function(a,b){null==b&&(b=!1);this.kx(a,b)},kx:function(a,b){null==b&&(b=!1);null!=this.Na&&a.Ga("position",this.Na,b);null!=this.gb&&a.Ga("normal",this.gb,b);null!=this.zb&&a.Ga("uv",
this.zb,b);null!=this.Zh&&a.Ga("uv2",this.Zh,b);null!=this.$h&&a.Ga("uv3",this.$h,b);null!=this.ai&&a.Ga("uv4",this.ai,b);null!=this.bi&&a.Ga("uv5",this.bi,b);null!=this.ci&&a.Ga("uv6",this.ci,b);null!=this.ke&&a.Ga("color",this.ke,b);null!=this.Kd&&a.Ga("matricesIndices",this.Kd,b);null!=this.Wf&&a.Ga("matricesWeights",this.Wf,b);null!=this.oe&&a.Ga("matricesIndicesExtra",this.oe,b);null!=this.Xf&&a.Ga("matricesWeightsExtra",this.Xf,b);null!=this.pb&&a.$j(this.pb)},TJ:function(a){if(null!=a.pb){null==
this.pb&&(this.pb=[]);for(var b=(null!=this.Na?this.Na.length/3:0)|0,c=0,d=a.pb.length;c<d;){var e=c++;this.pb.push(a.pb[e]+b)}}if(null!=a.Na)for(null==this.Na&&(this.Na=[]),b=0,c=a.Na.length;b<c;)d=b++,this.Na.push(a.Na[d]);if(null!=a.gb)for(null==this.gb&&(this.gb=[]),b=0,c=a.gb.length;b<c;)d=b++,this.gb.push(a.gb[d]);if(null!=a.zb)for(null==this.zb&&(this.zb=[]),b=0,c=a.zb.length;b<c;)d=b++,this.zb.push(a.zb[d]);if(null!=a.Zh)for(null==this.Zh&&(this.Zh=[]),b=0,c=a.Zh.length;b<c;)d=b++,this.Zh.push(a.Zh[d]);
if(null!=a.$h)for(null==this.$h&&(this.$h=[]),b=0,c=a.$h.length;b<c;)d=b++,this.$h.push(a.$h[d]);if(null!=a.ai)for(null==this.ai&&(this.ai=[]),b=0,c=a.ai.length;b<c;)d=b++,this.ai.push(a.ai[d]);if(null!=a.bi)for(null==this.bi&&(this.bi=[]),b=0,c=a.bi.length;b<c;)d=b++,this.bi.push(a.bi[d]);if(null!=a.ci)for(null==this.ci&&(this.ci=[]),b=0,c=a.ci.length;b<c;)d=b++,this.ci.push(a.ci[d]);if(null!=a.Kd)for(null==this.Kd&&(this.Kd=[]),b=0,c=a.Kd.length;b<c;)d=b++,this.Kd.push(a.Kd[d]);if(null!=a.Wf)for(null==
this.Wf&&(this.Wf=[]),b=0,c=a.Wf.length;b<c;)d=b++,this.Wf.push(a.Wf[d]);if(null!=a.oe)for(null==this.oe&&(this.oe=[]),b=0,c=a.oe.length;b<c;)d=b++,this.oe.push(a.oe[d]);if(null!=a.Xf)for(null==this.Xf&&(this.Xf=[]),b=0,c=a.Xf.length;b<c;)d=b++,this.Xf.push(a.Xf[d]);if(null!=a.ke)for(null==this.ke&&(this.ke=[]),b=0,c=a.ke.length;b<c;)d=b++,this.ke.push(a.ke[d])},l:I};var T=J.BABYLON.StandardMaterial=function(a,b){this.Zj="diffuseSampler ambientSampler opacitySampler reflectionCubeSampler reflection2DSampler emissiveSampler specularSampler bumpSampler lightmapSampler refractionCubeSampler refraction2DSampler".split(" ");
this.wb="world view viewProjection vEyePosition vLightsType vAmbientColor vDiffuseColor vSpecularColor vEmissiveColor vFogInfos vFogColor pointSize vDiffuseInfos vAmbientInfos vOpacityInfos vReflectionInfos vEmissiveInfos vSpecularInfos vBumpInfos vLightmapInfos vRefractionInfos mBones vClipPlane diffuseMatrix ambientMatrix opacityMatrix reflectionMatrix emissiveMatrix specularMatrix bumpMatrix lightmapMatrix refractionMatrix depthValues diffuseLeftColor diffuseRightColor opacityParts reflectionLeftColor reflectionRightColor emissiveLeftColor emissiveRightColor refractionLeftColor refractionRightColor logarithmicDepthConstant".split(" ");
this.fD="default";this.XG=!1;this.Yg=new id;this.Mc=new id;this.Pa=0;this.gy=new L(0,0,0);this.hf=new Ga(16);this.yj=this.Jq=null;this.oB=this.pB=!1;this.Sj=4;this.JD=this.ID=!1;this.tr=!0;this.pr=.98;this.ew=0;this.lC=.05;this.GD=this.ds=this.EB=this.es=this.gs=this.fs=this.Ln=this.KD=this.LD=!1;this.bs=64;this.Ku=new L(0,0,0);this.Bo=new L(1,1,1);this.Kn=new L(1,1,1);this.vn=new L(0,0,0);this.Xc=this.He=this.Zd=this.jc=this.Fd=this.Te=this.Je=this.Vf=this.kc=null;var c=this;sa.call(this,a,b);this.Yg.Zi=
-1;this.IA=function(){var a=c.hf;a.length=0;a.Ka++;if(null!=c.jc&&c.jc.Mi){var a=c.hf,b=c.jc;a.data[a.length++]=b;b.yb[a.eb]=a.Ka}null!=c.kc&&c.kc.Mi&&(a=c.hf,b=c.kc,a.data[a.length++]=b,b.yb[a.eb]=a.Ka);return c.hf};this.N=this.Mc.Ac};q["com.babylonhx.materials.StandardMaterial"]=T;T.i=["com","babylonhx","materials","StandardMaterial"];T.ya=function(a){var b=new Ld;b.isEnabled=a.isEnabled;var c=a.Jh;b.Jh=new L(c[0],c[1],c[2]);c=a.Oh;b.Oh=new L(c[0],c[1],c[2]);b.uh=a.uh;b.$f=null!=a.$f?a.$f:1;return b};
T.ab=function(a,b,c){var d=new T(a.name,b),e=a.PN;d.vn=new L(e[0],e[1],e[2]);e=a.Gu;d.Kn=new L(e[0],e[1],e[2]);e=a.as;d.Bo=new L(e[0],e[1],e[2]);d.bs=a.bs;e=a.eO;d.Ku=new L(e[0],e[1],e[2]);d.es=a.es;d.ds=a.ds;d.pr=a.pr;d.tr=a.tr;d.gs=a.gs;d.fs=a.fs;d.alpha=a.alpha;d.id=a.id;null!=a.gl&&(d.gl=a.gl);za.ae(d,a.Rl);d.xn=a.xn;d.qw(a.NM);null!=a.Xc&&(d.Xc=ma.ab(a.Xc,b,c));null!=a.Mf&&(d.Mf=T.ya(a.Mf));null!=a.He&&(d.He=ma.ab(a.He,b,c));null!=a.Zd&&(d.Zd=ma.ab(a.Zd,b,c));null!=a.Oe&&(d.Oe=T.ya(a.Oe));null!=
a.jc&&(d.jc=ma.ab(a.jc,b,c));null!=a.cg&&(d.cg=T.ya(a.cg));null!=a.Fd&&(d.Fd=ma.ab(a.Fd,b,c));null!=a.Vf&&(d.Vf=ma.ab(a.Vf,b,c),d.xJ=a.xJ);null!=a.Nf&&(d.Nf=T.ya(a.Nf));null!=a.Te&&(d.Te=ma.ab(a.Te,b,c));null!=a.Je&&(d.Je=ma.ab(a.Je,b,c));null!=a.kc&&(d.kc=ma.ab(a.kc,b,c));null!=a.Zk&&(d.Zk=a.Zk);return d};T.U=sa;T.prototype=F(sa.prototype,{eB:function(){return this.XG},Oi:function(){return 1>this.alpha||null!=this.Zd||this.mz()?!0:null!=this.Oe?this.Oe.isEnabled:!1},Yf:function(){return null!=this.Xc?
this.Xc.Ij:!1},mz:function(){return null!=this.Xc&&this.Xc.Ij?this.GD:!1},br:function(){return this.Xc},Fs:function(a,b,c){null==c&&(c=!1);return null==b?!0:this.N[28]!=c?!1:null!=b.Zp&&b.Zp.isEqual(this.Mc)?!0:!1},pa:function(a,b){null==b&&(b=!1);if(this.dv()&&this.Dz)return!0;var c=this.f;if(!this.tu&&this.Pa==c.Pa&&this.Fs(c,a,b))return!0;var d=c.c,e=!1,f=!1;this.Mc.reset();if(c.uD){if(null!=this.Xc&&T.$a)if(this.Xc.pa())f=!0,this.N[0]=!0;else return!1;if(null!=this.He&&T.Ta)if(this.He.pa())f=
!0,this.N[1]=!0;else return!1;if(null!=this.Zd&&T.$b)if(this.Zd.pa())f=!0,this.N[2]=!0,this.Zd.Tu&&(this.N[3]=!0);else return!1;if(null!=this.jc&&T.mc)if(this.jc.pa())switch(e=!0,this.N[4]=!0,0<this.ew&&(this.N[30]=!0),this.fs&&(this.N[49]=!0),6==this.jc.Ed&&(this.N[45]=!0),this.N[36]=this.jc.rc,this.jc.Ed){case 0:this.N[42]=!0;break;case 1:this.N[37]=!0;break;case 2:this.N[38]=!0;break;case 3:case 6:this.N[39]=!0;break;case 4:this.N[40]=!0;break;case 5:this.N[41]=!0;break;case 7:this.N[43]=!0;break;
case 8:this.N[44]=!0}else return!1;if(null!=this.Fd&&T.be)if(this.Fd.pa())f=!0,this.N[5]=!0;else return!1;if(null!=this.Vf&&T.Ib)if(this.Vf.pa())f=!0,this.N[34]=!0,this.N[35]=this.JD;else return!1;if(null!=this.Te&&T.Ec)if(this.Te.pa())f=!0,this.N[6]=!0,this.N[29]=this.ID;else return!1;if(1==c.c.T.tw&&null!=this.Je&&T.Za)if(this.Je.pa())f=!0,this.N[7]=!0,this.KD&&(this.N[8]=!0,this.LD&&(this.N[9]=!0)),this.oB&&(this.N[50]=!0),this.pB&&(this.N[51]=!0);else return!1;if(null!=this.kc&&T.tc)if(this.kc.pa())f=
!0,this.N[47]=!0,this.N[48]=this.kc.rc;else return!1;if(null!=this.yj&&T.ae)if(this.yj.pa())this.N[55]=!0;else return!1}null!=c.zj&&(this.N[11]=!0);d.Bs&&(this.N[12]=!0);this.mz()&&(this.N[13]=!0);this.ds&&(this.N[31]=!0);this.EB&&(this.N[32]=!0);this.eB()&&(this.N[46]=!0);null!=this.Jq&&(this.N[54]=!0);if(this.lr()||c.Ou)this.N[14]=!0;c.qf&&null!=a&&a.sh&&c.Fj!=Aa.g&&this.qf&&(this.N[15]=!0);c.BB&&!this.Ln&&(e=gc.IE(c,a,this.Mc,this.Sj));T.lb&&(null!=this.Mf&&this.Mf.isEnabled&&(this.N[17]=!0),null!=
this.Oe&&this.Oe.isEnabled&&(this.N[18]=!0),null!=this.cg&&this.cg.isEnabled&&(this.N[19]=!0,this.es&&(this.N[33]=!0)),null!=this.Vi&&this.Vi.isEnabled&&(this.N[20]=!0),null!=this.Nf&&this.Nf.isEnabled&&(this.N[21]=!0),this.N[17]||this.N[18]||this.N[19]||this.N[21]||this.N[20])&&(e=!0,this.N[22]=!0);this.N[16]&&this.gs&&(this.N[10]=!0);null!=a&&(e&&a.fb("normal")&&(this.N[23]=!0),f&&(a.fb("uv")&&(this.N[24]=!0),a.fb("uv2")&&(this.N[25]=!0)),a.Lw&&a.fb("color")&&(this.N[26]=!0,a.ul&&(this.N[27]=!0)),
a.Hg()&&a.nf&&(this.Mc.ei=a.Me,this.Mc.Zi=a.gd().Ie.length+1),b&&(this.N[28]=!0));this.Mc.isEqual(this.Yg)||(this.Mc.Lq(this.Yg),c.$e=null,d=new Ke,this.N[4]&&d.Oc(0,"REFLECTION"),this.N[6]&&d.Oc(0,"SPECULAR"),this.N[7]&&d.Oc(0,"BUMP"),this.N[8]&&d.Oc(1,"PARALLAX"),this.N[9]&&d.Oc(0,"PARALLAXOCCLUSION"),this.N[10]&&d.Oc(0,"SPECULAROVERALPHA"),this.N[15]&&d.Oc(1,"FOG"),this.N[14]&&d.Oc(0,"POINTSIZE"),this.N[46]&&d.Oc(0,"LOGARITHMICDEPTH"),gc.DE(this.Mc,d,this.Sj),this.N[16]&&d.Oc(0,"SPECULARTERM"),
this.N[17]&&d.Oc(1,"DIFFUSEFRESNEL"),this.N[18]&&d.Oc(2,"OPACITYFRESNEL"),this.N[19]&&d.Oc(3,"REFLECTIONFRESNEL"),this.N[21]&&d.Oc(4,"EMISSIVEFRESNEL"),this.N[22]&&d.Oc(4,"FRESNEL"),0<this.Mc.ei&&d.eu(0,a),e=["position"],this.N[23]&&e.push("normal"),this.N[24]&&e.push("uv"),this.N[25]&&e.push("uv2"),this.N[26]&&e.push("color"),f=this.Mc.ei,0<f&&(d.eu(0,a),e.push("matricesIndices"),e.push("matricesWeights"),4<f&&(e.push("matricesIndicesExtra"),e.push("matricesWeightsExtra"))),gc.HE(e,this.N),1!=c.c.T.tw&&
(this.fD="legacydefault"),f=this.Mc.toString(),this.N[54]&&ya.JE(this.wb),this.N[55]&&Bc.KE(this.wb,this.Zj),gc.LE(this.wb,this.Zj,this.Mc.ic,this.Sj),this.s=c.c.Aj(this.fD,e,this.wb,this.Zj,f,d,this.Fr,this.Mh,{Sj:this.Sj-1}));if(null==this.s||!this.s.Nc)return!1;this.Pa=c.Pa;this.Dz=!0;null!=a&&(null==a.Zp&&(a.Zp=new id),this.Mc.Lq(a.Zp));return!0},Io:function(){null!=this.jc&&this.jc.Mi&&this.s.Hb("reflection2DSampler",null);null!=this.kc&&this.kc.Mi&&this.s.Hb("refraction2DSampler",null);sa.prototype.Io.call(this)},
zn:function(a){var b=this.s;if(b.Wa("world",a)){var c=b.c,b=b.u.get("world");c.b.uniformMatrix4fv(b,!1,a.a)}},bind:function(a,b){var c=this.f;this.zn(a);var d=this.s;if(null!=b&&b.Hg()&&b.nf){var e=b.gd(),f;e.Pi&&null!=b.ee?f=b.ee:(null==e.Fe&&e.Hl(),f=e.Fe);if(null!=f){d.Qa.set("mBones",null);var g=d.c,h=d.u.get("mBones");g.b.uniformMatrix4fv(h,!1,f)}}if(c.$e!=this){var k=this.s,l=c.sb;if(k.Wa("viewProjection",l)){var m=k.c,n=k.u.get("viewProjection");m.b.uniformMatrix4fv(n,!1,l.a)}if(T.lb){if(null!=
this.Mf&&this.Mf.isEnabled){var p=this.s,u=this.Mf.Jh,q=this.Mf.$f;if(p.Oa("diffuseLeftColor",u.r,u.v,u.m,q)){var r=p.c,t=p.u.get("diffuseLeftColor");r.b.uniform4f(t,u.r,u.v,u.m,q)}var A=this.s,B=this.Mf.Oh,F=this.Mf.uh;if(A.Oa("diffuseRightColor",B.r,B.v,B.m,F)){var x=A.c,I=A.u.get("diffuseRightColor");x.b.uniform4f(I,B.r,B.v,B.m,F)}}if(null!=this.Oe&&this.Oe.isEnabled){var G=this.s,D,K,P,N=this.Oe.Jh,E=this.Oe.Oh;D=.3*N.r+.59*N.v+.11*N.m;K=.3*E.r+.59*E.v+.11*E.m;P=this.Oe.uh;var O=this.Oe.$f;if(G.Oa("opacityParts",
D,K,P,O)){var L=G.c,H=G.u.get("opacityParts");L.b.uniform4f(H,D,K,P,O)}}if(null!=this.cg&&this.cg.isEnabled){var S=this.s,R=this.cg.Jh,W=this.cg.$f;if(S.Oa("reflectionLeftColor",R.r,R.v,R.m,W)){var Q=S.c,ba=S.u.get("reflectionLeftColor");Q.b.uniform4f(ba,R.r,R.v,R.m,W)}var da=this.s,X=this.cg.Oh,ca=this.cg.uh;if(da.Oa("reflectionRightColor",X.r,X.v,X.m,ca)){var U=da.c,Y=da.u.get("reflectionRightColor");U.b.uniform4f(Y,X.r,X.v,X.m,ca)}}if(null!=this.Vi&&this.Vi.isEnabled){var aa=this.s,ja=this.Vi.Jh,
Fb=this.Vi.$f;if(aa.Oa("refractionLeftColor",ja.r,ja.v,ja.m,Fb)){var ga=aa.c,ha=aa.u.get("refractionLeftColor");ga.b.uniform4f(ha,ja.r,ja.v,ja.m,Fb)}var Da=this.s,Va=this.Vi.Oh,ia=this.Vi.uh;if(Da.Oa("refractionRightColor",Va.r,Va.v,Va.m,ia)){var la=Da.c,ma=Da.u.get("refractionRightColor");la.b.uniform4f(ma,Va.r,Va.v,Va.m,ia)}}if(null!=this.Nf&&this.Nf.isEnabled){var ka=this.s,Z=this.Nf.Jh,na=this.Nf.$f;if(ka.Oa("emissiveLeftColor",Z.r,Z.v,Z.m,na)){var fa=ka.c,qa=ka.u.get("emissiveLeftColor");fa.b.uniform4f(qa,
Z.r,Z.v,Z.m,na)}var oa=this.s,pa=this.Nf.Oh,ua=this.Nf.uh;if(oa.Oa("emissiveRightColor",pa.r,pa.v,pa.m,ua)){var va=oa.c,wa=oa.u.get("emissiveRightColor");va.b.uniform4f(wa,pa.r,pa.v,pa.m,ua)}}}if(c.uD){if(null!=this.Xc&&T.$a){this.s.Hb("diffuseSampler",this.Xc);var ta=this.s,za=this.Xc.Lf,Ea=this.Xc.level;if(ta.Jb("vDiffuseInfos",za,Ea)){var Ga=ta.c,Oa=ta.u.get("vDiffuseInfos");Ga.b.uniform2f(Oa,za,Ea)}var Ra=this.s,Fa=this.Xc.Le();if(Ra.Wa("diffuseMatrix",Fa)){var ra=Ra.c,La=Ra.u.get("diffuseMatrix");
ra.b.uniformMatrix4fv(La,!1,Fa.a)}}if(null!=this.He&&T.Ta){this.s.Hb("ambientSampler",this.He);var Ta=this.s,bb=this.He.Lf,Ma=this.He.level;if(Ta.Jb("vAmbientInfos",bb,Ma)){var Na=Ta.c,Ha=Ta.u.get("vAmbientInfos");Na.b.uniform2f(Ha,bb,Ma)}var Ka=this.s,Ca=this.He.Le();if(Ka.Wa("ambientMatrix",Ca)){var Ia=Ka.c,Za=Ka.u.get("ambientMatrix");Ia.b.uniformMatrix4fv(Za,!1,Ca.a)}}if(null!=this.Zd&&T.$b){this.s.Hb("opacitySampler",this.Zd);var cb=this.s,ib=this.Zd.Lf,Sa=this.Zd.level;if(cb.Jb("vOpacityInfos",
ib,Sa)){var kb=cb.c,lb=cb.u.get("vOpacityInfos");kb.b.uniform2f(lb,ib,Sa)}var Ja=this.s,Ua=this.Zd.Le();if(Ja.Wa("opacityMatrix",Ua)){var fb=Ja.c,wb=Ja.u.get("opacityMatrix");fb.b.uniformMatrix4fv(wb,!1,Ua.a)}}if(null!=this.jc&&T.mc){this.jc.rc?this.s.Hb("reflectionCubeSampler",this.jc):this.s.Hb("reflection2DSampler",this.jc);var Hc=this.s,$a=this.jc.ol();if(Hc.Wa("reflectionMatrix",$a)){var gb=Hc.c,hb=Hc.u.get("reflectionMatrix");gb.b.uniformMatrix4fv(hb,!1,$a.a)}var ab=this.s,ob=this.jc.level,
ub=this.ew;if(ab.Jb("vReflectionInfos",ob,ub)){var yb=ab.c,Tc=ab.u.get("vReflectionInfos");yb.b.uniform2f(Tc,ob,ub)}}if(null!=this.Fd&&T.be){this.s.Hb("emissiveSampler",this.Fd);var Pa=this.s,Ba=this.Fd.Lf,Xa=this.Fd.level;if(Pa.Jb("vEmissiveInfos",Ba,Xa)){var Ic=Pa.c,yc=Pa.u.get("vEmissiveInfos");Ic.b.uniform2f(yc,Ba,Xa)}var xa=this.s,Ib=this.Fd.Le();if(xa.Wa("emissiveMatrix",Ib)){var pb=xa.c,Cb=xa.u.get("emissiveMatrix");pb.b.uniformMatrix4fv(Cb,!1,Ib.a)}}if(null!=this.Vf&&T.Ib){this.s.Hb("lightmapSampler",
this.Vf);var qb=this.s,Ya=this.Vf.Lf,Ab=this.Vf.level;if(qb.Jb("vLightmapInfos",Ya,Ab)){var dd=qb.c,Jc=qb.u.get("vLightmapInfos");dd.b.uniform2f(Jc,Ya,Ab)}var Dc=this.s,db=this.Vf.Le();if(Dc.Wa("lightmapMatrix",db)){var Xd=Dc.c,Fd=Dc.u.get("lightmapMatrix");Xd.b.uniformMatrix4fv(Fd,!1,db.a)}}if(null!=this.Te&&T.Ec){this.s.Hb("specularSampler",this.Te);var zc=this.s,kd=this.Te.Lf,rb=this.Te.level;if(zc.Jb("vSpecularInfos",kd,rb)){var Kc=zc.c,wc=zc.u.get("vSpecularInfos");Kc.b.uniform2f(wc,kd,rb)}var Wa=
this.s,sb=this.Te.Le();if(Wa.Wa("specularMatrix",sb)){var ce=Wa.c,Eb=Wa.u.get("specularMatrix");ce.b.uniformMatrix4fv(Eb,!1,sb.a)}}if(null!=this.Je&&1==c.c.T.tw&&T.Za){this.s.Hb("bumpSampler",this.Je);var mb=this.s,Rb=this.Je.Lf,xb=1/this.Je.level,Nb=this.lC;if(mb.xe("vBumpInfos",Rb,xb,Nb)){var vb=mb.c,Gb=mb.u.get("vBumpInfos");vb.b.uniform3f(Gb,Rb,xb,Nb)}var nb=this.s,Bb=this.Je.Le();if(nb.Wa("bumpMatrix",Bb)){var Wb=nb.c,Xb=nb.u.get("bumpMatrix");Wb.b.uniformMatrix4fv(Xb,!1,Bb.a)}}if(null!=this.kc&&
T.tc){var Ub=1;if(this.kc.rc)this.s.Hb("refractionCubeSampler",this.kc);else{this.s.Hb("refraction2DSampler",this.kc);var Mb=this.s,Ob=this.kc.ol();if(Mb.Wa("refractionMatrix",Ob)){var Yb=Mb.c,jb=Mb.u.get("refractionMatrix");Yb.b.uniformMatrix4fv(jb,!1,Ob.a)}v.D(this.kc,je)&&(Ub=this.kc.depth)}var zb=this.s,Pb=this.kc.level,Zb=this.pr,ac=this.tr?-1:1;zb.Oa("vRefractionInfos",Pb,Zb,Ub,ac)&&zb.c.Ub(zb.u.get("vRefractionInfos"),Pb,Zb,Ub,ac)}null!=this.yj&&T.ae&&Bc.Fo(this.yj,this.s)}var Sb=this.s;if(null!=
c.zj){var Hb=c.zj,cc=Hb.j.x,ec=Hb.j.y,ic=Hb.j.z,jc=Hb.d;Sb.Oa("vClipPlane",cc,ec,ic,jc)&&Sb.c.Ub(Sb.u.get("vClipPlane"),cc,ec,ic,jc)}if(this.lr()){var Qb=this.s,bc=this.pC,mc=Qb.Qa.get("pointSize");if(null==mc||mc[0]!=bc){Qb.Qa.set("pointSize",[bc]);var pc=Qb.c,qc=Qb.u.get("pointSize");pc.b.uniform1f(qc,bc)}}var dc=c.vn,fc=this.vn,Qa=this.gy;Qa.r=dc.r*fc.r;Qa.v=dc.v*fc.v;Qa.m=dc.m*fc.m;var hc=this.s,Db=null!=c.qt?c.qt:c.L.position;if(hc.xe("vEyePosition",Db.x,Db.y,Db.z)){var tc=hc.c,uc=hc.u.get("vEyePosition");
tc.b.uniform3f(uc,Db.x,Db.y,Db.z)}var kc=this.s,lc=this.gy;if(kc.xe("vAmbientColor",lc.r,lc.v,lc.m)){var Lc=kc.c,Mc=kc.u.get("vAmbientColor");Lc.b.uniform3f(Mc,lc.r,lc.v,lc.m)}if(this.N[16]){var Ac=this.s,nc=this.Bo,Fc=this.bs;if(Ac.Oa("vSpecularColor",nc.r,nc.v,nc.m,Fc)){var Oc=Ac.c,Qc=Ac.u.get("vSpecularColor");Oc.b.uniform4f(Qc,nc.r,nc.v,nc.m,Fc)}}var Vb=this.s,rc=this.Ku;if(Vb.xe("vEmissiveColor",rc.r,rc.v,rc.m)){var Vc=Vb.c,Wc=Vb.u.get("vEmissiveColor");Vc.b.uniform3f(Wc,rc.r,rc.v,rc.m)}}if(c.$e!=
this||!this.dv()){var eb=this.s,sc=this.Kn,Nc=this.alpha*b.Ei();if(eb.Oa("vDiffuseColor",sc.r,sc.v,sc.m,Nc)){var Zc=eb.c,$c=eb.u.get("vDiffuseColor");Zc.b.uniform4f($c,sc.r,sc.v,sc.m,Nc)}c.BB&&!this.Ln&&gc.iE(c,b,this.s,this.N[16],this.Sj);if(c.qf&&b.sh&&c.Fj!=Aa.g||null!=this.jc||null!=this.kc){var Gc=this.s,Pc=c.Aa;if(Gc.Wa("view",Pc)){var ad=Gc.c,bd=Gc.u.get("view");ad.b.uniformMatrix4fv(bd,!1,Pc.a)}}var vc=this.s;if(c.qf&&b.sh&&c.Fj!=Aa.g){var Rc=c.Fj,Sc=c.AA,Uc=c.zA,Xc=c.yA;vc.Oa("vFogInfos",
Rc,Sc,Uc,Xc)&&vc.c.Ub(vc.u.get("vFogInfos"),Rc,Sc,Uc,Xc);var xc=c.xA;if(vc.xe("vFogColor",xc.r,xc.v,xc.m)){var gd=vc.c,hd=vc.u.get("vFogColor");gd.b.uniform3f(hd,xc.r,xc.v,xc.m)}}var Ec=this.s;if(this.N[46]){var tb=2/(Math.log(c.L.Fb+1)/.6931471805599453),Yc=Ec.Qa.get("logarithmicDepthConstant");if(null==Yc||Yc[0]!=tb){Ec.Qa.set("logarithmicDepthConstant",[tb]);var id=Ec.c,jd=Ec.u.get("logarithmicDepthConstant");id.b.uniform1f(jd,tb)}}null!=this.Jq&&ya.Fo(this.Jq,this.s)}sa.prototype.bind.call(this,
a,b)},dispose:function(a,b){null==b&&(b=!0);null==a&&(a=!1);b&&(null!=this.Xc&&this.Xc.dispose(),null!=this.He&&this.He.dispose(),null!=this.Zd&&this.Zd.dispose(),null!=this.jc&&this.jc.dispose(),null!=this.Fd&&this.Fd.dispose(),null!=this.Te&&this.Te.dispose(),null!=this.Je&&this.Je.dispose(),null!=this.kc&&this.kc.dispose(),null!=this.yj&&this.yj.dispose());sa.prototype.dispose.call(this,a)},l:T,ha:F(sa.prototype.ha,{eB:"get_useLogarithmicDepth"})});var L=J.BABYLON.Color3=function(a,b,c){null==
c&&(c=0);null==b&&(b=0);null==a&&(a=0);this.r=a;this.v=b;this.m=c};q["com.babylonhx.math.Color3"]=L;L.i=["com","babylonhx","math","Color3"];L.bp=function(a){return"#"!=a.substring(0,1)||7!=a.length?(console.log("Color3.FromHexString must be called with a string like #FFFFFF"),new L(0,0,0)):new L(na.$a("0x"+a.substring(1,3))/255,na.$a("0x"+a.substring(3,5))/255,na.$a("0x"+a.substring(5,7))/255)};L.Pb=function(a){return new L(a[0],a[1],a[2])};L.Ve=function(a){return new L((a>>16&255)/255,(a>>8&255)/
255,(a&255)/255)};L.cp=function(a,b,c){return new L(a/255,b/255,c/255)};L.D=function(a,b,c){return new L(a.r+(b.r-a.r)*c,a.v+(b.v-a.v)*c,a.m+(b.m-a.m)*c)};L.Jl=function(){return new L(1,0,0)};L.Ag=function(){return new L(0,1,0)};L.mc=function(){return new L(0,0,1)};L.$b=function(){return new L(0,0,0)};L.Qo=function(){return new L(1,1,1)};L.Ni=function(){return new L(.5,0,.5)};L.Bg=function(){return new L(1,0,1)};L.So=function(){return new L(1,1,0)};L.Cf=function(){return new L(.5,.5,.5)};L.prototype=
{scale:function(a){return new L(this.r*a,this.v*a,this.m*a)},l:L};var vc=J.BABYLON.CubeTexture=function(a,b,c,d,e){null==d&&(d=!1);hb.call(this,b);this.Ed=3;this.url=this.name=a;this.Mm=d;this.Ij=!1;if(null!=a&&""!=a||null!=e){if(null==e){null==c&&(c="_px.jpg _py.jpg _pz.jpg _nx.jpg _ny.jpg _nz.jpg".split(" "));e=[];for(var f=0,g=c.length;f<g;){var h=f++;e.push(a+c[h])}}this.IF=e;null==this.fa&&(b.HD?this.Ma=4:this.fa=b.c.aA(a,b,e,d));this.rc=!0;a=new r;a.a[0]=1;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=
0;a.a[5]=1;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=1;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=1;this.tq=a}};q["com.babylonhx.materials.textures.CubeTexture"]=vc;vc.i=["com","babylonhx","materials","textures","CubeTexture"];vc.ab=function(a,b,c){var d=null;null==a.name&&null==a.rI||a.Mi||(d=new vc(c+na.Pb(a.name),b,a.rI),d.name=a.name,d.Ij=a.Ij,d.level=a.level,d.Ed=a.Ed);return d};vc.U=hb;vc.prototype=F(hb.prototype,{Sq:function(){4==this.Ma&&(this.Ma=1,this.fa=this.Pp(this.url,this.Mm),
null==this.fa&&(this.fa=this.f.c.aA(this.url,this.f,this.IF,this.Mm)))},ol:function(){return this.tq},l:vc});var nb=J.BABYLON.RenderTargetTexture=function(a,b,c,d,e,f,g,h,k,l){null==l&&(l=!1);null==k&&(k=!0);null==h&&(h=3);null==g&&(g=!1);null==f&&(f=0);null==e&&(e=!0);this.Jt=1;this.cf=-1;this.Db={width:0,height:0};this.Lv=new R;this.Lc=new R;this.sc=new R;this.WB=new R;this.tL=!1;this.aw=!0;this.lc=[];ma.call(this,null,c,!d);this.Ed=4;this.name=a;this.Mi=!0;"number"==typeof b&&(b|0)===b?(this.Db.width=
b,this.Db.height=b):null!=b.width&&(this.Db.width=b.width,this.Db.height=b.height);this.Vx=e;this.rc=g;1==h&&(this.lg=this.kg=0);g?(this.fa=c.c.VH(this.Db,{qc:d,kd:h,jl:k,kl:l}),this.Ed=6,a=new r,a.a[0]=1,a.a[1]=0,a.a[2]=0,a.a[3]=0,a.a[4]=0,a.a[5]=1,a.a[6]=0,a.a[7]=0,a.a[8]=0,a.a[9]=0,a.a[10]=1,a.a[11]=0,a.a[12]=0,a.a[13]=0,a.a[14]=0,a.a[15]=1,this.tq=a):this.fa=c.c.Bu(this.Db,{qc:d,type:f,kd:h,jl:k,kl:l});this.pj=new Ae(c)};q["com.babylonhx.materials.textures.RenderTargetTexture"]=nb;nb.i=["com",
"babylonhx","materials","textures","RenderTargetTexture"];nb.U=ma;nb.prototype=F(ma.prototype,{HC:function(){this.cf=-1},Tn:function(){return this.Jt},qh:function(){if(-1==this.cf||this.Tn()==this.cf)return this.cf=1,!0;this.cf++;return!1},pa:function(){return this.f.Nr?ma.prototype.pa.call(this):!1},ol:function(){return this.rc?this.tq:ma.prototype.ol.call(this)},hb:function(a){null==a&&(a=!1);var b=this.f,c=b.c;0==this.BM&&(a=this.BM);if(null!=this.tn){this.lc=[];for(var d=0,e=this.tn.length;d<
e;){var f=d++;this.lc.push(b.Vu(this.tn[f]))}this.tn=null}if(null!=this.rL)for(this.lc.splice(0,this.lc.length-1),d=this.f.Yb,e=0,f=d.length;e<f;){var g=e++,g=d[g];this.rL(g)&&this.lc.push(g)}if(null==this.lc||0!=this.lc.length){if(null!=this.L){var d=this.L.viewport,e=c.Wb(),f=c.Lb(),g=d.x,h=d.y;c.af=d;c.b.viewport(g*e|0,h*f|0,e*d.width|0,f*d.height|0);this.L!=b.L&&(d=this.L.rf(),e=this.L.Pf(!0),b.Aa=d,b.Va=e,b.Aa.qa(b.Va,b.sb.a,0))}else d=b.L.viewport,e=c.Wb(),f=c.Lb(),g=d.x,h=d.y,c.af=d,c.b.viewport(g*
e|0,h*f|0,e*d.width|0,f*d.height|0);this.pj.reset();d=null!=this.lc?this.lc:b.Vg.data;e=null!=this.lc?this.lc.length:b.Vg.length;f=b.Pa;for(g=0;g<e;){var h=g++,k=d[h];if(null!=k)if(k.pa()){if(k.Oy(f),k.isEnabled()&&k.hd&&null!=k.Ha&&0!=(k.tb&b.L.tb))for(k.ys(f),h=0,k=k.Ha;h<k.length;){var l=k[h];++h;b.op+=l.Xd;this.pj.pf(l)}}else this.HC()}if(this.rc)for(f=0;6>f;)g=f++,this.FC(g,d,e,a),b.Pa++,b.$e=null;else this.FC(0,d,e,a);this.WB.la(this);null!=this.L&&this.L!=b.L&&(a=b.L.rf(),d=b.L.Pf(!0),b.Aa=
a,b.Va=d,b.Aa.qa(b.Va,b.sb.a,0));a=b.L.viewport;d=c.Wb();e=c.Lb();f=a.x;g=a.y;c.af=a;c.b.viewport(f*d|0,g*e|0,d*a.width|0,e*a.height|0);b.$e=null}},FC:function(a,b,c,d){null==d&&(d=!1);var e=this.f;c=e.c;d&&e.Gl.Qy(this.fa)||(this.rc?c.bindFramebuffer(this.fa,a):c.bindFramebuffer(this.fa));this.sc.la(a);if(this.Lv.Fh())this.Lv.la(c);else{var f=e.clearColor;c.G.apply(c.b);c.rb.apply(c.b);c.J.apply(c.b);var g=0;v.D(f,ca)?c.b.clearColor(f.r,f.v,f.m,f.W):c.b.clearColor(f.r,f.v,f.m,1);g|=16384;c.b.clearDepth(1);
g|=256;c.b.clearStencil(0);c.b.clear(g|1024)}this.Vx||(f=e.L.rf(),g=e.L.Pf(!0),e.Aa=f,e.Va=g,e.Aa.qa(e.Va,e.sb.a,0));this.pj.hb(this.ZH,b,this.aw,this.tL);d&&e.Gl.Xx(!1,this.fa,a);this.Vx||(b=e.L.rf(),d=e.L.Pf(!0),e.Aa=b,e.Va=d,e.Aa.qa(e.Va,e.sb.a,0));this.Lc.la(a);this.rc&&5!=a||(this.rc&&5==a&&c.DA(this.fa),a=this.fa,c.pg=null,a.qc&&!this.rc&&(a=a.data,c.O[c.I]!=a&&(c.b.bindTexture(3553,a),c.O[c.I]=a),c.b.generateMipmap(3553),null!=c.O[c.I]&&(c.b.bindTexture(3553,null),c.O[c.I]=null)),null!=c.uc&&
(c.b.bindFramebuffer(36160,null),c.uc=null))},l:nb,ha:{Tn:"get_refreshRate"}});var Rc=J.BABYLON.MirrorTexture=function(a,b,c,d){null==d&&(d=!1);var e=new r;e.a[0]=0;e.a[1]=0;e.a[2]=0;e.a[3]=0;e.a[4]=0;e.a[5]=0;e.a[6]=0;e.a[7]=0;e.a[8]=0;e.a[9]=0;e.a[10]=0;e.a[11]=0;e.a[12]=0;e.a[13]=0;e.a[14]=0;e.a[15]=0;this.pt=e;e=new r;e.a[0]=0;e.a[1]=0;e.a[2]=0;e.a[3]=0;e.a[4]=0;e.a[5]=0;e.a[6]=0;e.a[7]=0;e.a[8]=0;e.a[9]=0;e.a[10]=0;e.a[11]=0;e.a[12]=0;e.a[13]=0;e.a[14]=0;e.a[15]=0;this.sb=e;this.fo=new Sc(0,
1,0,1);var f=this;nb.call(this,a,b,c,d,!0);this.sc.add(function(){r.OB(f.fo,f.pt);f.bz=c.Aa;f.pt.qa(f.bz,f.sb.a,0);var a=c.Va;c.Aa=f.sb;c.Va=a;c.Aa.qa(c.Va,c.sb.a,0);c.zj=f.fo;c.c.Dg=!1;var b=c.L.position,d=f.pt,a=new n(0,0,0),e=b.x,m=b.y,b=b.z,d=d.a,w=e*d[1]+m*d[5]+b*d[9]+d[13],p=e*d[2]+m*d[6]+b*d[10]+d[14],u=e*d[3]+m*d[7]+b*d[11]+d[15];a.x=(e*d[0]+m*d[4]+b*d[8]+d[12])/u;a.y=w/u;a.z=p/u;c.qt=a});this.Lc.add(function(){var a=c.Va;c.Aa=f.bz;c.Va=a;c.Aa.qa(c.Va,c.sb.a,0);c.c.Dg=!0;c.qt=null;c.zj=null})};
q["com.babylonhx.materials.textures.MirrorTexture"]=Rc;Rc.i=["com","babylonhx","materials","textures","MirrorTexture"];Rc.U=nb;Rc.prototype=F(nb.prototype,{l:Rc});var Ae=J.BABYLON.RenderingManager=function(a){this.Mt=null;this.wF=[];this.uF=[];this.vF=[];this.lx=[];this.$m=[];this.f=a;for(a=0;4>a;){var b=a++,c=this.lx,d=new W;null!=t.autoClear?d.C("autoClear",!0):d.h.autoClear=!0;null!=t.depth?d.C("depth",!0):d.h.depth=!0;null!=t.stencil?d.C("stencil",!0):d.h.stencil=!0;c[b]=d}};q["com.babylonhx.rendering.RenderingManager"]=
Ae;Ae.i=["com","babylonhx","rendering","RenderingManager"];Ae.prototype={wG:function(a,b){if(0!=this.f.am.length){this.zs=this.f.L;for(var c=0,d=this.f.am.length;c<d;){var e=c++,e=this.f.am.data[e];if(e.dg==a&&0!=(this.zs.tb&e.tb)){if(!this.uk){var f=this.f.c;f.G.apply(f.b);f.rb.apply(f.b);f.J.apply(f.b);var g=0;f.b.clearDepth(1);g|=256;f.b.clearStencil(0);g|=1024;f.b.clear(g);this.uk=!0}if(null==e.Gd.position||null==b||-1!=b.indexOf(e.Gd))this.f.fx+=e.hb()}}}},yG:function(a){if(this.f.mD&&0!=this.f.gg.length){this.zs=
this.f.L;for(var b=0,c=this.f.gg.length;b<c;){var d=b++,d=this.f.gg[d];if(d.dg==a&&0!=(this.zs.tb&d.tb)){if(!this.uk){var e=this.f.c;e.G.apply(e.b);e.rb.apply(e.b);e.J.apply(e.b);var f=0;e.b.clearDepth(1);f|=256;e.b.clearStencil(0);f|=1024;e.b.clear(f);this.uk=!0}d.hb()}}}},$y:function(){this.tF&&this.yG(this.Ox);this.sF&&this.wG(this.Ox,this.qF)},hb:function(a,b,c,d){var e=this.f.fC.Fh()?this.f.fC:null,f=null;null!=e&&(null==this.Mt&&(this.Mt=new ef),f=this.Mt,f.scene=this.f,f.Vz=this.f.L);this.qF=
b;this.sF=c;this.tF=d;for(b=0;4>b;){this.uk=0==b;c=this.$m[b];this.Ox=b;if(null!=c){d=0;null!=e&&(d=Math.pow(2,b),f.ro=1,f.dg=b,e.la(f,d));var g=this.lx[b];if(null!=g&&(null!=t.autoClear?g.H("autoClear"):g.h.autoClear)){var h=null!=t.depth?g.H("depth"):g.h.depth,g=null!=t.stencil?g.H("stencil"):g.h.stencil;if(!this.uk){var k=this.f.c;k.G.apply(k.b);k.rb.apply(k.b);k.J.apply(k.b);var l=0;h&&(k.b.clearDepth(1),l|=256);g&&(k.b.clearStencil(0),l|=1024);k.b.clear(l);this.uk=!0}}null!=e&&(f.ro=2,e.la(f,
d));null==c.lo&&(c.lo=B(this,this.$y));null!=e&&(f.ro=3,e.la(f,d));c.hb(a);null!=e&&(f.ro=4,e.la(f,d))}else this.$y(),null!=e&&(c=Math.pow(2,b),f.ro=1,f.dg=b,e.la(f,c),f.ro=4,e.la(f,c));++b}},reset:function(){for(var a=0;4>a;){var b=a++,b=this.$m[b];if(null!=b){var c=b.Pm;c.length=0;c.Ka++;c=b.Vk;c.length=0;c.Ka++;b=b.bm;b.length=0;b.Ka++}}},pf:function(a){var b=a.ta.dg;null==this.$m[b]&&(this.$m[b]=new Oa(b,this.f,this.vF[b],this.uF[b],this.wF[b]));b=this.$m[b];Oa.Ta=a.Of();Oa.Zc=a.ta;b=Oa.Ta.Oi()||
1>Oa.Zc.Ei()||Oa.Zc.ul?b.Vk:Oa.Ta.Yf()?b.bm:b.Pm;b.data[b.length++]=a;a.yb[b.eb]=b.Ka},l:Ae};var Sc=J.BABYLON.Plane=function(a,b,c,d){this.j=new n(a,b,c);this.d=d};q["com.babylonhx.math.Plane"]=Sc;Sc.i=["com","babylonhx","math","Plane"];Sc.prototype={l:Sc};var Ld=J.BABYLON.FresnelParameters=function(){this.$f=1;this.uh=0;this.Oh=new L(0,0,0);this.Jh=new L(1,1,1);this.isEnabled=!0};q["com.babylonhx.materials.FresnelParameters"]=Ld;Ld.i=["com","babylonhx","materials","FresnelParameters"];Ld.ab=function(a){var b=
new Ld;b.isEnabled=a.isEnabled;var c=a.Jh;b.Jh=new L(c[0],c[1],c[2]);c=a.Oh;b.Oh=new L(c[0],c[1],c[2]);b.uh=a.uh;b.$f=null!=a.$f?a.$f:1;return b};Ld.prototype={l:Ld};var Rb=J.BABYLON.SubMesh=function(a,b,c,d,e,f,g,h){null==h&&(h=!0);this.yb=[];this.wf=a;this.te=b;this.Ug=c;this.Xb=d;this.Xd=e;this.ta=f;this.ph=null!=g?g:v.g(f,S);f.Ha.push(this);this.tj=[];this.eb=f.Ha.length-1;h&&(this.Xv(),f.Wd(!0))};q["com.babylonhx.mesh.SubMesh"]=Rb;Rb.i=["com","babylonhx","mesh","SubMesh"];Rb.xb=[$a];Rb.g=function(a,
b,c,d){var e,f=Infinity,g=-Infinity;null==e&&(e=v.g(d,S));for(var h=e.Bc(),k=b,l=b+c;k<l;){var m=k++,m=h[m];m<f&&(f=m);m>g&&(g=m)}new Rb(a,f|0,g-f+1|0,b,c,d,e)};Rb.prototype={Rf:function(){return 0==this.te?this.Ug==this.ta.Qf():!1},Of:function(){var a=this.ph.Gg();return null!=a&&v.D(a,rb)?a.KA(this.wf):null==a?this.ta.f.Rq:a},Xv:function(){this.Xp=null;if(!this.Rf()){var a=this.ph.Ba("position");if(null==a)this.ra=this.ta.ra;else{var b=this.ph.Bc();new n(0,0,0);var c;new n(0,0,0);if(0==this.Xb&&
this.Xd==b.length)c=this.ph.fd().Gb,a=new n(c.x,c.y,c.z),c=this.ph.fd().Mb,c=new n(c.x,c.y,c.z);else{var d=this.Xb,e=this.Xd,f=new n(Infinity,Infinity,Infinity);c=new n(-Infinity,-Infinity,-Infinity);for(var g=d,d=d+e;g<d;){var h=g++,k=a[3*b[h]],e=a[3*b[h]+1],h=a[3*b[h]+2],l=new n(k,e,h);f.x<l.x&&(l.x=f.x);f.y<l.y&&(l.y=f.y);f.z<l.z&&(l.z=f.z);f=l;e=new n(k,e,h);c.x>e.x&&(e.x=c.x);c.y>e.y&&(e.y=c.y);c.z>e.z&&(e.z=c.z);c=e}a=f}this.ra=new xb(a,c)}}},clone:function(a,b){var c=new Rb(this.wf,this.te,
this.Ug,this.Xb,this.Xd,a,b,!1);this.Rf()||(c.ra=new xb(this.ra.Gb,this.ra.Mb));return c},dispose:function(){if(null!=this.Fm){var a=this.Fm;a.ia--;0==a.ia&&this.ta.f.c.b.deleteBuffer(a.buffer);this.Fm=null}Q.remove(this.ta.Ha,this)},l:Rb,ha:{Rf:"get_IsGlobal"}};var Cf=J.BABYLON.PhysicsBodyCreationOptions=function(a,b,c,d){null==d&&(d="");this.name="";""==d&&(d=function(a){var b=15;null==b&&(b=61);var c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),d=[];for(61<b&&(b=61);0<
a--;)d.push(c[Math.floor((b+1)*Math.random())]);return d.join("")},d=d(8)+"-"+d(4)+"-4"+d(3)+"-"+Math.floor(4*Math.random())+d(3)+"-"+d(12));this.name=d;this.xr=a;this.ar=b;this.Or=c};q["com.babylonhx.physics.PhysicsBodyCreationOptions"]=Cf;Cf.i=["com","babylonhx","physics","PhysicsBodyCreationOptions"];Cf.prototype={l:Cf};var Sa=J.BABYLON.ParticleSystem=function(a,b,c,d){this.pp=0;this.qq=this.sj=!1;this.As=!0;this.ud=-1;this.gz=new n(0,0,0);this.fz=new n(0,0,0);this.Ix=new ca(0,0,0,0);this.ez=new ca(0,
0,0,0);this.ua=new W;this.ni=0;this.Vt=[];this.Pg=[];this.cs=new ca(1,1,1,1);this.KH=new ca(0,0,0,0);this.JH=new ca(1,1,1,.4);this.IH=new ca(1,1,1,.5);this.Dv=new n(.5,.5,.5);this.Fv=new n(-.5,-.5,-.5);this.Iu=new n(0,1,0);this.Hu=new n(0,1,0);this.Vn=new n(0,0,0);this.xI=!1;this.vH=Sa.Pb;this.Nb=new R;this.tb=268435455;this.UJ=this.LJ=0;this.VJ=this.OJ=this.WJ=this.PJ=this.XJ=this.QJ=1;this.yb=[];this.eI=!1;this.qD=0;this.zM=.01;this.Av=-1;this.uA=10;this.Gd=null;this.dg=0;this.Xa=[];var e=this;
this.id=this.name=a;this.bj=b;this.f=c;this.c=c.c;this.Qx=d;c.Pe.push(this);a=[];for(var f=d=0;f<b;)f++,a.push(d),a.push(d+1),a.push(d+2),a.push(d),a.push(d+2),a.push(d+3),d+=4;d=this.c;f=d.b.createBuffer();f=new ub(f);d.V.get(34963)!=f&&(d.b.bindBuffer(34963,null==f?null:f.buffer),d.V.set(34963,null==f?null:f));var g=null,h=!1;if(d.T.Ul){for(var k=0,l=a.length;k<l;){var m=k++;if(65535<a[m]){h=!0;break}}h?g=new Int32Array(a):g=new Int16Array(a)}else g=new Int16Array(a);d.b.bufferData(34963,g,35044);
null!=d.V.get(34963)&&(d.b.bindBuffer(34963,null),d.V.set(34963,null));d.kb=null;f.ia=1;f.Sc=h;this.wa=f;this.ga=[];a=0;for(b=44*b|0;a<b;)d=a++,this.ga[d]=0;this.F=new jd(c.c,this.ga,!0,11);a=this.F.Bj("position",0,3);b=this.F.Bj("color",3,4);c=this.F.Bj("options",7,4);d=this.ua;null!=t.position?d.C("position",a):d.h.position=a;a=this.ua;null!=t.color?a.C("color",b):a.h.color=b;b=this.ua;null!=t.options?b.C("options",c):b.h.options=c;this.YL=function(a,b,c){var d=e.Hu.x,f=e.Iu.x,g=e.Hu.y,h=e.Iu.y,
k=e.Hu.z,l=e.Iu.z,d=(d==f?d:Math.random()*(f-d)+d)*a,g=(g==h?g:Math.random()*(h-g)+g)*a;a=(k==l?k:Math.random()*(l-k)+k)*a;c.x=d*b.a[0]+g*b.a[4]+a*b.a[8];c.y=d*b.a[1]+g*b.a[5]+a*b.a[9];c.z=d*b.a[2]+g*b.a[6]+a*b.a[10]};this.ZL=function(a,b){var c=e.Fv.x,d=e.Dv.x,c=c==d?c:Math.random()*(d-c)+c,d=e.Fv.y,f=e.Dv.y,d=d==f?d:Math.random()*(f-d)+d,f=e.Fv.z,g=e.Dv.z,f=f==g?f:Math.random()*(g-f)+f,g=c*a.a[1]+d*a.a[5]+f*a.a[9]+a.a[13],h=c*a.a[2]+d*a.a[6]+f*a.a[10]+a.a[14],k=c*a.a[3]+d*a.a[7]+f*a.a[11]+a.a[15];
b.x=(c*a.a[0]+d*a.a[4]+f*a.a[8]+a.a[12])/k;b.y=g/k;b.z=h/k};this.sM=function(a){for(var b=0;b<a.length;){var c=a[b];c.Xk+=e.vi;if(c.Xk>=c.co){var d=e.Pg.pop();if(d!=c){var f=c.position,g=d.position;f.x=g.x;f.y=g.y;f.z=g.z;f=c.direction;g=d.direction;f.x=g.x;f.y=g.y;f.z=g.z;c.color.$z(d.color);c.Nq.$z(d.Nq);c.co=d.co;c.Xk=d.Xk;c.size=d.size;c.Cd=d.Cd;c.Bq=d.Bq;e.Vt.push(d)}}else c.Nq.iw(e.vi,e.ez),c.color.Gz(e.ez),0>c.color.W&&(c.color.W=0),c.Cd+=c.Bq*e.vi,d=c.direction,f=e.vi,g=e.fz,g.x=d.x*f,g.y=
d.y*f,g.z=d.z*f,d=c.position,f=e.fz,d.x+=f.x,d.y+=f.y,d.z+=f.z,d=e.Vn,f=e.vi,g=e.gz,g.x=d.x*f,g.y=d.y*f,g.z=d.z*f,c=c.direction,d=e.gz,c.x+=d.x,c.y+=d.y,c.z+=d.z,++b}};this.s=this.NF()};q["com.babylonhx.particles.ParticleSystem"]=Sa;Sa.i=["com","babylonhx","particles","ParticleSystem"];Sa.xb=[Qb,$a,ze];Sa.prototype={start:function(){this.qq=!0;this.sj=!1;this.pp=0},stop:function(){this.sj=!0},NF:function(){if(null!=this.Qx)return this.Qx;var a=[];null!=this.f.zj&&a.push("#define CLIPPLANE");a=a.join("\n");
this.Yg!=a&&(this.Yg=a,this.s=this.f.c.Aj("particles",["position","color","options"],["invView","view","projection","vClipPlane","textureMask"],["diffuseSampler"],a));return this.s},ku:function(){if(this.qq&&null!=this.Gd&&this.s.Nc&&null!=this.Ld&&this.Ld.pa()&&this.ud!=this.f.Pa){this.ud=this.f.Pa;this.vi=this.zM*this.f.ix;var a;-1<this.Av?(a=this.Av,this.Av=this.ni=0):(a=this.uA*this.vi|0,this.ni+=(this.uA*this.vi|0)-a);1<this.ni&&(a+=this.ni,this.ni-=this.ni);this.As=!1;this.sj?a=0:(this.pp+=
this.vi,0!=this.qD&&this.pp>=this.qD&&this.stop());this.As=0<this.Pg.length;this.sM(this.Pg);if(null!=this.Gd.position)Sa.$a=this.Gd.va();else{var b=this.Gd.x,c=this.Gd.y,d=this.Gd.z,e=new r;e.a[0]=1;e.a[1]=0;e.a[2]=0;e.a[3]=0;e.a[4]=0;e.a[5]=1;e.a[6]=0;e.a[7]=0;e.a[8]=0;e.a[9]=0;e.a[10]=1;e.a[11]=0;e.a[12]=0;e.a[13]=0;e.a[14]=0;e.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,b,c,d,e);Sa.$a=e}for(b=0;b<a;){b++;if(this.Pg.length==this.bj)break;0!=this.Vt.length?(this.zf=this.Vt.pop(),this.zf.Xk=0):this.zf=new Ff;
this.Pg.push(this.zf);c=this.VJ;d=this.OJ;this.YL(c==d?c:Math.random()*(d-c)+c,Sa.$a,this.zf.direction);c=this.WJ;d=this.PJ;this.zf.co=c==d?c:Math.random()*(d-c)+c;c=this.XJ;d=this.QJ;this.zf.size=c==d?c:Math.random()*(d-c)+c;c=this.UJ;d=this.LJ;this.zf.Bq=c==d?c:Math.random()*(d-c)+c;this.ZL(Sa.$a,this.zf.position);ca.tc(this.IH,this.JH,Math.random(),this.zf.color);this.KH.ww(this.zf.color,this.Ix);this.Ix.iw(1/this.zf.co,this.zf.Nq)}this.sj&&!this.As&&(this.qq=!1,this.eI&&(b=this.f.mn,b.data[b.length++]=
this,this.yb[b.eb]=b.Ka));a=b=0;for(c=this.Pg.length;a<c;)d=a++,d=this.Pg[d],e=11*b++,this.ga[e]=d.position.x,this.ga[e+1]=d.position.y,this.ga[e+2]=d.position.z,this.ga[e+3]=d.color.r,this.ga[e+4]=d.color.v,this.ga[e+5]=d.color.m,this.ga[e+6]=d.color.W,this.ga[e+7]=d.Cd,this.ga[e+8]=d.size,this.ga[e+9]=0,this.ga[e+10]=0,e=11*b++,this.ga[e]=d.position.x,this.ga[e+1]=d.position.y,this.ga[e+2]=d.position.z,this.ga[e+3]=d.color.r,this.ga[e+4]=d.color.v,this.ga[e+5]=d.color.m,this.ga[e+6]=d.color.W,this.ga[e+
7]=d.Cd,this.ga[e+8]=d.size,this.ga[e+9]=1,this.ga[e+10]=0,e=11*b++,this.ga[e]=d.position.x,this.ga[e+1]=d.position.y,this.ga[e+2]=d.position.z,this.ga[e+3]=d.color.r,this.ga[e+4]=d.color.v,this.ga[e+5]=d.color.m,this.ga[e+6]=d.color.W,this.ga[e+7]=d.Cd,this.ga[e+8]=d.size,this.ga[e+9]=1,this.ga[e+10]=1,e=11*b++,this.ga[e]=d.position.x,this.ga[e+1]=d.position.y,this.ga[e+2]=d.position.z,this.ga[e+3]=d.color.r,this.ga[e+4]=d.color.v,this.ga[e+5]=d.color.m,this.ga[e+6]=d.color.W,this.ga[e+7]=d.Cd,this.ga[e+
8]=d.size,this.ga[e+9]=0,this.ga[e+10]=1;this.F.create(this.ga)}},hb:function(){if(null==this.Gd||!this.s.Nc||null==this.Ld||!this.Ld.pa()||0==this.Pg.length)return 0;var a=this.c,b=this.s,c=b.zd;a.vc!=c&&(a.b.useProgram(c),a.vc=c);a.Ff=b;null!=b.Tc&&b.Tc(b);a=this.c;b=a.Dg?1029:1028;0==a.G.Sf()&&a.G.Fg()==b||a.G.fg(!1);a.G.Qh(0);b=this.f.Aa;this.s.Hb("diffuseSampler",this.Ld);c=this.s;c.Wa("view",b)&&(a=c.c,c=c.u.get("view"),a.b.uniformMatrix4fv(c,!1,b.a));var d=this.s,a=this.f.Va;d.Wa("projection",
a)&&(c=d.c,d=d.u.get("projection"),c.b.uniformMatrix4fv(d,!1,a.a));var a=this.s,c=this.cs.r,d=this.cs.v,e=this.cs.m,f=this.cs.W;a.Oa("textureMask",c,d,e,f)&&a.c.Ub(a.u.get("textureMask"),c,d,e,f);if(null!=this.f.zj){var a=this.f.zj,c=b.a[0],d=b.a[1],e=b.a[2],f=b.a[3],g=b.a[4],h=b.a[5],k=b.a[6],l=b.a[7],m=b.a[8],n=b.a[9],q=b.a[10],u=b.a[11],y=b.a[12],v=b.a[13],z=b.a[14],A=b.a[15],b=new r;b.a[0]=c;b.a[1]=d;b.a[2]=e;b.a[3]=f;b.a[4]=g;b.a[5]=h;b.a[6]=k;b.a[7]=l;b.a[8]=m;b.a[9]=n;b.a[10]=q;b.a[11]=u;b.a[12]=
y;b.a[13]=v;b.a[14]=z;b.a[15]=A;var c=b.a[0],d=b.a[1],e=b.a[2],f=b.a[3],B=b.a[4],F=b.a[5],x=b.a[6],I=b.a[7],G=b.a[8],D=b.a[9],K=b.a[10],P=b.a[11],N=b.a[12],E=b.a[13],O=b.a[14],L=b.a[15],g=K*L-P*O,h=D*L-P*E,k=D*O-K*E,l=G*L-P*N,m=G*O-K*N,n=G*E-D*N,q=F*g-x*h+I*k,u=-(B*g-x*l+I*m),y=B*h-F*l+I*n,v=-(B*k-F*m+x*n),z=1/(c*q+d*u+e*y+f*v),A=x*L-I*O,H=F*L-I*E,S=F*O-x*E,L=B*L-I*N,O=B*O-x*N,N=B*E-F*N,E=x*P-I*K,R=F*P-I*D,T=F*K-x*D,I=B*P-I*G,x=B*K-x*G,B=B*D-F*G;b.a[0]=q*z;b.a[4]=u*z;b.a[8]=y*z;b.a[12]=v*z;b.a[1]=
-(d*g-e*h+f*k)*z;b.a[5]=(c*g-e*l+f*m)*z;b.a[9]=-(c*h-d*l+f*n)*z;b.a[13]=(c*k-d*m+e*n)*z;b.a[2]=(d*A-e*H+f*S)*z;b.a[6]=-(c*A-e*L+f*O)*z;b.a[10]=(c*H-d*L+f*N)*z;b.a[14]=-(c*S-d*O+e*N)*z;b.a[3]=-(d*E-e*R+f*T)*z;b.a[7]=(c*E-e*I+f*x)*z;b.a[11]=-(c*R-d*I+f*B)*z;b.a[15]=(c*T-d*x+e*B)*z;d=this.s;d.Wa("invView",b)&&(c=d.c,d=d.u.get("invView"),c.b.uniformMatrix4fv(d,!1,b.a));b=this.s;c=a.j.x;d=a.j.y;e=a.j.z;a=a.d;b.Oa("vClipPlane",c,d,e,a)&&b.c.Ub(b.u.get("vClipPlane"),c,d,e,a)}a=this.c;b=this.ua;c=this.wa;
d=this.s;if(a.qb!=b||a.Qb!=d)for(a.qb=b,a.Qb=d,p.sa=d.we,e=0,f=p.sa.length;e<f;)g=e++,p.g=d.sa[g],0<=p.g&&(g=p.sa[g],p.F=null!=t[g]?b.H(g):b.h[g],null==p.F?a.na[p.g]&&(a.b.disableVertexAttribArray(p.g),a.na[p.g]=!1):(a.na[p.g]||(a.b.enableVertexAttribArray(p.g),a.na[p.g]=!0),g=p.F.R.R,a.vertexAttribPointer(g,p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(a.T.Kc.vertexAttribDivisorANGLE(p.g,1),a.ad.push(p.g),a.td.push(g))));null!=c&&a.kb!=c&&(a.kb=c,a.V.get(34963)!=c&&(a.b.bindBuffer(34963,null==
c?null:c.buffer),a.V.set(34963,null==c?null:c)),a.Ud=c.Sc);this.vH==Sa.Pb?(a=this.c,6!=a.bb&&(a.J.Ya(1,1,0,1),a.J.za(!0),a.G.vb(!1),a.bb=6)):(a=this.c,2!=a.bb&&(a.J.Ya(770,771,1,1),a.J.za(!0),a.G.vb(!1),a.bb=2));this.xI&&this.c.G.vb(!0);this.c.Ic(!0,0,6*this.Pg.length);a=this.c;0!=a.bb&&(a.J.za(!1),a.G.vb(!0),a.bb=0);return this.Pg.length},dispose:function(){null!=this.F&&(this.F.dispose(),this.F=null);if(null!=this.wa){var a=this.wa;a.ia--;0==a.ia&&this.c.b.deleteBuffer(a.buffer);this.wa=null}null!=
this.Ld&&(this.Ld.dispose(),this.Ld=null);Q.remove(this.f.Pe,this);this.Nb.la(this);this.Nb.clear()},clone:function(a,b){var c=new Sa(a,this.bj,this.f);null==b&&(b=this.Gd);c.Gd=b;null!=this.Ld&&(c.Ld=new ma(this.Ld.url,this.f));c.start();return c},l:Sa};var ub=J.BABYLON.WebGLBuffer=function(a){function b(a){var b=15;null==b&&(b=61);var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),f=[];for(61<b&&(b=61);0<a--;)f.push(e[Math.floor((b+1)*Math.random())]);return f.join("")}
this.Sc=!1;this.id=b(8)+"-"+b(4)+"-4"+b(3)+"-"+Math.floor(4*Math.random())+b(3)+"-"+b(12);this.buffer=a;this.ia=1};q["com.babylonhx.mesh.WebGLBuffer"]=ub;ub.i=["com","babylonhx","mesh","WebGLBuffer"];ub.prototype={l:ub};q["com.babylonhx.mesh.Buffer"]=jd;jd.i=["com","babylonhx","mesh","Buffer"];jd.prototype={Bj:function(a,b,c,d){return new Id(this.c,this,a,this.rh,!0,null!=d?d:this.Wt,this.ge,b,c)},create:function(a){null==a&&(a=this.qg);if(null==this.R)if(this.rh){var b=this.c,c=b.b.createBuffer(),
c=new ub(c);b.V.get(34962)!=c&&(b.b.bindBuffer(34962,null==c?null:c.buffer),b.V.set(34962,null==c?null:c));b.b.bufferData(34962,new ib(a),35048);null!=b.V.get(34962)&&(b.b.bindBuffer(34962,null),b.V.set(34962,null));b.qb=null;c.ia=1;this.R=c;this.qg=a}else b=this.c,c=b.b.createBuffer(),c=new ub(c),b.V.get(34962)!=c&&(b.b.bindBuffer(34962,null==c?null:c.buffer),b.V.set(34962,null==c?null:c)),b.b.bufferData(34962,new ib(a),35044),null!=b.V.get(34962)&&(b.b.bindBuffer(34962,null),b.V.set(34962,null)),
b.qb=null,c.ia=1,this.R=c;else this.rh&&(b=this.c,c=this.R,b.V.get(34962)!=c&&(b.b.bindBuffer(34962,null==c?null:c.buffer),b.V.set(34962,null==c?null:c)),b.b.bufferSubData(34962,0,new ib(a)),null!=b.V.get(34962)&&(b.b.bindBuffer(34962,null),b.V.set(34962,null)),b.qb=null,this.qg=a)},qM:function(a,b,c){if(null!=this.R&&this.rh){var d=this.c,e=this.R;c=null!=c?c*this.Wt:0;d.V.get(34962)!=e&&(d.b.bindBuffer(34962,null==e?null:e.buffer),d.V.set(34962,null==e?null:e));-1==c||c==a.length&&0==b?d.b.bufferSubData(34962,
b,new ib(a)):d.b.bufferSubData(34962,0,new ib(a.splice(b,b+c)));null!=d.V.get(34962)&&(d.b.bindBuffer(34962,null),d.V.set(34962,null));this.qg=d.qb=null}},dispose:function(){if(null!=this.R){var a=this.R;a.ia--;0==a.ia?(this.c.b.deleteBuffer(a.buffer),a=!0):a=!1;a&&(this.R=null)}},l:jd};q["com.babylonhx.tools.serialization.SerializationHelper"]=cf;cf.i=["com","babylonhx","tools","serialization","SerializationHelper"];cf.ab=function(a,b,c,d){a=a();za.ae(a,b.Rl);for(var e=0,f=X.Eg(a.TE);e<f.length;){var g=
f[e];++e;var h=X.Fa(a.TE,"property"),k=X.Fa(b,null!=h.WL?h.WL:g),h=h.type;if(null!=k)switch(h){case 0:X.$b(a,g,k);break;case 1:X.$b(a,g,ma.ab(k,c,d));break;case 2:X.$b(a,g,new L(k[0],k[1],k[2]));break;case 3:X.$b(a,g,Ld.ab(k));break;case 4:X.$b(a,g,new K(k[0],k[1]));break;case 5:X.$b(a,g,new n(k[0],k[1],k[2]))}}return a};var kc=J.BABYLON.PassPostProcess=function(a,b,c,d,e,f){null==f&&(f=!1);pa.call(this,a,"pass",null,null,b,c,d,e,f)};q["com.babylonhx.postprocess.PassPostProcess"]=kc;kc.i=["com","babylonhx",
"postprocess","PassPostProcess"];kc.U=pa;kc.prototype=F(pa.prototype,{l:kc});var zd=J.BABYLON.AnaglyphPostProcess=function(a,b,c,d,e,f){null==f&&(f=!1);var g=this;pa.call(this,a,"anaglyph",null,["leftSampler"],b,c[1],d,e,f);this.Xm=c[0].If;this.Ne.add(function(a){var b=g.Xm,c=a.c;a=a.Rd.indexOf("leftSampler");0<b.ob.length&&(b=b.ob.data[b.$g].data,0<=a&&(a=33984+a,c.I!=a-33984&&(c.b.activeTexture(a),c.I=a-33984),c.O[c.I]!=b&&(c.b.bindTexture(3553,b),c.O[c.I]=b)))})};q["com.babylonhx.postprocess.AnaglyphPostProcess"]=
zd;zd.i=["com","babylonhx","postprocess","AnaglyphPostProcess"];zd.U=pa;zd.prototype=F(pa.prototype,{l:zd});var Id=J.BABYLON.VertexBuffer=function(a,b,c,d,e,f,g,h,k){null==h&&(h=0);null==e&&(e=!1);if(null==f)switch(c){case "color":f=4;break;case "matricesIndices":case "matricesIndicesExtra":f=4;break;case "matricesWeights":case "matricesWeightsExtra":f=4;break;case "normal":f=3;break;case "position":f=3;break;case "uv":case "uv2":case "uv3":case "uv4":case "uv5":case "uv6":f=2}v.D(b,jd)?(null==f&&
(f=b.Wt),this.R=b,this.Gf=!1):(this.R=new jd(a,b,d,f,e,g),this.Gf=!0);this.Bd=f;this.Cb=h;this.Db=null!=k?k:f;this.aG=c};q["com.babylonhx.mesh.VertexBuffer"]=Id;Id.i=["com","babylonhx","mesh","VertexBuffer"];Id.prototype={create:function(a){this.R.create(a)},l:Id};q["com.babylonhx.materials.ColorCurves"]=ya;ya.i=["com","babylonhx","materials","ColorCurves"];ya.Fo=function(a,b){a.Ux&&(a.Ux=!1,a.cr(a.jy,a.hy,a.ky,a.iy,a.Qp),a.cr(a.oy,a.my,a.py,a.ny,a.Tk),a.Tk.Iv(a.Qp,a.ly),a.cr(a.Gy,a.Ey,a.Hy,a.Fy,
a.Tk),a.Tk.Iv(a.Qp,a.kj),a.cr(a.IG,a.GG,a.JG,a.HG,a.Tk),a.Tk.Iv(a.Qp,a.kz),a.ly.ww(a.kj,a.Ym),a.kj.ww(a.kz,a.Lm));var c=a.Ym.r,d=a.Ym.v,e=a.Ym.m,f=a.Ym.W;b.Oa("vCameraColorCurvePositive",c,d,e,f)&&b.c.Ub(b.u.get("vCameraColorCurvePositive"),c,d,e,f);c=a.kj.r;d=a.kj.v;e=a.kj.m;f=a.kj.W;b.Oa("vCameraColorCurveNeutral",c,d,e,f)&&b.c.Ub(b.u.get("vCameraColorCurveNeutral"),c,d,e,f);c=a.Lm.r;d=a.Lm.v;e=a.Lm.m;f=a.Lm.W;b.Oa("vCameraColorCurveNegative",c,d,e,f)&&b.c.Ub(b.u.get("vCameraColorCurveNegative"),
c,d,e,f)};ya.JE=function(a){a.push("vCameraColorCurveNeutral");a.push("vCameraColorCurvePositive");a.push("vCameraColorCurveNegative")};ya.NC=function(a){a/=100;var b=Math.abs(a),b=Math.pow(b,2);0>a&&(b*=-1);return 100*b};ya.$J=function(a,b,c,d){var e=ya.ue(a,0,360);b=ya.ue(b/100,0,1);c=ya.ue(c/100,0,1);if(0==b)d.r=c,d.v=c,d.m=c;else{e/=60;a=Math.floor(e);var f=e-a,e=c*(1-b),g=c*(1-b*f);b=c*(1-b*(1-f));switch(a){case 0:d.r=c;d.v=b;d.m=e;break;case 1:d.r=g;d.v=c;d.m=e;break;case 2:d.r=e;d.v=c;d.m=
b;break;case 3:d.r=e;d.v=g;d.m=c;break;case 4:d.r=b;d.v=e;d.m=c;break;default:d.r=c,d.v=e,d.m=g}}d.W=1};ya.ue=function(a,b,c){return Math.min(Math.max(a,b),c)};ya.ab=function(a){return cf.ab(function(){return new ya},a,null,null)};ya.prototype={cr:function(a,b,c,d,e){null!=a&&(a=ya.ue(a,0,360),b=ya.ue(b,-100,100),c=ya.ue(c,-100,100),d=ya.ue(d,-100,100),b=ya.NC(b),b*=.5,d=ya.NC(d),0>b&&(b*=-1,a=(a+180)%360),ya.$J(a,b,50+.25*d,e),e.iw(2,e),e.W=1+.01*c)},l:ya};var pf=J.BABYLON.Effect=function(a,b,c,
d,e,f,g,h,k,l){function m(){var a="",b=Db.Bb,c=u+".fragment";(null!=t[c]?b.Id(c):b.h.hasOwnProperty(c))?(b=Db.Bb,c=u+".fragment",a=null!=t[c]?b.H(c):b.h[c],q.Ft(a,function(b){a=b;n(a)})):ga.Lj(r+".fragment.fx",function(b){a=b;n(a)},null,"text")}function n(a){q.Dt(v,a,b,f,g);q.Qa=new W;q.yz=new W}this.Is="";this.Nc=!1;var q=this;this.c=e;this.name=a;this.Ac=f;this.TG=c.concat(d);this.Rd=d;this.we=b;this.SF=l;this.Mh=k;this.Fr=h;c=null!=a.vertex?a.vertex:a;var u=null!=a.fragment?a.fragment:a;a="";"."==
c.charAt(0)?a=c:a=p.Bb+c;var r="";"."==u.charAt(0)?r=u:r=p.Bb+u;var v="";d=Db.Bb;e=c+".vertex";(null!=t[e]?d.Id(e):d.h.hasOwnProperty(e))?(a=Db.Bb,c+=".vertex",v=null!=t[c]?a.H(c):a.h[c],this.Ft(v,function(a){v=a;m()})):ga.Lj(a+".vertex.fx",function(a){v=a;m()},null,"text")};q["com.babylonhx.materials.Effect"]=pf;pf.i=["com","babylonhx","materials","Effect"];pf.prototype={Ft:function(a,b){for(var c=this,d=new jc("#include<(.+)>(\\((.*)\\))*(\\[(.*)\\])*","g"),e=d.match(a),f=a;e;){var e=[d.Kg(1)],
g=ae.Bb;if(null!=(null!=t[e[0]]?g.H(e[0]):g.h[e[0]])){var g=d.Kg(0),h=ae.Bb;a=wa.replace(a,g,null!=t[e[0]]?h.H(e[0]):h.h[e[0]]);g=ae.Bb;e=null!=t[e[0]]?g.H(e[0]):g.h[e[0]];if(null!=d.Kg(2))for(g=d.Kg(3).split(","),h=0;h<g.length;)e=e.replace(new RegExp(g[h],"g"),g[h+1]),h+=2;if(null!=d.Kg(4))if(g=RegExp("\\{X\\}","g"),h=d.Kg(5),-1!=h.indexOf("..")){var k=h.split(".."),l=na.$a(k[0]),m=na.$a(k[1]),h=Q.substr(e,0,null),e="";if(null==m||isNaN(m))m=X.Fa(this.SF,k[1])|0;k=l;for(m+=1;k<m;)l=k++,e+=h.replace(g,
l+"")+"\n"}else e=e.replace(g,h);f=wa.replace(f,d.Kg(0),e)}else{ga.Lj(p.Bb+"ShadersInclude/"+e[0]+".fx",function(d){return function(e){var f=ae.Bb;null!=t[d[0]]?f.C(d[0],e):f.h[d[0]]=e;c.Ft(a,b)}}(e));return}e=d.match(a)}b(f)},Ry:function(a){-1==a.indexOf("precision highp float")?a=this.c.T.jv?"precision highp float;\n"+a:"precision mediump float;\n"+a:this.c.T.jv||(a=wa.replace(a,"precision highp float","precision mediump float"));return a},Dt:function(a,b,c,d,e){try{var f=this.c;a=this.Ry(a);b=
this.Ry(b);for(var g=this.zd=f.cA(a,b,d),h=this.TG,k=new W,l=0;l<h.length;){var m=h[l];++l;var n=f.b.getUniformLocation(g,m);null!=n&&(null!=t[m]?k.C(m,n):k.h[m]=n)}this.u=k;for(var p=this.zd,g=[],h=0,u=c.length;h<u;){var q=h++;try{g.push(f.b.getAttribLocation(p,c[q]))}catch(r){r instanceof ja&&(r=r.Lo),console.log("getAttributes() -> ERROR: "+na.Pb(r)),g.push(-1)}}this.sa=g;for(p=0;p<this.Rd.length;)null==this.u.get(this.Rd[p])&&(this.Rd.splice(p,1),--p),++p;var v=this.zd;f.vc!=v&&(f.b.useProgram(v),
f.vc=v);for(var z=this.Rd,v=0,A=z.length;v<A;){var B=v++,F=this.u.get(z[B]);f.b.uniform1i(F,B)}f.Ff=null;this.Nc=!0;null!=this.Fr&&this.Fr(this)}catch(r){r instanceof ja&&(r=r.Lo),-1!=r.indexOf("highp")?(a=wa.replace(a,"precision highp float","precision mediump float"),b=wa.replace(b,"precision highp float","precision mediump float"),this.Dt(a,b,c,d,e)):null!=e&&e.RA()?(d=e.reduce(d),this.Dt(a,b,c,d,e)):(console.log("Unable to compile effect: "+na.Pb(this.name)),console.log("Defines: "+d),console.log("Error: "+
na.Pb(r)),this.Is=r,null!=this.Mh&&this.Mh(this,this.Is))}},Tf:function(){return""==this.Is},Hb:function(a,b){this.c.Hb(this.Rd.indexOf(a),this.u.get(a),b)},Wa:function(a,b){var c=!1,d=this.yz,d=null!=t[a]?d.H(a):d.h[a];null!=d&&v.D(d,r)||(c=!0,d=new r);for(var e=d.a,f=b.a,g=0;16>g;){var h=g++;e[h]!=f[h]&&(e[h]=f[h],c=!0)}e=this.yz;null!=t[a]?e.C(a,d):e.h[a]=d;return c},Jb:function(a,b,c){var d=this.Qa,d=null!=t[a]?d.H(a):d.h[a];if(null==d)return d=[b,c],b=this.Qa,null!=t[a]?b.C(a,d):b.h[a]=d,!0;
a=!1;d[0]!=b&&(d[0]=b,a=!0);d[1]!=c&&(d[1]=c,a=!0);return a},xe:function(a,b,c,d){var e=this.Qa,e=null!=t[a]?e.H(a):e.h[a];if(null==e)return e=[b,c,d],b=this.Qa,null!=t[a]?b.C(a,e):b.h[a]=e,!0;a=!1;e[0]!=b&&(e[0]=b,a=!0);e[1]!=c&&(e[1]=c,a=!0);e[2]!=d&&(e[2]=d,a=!0);return a},Oa:function(a,b,c,d,e){var f=this.Qa,f=null!=t[a]?f.H(a):f.h[a];if(null==f)return f=[b,c,d,e],b=this.Qa,null!=t[a]?b.C(a,f):b.h[a]=f,!0;a=!1;f[0]!=b&&(f[0]=b,a=!0);f[1]!=c&&(f[1]=c,a=!0);f[2]!=d&&(f[2]=d,a=!0);f[3]!=e&&(f[3]=
e,a=!0);return a},l:pf,ha:{Tf:"get_isSupported"}};var Ke=J.BABYLON.EffectFallbacks=function(){this.Im=-1;this.tk=32;this.Mc=[]};q["com.babylonhx.materials.EffectFallbacks"]=Ke;Ke.i=["com","babylonhx","materials","EffectFallbacks"];Ke.prototype={Oc:function(a,b){null==this.Mc[a]&&(a<this.tk&&(this.tk=a),a>this.Im&&(this.Im=a),this.Mc[a]=[]);this.Mc[a].push(b+"\n")},eu:function(a,b){this.gG=a;this.ta=b;a>this.Im&&(this.Im=a)},reduce:function(a){for(var b=this.Mc[this.tk],c=0,d=b.length;c<d;){var e=
c++;a=wa.replace(a,"#define "+b[e]+"\n","")}null!=this.ta&&this.tk==this.gG&&(this.ta.nf=!1,a=wa.replace(a,"#define NUM_BONE_INFLUENCERS "+this.ta.Me,"#define NUM_BONE_INFLUENCERS 0"),console.log("Falling back to CPU skinning for "+this.ta.name));this.tk++;return a},RA:function(){return this.tk<=this.Im},l:Ke,ha:{RA:"get_isMoreFallbacks"}};var ae=J.BABYLON.IncludesShadersStore=function(){};q["com.babylonhx.materials.IncludesShadersStore"]=ae;ae.i=["com","babylonhx","materials","IncludesShadersStore"];
q["com.babylonhx.materials.MaterialDefines"]=Fc;Fc.i=["com","babylonhx","materials","MaterialDefines"];Fc.prototype={isEqual:function(a){if(this.ba.length!=a.ba.length)return!1;for(var b=0,c=this.Ac.length;b<c;){var d=b++;if(this.Ac[d]!=a.Ac[d])return!1}b=0;for(c=this.ic.length;b<c;)if(d=b++,this.ic[d]!=a.ic[d])return!1;b=0;for(c=this.Si.length;b<c;)if(d=b++,this.Si[d]!=a.Si[d])return!1;b=0;for(c=this.zi.length;b<c;)if(d=b++,this.zi[d]!=a.zi[d])return!1;b=0;for(c=this.Fi.length;b<c;)if(d=b++,this.Fi[d]!=
a.Fi[d])return!1;b=0;for(c=this.Xi.length;b<c;)if(d=b++,this.Xi[d]!=a.Xi[d])return!1;b=0;for(c=this.Sh.length;b<c;)if(d=b++,this.Sh[d]!=a.Sh[d])return!1;b=0;for(c=this.Th.length;b<c;)if(d=b++,this.Th[d]!=a.Th[d])return!1;b=0;for(c=this.Rh.length;b<c;)if(d=b++,this.Rh[d]!=a.Rh[d])return!1;return!0},Lq:function(a){if(this.ba.length!=a.ba.length)for(var b=0,c=this.ba.length;b<c;){var d=b++;a.ba[d]=this.ba[d]}b=0;for(c=this.Ac.length;b<c;)d=b++,a.Ac[d]=this.Ac[d];a.ic=this.ic.slice();a.Si=this.Si.slice();
a.zi=this.zi.slice();a.Fi=this.Fi.slice();a.Xi=this.Xi.slice();a.Sh=this.Sh.slice();a.Th=this.Th.slice();a.Rh=this.Rh.slice()},reset:function(){for(var a=0,b=this.Ac.length;a<b;){var c=a++;this.Ac[c]=!1}this.ic=[];this.Si=[];this.zi=[];this.Fi=[];this.Xi=[];this.Sh=[];this.Th=[];this.Rh=[]},toString:function(){this.Jc="";for(var a=0,b=this.Ac.length;a<b;){var c=a++;1==this.Ac[c]&&(this.Jc+="#define "+this.ba[c]+"\n")}a=0;for(b=this.ic.length;a<b;)c=a++,this.Jc+="#define LIGHT"+c+"\n";a=0;for(b=this.Si.length;a<
b;)c=a++,this.Jc+="#define POINTLIGHT"+c+"\n";a=0;for(b=this.zi.length;a<b;)c=a++,this.Jc+="#define DIRLIGHT"+c+"\n";a=0;for(b=this.Fi.length;a<b;)c=a++,this.Jc+="#define HEMILIGHT"+c+"\n";a=0;for(b=this.Xi.length;a<b;)c=a++,this.Jc+="#define SPOTLIGHT"+c+"\n";a=0;for(b=this.Sh.length;a<b;)c=a++,this.Jc+="#define SHADOW"+c+"\n";a=0;for(b=this.Th.length;a<b;)c=a++,this.Jc+="#define SHADOWVSM"+c+"\n";a=0;for(b=this.Rh.length;a<b;)c=a++,this.Jc+="#define SHADOWPCF"+c+"\n";return this.Jc},l:Fc};q["com.babylonhx.materials.MaterialHelper"]=
gc;gc.i=["com","babylonhx","materials","MaterialHelper"];gc.IE=function(a,b,c,d){var e=16,f=53,g=52;null==g&&(g=-1);null==f&&(f=-1);null==e&&(e=-1);for(var h=0,k=!1,l=!1,m=!1,n=0,p=a.ic.length;n<p;){var u=n++,u=a.ic[u];if(u.isEnabled()){if(0<u.hm.length){for(var q=0,r=u.hm.length;q<r;){var t=q++,t=a.Vu(u.hm[t]);null!=t&&u.Dj.push(t)}u.hm=[]}if(0<u.om.length){q=0;for(r=u.om.length;q<r;)t=q++,t=a.Vu(u.om[t]),null!=t&&u.Jj.push(t);u.om=[]}if(null==b||(0<u.Jj.length&&-1==u.Jj.indexOf(b)?0:0<u.Dj.length&&
-1!=u.Dj.indexOf(b)?0:0!=u.Xn&&0==(u.Xn&b.tb)?0:0==u.Mn||0==(u.Mn&b.tb))){k=!0;c.ic[h]=!0;switch(u.fv()){case "DIRLIGHT":c.zi[h]=!0;break;case "HEMILIGHT":c.Fi[h]=!0;break;case "POINTLIGHT":c.Si[h]=!0;break;case "SPOTLIGHT":c.Xi[h]=!0}q=u.as;(0!=q.r||0!=q.v||0!=q.m)&&-1<e&&(c.Ac[e]=!0);if(a.Yr&&(q=u.fr(),null!=b&&b.Gj()&&null!=q)){c.Sh[h]=!0;c.Ac[f]=!0;if(q.gB()||q.dB())c.Th[h]=!0;q.fB()&&(c.Rh[h]=!0);l=!0}0!=u.sv&&(m=!0,c.yJ[h]=!0,2==u.sv&&(c.zJ[h]=!0));++h;if(h==d)break}}}a=a.c.T;l&&1==a.sD&&1==
a.tD&&1==a.LP&&-1!=g&&(c.Ac[g]=!0);m&&(c.qE=!0);return k};gc.LE=function(a,b,c,d){null==d&&(d=4);for(var e=0;e<d;){var f=e++;if(!c[f])break;a.push("vLightData"+f);a.push("vLightDiffuse"+f);a.push("vLightSpecular"+f);a.push("vLightDirection"+f);a.push("vLightGround"+f);a.push("lightMatrix"+f);a.push("shadowsInfo"+f);b.push("shadowSampler"+f)}};gc.DE=function(a,b,c){null==c&&(c=4);for(var d=0;d<c;){var e=d++;a.ic[e]&&(0<e&&b.Oc(e,"LIGHT"+e),a.Sh[e]&&b.Oc(0,"SHADOW"+e),a.Rh[e]&&b.Oc(0,"SHADOWPCF"+e),
a.Th[e]&&b.Oc(0,"SHADOWVSM"+e))}};gc.HE=function(a,b){b[28]&&(a.push("world0"),a.push("world1"),a.push("world2"),a.push("world3"))};gc.gE=function(a,b,c,d,e,f){var g=a.fr();if(c.Gj()&&null!=g){if(!v.g(a,mc).Jv())c="lightMatrix"+d,a=g.RI(),e.Wa(c,a)&&(b=e.c,c=e.u.get(c),b.b.uniformMatrix4fv(c,!1,a.a));else if(!f&&(f=!0,a=b.L.Tb,b=b.L.Fb,e.Jb("depthValues",a,b))){c=e.c;var h=e.u.get("depthValues");c.b.uniform2f(h,a,b)}e.Hb("shadowSampler"+d,g.OI());b="shadowsInfo"+d;d=g.xF;a=g.yH/g.Ok.Yu().width;g=
g.LA();e.xe(b,d,a,g)&&(c=e.c,e=e.u.get(b),c.b.uniform3f(e,d,a,g))}return f};gc.iE=function(a,b,c,d,e){null==e&&(e=4);for(var f=0,g=!1,h=0,k=a.ic.length;h<k;){var l=h++,l=a.ic[l];if(l.isEnabled()&&(null==b||(0<l.Jj.length&&-1==l.Jj.indexOf(b)?0:0<l.Dj.length&&-1!=l.Dj.indexOf(b)?0:0!=l.Xn&&0==(l.Xn&b.tb)?0:0==l.Mn||0==(l.Mn&b.tb)))){switch(l.fv()){case "DIRLIGHT":l.Yi(c,"vLightData"+f);break;case "HEMILIGHT":l.Yi(c,"vLightData"+f,"vLightGround"+f);break;case "POINTLIGHT":l.Yi(c,"vLightData"+f);break;
case "SPOTLIGHT":l.Yi(c,"vLightData"+f,"vLightDirection"+f)}var m=l.Gu,n=l.qr,p=ba.Bl[0];p.r=m.r*n;p.v=m.v*n;p.m=m.m*n;var q="vLightDiffuse"+f,m=ba.Bl[0],n=l.Wv;c.Oa(q,m.r,m.v,m.m,n)&&(p=c.c,q=c.u.get(q),p.b.uniform4f(q,m.r,m.v,m.m,n));d&&(m=l.as,n=l.qr,p=ba.Bl[1],p.r=m.r*n,p.v=m.v*n,p.m=m.m*n,p="vLightSpecular"+f,m=ba.Bl[1],c.xe(p,m.r,m.v,m.m)&&(n=c.c,p=c.u.get(p),n.b.uniform3f(p,m.r,m.v,m.m)));a.Yr&&(g=gc.gE(l,a,b,f,c,g));++f;if(f==e)break}}};var rc=J.BABYLON.ShaderMaterial=function(a,b,c,d){this.wx=
new r;this.zz=new W;this.Ay=new W;this.By=new W;this.Gm=new W;this.rn=new W;this.qn=new W;this.Zg=new W;this.em=new W;this.im=new W;this.ji=new W;this.ob=new W;sa.call(this,a,b);this.FG=c;d.Oi=null!=d.Oi&&d.Oi;d.Yf=null!=d.Yf&&d.Yf;d.attributes=null!=d.attributes?d.attributes:["position","normal","uv"];d.wb=null!=d.wb?d.wb:["worldViewProjection"];d.Zj=null!=d.Zj?d.Zj:[];d.Ac=null!=d.Ac?d.Ac:[];this.Da=d};q["com.babylonhx.materials.ShaderMaterial"]=rc;rc.i=["com","babylonhx","materials","ShaderMaterial"];
rc.ab=function(a,b){return new rc(a.name,b,a.IP,a.options)};rc.U=sa;rc.prototype=F(sa.prototype,{Oi:function(){return this.Da.Oi},Yf:function(){return this.Da.Yf},Fs:function(a,b){return null==b?!0:!1},pa:function(a,b){null==b&&(b=!1);var c=this.f,d=c.c;if(!this.tu&&this.Pa==c.Pa&&this.Fs(c,a,b))return!0;var e=[],f=new Ke;b&&e.push("#define INSTANCES");for(var g=0,h=this.Da.Ac.length;g<h;){var k=g++;e.push(this.Da.Ac[k])}null!=a&&a.Hg()&&a.nf&&(e.push("#define NUM_BONE_INFLUENCERS "+a.Me),e.push("#define BonesPerMesh "+
(a.gd().Ie.length+1)),f.eu(0,a));d.Bs&&e.push("#define ALPHATEST");g=this.s;this.s=d.Aj(this.FG,this.Da.attributes,this.Da.wb,this.Da.Zj,e.join("\n"),f,this.Fr,this.Mh);if(!this.s.Nc)return!1;g!=this.s&&(c.$e=null);this.Pa=c.Pa;return!0},zn:function(a){var b=this.f;if(-1!=this.Da.wb.indexOf("world")){var c=this.s;if(c.Wa("world",a)){var d=c.c,c=c.u.get("world");d.b.uniformMatrix4fv(c,!1,a.a)}}if(-1!=this.Da.wb.indexOf("worldView")){a.qa(b.Aa,this.wx.a,0);var e=this.s,d=this.wx;e.Wa("worldView",d)&&
(c=e.c,e=e.u.get("worldView"),c.b.uniformMatrix4fv(e,!1,d.a))}-1!=this.Da.wb.indexOf("worldViewProjection")&&(d=this.s,c=b.sb,b=new r,a.qa(c,b.a,0),d.Wa("worldViewProjection",b)&&(a=d.c,d=d.u.get("worldViewProjection"),a.b.uniformMatrix4fv(d,!1,b.a)))},bind:function(a,b){this.zn(a);if(this.f.$e!=this){if(-1!=this.Da.wb.indexOf("view")){var c=this.s,d=this.f.Aa;if(c.Wa("view",d)){var e=c.c,c=c.u.get("view");e.b.uniformMatrix4fv(c,!1,d.a)}}-1!=this.Da.wb.indexOf("projection")&&(c=this.s,d=this.f.Va,
c.Wa("projection",d)&&(e=c.c,c=c.u.get("projection"),e.b.uniformMatrix4fv(c,!1,d.a)));-1!=this.Da.wb.indexOf("viewProjection")&&(c=this.s,d=this.f.sb,c.Wa("viewProjection",d)&&(e=c.c,c=c.u.get("viewProjection"),e.b.uniformMatrix4fv(c,!1,d.a)));d=this.s;null!=b&&b.Hg()&&b.nf&&(e=b.gd(),e.Pi&&null!=b.ee?e=b.ee:(null==e.Fe&&e.Hl(),e=e.Fe),null!=e&&(d.Qa.set("mBones",null),c=d.c,d=d.u.get("mBones"),c.b.uniformMatrix4fv(d,!1,e)));for(d=this.ob.keys();d.Ca();)e=d.next(),c=this.ob,this.s.Hb(e,null!=t[e]?
c.H(e):c.h[e]);for(d=this.ji.keys();d.Ca();){var e=d.next(),c=this.s,f=this.ji,f=null!=t[e]?f.H(e):f.h[e],g=c.Qa.get(e);if(null==g||g[0]!=f)c.Qa.set(e,[f]),g=c.c,e=c.u.get(e),g.b.uniform1f(e,f)}for(d=this.im.keys();d.Ca();)e=d.next(),c=this.s,f=this.im,f=null!=t[e]?f.H(e):f.h[e],c.Qa.set(e,null),g=c.c,e=c.u.get(e),g.b.uniform1fv(e,new ib(f));for(d=this.em.keys();d.Ca();)e=d.next(),c=this.s,f=this.em,f=null!=t[e]?f.H(e):f.h[e],c.xe(e,f.r,f.v,f.m)&&(g=c.c,e=c.u.get(e),g.b.uniform3f(e,f.r,f.v,f.m));
for(d=this.Zg.keys();d.Ca();){var e=d.next(),c=this.Zg,h=null!=t[e]?c.H(e):c.h[e],c=this.s,f=h.r,g=h.v,k=h.m,h=h.W;c.Oa(e,f,g,k,h)&&c.c.Ub(c.u.get(e),f,g,k,h)}for(d=this.qn.keys();d.Ca();)e=d.next(),c=this.s,f=this.qn,f=null!=t[e]?f.H(e):f.h[e],c.Jb(e,f.x,f.y)&&(g=c.c,e=c.u.get(e),g.b.uniform2f(e,f.x,f.y));for(d=this.rn.keys();d.Ca();)e=d.next(),c=this.s,f=this.rn,f=null!=t[e]?f.H(e):f.h[e],c.xe(e,f.x,f.y,f.z)&&(g=c.c,e=c.u.get(e),g.b.uniform3f(e,f.x,f.y,f.z));for(d=this.Gm.keys();d.Ca();)e=d.next(),
c=this.s,f=this.Gm,f=null!=t[e]?f.H(e):f.h[e],c.Wa(e,f)&&(g=c.c,e=c.u.get(e),g.b.uniformMatrix4fv(e,!1,f.a));for(d=this.By.keys();d.Ca();)e=d.next(),c=this.s,f=this.By,f=null!=t[e]?f.H(e):f.h[e],c.Qa.set(e,null),g=c.c,e=c.u.get(e),g.b.uniformMatrix3fv(e,!1,f);for(d=this.Ay.keys();d.Ca();)e=d.next(),c=this.s,f=this.Ay,f=null!=t[e]?f.H(e):f.h[e],c.Qa.set(e,null),g=c.c,e=c.u.get(e),g.b.uniformMatrix2fv(e,!1,f);for(d=this.zz.keys();d.Ca();)e=d.next(),c=this.s,f=this.zz,f=null!=t[e]?f.H(e):f.h[e],c.Qa.set(e,
null),g=c.c,e=c.u.get(e),0==f.length%3&&g.b.uniform3fv(e,new ib(f))}sa.prototype.bind.call(this,a,null)},dispose:function(a,b){null==b&&(b=!0);null==a&&(a=!1);if(b)for(var c=this.ob.keys();c.Ca();){var d=c.next(),e=this.ob;(null!=t[d]?e.H(d):e.h[d]).dispose()}this.ob=null;sa.prototype.dispose.call(this,a,b)},l:rc});var Db=J.BABYLON.ShadersStore=function(){};q["com.babylonhx.materials.ShadersStore"]=Db;Db.i=["com","babylonhx","materials","ShadersStore"];q["com.babylonhx.materials.StandardMaterialDefines"]=
id;id.i=["com","babylonhx","materials","StandardMaterialDefines"];id.U=Fc;id.prototype=F(Fc.prototype,{Lq:function(a){Fc.prototype.Lq.call(this,a);a.Zi=this.Zi;a.ei=this.ei},reset:function(){Fc.prototype.reset.call(this);this.ei=this.Zi=0},toString:function(){var a=Fc.prototype.toString.call(this),a=a+("#define BonesPerMesh "+this.Zi+"\n");return a+="#define NUM_BONE_INFLUENCERS "+this.ei+"\n"},l:id});q["com.babylonhx.materials.textures.ColorGradingTexture"]=Bc;Bc.i=["com","babylonhx","materials",
"textures","ColorGradingTexture"];Bc.Fo=function(a,b){b.Hb("cameraColorGrading2DSampler",a);var c=a.level,d=a.Yu().height,e=d-1,f=1/d;b.Oa("vCameraColorGradingInfos",c,d,e,f)&&b.c.Ub(b.u.get("vCameraColorGradingInfos"),c,d,e,f);var g=f/d,c=e*g,d=e/d,e=.5*g,f=.5*f;b.Oa("vCameraColorGradingScaleOffset",c,d,e,f)&&b.c.Ub(b.u.get("vCameraColorGradingScaleOffset"),c,d,e,f)};Bc.KE=function(a,b){a.push("vCameraColorGradingInfos");a.push("vCameraColorGradingScaleOffset");b.push("cameraColorGrading2DSampler")};
Bc.U=hb;Bc.prototype=F(hb.prototype,{Le:function(){return this.tq},AJ:function(){var a=this,b=this.f.c.Pq(null,1,1,5,!1,!1,2);this.fa=b;ga.Lj(this.url,function(c){for(var d=null,e=[],f,g=c.split("\n"),h=c=0,k=0,l=0,m=0,n=0,q=g.length;n<q;)if(f=n++,f=g[f],Bc.DI.match(f)&&0!=f.indexOf("#")){var u=f.split(" ");if(0==c)c=u.length,d=new Ka(c*c*c*4);else if(0!=c){f=Math.max(na.$a(u[0]),0);var r=Math.max(na.$a(u[1]),0),u=Math.max(na.$a(u[2]),0),m=Math.max(f,m),m=Math.max(r,m),m=Math.max(u,m),t=4*(h+l*c+
k*c*c);e[t]=f;e[t+1]=r;e[t+2]=u;e[t+3]=0;++l;0==l%c&&(++k,l=0,0==k%c&&(++h,k=0))}}g=0;for(h=e.length;g<h;)k=g++,d[k]=e[k]/m*255;a.f.c.AM(b,c*c,c);e=a.f.c;c=e.$x(5);m=b.data;e.O[e.I]!=m&&(e.b.bindTexture(3553,m),e.O[e.I]=m);0!=b.La%4&&e.b.pixelStorei(3317,1);e.b.texImage2D(3553,0,c,b.La,b.Ua,0,c,5121,d);d=p.ya(b.kd,b.qc);e.b.texParameteri(3553,10240,d.Kh);e.b.texParameteri(3553,10241,d.min);b.qc&&e.b.generateMipmap(3553);null!=e.O[e.I]&&(e.b.bindTexture(3553,null),e.O[e.I]=null);e.Nh();b.pa=!0});return this.fa},
DJ:function(){""!=this.url&&this.url.toLowerCase().indexOf(".3dl")==this.url.length-4&&this.AJ()},Sq:function(){4==this.Ma&&(this.Ma=1,this.fa=this.Pp(this.url,!0),null==this.fa&&this.DJ())},l:Bc});var Ad=J.BABYLON.RawTexture=function(a,b,c,d,e,f,g,h){null==h&&(h=3);null==g&&(g=!1);null==f&&(f=!0);ma.call(this,null,e,!f,g);this.format=d;this.fa=e.c.Pq(a,b,c,d,f,g,h);this.lg=this.kg=0};q["com.babylonhx.materials.textures.RawTexture"]=Ad;Ad.i=["com","babylonhx","materials","textures","RawTexture"];
Ad.D=function(a,b,c,d){var e=!1,f=!1,g=2;null==g&&(g=3);null==f&&(f=!1);null==e&&(e=!0);return new Ad(a,b,c,5,d,e,f,g)};Ad.U=ma;Ad.prototype=F(ma.prototype,{l:Ad});q["com.babylonhx.materials.textures.RefractionTexture"]=je;je.i=["com","babylonhx","materials","textures","RefractionTexture"];je.U=nb;je.prototype=F(nb.prototype,{l:je});var Ud=J.BABYLON.VideoTexture=function(){this.mx=!0};q["com.babylonhx.materials.textures.VideoTexture"]=Ud;Ud.i=["com","babylonhx","materials","textures","VideoTexture"];
Ud.U=ma;Ud.prototype=F(ma.prototype,{update:function(){this.mx&&(this.mx=!1,this.video.play());var a=1E3*((new Date).getTime()/1E3-ga.ce)|0;if(15>a-this.Yp||4!=this.video.readyState)return!1;this.Yp=a;this.f.c.FD(this.fa,this.video,this.it);return!0},l:Ud});var ab=J.BABYLON.WebGLTexture=function(a,b){this.yb=[];this.Cr=!0;this.url=a;this.data=b;this.rc=this.qc=!1;this.kd=3;this.Db=null;this.qk=this.pk=this.Ua=this.La=1;this.yx=this.xx=-1;this.Ep=this.jm=null;this.yp=-1;this.Cr=this.pa=this.ry=!1;
this.ia=0};q["com.babylonhx.materials.textures.WebGLTexture"]=ab;ab.i=["com","babylonhx","materials","textures","WebGLTexture"];ab.xb=[$a];ab.prototype={l:ab};var Gf=J.BABYLON.ProceduralTexture=function(){this.Xs=!1;this.Gm=new W;this.rn=new W;this.qn=new W;this.Zg=new W;this.em=new W;this.im=new W;this.ji=new W;this.ob=new W;this.Rd=[];this.u=[];this.ua=new W;this.cC=null;this.Jt=1;this.cf=-1;this.isEnabled=!0};q["com.babylonhx.materials.textures.procedurals.ProceduralTexture"]=Gf;Gf.i="com babylonhx materials textures procedurals ProceduralTexture".split(" ");
Gf.U=ma;Gf.prototype=F(ma.prototype,{pa:function(){var a=this,b=this.f.c,c=null;if(null==this.$s)return!1;if(this.Xs)return!0;null!=this.$s.Zq?c={vertex:"procedural",Zq:this.$s.Zq}:c={vertex:"procedural",fragment:this.$s};this.s=b.Aj(c,["position"],this.u,this.Rd,"",null,null,function(){a.BC();null!=a.HF&&(a.fa=a.HF.fa,a.fa.ia++);a.Xs=!0});return this.s.Nc},Tn:function(){return this.Jt},qh:function(){if(!this.isEnabled||!this.pa()||null==this.fa||this.Xs)return!1;if(-1==this.cf||this.Tn()==this.cf)return this.cf=
1,!0;this.cf++;return!1},hb:function(){var a=this.f,b=a.c;b.bindFramebuffer(this.fa);var c=a.clearColor;b.G.apply(b.b);b.rb.apply(b.b);b.J.apply(b.b);var d=0;v.D(c,ca)?b.b.clearColor(c.r,c.v,c.m,c.W):b.b.clearColor(c.r,c.v,c.m,1);d|=16384;b.b.clearDepth(1);b.b.clear(d|256);c=this.s;d=c.zd;b.vc!=d&&(b.b.useProgram(d),b.vc=d);b.Ff=c;null!=c.Tc&&c.Tc(c);c=b.Dg?1029:1028;0==b.G.Sf()&&b.G.Fg()==c||b.G.fg(!1);b.G.Qh(0);for(c=this.ob.keys();c.Ca();){var d=c.next(),e=this.ob;this.s.Hb(d,null!=t[d]?e.H(d):
e.h[d])}for(c=this.ji.keys();c.Ca();){var d=c.next(),e=this.s,f=this.ji,f=null!=t[d]?f.H(d):f.h[d],g=e.Qa.get(d);if(null==g||g[0]!=f)e.Qa.set(d,[f]),g=e.c,d=e.u.get(d),g.b.uniform1f(d,f)}for(c=this.im.keys();c.Ca();)d=c.next(),e=this.s,f=this.im,f=null!=t[d]?f.H(d):f.h[d],e.Qa.set(d,null),g=e.c,d=e.u.get(d),g.b.uniform1fv(d,new ib(f));for(c=this.em.keys();c.Ca();)d=c.next(),e=this.s,f=this.em,f=null!=t[d]?f.H(d):f.h[d],e.xe(d,f.r,f.v,f.m)&&(g=e.c,d=e.u.get(d),g.b.uniform3f(d,f.r,f.v,f.m));for(c=this.Zg.keys();c.Ca();){var d=
c.next(),e=this.Zg,h=null!=t[d]?e.H(d):e.h[d],e=this.s,f=h.r,g=h.v,k=h.m,h=h.W;e.Oa(d,f,g,k,h)&&e.c.Ub(e.u.get(d),f,g,k,h)}for(c=this.qn.keys();c.Ca();)d=c.next(),e=this.s,f=this.qn,f=null!=t[d]?f.H(d):f.h[d],e.Jb(d,f.x,f.y)&&(g=e.c,d=e.u.get(d),g.b.uniform2f(d,f.x,f.y));for(c=this.rn.keys();c.Ca();)d=c.next(),e=this.s,f=this.rn,f=null!=t[d]?f.H(d):f.h[d],e.xe(d,f.x,f.y,f.z)&&(g=e.c,d=e.u.get(d),g.b.uniform3f(d,f.x,f.y,f.z));for(c=this.Gm.keys();c.Ca();)d=c.next(),e=this.s,f=this.Gm,f=null!=t[d]?
f.H(d):f.h[d],e.Wa(d,f)&&(g=e.c,d=e.u.get(d),g.b.uniformMatrix4fv(d,!1,f.a));c=this.ua;d=this.wa;e=this.s;if(b.qb!=c||b.Qb!=e)for(b.qb=c,b.Qb=e,p.sa=e.we,f=0,g=p.sa.length;f<g;)k=f++,p.g=e.sa[k],0<=p.g&&(k=p.sa[k],p.F=null!=t[k]?c.H(k):c.h[k],null==p.F?b.na[p.g]&&(b.b.disableVertexAttribArray(p.g),b.na[p.g]=!1):(b.na[p.g]||(b.b.enableVertexAttribArray(p.g),b.na[p.g]=!0),k=p.F.R.R,b.vertexAttribPointer(k,p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(b.T.Kc.vertexAttribDivisorANGLE(p.g,1),b.ad.push(p.g),
b.td.push(k))));null!=d&&b.kb!=d&&(b.kb=d,b.V.get(34963)!=d&&(b.b.bindBuffer(34963,null==d?null:d.buffer),b.V.set(34963,null==d?null:d)),b.Ud=d.Sc);if(this.rc)for(c=0;6>c;){d=c++;b.bindFramebuffer(this.fa,d);e=this.s;f=e.Qa.get("face");if(null==f||f[0]!=d)e.Qa.set("face",[d]),f=e.c,e=e.u.get("face"),f.b.uniform1f(e,d);e=a.clearColor;b.G.apply(b.b);b.rb.apply(b.b);b.J.apply(b.b);f=0;v.D(e,ca)?b.b.clearColor(e.r,e.v,e.m,e.W):b.b.clearColor(e.r,e.v,e.m,1);f|=16384;b.b.clearDepth(1);f|=256;b.b.clearStencil(0);
f|=1024;b.b.clear(f);b.Ic(!0,0,6);5==d&&b.DA(this.fa)}else b.bindFramebuffer(this.fa),a=a.clearColor,b.G.apply(b.b),b.rb.apply(b.b),b.J.apply(b.b),c=0,v.D(a,ca)?b.b.clearColor(a.r,a.v,a.m,a.W):b.b.clearColor(a.r,a.v,a.m,1),c|=16384,b.b.clearDepth(1),c|=256,b.b.clearStencil(0),b.b.clear(c|1024),b.Ic(!0,0,6);a=this.fa;b.pg=null;a.qc&&!this.rc&&(a=a.data,b.O[b.I]!=a&&(b.b.bindTexture(3553,a),b.O[b.I]=a),b.b.generateMipmap(3553),null!=b.O[b.I]&&(b.b.bindTexture(3553,null),b.O[b.I]=null));null!=b.uc&&
(b.b.bindFramebuffer(36160,null),b.uc=null);null!=this.cC&&this.cC()},dispose:function(){var a=this.f.hq.indexOf(this);0<=a&&this.f.hq.splice(a,1);a=this.ua;a=null!=t.position?a.H("position"):a.h.position;null!=a&&(a.Gf&&a.R.dispose(),a=this.ua,null!=t.position?a.C("position",null):a.h.position=null);if(null!=this.wa){var a=this.f.c,b=this.wa;b.ia--;0==b.ia?(a.b.deleteBuffer(b.buffer),a=!0):a=!1}else a=!1;a&&(this.wa=null);ma.prototype.dispose.call(this)},l:Gf,ha:{Tn:"get_refreshRate"}});var gb=J.BABYLON.Axis=
function(){};q["com.babylonhx.math.Axis"]=gb;gb.i=["com","babylonhx","math","Axis"];q["com.babylonhx.math.ISize"]=pg;pg.i=["com","babylonhx","math","ISize"];var Le=J.BABYLON.Path3D=function(a,b,c){null==c&&(c=!1);this.oj=!1;this.rk=[];this.ri=[];this.xg=[];this.fm=[];this.bd=[];for(var d=0,e=a.length;d<e;){var f=d++,g=a[f];this.bd[f]=new n(g.x,g.y,g.z)}this.oj=c;this.Jx(b)};q["com.babylonhx.math.Path3D"]=Le;Le.i=["com","babylonhx","math","Path3D"];Le.prototype={update:function(a,b){for(var c=0,d=
a.length;c<d;){var e=c++;this.bd[e].x=a[e].x;this.bd[e].y=a[e].y;this.bd[e].z=a[e].z}this.Jx(b);return this},Jx:function(a){var b=this.bd.length;this.xg[0]=this.Yx(0);this.oj||this.xg[0].normalize();var c=this.bd[b-1],d=this.bd[b-2];this.xg[b-1]=new n(c.x-d.x,c.y-d.y,c.z-d.z);this.oj||this.xg[b-1].normalize();c=this.xg[0];a=this.jG(this.bd[0],c,a);this.ri[0]=a;this.oj||this.ri[0].normalize();a=this.rk;var d=this.ri[0],e=new n(0,0,0);e.x=c.y*d.z-c.z*d.y;e.y=c.z*d.x-c.x*d.z;e.z=c.x*d.y-c.y*d.x;a[0]=
e;this.oj||this.rk[0].normalize();this.fm[0]=0;new n(0,0,0);new n(0,0,0);new n(0,0,0);new n(0,0,0);new n(0,0,0);for(c=1;c<b;){a=c++;d=this.OF(a);a<b-1&&(e=this.Yx(a),this.xg[a]=new n(d.x+e.x,d.y+e.y,d.z+e.z),this.xg[a].normalize());this.fm[a]=this.fm[a-1]+Math.sqrt(d.x*d.x+d.y*d.y+d.z*d.z);var d=this.xg[a],e=this.rk[a-1],f=this.ri,g=new n(0,0,0);g.x=e.y*d.z-e.z*d.y;g.y=e.z*d.x-e.x*d.z;g.z=e.x*d.y-e.y*d.x;f[a]=g;this.oj||this.ri[a].normalize();e=this.rk;f=this.ri[a];g=new n(0,0,0);g.x=d.y*f.z-d.z*
f.y;g.y=d.z*f.x-d.x*f.z;g.z=d.x*f.y-d.y*f.x;e[a]=g;this.oj||this.rk[a].normalize()}},Yx:function(a){for(var b=1,c=this.bd[a+b],d=this.bd[a],c=new n(c.x-d.x,c.y-d.y,c.z-d.z);0==Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z)&&a+b+1<this.bd.length;)++b,c=this.bd[a+b],d=this.bd[a],c=new n(c.x-d.x,c.y-d.y,c.z-d.z);return c},OF:function(a){for(var b=1,c=this.bd[a],d=this.bd[a-b],c=new n(c.x-d.x,c.y-d.y,c.z-d.z);0==Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z)&&a>b+1;)++b,c=this.bd[a],d=this.bd[a-b],c=new n(c.x-d.x,c.y-d.y,c.z-
d.z);return c},jG:function(a,b,c){new n(0,0,0);null==c?(c=new n(0,0,0),a=b.y-1,-.001<=a&&.001>=a?(a=b.x-1,-.001<=a&&.001>=a?(a=b.z-1,-.001<=a&&.001>=a||(c=new n(0,0,1))):c=new n(1,0,0)):c=new n(0,-1,0),a=new n(0,0,0),a.x=b.y*c.z-b.z*c.y,a.y=b.z*c.x-b.x*c.z,a.z=b.x*c.y-b.y*c.x,c=a):(a=new n(0,0,0),a.x=b.y*c.z-b.z*c.y,a.y=b.z*c.x-b.x*c.z,a.z=b.x*c.y-b.y*c.x,c=a,c.x=c.y*b.z-c.z*b.y,c.y=c.z*b.x-c.x*b.z,c.z=c.x*b.y-c.y*b.x);c.normalize();return c},l:Le};q["com.babylonhx.math.PositionNormalVertex"]=Yc;
Yc.i=["com","babylonhx","math","PositionNormalVertex"];Yc.prototype={clone:function(){var a=this.position,a=new n(a.x,a.y,a.z),b=this.j;return new Yc(a,new n(b.x,b.y,b.z))},l:Yc};q["com.babylonhx.math.Size"]=fb;fb.i=["com","babylonhx","math","Size"];fb.xb=[pg];fb.ve=function(){return new fb(0,0)};fb.Vc=function(a,b,c){return new fb(a.width+(b.width-a.width)*c|0,a.height+(b.height-a.height)*c|0)};fb.prototype={add:function(a){return new fb(this.width+a.width,this.height+a.height)},aM:function(a){return new fb(this.width-
a.width,this.height-a.height)},l:fb};var Kd=J.BABYLON.Vector4=function(a,b,c,d){null==d&&(d=0);null==c&&(c=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=c;this.o=d};q["com.babylonhx.math.Vector4"]=Kd;Kd.i=["com","babylonhx","math","Vector4"];Kd.prototype={l:Kd};q["com.babylonhx.math.Tmp"]=ba;ba.i=["com","babylonhx","math","Tmp"];var wd=J.BABYLON.Viewport=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d};q["com.babylonhx.math.Viewport"]=wd;wd.i=["com","babylonhx","math","Viewport"];
wd.prototype={l:wd};var ee=J.BABYLON.GroundMesh=function(a,b){S.call(this,a,b)};q["com.babylonhx.mesh.GroundMesh"]=ee;ee.i=["com","babylonhx","mesh","GroundMesh"];ee.U=S;ee.prototype=F(S.prototype,{l:ee});var Jd=J.BABYLON.InstancedMesh=function(a,b){ka.call(this,a,b.f);b.Gh.push(this);this.gc=b;var c=this.position,d=b.position;c.x=d.x;c.y=d.y;c.z=d.z;c=this.Kb;d=b.Kb;c.x=d.x;c.y=d.y;c.z=d.z;c=this.De;d=b.De;c.x=d.x;c.y=d.y;c.z=d.z;null!=b.Ad&&(c=b.Ad,this.Pl(new da(c.x,c.y,c.z,c.o)));this.Ji=b.Ji;
this.nj=b.nj;this.K.po=!0;c=this.gc.fd();d=c.Gb;d=new n(d.x,d.y,d.z);c=c.Mb;this.ra=new xb(d,new n(c.x,c.y,c.z));d=this.ra=null==this.ra?new xb(this.sf(),this.sf()):this.ra;c=this.me();if(!d.Bk){var e=d.zc,f=e.ea;f.x=Infinity;f.y=Infinity;f.z=Infinity;f=e.da;f.x=-Infinity;f.y=-Infinity;f.z=-Infinity;for(var g,h,k,f=0,l=e.Ab.length;f<l;){g=f++;la.g=e.jg[g];var m=e.Ab[g];g=la.g;h=m.x;k=m.y;var m=m.z,p=c.a,q=h*p[1]+k*p[5]+m*p[9]+p[13],u=h*p[2]+k*p[6]+m*p[10]+p[14],r=h*p[3]+k*p[7]+m*p[11]+p[15];g.x=(h*
p[0]+k*p[4]+m*p[8]+p[12])/r;g.y=q/r;g.z=u/r;g=la.g.x;h=la.g.y;k=la.g.z;g<e.ea.x&&(e.ea.x=g);h<e.ea.y&&(e.ea.y=h);k<e.ea.z&&(e.ea.z=k);g>e.da.x&&(e.da.x=g);h>e.da.y&&(e.da.y=h);k>e.da.z&&(e.da.z=k)}f=e.da;l=e.ea;g=e.oa;g.x=f.x+l.x;g.y=f.y+l.y;g.z=f.z+l.z;f=e.oa;f.x*=.5;f.y*=.5;f.z*=.5;f=c.a;l=e.w[0];l.x=f[0];l.y=f[1];l.z=f[2];f=c.a;l=e.w[1];l.x=f[4];l.y=f[5];l.z=f[6];f=c.a;l=e.w[2];l.x=f[8];l.y=f[9];l.z=f[10];e.Ea=c;d=d.Pc;e=Math.max;f=Math.abs;k=d.oa;l=d.Hc;g=k.x;h=k.y;k=k.z;m=c.a;p=g*m[1]+h*m[5]+
k*m[9]+m[13];q=g*m[2]+h*m[6]+k*m[10]+m[14];u=g*m[3]+h*m[7]+k*m[11]+m[15];l.x=(g*m[0]+h*m[4]+k*m[8]+m[12])/u;l.y=p/u;l.z=q/u;l=d.Eb;l.x=c.a[0]+c.a[4]+c.a[8];l.y=c.a[1]+c.a[5]+c.a[9];l.z=c.a[2]+c.a[6]+c.a[10];d.bg=e(e(f(d.Eb.x),f(d.Eb.y)),f(d.Eb.z))*d.P}this.Wk(this.me());this.qo();if(null!=this.gc.Ha)for(c=0,d=this.gc.Ha.length;c<d;)e=c++,this.gc.Ha[e].clone(this,this.gc)};q["com.babylonhx.mesh.InstancedMesh"]=Jd;Jd.i=["com","babylonhx","mesh","InstancedMesh"];Jd.xb=[Qb];Jd.U=ka;Jd.prototype=F(ka.prototype,
{Gj:function(){return this.gc.Gj()},Gg:function(){return this.gc.Gg()},Ei:function(){return this.gc.Ei()},gd:function(){return this.gc.gd()},Qf:function(){return this.gc.Qf()},ev:function(){return this.gc},Ba:function(a,b){null==b&&(b=!1);return this.gc.Ba(a,b)},fb:function(a){return this.gc.fb(a)},Bc:function(a){null==a&&(a=!1);return this.gc.Bc(a)},mr:function(){return this.gc.nh},Zm:function(){null!=this.sk&&this.sk.Zm()},ys:function(a){null!=this.sk&&this.sk.qG(this,a)},er:function(){this.sk=
this.ev().er(this.f.L,this.fd().Pc);return this.sk==this.ev()?this:this.sk},km:function(){return this.gc.km()},clone:function(a,b,c){null==c&&(c=!1);a=this.gc.bl(a);var d=this.gc.fd(),e=d.Gb,e=new n(e.x,e.y,e.z),d=d.Mb;this.ra=new xb(e,new n(d.x,d.y,d.z));e=this.ra=null==this.ra?new xb(this.sf(),this.sf()):this.ra;d=this.me();if(!e.Bk){var f=e.zc,g=f.ea;g.x=Infinity;g.y=Infinity;g.z=Infinity;g=f.da;g.x=-Infinity;g.y=-Infinity;g.z=-Infinity;for(var h,k,l,g=0,m=f.Ab.length;g<m;){h=g++;la.g=f.jg[h];
var p=f.Ab[h];h=la.g;k=p.x;l=p.y;var p=p.z,q=d.a,u=k*q[1]+l*q[5]+p*q[9]+q[13],r=k*q[2]+l*q[6]+p*q[10]+q[14],t=k*q[3]+l*q[7]+p*q[11]+q[15];h.x=(k*q[0]+l*q[4]+p*q[8]+q[12])/t;h.y=u/t;h.z=r/t;h=la.g.x;k=la.g.y;l=la.g.z;h<f.ea.x&&(f.ea.x=h);k<f.ea.y&&(f.ea.y=k);l<f.ea.z&&(f.ea.z=l);h>f.da.x&&(f.da.x=h);k>f.da.y&&(f.da.y=k);l>f.da.z&&(f.da.z=l)}g=f.da;m=f.ea;h=f.oa;h.x=g.x+m.x;h.y=g.y+m.y;h.z=g.z+m.z;g=f.oa;g.x*=.5;g.y*=.5;g.z*=.5;g=d.a;m=f.w[0];m.x=g[0];m.y=g[1];m.z=g[2];g=d.a;m=f.w[1];m.x=g[4];m.y=g[5];
m.z=g[6];g=d.a;m=f.w[2];m.x=g[8];m.y=g[9];m.z=g[10];f.Ea=d;e=e.Pc;f=Math.max;g=Math.abs;l=e.oa;m=e.Hc;h=l.x;k=l.y;l=l.z;p=d.a;q=h*p[1]+k*p[5]+l*p[9]+p[13];u=h*p[2]+k*p[6]+l*p[10]+p[14];r=h*p[3]+k*p[7]+l*p[11]+p[15];m.x=(h*p[0]+k*p[4]+l*p[8]+p[12])/r;m.y=q/r;m.z=u/r;m=e.Eb;m.x=d.a[0]+d.a[4]+d.a[8];m.y=d.a[1]+d.a[5]+d.a[9];m.z=d.a[2]+d.a[6]+d.a[10];e.bg=f(f(g(e.Eb.x),g(e.Eb.y)),g(e.Eb.z))*e.P}this.Wk(this.me());null!=b&&a.ck(b);if(!c)for(b=0,c=this.f.Yb.length;b<c;)d=b++,d=this.f.Yb[d],d.ca==this&&
d.clone(d.name,a);a.Wd(!0);return a},dispose:function(a){null==a&&(a=!1);Q.remove(this.gc.Gh,this);ka.prototype.dispose.call(this,a)},l:Jd,ha:F(ka.prototype.ha,{ev:"get_sourceMesh"})});q["com.babylonhx.mesh.MeshBuilder"]=A;A.i=["com","babylonhx","mesh","MeshBuilder"];A.lb=function(a){return 2==a?2:-1==a?0:a};A.yh=function(a,b,c){a=new S(a,c);var d=I.yh(b);b.$=A.lb(b.$);a.Ee=b.$;null!=c.ie&&(a.Hr={},a.Hr.size=b);d.dc(a,b.Ia);return a};A.gp=function(a,b,c){a=new S(a,c);b.$=A.lb(b.$);a.Ee=b.$;I.gp(b).dc(a,
b.Ia);return a};A.cp=function(a,b,c){a=new S(a,c);b.$=A.lb(b.$);a.Ee=b.$;null==b.Ia&&(b.Ia=!1);I.cp(b).dc(a,b.Ia);return a};A.$o=function(a,b,c){a=new S(a,c);b.$=A.lb(b.$);a.Ee=b.$;I.$o(b).dc(a,b.Ia);return a};A.Df=function(a,b,c){var d=b.Qg,e=b.$k,f=b.closePath,g=b.offset,h=b.Ia,k=A.lb(b.$);b=b.Ig;if(null!=b){e=b.Ba("position");f=d[0].length;h=0;g=1;for(k=(2==b.Ee?2:1)+1;g<k;)for(g++,a=0,c=d.length;a<c;){var l=a++,l=d[l],m=l.length;f<m||(f=m);for(m=0;m<f;)e[h]=l[m].x,e[h+1]=l[m].y,e[h+2]=l[m].z,
++m,h+=3;b.Hs&&(e[h]=l[0].x,e[h+1]=l[0].y,e[h+2]=l[0].z,h+=3)}b.Yh("position",e,!0,!1);if(!b.YE){h=b.Bc();f=b.Ba("normal");I.be(e,h,f);if(b.Hs)for(h=0,g=d.length;h<g;)k=h++,e=3*b.Sp[k],k=k+1<d.length?3*(b.Sp[k+1]-1):f.length-3,f[e]=.5*(f[e]+f[k]),f[e+1]=.5*(f[e+1]+f[k+1]),f[e+2]=.5*(f[e+2]+f[k+2]),f[k]=f[e],f[k+1]=f[e+1],f[k+2]=f[e+2];b.Yh("normal",f,!0,!1)}return b}b=new S(a,c);b.Ee=k;d=I.Df({Qg:d,$k:e,closePath:f,offset:g,$:k});f&&(b.Sp=d.Sp);b.Hs=f;b.nF=e;d.dc(b,h);return b};A.Jl=function(a,b,
c){a=new S(a,c);b.$=A.lb(b.$);a.Ee=b.$;var d=I.Jl(b);null!=c.ie&&(a.Hr={},a.Hr.height=b.height,a.Hr.Fu=b.In>b.Jn?b.In:b.Jn);d.dc(a,b.Ia);return a};A.ip=function(a,b,c){a=new S(a,c);b.$=A.lb(b.$);a.Ee=b.$;I.ip(b).dc(a,b.Ia);return a};A.jp=function(a,b,c){a=new S(a,c);b.$=A.lb(b.$);a.Ee=b.$;I.jp(b).dc(a,b.Ia);return a};A.js=function(a,b,c){var d=b.Ig,e=b.CB;if(null!=d)return d.CD(function(a){for(var b=0,c=0,d=e.length;c<d;)for(var l=c++,l=e[l],m=0,n=l.length;m<n;){var p=m++;a[b]=l[p].x;a[b+1]=l[p].y;
a[b+2]=l[p].z;b+=3}},!1),d;a=new pc(a,c);I.js(b).dc(a,b.Ia);return a};A.aL=function(a,b,c){return A.js(a,{CB:[b.Ir],Ia:b.Ia,Ig:b.Ig},c)};A.Zo=function(a,b,c){var d=b.Ir,e=b.Ig,f=b.il,g=b.Cj;if(null!=e)return e.CD(function(a){var b=new n(0,0,0),c=a.length/6,f=0,g,p,q=0,r=0,t;g=0;for(p=d.length-1;g<p;){var v=g++;t=d[v+1];v=d[v];b.x=t.x-v.x;b.y=t.y-v.y;b.z=t.z-v.z;f+=Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z)}c=f/c;for(f=e.Cj*c/(e.Cj+e.il);r<d.length-1;){g=d[r+1];p=d[r];b.x=g.x-p.x;b.y=g.y-p.y;b.z=g.z-p.z;g=
Math.floor(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z)/c);b.normalize();for(t=0;t<g&&q<a.length;)p=c*t,a[q]=d[r].x+p*b.x,a[q+1]=d[r].y+p*b.y,a[q+2]=d[r].z+p*b.z,a[q+3]=d[r].x+(p+f)*b.x,a[q+4]=d[r].y+(p+f)*b.y,a[q+5]=d[r].z+(p+f)*b.z,q+=6,++t;++r}for(;q<a.length;)a[q]=d[r].x,a[q+1]=d[r].y,a[q+2]=d[r].z,q+=3},!1),e;a=new pc(a,c);I.Zo(b).dc(a,b.Ia);a.Cj=g;a.il=f;return a};A.AL=function(a,b,c){return A.TB(a,b.shape,b.path,null!=b.scale?b.scale:1,null!=b.rotation?b.rotation:0,null,null,!1,!1,null!=b.Vd?b.Vd:0,
!1,c,b.Ia,A.lb(b.$),b.Nu)};A.cM=function(a,b,c){return A.TB(a,b.shape,b.path,null,null,null!=b.OC?b.OC:function(){return 1},null!=b.MC?b.MC:function(){return 0},null!=b.JC&&b.JC,null!=b.KC&&b.KC,null!=b.Vd?b.Vd:0,!0,c,b.Ia,A.lb(b.$),b.Nu)};A.NK=function(a,b,c){var d=null!=b.arc?b.arc:1;0>=d&&(d=1);var e=null==b.closed?!0:b.closed,f=b.shape,g=null!=b.P?b.P:1,h=null!=b.Md?b.Md:64,k=b.Ia,l=A.lb(b.$);b=null!=b.Vd?b.Vd:0;for(var m=[],d=2*Math.PI/h*d,p,q=0,h=h+1;q<h;){var u=q++,r=[];if(1==b||3==b)r.push(new n(0,
f[0].y,0)),r.push(new n(Math.cos(u*d)*f[0].x*g,f[0].y,Math.sin(u*d)*f[0].x*g));for(var t=0,v=f.length;t<v;)p=t++,p=new n(Math.cos(u*d)*f[p].x*g,f[p].y,Math.sin(u*d)*f[p].x*g),r.push(p);if(2==b||3==b)r.push(new n(Math.cos(u*d)*f[f.length-1].x*g,f[f.length-1].y,Math.sin(u*d)*f[f.length-1].x*g)),r.push(new n(0,f[f.length-1].y,0));m.push(r)}return A.Df(a,{Qg:m,$k:e,$:l,Ia:k},c)};A.ep=function(a,b,c){a=new S(a,c);b.$=A.lb(b.$);a.Ee=b.$;I.ep(b).dc(a,b.Ia);if(null!=b.$r){a.translate(b.$r.j,b.$r.d);c=b.$r.j;
var d=gb.Z;c=Math.acos(c.x*d.x+c.y*d.y+c.z*d.z);d=gb.Z;b=b.$r.j;var e=new n(0,0,0);e.x=d.y*b.z-d.z*b.y;e.y=d.z*b.x-d.x*b.z;e.z=d.x*b.y-d.y*b.x;a.rotate(e,c)}return a};A.ap=function(a,b,c){a=new ee(a,c);a.mq(!1);a.MG=null!=b.uw?b.uw:null!=b.Uc?b.Uc:1;a.NG=null!=b.vw?b.vw:null!=b.Uc?b.Uc:1;I.ap(b).dc(a,b.Ia);a.mq(!0);return a};A.hp=function(a,b,c){a=new S(a,c);I.hp(b).dc(a,b.Ia);return a};A.bp=function(a,b,c,d){var e=null!=c.width?c.width:10,f=null!=c.height?c.height:10,g=null!=c.Uc?c.Uc:1,h=c.Ia,k=
c.Nv,l=new ee(a,d);l.MG=g;l.NG=g;l.La=e;l.Ua=f;l.eG=l.La/2;l.fG=l.Ua/2;l.EN=-l.eG;l.FN=-l.fG;l.mq(!1);ga.Qj(b,function(a){c.buffer=a.data;c.CH=a.width;c.AH=a.height;I.bp(c).dc(l,h);l.mq(!0);null!=k&&k(l)});return l};A.dL=function(a,b,c){function d(a,b,c,d,e,f,g){function h(b,c){for(var d=[],e=0;e<b;)e++,d.push(a[c]);return d}var k;null==k&&(k=1);k=b.xg;var l=b.ri;b=b.fm;var m=2*Math.PI/e;f=null!=f?f:function(){return d};for(var p=[],q=0,t=new n(0,0,0),v=new n(0,0,0),A=ba.Ra[0],B=0==g||2==g?2:0,F=
0,I=a.length;F<I;){for(var H=F++,q=f(H,b[H]),p=[],t=l[H],K=0,L=e;K<L;){var S=K++;r.kp(k[H],m*S,A);var v=null!=p[S]?p[S]:new n(0,0,0),R=t.x,T=t.y,W=t.z,Q=A.a,X=R*Q[1]+T*Q[5]+W*Q[9]+Q[13],da=R*Q[2]+T*Q[6]+W*Q[10]+Q[14],ca=R*Q[3]+T*Q[7]+W*Q[11]+Q[15];v.x=(R*Q[0]+T*Q[4]+W*Q[8]+Q[12])/ca;v.y=X/ca;v.z=da/ca;v.x*=q;v.y*=q;v.z*=q;R=v;T=a[H];R.x+=T.x;R.y+=T.y;R.z+=T.z;p[S]=v}c[B]=p;++B}switch(g){case 1:c.unshift(h(e+1,0));break;case 2:c.push(h(e+1,a.length-1));break;case 3:c.unshift(h(e+1,0)),c.push(h(e+1,
a.length-1))}return c}var e=b.path,f=null!=b.P?b.P:1,g=null!=b.Md?b.Md:64,h=b.bL,k=null!=b.Vd?b.Vd:0,l=b.Ia,m=A.lb(b.$);b=b.Ig;if(null!=b)return g=b.Gr.update(e),g=d(e,g,b.Qg,f,b.Md,h,b.Vd),b=A.Df(null,{Qg:g,Ig:b},c);b=new Le(e);if(0>k||3<k)k=0;e=d(e,b,[],f,g,h,k);c=A.Df(a,{Qg:e,$k:!1,closePath:!0,offset:0,Ia:l,$:m},c);c.Qg=e;c.Gr=b;c.Md=g;c.Vd=k;return c};A.fp=function(a,b,c){a=new S(a,c);b.$=A.lb(b.$);a.Ee=b.$;I.fp(b).dc(a,b.Ia);return a};A.dK=function(a,b,c){function d(a,b){function c(a,e){var f=
a.position,g=e.position,f=f.x*b.x+f.y*b.y+f.z*b.z-d,g=f/(f-(g.x*b.x+g.y*b.y+g.z*b.z-d));return new Yc(n.D(a.position,e.position,g),n.D(a.j,e.j,g))}if(0==a.length)return a;for(var d=.5*Math.abs(h.x*b.x+h.y*b.y+h.z*b.z),e=[],f=!1,g=!1,k=!1,l=0,m=null,p=null,q=null,u=null,r=k=g=f=0;r<a.length;){f=a[r].position;f=f.x*b.x+f.y*b.y+f.z*b.z-d;g=a[r+1].position;g=g.x*b.x+g.y*b.y+g.z*b.z-d;k=a[r+2].position;k=k.x*b.x+k.y*b.y+k.z*b.z-d;f=0<f;g=0<g;k=0<k;l=(f?1:0)+(g?1:0)+(k?1:0);switch(l){case 0:e.push(a[r]);
e.push(a[r+1]);e.push(a[r+2]);break;case 1:f&&(m=a[r+1],p=a[r+2],q=c(a[r],m),u=c(a[r],p));g?(m=a[r],p=a[r+2],q=c(a[r+1],m),u=c(a[r+1],p),e.push(q),e.push(p.clone()),e.push(m.clone()),e.push(p.clone()),e.push(q.clone()),e.push(u)):(k&&(m=a[r],p=a[r+1],q=c(a[r+2],m),u=c(a[r+2],p)),e.push(m.clone()),e.push(p.clone()),e.push(q),e.push(u),e.push(q.clone()),e.push(p.clone()));break;case 2:f||(m=a[r].clone(),p=c(m,a[r+1]),q=c(m,a[r+2]),e.push(m),e.push(p),e.push(q)),g||(m=a[r+1].clone(),p=c(m,a[r+2]),q=
c(m,a[r]),e.push(m),e.push(p),e.push(q)),k||(m=a[r+2].clone(),p=c(m,a[r]),q=c(m,a[r+1]),e.push(m),e.push(p),e.push(q))}r+=3}return e}function e(a){a=A.Ho[a];var b=new Yc;b.position=new n(A.Ni[3*a],A.Ni[3*a+1],A.Ni[3*a+2]);var c=b.position,d=A.Fz,e=new n(0,0,0),f=c.x,g=c.y,c=c.z,d=d.a,h=f*d[1]+g*d[5]+c*d[9]+d[13],k=f*d[2]+g*d[6]+c*d[10]+d[14],l=f*d[3]+g*d[7]+c*d[11]+d[15];e.x=(f*d[0]+g*d[4]+c*d[8]+d[12])/l;e.y=h/l;e.z=k/l;b.position=e;b.j=new n(A.Gi[3*a],A.Gi[3*a+1],A.Gi[3*a+2]);return b}var f=null!=
c.position?c.position:new n(0,0,0),g=c.j,h=null!=c.size?c.size:new n(1,1,1),k=c.Cd;A.Ho=b.Bc();A.Ni=b.Ba("position");A.Gi=b.Ba("normal");if(null==g){var l=b.f.L,m=A.kE,p=l.va(),q=new n(0,0,0),u=m.x,t=m.y,v=m.z,z=p.a,B=u*z[1]+t*z[5]+v*z[9]+z[13],F=u*z[2]+t*z[6]+v*z[10]+z[14],I=u*z[3]+t*z[7]+v*z[11]+z[15];q.x=(u*z[0]+t*z[4]+v*z[8]+z[12])/I;q.y=B/I;q.z=F/I;A.Zw=q;var x=l.Dh(),K=A.Zw,g=new n(x.x-K.x,x.y-K.y,x.z-K.z)}var G=-Math.atan2(g.z,g.x)-Math.PI/2,D=Math.atan2(g.y,Math.sqrt(g.x*g.x+g.z*g.z)),L=new r,
P=r.Ta,N=.5*k,E=.5*D,O=.5*G,R=Math.sin(N),H=Math.cos(N),Q=Math.sin(E),T=Math.cos(E),W=Math.sin(O),X=Math.cos(O);P.x=X*Q*H+W*T*R;P.y=W*T*H-X*Q*R;P.z=X*T*R-W*Q*H;P.o=X*T*H+W*Q*R;r.Ta.Af(L);var ba=f.x,ca=f.y,da=f.z,U=new r;U.a[0]=1;U.a[1]=0;U.a[2]=0;U.a[3]=0;U.a[4]=0;U.a[5]=1;U.a[6]=0;U.a[7]=0;U.a[8]=0;U.a[9]=0;U.a[10]=1;U.a[11]=0;U.a[12]=0;U.a[13]=0;U.a[14]=0;U.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,ba,ca,da,U);var ja=new r;L.qa(U,ja.a,0);A.UD=ja;var aa=A.UD,Y=new r,ga=aa.a[0],Fb=aa.a[1],ha=aa.a[2],ia=aa.a[3],
Da=aa.a[4],Va=aa.a[5],ka=aa.a[6],la=aa.a[7],ma=aa.a[8],na=aa.a[9],Z=aa.a[10],fa=aa.a[11],oa=aa.a[12],pa=aa.a[13],qa=aa.a[14],sa=aa.a[15],ta=Z*sa-fa*qa,ua=na*sa-fa*pa,va=na*qa-Z*pa,wa=ma*sa-fa*oa,ya=ma*qa-Z*oa,za=ma*pa-na*oa,Ea=Va*ta-ka*ua+la*va,Aa=-(Da*ta-ka*wa+la*ya),Ra=Da*ua-Va*wa+la*za,Ga=-(Da*va-Va*ya+ka*za),ra=1/(ga*Ea+Fb*Aa+ha*Ra+ia*Ga),Oa=ka*sa-la*qa,Ta=Va*sa-la*pa,bb=Va*qa-ka*pa,Fa=Da*sa-la*oa,Ma=Da*qa-ka*oa,Ha=Da*pa-Va*oa,Ka=ka*fa-la*Z,La=Va*fa-la*na,Na=Va*Z-ka*na,Ca=Da*fa-la*ma,cb=Da*Z-
ka*ma,Ia=Da*na-Va*ma;Y.a[0]=Ea*ra;Y.a[4]=Aa*ra;Y.a[8]=Ra*ra;Y.a[12]=Ga*ra;Y.a[1]=-(Fb*ta-ha*ua+ia*va)*ra;Y.a[5]=(ga*ta-ha*wa+ia*ya)*ra;Y.a[9]=-(ga*ua-Fb*wa+ia*za)*ra;Y.a[13]=(ga*va-Fb*ya+ha*za)*ra;Y.a[2]=(Fb*Oa-ha*Ta+ia*bb)*ra;Y.a[6]=-(ga*Oa-ha*Fa+ia*Ma)*ra;Y.a[10]=(ga*Ta-Fb*Fa+ia*Ha)*ra;Y.a[14]=-(ga*bb-Fb*Ma+ha*Ha)*ra;Y.a[3]=-(Fb*Ka-ha*La+ia*Na)*ra;Y.a[7]=(ga*Ka-ha*Ca+ia*cb)*ra;Y.a[11]=-(ga*La-Fb*Ca+ia*Ia)*ra;Y.a[15]=(ga*Na-Fb*cb+ha*Ia)*ra;A.WD=Y;A.Qw=b.va();var Za=A.Qw,ib=A.WD,ab=new r;Za.qa(ib,
ab.a,0);A.Fz=ab;A.mc.pb=[];A.mc.Na=[];A.mc.gb=[];A.mc.zb=[];for(var Ja=0,Ua=[],Sa=0;Sa<A.Ho.length;){Ua=[];Ua.push(e(Sa));Ua.push(e(Sa+1));Ua.push(e(Sa+2));Ua=d(Ua,new n(1,0,0));Ua=d(Ua,new n(-1,0,0));Ua=d(Ua,new n(0,1,0));Ua=d(Ua,new n(0,-1,0));Ua=d(Ua,new n(0,0,1));Ua=d(Ua,new n(0,0,-1));if(0!=Ua.length){var qb=new r,$a=r.Ta,mb=.5*k,ob=.5*D,ub=.5*G,kb=Math.sin(mb),lb=Math.cos(mb),Xa=Math.sin(ob),fb=Math.cos(ob),Ya=Math.sin(ub),Pa=Math.cos(ub);$a.x=Pa*Xa*lb+Ya*fb*kb;$a.y=Ya*fb*lb-Pa*Xa*kb;$a.z=Pa*
fb*kb-Ya*Xa*lb;$a.o=Pa*fb*lb+Ya*Xa*kb;r.Ta.Af(qb);for(var Ba=null,rb=0,sb=Ua.length;rb<sb;){var wb=rb++,Ba=Ua[wb];A.mc.pb.push(Ja);var xa=Ba.position,Ib=A.mc.Na,pb=3*Ja;Ib[pb]=xa.x;Ib[pb+1]=xa.y;Ib[pb+2]=xa.z;var gb=Ba.j,hb=A.mc.gb,nb=3*Ja;hb[nb]=gb.x;hb[nb+1]=gb.y;hb[nb+2]=gb.z;A.mc.zb.push(.5+Ba.position.x/h.x);A.mc.zb.push(.5+Ba.position.y/h.y);++Ja}}Sa+=3}var Ab=new S(a,b.f);A.mc.dc(Ab);Ab.position=new n(f.x,f.y,f.z);Ab.Kb=new n(D,G,k);return Ab};A.TB=function(a,b,c,d,e,f,g,h,k,l,m,p,q,u,t){function v(a,
b,c,d,e,f,g,h,k,l){function m(a){for(var b=[],c=new n(0,0,0),d=0,e=a.length;d<e;){var f=d++,f=a[f];c.x+=f.x;c.y+=f.y;c.z+=f.z}d=1/a.length;c.x*=d;c.y*=d;c.z*=d;d=0;for(a=a.length;d<a;)d++,b.push(c);return b}null==l&&(l=!1);l=c.xg;var p=c.ri,q=c.rk;c=c.fm;var u=0;h=null!=h?h:function(){return f};g=null!=g?g:function(){return e};for(var w=0==k||2==k?0:2,t=ba.Ra[0],y=0,A=b.length;y<A;){for(var C=y++,B=[],F=h(C,c[C]),I=g(C,c[C]),V=0,K=a.length;V<K;){var L=V++;r.kp(l[C],u,t);var S,R,Q,T,U,W;T=l[C];R=a[L].z;
W=T.x*R;U=T.y*R;T=T.z*R;Q=p[C];var X=a[L].x;S=Q.x*X;R=Q.y*X;Q=Q.z*X;W+=S;U+=R;T+=Q;S=q[C];X=a[L].y;Q=S.x*X;R=S.y*X;S=S.z*X;Q=W+Q;R=U+R;S=T+S;W=null!=B[L]?B[L]:new n(0,0,0);U=Q;T=R;R=S;Q=t.a;S=U*Q[1]+T*Q[5]+R*Q[9]+Q[13];var X=U*Q[2]+T*Q[6]+R*Q[10]+Q[14],Y=U*Q[3]+T*Q[7]+R*Q[11]+Q[15];W.x=(U*Q[0]+T*Q[4]+R*Q[8]+Q[12])/Y;W.y=S/Y;W.z=X/Y;W.x*=I;W.y*=I;W.z*=I;U=W;T=b[C];U.x+=T.x;U.y+=T.y;U.z+=T.z;B[L]=W}d[w]=B;u+=F;++w}switch(k){case 1:d[0]=m(d[2]);d[1]=d[2].slice(0);break;case 2:d[w]=d[w-1];d[w+1]=m(d[w-
1]);break;case 3:d[0]=m(d[2]),d[1]=d[2].slice(0),d[w]=d[w-1],d[w+1]=m(d[w-1])}return d}if(null!=t)return t.Gr.update(c),l=v(b,c,t.Gr,t.Qg,d,e,f,g,t.Vd,m),t=S.Fa(null,l,!1,!1,p,!1,0,t);t=new Le(c);if(0>l||3<l)l=0;b=v(b,c,t,[],d,e,f,g,l,m);p=S.Fa(a,b,h,k,p,q,u);p.Qg=b;p.Gr=t;p.Vd=l;return p};var Df=J.BABYLON.MeshLODLevel=function(a,b){this.Sb=a;this.Zc=b};q["com.babylonhx.mesh.MeshLODLevel"]=Df;Df.i=["com","babylonhx","mesh","MeshLODLevel"];Df.prototype={l:Df};var Bf=J.BABYLON._InstancesBatch=function(){this.Mr=
[];this.Nd=[];this.Br=!1};q["com.babylonhx.mesh._InstancesBatch"]=Bf;Bf.i=["com","babylonhx","mesh","_InstancesBatch"];Bf.prototype={l:Bf};var Ef=J.BABYLON._VisibleInstances=function(a,b){this.gA=this.mB=0;this.map=new sc;this.gA=a;this.BL=b};q["com.babylonhx.mesh._VisibleInstances"]=Ef;Ef.i=["com","babylonhx","mesh","_VisibleInstances"];Ef.prototype={l:Ef};var Wb=J.BABYLON.CSG=function(){this.Qe=[]};q["com.babylonhx.mesh.csg.CSG"]=Wb;Wb.i=["com","babylonhx","mesh","csg","CSG"];Wb.sA=function(a){var b,
c,d,e,f=[],g,h,k,l;if(v.D(a,S))a.Wd(!0),g=a.va(),h=a.position,h=new n(h.x,h.y,h.z),k=a.Kb,k=new n(k.x,k.y,k.z),l=a.De,l=new n(l.x,l.y,l.z);else throw new ja("CSG:Wrong Mesh type, must be Mesh");var m=a.Bc(),p=a.Ba("position"),q=a.Ba("normal"),r=a.Ba("uv");a=a.Ha;for(var t=0,A=a.length;t<A;)for(var z=t++,B=a[z].Xb,F=a[z].Xd+a[z].Xb;B<F;){e=[];for(var I=0;3>I;){d=I++;b=new n(q[3*m[B+d]],q[3*m[B+d]+1],q[3*m[B+d]+2]);c=new K(r[2*m[B+d]],r[2*m[B+d]+1]);d=new n(p[3*m[B+d]],p[3*m[B+d]+1],p[3*m[B+d]+2]);
var x=d.x,L=d.y,G=d.z,D=g.a,Q=x*D[1]+L*D[5]+G*D[9]+D[13],P=x*D[2]+L*D[6]+G*D[10]+D[14],N=x*D[3]+L*D[7]+G*D[11]+D[15];d.x=(x*D[0]+L*D[4]+G*D[8]+D[12])/N;d.y=Q/N;d.z=P/N;b.x=b.x*g.a[0]+b.y*g.a[4]+b.z*g.a[8];b.y=b.x*g.a[1]+b.y*g.a[5]+b.z*g.a[9];b.z=b.x*g.a[2]+b.y*g.a[6]+b.z*g.a[10];b=new Ec(d,b,c);e.push(b)}e=new Pd(e,{Tg:z,Lh:Wb.OD,wf:a[z].wf});null!=e.qe&&f.push(e);B+=3}f=Wb.xE(f);f.Ra=g;f.position=h;f.rotation=k;f.Ml=l;Wb.OD++;return f};Wb.xE=function(a){var b=new Wb;b.Qe=a;return b};Wb.prototype=
{bM:function(a){var b=new Pb(this.Qe);a=new Pb(a.Qe);b.xl();b.Cn(a);a.Cn(b);a.xl();a.Cn(b);a.xl();b.Hq(a.yq());b.xl();this.Qe=b.yq()},DH:function(a,b,c){var d=this.Ra,e=d.a[0],f=d.a[1],g=d.a[2],h=d.a[3],k=d.a[4],l=d.a[5],m=d.a[6],p=d.a[7],q=d.a[8],u=d.a[9],v=d.a[10],A=d.a[11],z=d.a[12],B=d.a[13],F=d.a[14],I=d.a[15],x=new r;x.a[0]=e;x.a[1]=f;x.a[2]=g;x.a[3]=h;x.a[4]=k;x.a[5]=l;x.a[6]=m;x.a[7]=p;x.a[8]=q;x.a[9]=u;x.a[10]=v;x.a[11]=A;x.a[12]=z;x.a[13]=B;x.a[14]=F;x.a[15]=I;var L=x.a[0],G=x.a[1],D=x.a[2],
Q=x.a[3],P=x.a[4],N=x.a[5],E=x.a[6],O=x.a[7],R=x.a[8],H=x.a[9],T=x.a[10],U=x.a[11],X=x.a[12],Y=x.a[13],aa=x.a[14],ba=x.a[15],ca=T*ba-U*aa,da=H*ba-U*Y,ga=H*aa-T*Y,ha=R*ba-U*X,ia=R*aa-T*X,ja=R*Y-H*X,ka=N*ca-E*da+O*ga,la=-(P*ca-E*ha+O*ia),ma=P*da-N*ha+O*ja,na=-(P*ga-N*ia+E*ja),fa=1/(L*ka+G*la+D*ma+Q*na),oa=E*ba-O*aa,pa=N*ba-O*Y,qa=N*aa-E*Y,sa=P*ba-O*X,Z=P*aa-E*X,ta=P*Y-N*X,ua=E*U-O*T,va=N*U-O*H,wa=N*T-E*H,ya=P*U-O*R,za=P*T-E*R,Ea=P*H-N*R;x.a[0]=ka*fa;x.a[4]=la*fa;x.a[8]=ma*fa;x.a[12]=na*fa;x.a[1]=-(G*
ca-D*da+Q*ga)*fa;x.a[5]=(L*ca-D*ha+Q*ia)*fa;x.a[9]=-(L*da-G*ha+Q*ja)*fa;x.a[13]=(L*ga-G*ia+D*ja)*fa;x.a[2]=(G*oa-D*pa+Q*qa)*fa;x.a[6]=-(L*oa-D*sa+Q*Z)*fa;x.a[10]=(L*pa-G*sa+Q*ta)*fa;x.a[14]=-(L*qa-G*Z+D*ta)*fa;x.a[3]=-(G*ua-D*va+Q*wa)*fa;x.a[7]=(L*ua-D*ya+Q*za)*fa;x.a[11]=-(L*va-G*ya+Q*Ea)*fa;x.a[15]=(L*wa-G*za+D*Ea)*fa;var Aa=new S(a,b),Ga=[],Oa=[],Fa=[],Ma=[],Ka=new n(0,0,0),Ra=new n(0,0,0),La=new K(0,0),ra=this.Qe,Na=[0,0,0],Ta,bb=new W,Ca=-1111,Sa=0,Ha=new W,Ia;c&&ra.sort(function(a,b){return a.md.Lh==
b.md.Lh?a.md.Tg-b.md.Tg|0:a.md.Lh-b.md.Lh|0});for(var $a=0,kb=ra.length;$a<kb;){var lb=$a++;Ta=ra[lb];var cb=Ta.md.Lh;if(null!=t[cb]?!Ha.Id(cb):!Ha.h.hasOwnProperty(cb)){var Xa=Ta.md.Lh,fb=new W;null!=t[Xa]?Ha.C(Xa,fb):Ha.h[Xa]=fb}var Ya=Ta.md.Lh,Za=Ta.md.Tg,Ja=null!=t[Ya]?Ha.H(Ya):Ha.h[Ya];if(null!=t[Za]?!Ja.Id(Za):!Ja.h.hasOwnProperty(Za)){var Ua=Ta.md.Lh,ab=Ta.md.Tg,ib=null!=t[Ua]?Ha.H(Ua):Ha.h[Ua],mb={Xb:Infinity,lv:-Infinity,wf:Ta.md.wf};null!=t[ab]?ib.C(ab,mb):ib.h[ab]=mb}var gb=Ta.md.Lh,hb=
Ta.md.Tg,nb=null!=t[gb]?Ha.H(gb):Ha.h[gb];Ia=null!=t[hb]?nb.H(hb):nb.h[hb];for(var ob=2,ub=Ta.ja.length;ob<ub;){var qb=ob++;Na[0]=0;Na[1]=qb-1;Na[2]=qb;for(var rb=0;3>rb;){var sb=rb++,Pa=Ta.ja[Na[sb]].Zf;Ka.x=Pa.x;Ka.y=Pa.y;Ka.z=Pa.z;var Ba=Ta.ja[Na[sb]].j;Ra.x=Ba.x;Ra.y=Ba.y;Ra.z=Ba.z;var wb=Ta.ja[Na[sb]].hs;La.x=wb.x;La.y=wb.y;var xb=new n(0,0,0),yb=Ka.x,xa=Ka.y,Ib=Ka.z,pb=x.a,Mb=yb*pb[1]+xa*pb[5]+Ib*pb[9]+pb[13],Nb=yb*pb[2]+xa*pb[6]+Ib*pb[10]+pb[14],Cb=yb*pb[3]+xa*pb[7]+Ib*pb[11]+pb[15];xb.x=(yb*
pb[0]+xa*pb[4]+Ib*pb[8]+pb[12])/Cb;xb.y=Mb/Cb;xb.z=Nb/Cb;var Ab=xb,zb=new n(0,0,0);zb.x=Ra.x*x.a[0]+Ra.y*x.a[4]+Ra.z*x.a[8];zb.y=Ra.x*x.a[1]+Ra.y*x.a[5]+Ra.z*x.a[9];zb.z=Ra.x*x.a[2]+Ra.y*x.a[6]+Ra.z*x.a[10];var Db=zb,Eb=Ab.x+","+Ab.y+","+Ab.z,Ca=null!=t[Eb]?bb.H(Eb):bb.h[Eb];if(-1111==Ca||Fa[3*Ca]!=Db.x||Fa[3*Ca+1]!=Db.y||Fa[3*Ca+2]!=Db.z||Ma[2*Ca]!=La.x||Ma[2*Ca+1]!=La.y){Ga.push(Ab.x);Ga.push(Ab.y);Ga.push(Ab.z);Ma.push(La.x);Ma.push(La.y);Fa.push(Ra.x);Fa.push(Ra.y);Fa.push(Ra.z);var Ca=(Ga.length/
3|0)-1,db=Ab.x+","+Ab.y+","+Ab.z;null!=t[db]?bb.C(db,Ca):bb.h[db]=Ca}Oa.push(Ca);Ia.Xb=Math.min(Sa,Ia.Xb);Ia.lv=Math.max(Sa,Ia.lv);++Sa}}}Aa.Ga("position",Ga);Aa.Ga("normal",Fa);Aa.Ga("uv",Ma);Aa.$j(Oa);if(c){var Hb=0,Bb;Aa.Ha=[];for(var Ob=Ha.keys();Ob.Ca();){var vb=Ob.next();Bb=-1;for(var Pb=(null!=t[vb]?Ha.H(vb):Ha.h[vb]).keys();Pb.Ca();){var Gb=Pb.next(),Qb=null!=t[vb]?Ha.H(vb):Ha.h[vb];Ia=null!=t[Gb]?Qb.H(Gb):Qb.h[Gb];Rb.g(Ia.wf+Hb,Ia.Xb,Ia.lv-Ia.Xb+1|0,Aa);Bb=Math.max(Ia.wf,Bb)|0}Hb+=++Bb}}return Aa},
jM:function(a,b,c,d){null==d&&(d=!1);a=this.DH(a,c,d);a.ld(b);b=a.position;c=this.position;b.x=c.x;b.y=c.y;b.z=c.z;b=a.Kb;c=this.rotation;b.x=c.x;b.y=c.y;b.z=c.z;b=a.De;c=this.Ml;b.x=c.x;b.y=c.y;b.z=c.z;a.Wd(!0);return a},l:Wb};q["com.babylonhx.mesh.csg.Node"]=Pb;Pb.i=["com","babylonhx","mesh","csg","Node"];Pb.prototype={xl:function(){for(var a=0,b=this.Qe.length;a<b;){var c=a++;this.Qe[c].hl()}null!=this.qe&&this.qe.hl();null!=this.Ke&&this.Ke.xl();null!=this.back&&this.back.xl();a=this.Ke;this.Ke=
this.back;this.back=a},uu:function(a){if(null==this.qe)return a.slice(0);for(var b=[],c=[],d=0,e=a.length;d<e;){var f=d++;this.qe.lD(a[f],b,c,b,c)}null!=this.Ke&&(b=this.Ke.uu(b));null!=this.back?c=this.back.uu(c):c=[];return b.concat(c)},Cn:function(a){this.Qe=a.uu(this.Qe);null!=this.Ke&&this.Ke.Cn(a);null!=this.back&&this.back.Cn(a)},yq:function(){var a=this.Qe.slice(0);null!=this.Ke&&(a=a.concat(this.Ke.yq()));null!=this.back&&(a=a.concat(this.back.yq()));return a},Hq:function(a){if(null!=a&&
0!=a.length){null==this.qe&&(this.qe=a[0].qe.clone());for(var b=[],c=[],d=0,e=a.length;d<e;){var f=d++;this.qe.lD(a[f],this.Qe,this.Qe,b,c)}0<b.length&&(null==this.Ke&&(this.Ke=new Pb),this.Ke.Hq(b));0<c.length&&(null==this.back&&(this.back=new Pb),this.back.Hq(c))}},l:Pb};q["com.babylonhx.mesh.csg.Plane"]=zb;zb.i=["com","babylonhx","mesh","csg","Plane"];zb.Bg=function(a,b,c){var d,e=c.x-a.x;d=c.y-a.y;c=c.z-a.z;var f,g,h=b.x-a.x;g=b.y-a.y;f=b.z-a.z;if(0==e*e+d*d+c*c||0==h*h+g*g+f*f)return null;b=
new n(0,0,0);b.x=d*f-c*g;b.y=c*h-e*f;b.z=e*g-d*h;d=new n(0,0,0);d.x=b.x;d.y=b.y;d.z=b.z;d.normalize();return new zb(d,d.x*a.x+d.y*a.y+d.z*a.z)};zb.prototype={clone:function(){var a=this.j;return new zb(new n(a.x,a.y,a.z),this.o)},hl:function(){var a=this.j;a.x*=-1;a.y*=-1;a.z*=-1;this.o=-this.o},lD:function(a,b,c,d,e){for(var f=0,g=[],h=0,k=a.ja.length;h<k;){var l=h++,m=this.j,l=a.ja[l].Zf,m=m.x*l.x+m.y*l.y+m.z*l.z-this.o,m=m<-zb.ue?2:m>zb.ue?1:0,f=f|m;g.push(m)}switch(f){case 0:e=this.j;d=a.qe.j;
(0<e.x*d.x+e.y*d.y+e.z*d.z?b:c).push(a);break;case 1:d.push(a);break;case 2:e.push(a);break;case 3:c=[];b=[];f=0;for(h=a.ja.length;f<h;){var k=f++,m=(k+1)%a.ja.length,l=g[k],n=g[m],k=a.ja[k],m=a.ja[m];2!=l&&c.push(k);1!=l&&b.push(2!=l?k.clone():k);if(3==(l|n)){var l=this.j,n=k.Zf,p=this.j,q=m.Zf,r=k.Zf,k=k.iJ(m,(this.o-(l.x*n.x+l.y*n.y+l.z*n.z))/(p.x*(q.x-r.x)+p.y*(q.y-r.y)+p.z*(q.z-r.z)));c.push(k);b.push(k.clone())}}3<=c.length&&(g=new Pd(c,a.md),null!=g.qe&&d.push(g));3<=b.length&&(a=new Pd(b,
a.md),null!=a.qe&&e.push(a))}},l:zb};q["com.babylonhx.mesh.csg.Polygon"]=Pd;Pd.i=["com","babylonhx","mesh","csg","Polygon"];Pd.prototype={hl:function(){this.ja.reverse();this.ja.map(function(a){a.hl()});this.qe.hl()},l:Pd};q["com.babylonhx.mesh.csg.Vertex"]=Ec;Ec.i=["com","babylonhx","mesh","csg","Vertex"];Ec.prototype={clone:function(){var a=this.Zf,a=new n(a.x,a.y,a.z),b=this.j,b=new n(b.x,b.y,b.z),c=this.hs;return new Ec(a,b,new K(c.x,c.y))},hl:function(){var a=this.j;this.j=new n(-1*a.x,-1*a.y,
-1*a.z)},iJ:function(a,b){var c=n.D(this.Zf,a.Zf,b),d=n.D(this.j,a.j,b),e=this.hs,f=a.hs;return new Ec(c,d,new K(e.x+(f.x-e.x)*b,e.y+(f.y-e.y)*b))},l:Ec};var Hf=J.BABYLON.DecimationTriangle=function(a){this.error=[];this.ov=this.dl=!1;this.An=0;this.ja=a;this.iA=!1};q["com.babylonhx.mesh.simplification.DecimationTriangle"]=Hf;Hf.i=["com","babylonhx","mesh","simplification","DecimationTriangle"];Hf.prototype={l:Hf};var If=J.BABYLON.DecimationVertex=function(a,b){this.id=b;this.position=a;this.Zn=!0;
this.q=new Uc;this.Wh=this.se=0;this.Ov=[]};q["com.babylonhx.mesh.simplification.DecimationVertex"]=If;If.i=["com","babylonhx","mesh","simplification","DecimationVertex"];If.prototype={wM:function(a){var b=this.position;b.x=a.x;b.y=a.y;b.z=a.z},l:If};var fg=J.BABYLON.ISimplificationSettings=function(){};q["com.babylonhx.mesh.simplification.ISimplificationSettings"]=fg;fg.i=["com","babylonhx","mesh","simplification","ISimplificationSettings"];fg.prototype={l:fg};var Jf=J.BABYLON.ISimplifier=function(){};
q["com.babylonhx.mesh.simplification.ISimplifier"]=Jf;Jf.i=["com","babylonhx","mesh","simplification","ISimplifier"];Jf.prototype={l:Jf};var Me=J.BABYLON.QuadraticErrorSimplification=function(){this.Eo=5E3;this.fJ=!1;this.jH=7;this.aI=100};q["com.babylonhx.mesh.simplification.QuadraticErrorSimplification"]=Me;Me.i=["com","babylonhx","mesh","simplification","QuadraticErrorSimplification"];Me.xb=[Jf];Me.prototype={iD:function(a,b){var c=this;this.dJ();yb.Za(this.ta.Ha.length,function(b){c.eJ(b.index,
function(){c.yL(a,b.index,function(){b.zh()})})},function(){ga.Ah(function(){b(c.xc)},0)})},yL:function(a,b,c){function d(a,b){ga.Ah(function(){0==a%5&&e.vM(0==a);for(var c=0,d=e.Ob.length;c<d;){var p=c++;e.Ob[p].ov=!1}var q=1E-9*Math.pow(a+3,e.jH);yb.Ta(e.Ob.length,e.Eo,function(a){var b=e.Ob[(e.Ob.length/2+a)%e.Ob.length|0];if(null!=b&&!(b.error[3]>q||b.dl||b.ov))for(var c=0;3>c;){var d=c++;if(b.error[d]<q){var f=[],h=[];a=b.ja[d];d=b.ja[(d+1)%3];if(a.Zn==d.Zn){var k=new n(0,0,0),l=new n(0,0,0),
m=new K(0,0),p=new ca(0,0,0,1);e.Bn(a,d,k,l,m,p);l=[];if(!(e.rB(a,d,k,f,b.An,l)||e.rB(d,a,k,h,b.An,l)||0>f.indexOf(!0)||0>h.indexOf(!0))){m=[];for(p=0;p<l.length;){var r=l[p];++p;-1==m.indexOf(r)&&(r.iA=!0,m.push(r))}if(0==m.length%2){a.q=d.q.add(a.q);a.wM(k);b=e.ia.length;g=e.ED(a,a,f,g);g=e.ED(a,d,h,g);f=e.ia.length-b;if(f<=a.se){if(0<f)for(h=0,c=f;h<c;)d=h++,e.ia[a.Wh+d]=e.ia[b+d]}else a.Wh=b;a.se=f;break}}}}}},b,function(){return h-g<=f})},0)}var e=this,f=this.Ob.length*a.xC|0,g=0,h=this.Ob.length;
yb.Za(this.aI,function(a){h-g<=f?a.Gq():d(a.index,B(a,a.zh))},function(){ga.Ah(function(){e.eL(b);c()},0)})},eJ:function(a,b,c){null==c&&(c=!1);var d=this;this.ja=[];this.Ob=[];var e=this.ta.Ba("position"),f=this.ta.Bc(),g=this.ta.Ha[a],h=[];yb.Ta(g.Ug,this.Eo/4|0,function(a){a+=g.te;var b=3*a,b=new n(e[b],e[b+1],e[b+2]),f;a:{if(c){f=0;for(var p=d.ja.length;f<p;){var q=f++,r=d.ja[q].position;if(null!=b&&r.x==b.x&&r.y==b.y&&r.z==b.z){f=d.ja[q];break a}}}f=null}null==f&&(f=new If(b,d.ja.length));f.Ov.push(a);
f.id==d.ja.length&&d.ja.push(f);h.push(f.id)},function(){yb.Ta(f.length/3|0,d.Eo,function(a){a=3*(g.Xb/3+a)|0;var b=new Hf([d.ja[h[f[a]-g.te]],d.ja[h[f[a+1]-g.te]],d.ja[h[f[a+2]-g.te]]]);b.GK=a;d.Ob.push(b)},function(){d.Yn(b)})})},Yn:function(a){var b=this;yb.Ta(this.Ob.length,this.Eo,function(a){a=b.Ob[a];var d,e,f;d=a.ja[1].position;var g=a.ja[0].position;f=d.x-g.x;e=d.y-g.y;d=d.z-g.z;var h,k;h=a.ja[2].position;var l=a.ja[0].position;k=h.x-l.x;g=h.y-l.y;h=h.z-l.z;l=new n(0,0,0);l.x=e*h-d*g;l.y=
d*k-f*h;l.z=f*g-e*k;a.j=l.normalize();for(e=0;3>e;)f=e++,d=a.j,g=a.ja[0].position,a.ja[f].q.dH(Uc.Fa(a.j.x,a.j.y,a.j.z,-(d.x*g.x+d.y*g.y+d.z*g.z)))},function(){yb.Ta(b.Ob.length,b.Eo,function(a){a=b.Ob[a];for(var d=0;3>d;){var e=d++;a.error[e]=b.Bn(a.ja[e],a.ja[(e+1)%3])}a.error[3]=Math.min(a.error[0],a.error[1]);a.error[3]=Math.min(a.error[3],a.error[2])},function(){b.fJ=!0;a()})})},eL:function(a){for(var b=[],c=0,d=this.ja.length;c<d;){var e=c++;this.ja[e].se=0}c=0;for(d=this.Ob.length;c<d;)if(e=
c++,!this.Ob[e].dl){for(var e=this.Ob[e],f=0;3>f;){var g=f++;e.ja[g].se=1}b.push(e)}d=this.xc.Ba("position");null==d&&(d=[]);e=this.xc.Ba("normal");null==e&&(e=[]);f=this.xc.Ba("uv");null==f&&(f=[]);g=this.xc.Ba("color");null==g&&(g=[]);for(var h=this.ta.Ba("normal"),k=this.ta.Ba("uv"),l=this.ta.Ba("color"),m=c=0,n=this.ja.length;m<n;){var p=m++,p=this.ja[p];p.id=c;if(0<p.se)for(var q=0,r=p.Ov;q<r.length;){var t=r[q];++q;d.push(p.position.x);d.push(p.position.y);d.push(p.position.z);e.push(h[3*t]);
e.push(h[3*t+1]);e.push(h[3*t+2]);null!=k&&0<k.length?(f.push(k[2*t]),f.push(k[2*t+1])):null!=l&&0<l.length&&(g.push(l[4*t]),g.push(l[4*t+1]),g.push(l[4*t+2]),g.push(l[4*t+3]));++c}}h=this.xc.On();k=this.xc.Qf();l=this.xc.Ha;this.xc.Ha=[];m=this.xc.Bc();n=this.ta.Bc();p=0;for(q=b.length;p<q;)for(var r=p++,r=b[r],t=0,v=[0,1,2];t<v.length;){var A=v[t];++t;var B=r.ja[A].Ov.indexOf(n[r.GK+A]);0>B&&(B=0);m.push(r.ja[A].id+B+k)}this.xc.$j(m);this.xc.Ga("position",d);this.xc.Ga("normal",e);0<f.length&&this.xc.Ga("uv",
f);0<g.length&&this.xc.Ga("color",g);d=this.ta.Ha[a];if(0<a){this.xc.Ha=[];for(a=0;a<l.length;)e=l[a],++a,new Rb(e.wf,e.te,e.Ug,e.Xb,e.Xd,e.ta);new Rb(d.wf,k,c,h,3*b.length,this.xc)}},dJ:function(){this.xc=new S(this.ta.name+"Decimated",this.ta.f);this.xc.ld(this.ta.Gg());this.xc.ck(this.ta.ca);this.xc.hd=!1;this.xc.dg=this.ta.dg},rB:function(a,b,c,d,e,f){e=0;for(var g=a.se;e<g;){var h=e++,k=this.Ob[this.ia[a.Wh+h].zw];if(!k.dl){var l=this.ia[a.Wh+h].QD,m=k.ja[(l+1)%3],l=k.ja[(l+2)%3];if(m==b||l==
b)d[h]=!0,f.push(k);else{m=m.position;m=new n(m.x-c.x,m.y-c.y,m.z-c.z);m=m.normalize();l=l.position;l=new n(l.x-c.x,l.y-c.y,l.z-c.z);l=l.normalize();if(.999<Math.abs(m.x*l.x+m.y*l.y+m.z*l.z))return!0;var p=new n(0,0,0);p.x=m.y*l.z-m.z*l.y;p.y=m.z*l.x-m.x*l.z;p.z=m.x*l.y-m.y*l.x;m=p.normalize();d[h]=!1;h=k.j;if(.2>m.x*h.x+m.y*h.y+m.z*h.z)return!0}}}return!1},ED:function(a,b,c,d){for(var e=0,f=b.se;e<f;){var g=e++,h=this.ia[b.Wh+g],k=this.Ob[h.zw];k.dl||(c[g]&&k.iA?(k.dl=!0,++d):(k.ja[h.QD]=a,k.ov=
!0,k.error[0]=this.Bn(k.ja[0],k.ja[1])+k.An/2,k.error[1]=this.Bn(k.ja[1],k.ja[2])+k.An/2,k.error[2]=this.Bn(k.ja[2],k.ja[0])+k.An/2,k.error[3]=Math.min(k.error[0],k.error[1]),k.error[3]=Math.min(k.error[3],k.error[2]),this.ia.push(h)))}return d},aJ:function(){for(var a=0,b=this.ja.length;a<b;){for(var c=a++,d=[],e=[],c=this.ja[c],f=0,g=c.se;f<g;)for(var h=f++,h=this.Ob[this.ia[c.Wh+h].zw],k=0;3>k;){for(var l=k++,m=0,l=h.ja[l];m<d.length&&e[m]!=l.id;)++m;m==d.length?(d.push(1),e.push(l.id)):d[m]++}c=
0;for(f=d.length;c<f;)g=c++,this.ja[e[g]].Zn=1==d[g]?!0:!1}},vM:function(a){null==a&&(a=!1);if(!a){for(var b=[],c=0,d=this.Ob.length;c<d;){var e=c++;this.Ob[e].dl||b.push(this.Ob[e])}this.Ob=b}b=0;for(c=this.ja.length;b<c;)d=b++,this.ja[d].se=0,this.ja[d].Wh=0;d=0;for(e=this.Ob.length;d<e;)for(var b=d++,b=this.Ob[b],f=0;3>f;)c=f++,c=b.ja[c],c.se++;c=b=0;for(d=this.ja.length;c<d;)e=c++,this.ja[e].Wh=b,b+=this.ja[e].se,this.ja[e].se=0;d=[];e=0;for(f=this.Ob.length;e<f;)for(var g=e++,b=this.Ob[g],h=
0;3>h;){var k=h++,c=b.ja[k];d[c.Wh+c.se]=new Kf(k,g);c.se++}this.ia=d;a&&this.aJ()},ls:function(a,b){var c=b.x,d=b.y,e=b.z;return a.data[0]*c*c+2*a.data[1]*c*d+2*a.data[2]*c*e+2*a.data[3]*c+a.data[4]*d*d+2*a.data[5]*d*e+2*a.data[6]*d+a.data[7]*e*e+2*a.data[8]*e+a.data[9]},Bn:function(a,b,c){var d=a.q.add(b.q),e=a.Zn&&b.Zn,f=d.Tq(0,1,2,1,4,5,2,5,7);if(0==f||e){var e=a.position,f=b.position,e=new n((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2),f=this.ls(d,a.position),g=this.ls(d,b.position),h=this.ls(d,e),d=
Math.min(f,g),d=Math.min(d,h);d==f?null!=c&&(a=a.position,c.x=a.x,c.y=a.y,c.z=a.z):d==g?null!=c&&(a=b.position,c.x=a.x,c.y=a.y,c.z=a.z):null!=c&&(c.x=e.x,c.y=e.y,c.z=e.z)}else null==c&&(c=new n(0,0,0)),c.x=-1/f*d.Tq(1,2,3,4,5,6,5,7,8),c.y=1/f*d.Tq(0,2,3,1,5,6,2,7,8),c.z=-1/f*d.Tq(0,1,3,1,4,6,2,5,8),d=this.ls(d,c);return d},l:Me};var Uc=J.BABYLON.QuadraticMatrix=function(a){this.data=[];if(null!=a)for(var b=0;10>b;){var c=b++;this.data[c]=c<=a.length?a[c]:0}};q["com.babylonhx.mesh.simplification.QuadraticMatrix"]=
Uc;Uc.i=["com","babylonhx","mesh","simplification","QuadraticMatrix"];Uc.Fa=function(a,b,c,d){return[a*a,a*b,a*c,a*d,b*b,b*c,b*d,c*c,c*d,d*d]};Uc.prototype={Tq:function(a,b,c,d,e,f,g,h,k){return this.data[a]*this.data[e]*this.data[k]+this.data[c]*this.data[d]*this.data[h]+this.data[b]*this.data[f]*this.data[g]-this.data[c]*this.data[e]*this.data[g]-this.data[a]*this.data[f]*this.data[h]-this.data[b]*this.data[d]*this.data[k]},dH:function(a){for(var b=0;10>b;){var c=b++;this.data[c]+=a[c]}},add:function(a){for(var b=
new Uc,c=0;10>c;){var d=c++;b.data[d]=this.data[d]+a.data[d]}return b},l:Uc};var Kf=J.BABYLON.Reference=function(a,b){this.QD=a;this.zw=b};q["com.babylonhx.mesh.simplification.Reference"]=Kf;Kf.i=["com","babylonhx","mesh","simplification","Reference"];Kf.prototype={l:Kf};var vf=J.BABYLON.SimplificationQueue=function(){this.gw=!1;this.KG=[]};q["com.babylonhx.mesh.simplification.SimplificationQueue"]=vf;vf.i=["com","babylonhx","mesh","simplification","SimplificationQueue"];vf.prototype={zh:function(){var a=
this.KG.pop();null!=a?(this.gw=!0,this.zL(a)):this.gw=!1},zL:function(a){var b=this;if(a.jP)for(var c=0,d=a.Wr;c<d.length;){var e=[d[c]];++c;this.JA(a).iD(e[0],function(c){return function(d){a.Zc.Hz(c[0].Sb,d);d.hd=!0;c[0].xC==a.Wr[a.Wr.length-1].xC&&null!=a.xw&&a.xw();b.zh()}}(e))}else{var f=this.JA(a),g=function(b,c){f.iD(b,function(d){a.Zc.Hz(b.Sb,d);d.hd=!0;c()})};yb.Za(a.Wr.length,function(b){g(a.Wr[b.index],function(){b.zh()})},function(){null!=a.xw&&a.xw();b.zh()})}},JA:function(a){return new Me(a.Zc)},
l:vf};var gg=J.BABYLON.SimplificationTask=function(){};q["com.babylonhx.mesh.simplification.SimplificationTask"]=gg;gg.i=["com","babylonhx","mesh","simplification","SimplificationTask"];gg.prototype={l:gg};var Ff=J.BABYLON.Particle=function(){this.Xk=this.size=this.Cd=this.Bq=0;this.co=1;this.Nq=new ca(0,0,0,0);this.color=new ca(0,0,0,0);this.direction=new n(0,0,0);this.position=new n(0,0,0)};q["com.babylonhx.particles.Particle"]=Ff;Ff.i=["com","babylonhx","particles","Particle"];Ff.prototype={l:Ff};
var hg=J.BABYLON.IPhysicsEnginePlugin=function(){};q["com.babylonhx.physics.IPhysicsEnginePlugin"]=hg;hg.i=["com","babylonhx","physics","IPhysicsEnginePlugin"];hg.prototype={l:hg};var xf=J.BABYLON.PhysicsEngine=function(a){this.hi=a};q["com.babylonhx.physics.PhysicsEngine"]=xf;xf.i=["com","babylonhx","physics","PhysicsEngine"];xf.prototype={ft:function(a){this.hi.initialize();this.DG(a)},CG:function(a){.1<a?a=.1:0>=a&&(a=.016666666666666666);this.hi.wP(a)},DG:function(a){this.Vn=null!=a?a:new n(0,
-9.82,0);this.hi.CP(this.Vn)},rG:function(a,b,c){return this.hi.sP(a,b,c)},UG:function(a){this.hi.PP(a)},dispose:function(){this.hi.dispose()},isSupported:function(){return null!=this.hi?this.hi.isSupported():!1},l:xf};var Gd=J.BABYLON.BlurPostProcess=function(a,b,c,d,e,f,g,h){null==h&&(h=!1);null==f&&(f=2);var k=this;pa.call(this,a,"blur",["screenSize","direction","blurWidth"],null,d,e,f,g,h);this.direction=b;this.pu=c;this.Ne.add(function(a){var b=k.width,c=k.height;if(a.Jb("screenSize",b,c)){var d=
a.c,e=a.u.get("screenSize");d.b.uniform2f(e,b,c)}b=k.direction;a.Jb("direction",b.x,b.y)&&(c=a.c,d=a.u.get("direction"),c.b.uniform2f(d,b.x,b.y));b=k.pu;c=a.Qa.get("blurWidth");if(null==c||c[0]!=b)a.Qa.set("blurWidth",[b]),c=a.c,a=a.u.get("blurWidth"),c.b.uniform1f(a,b)})};q["com.babylonhx.postprocess.BlurPostProcess"]=Gd;Gd.i=["com","babylonhx","postprocess","BlurPostProcess"];Gd.U=pa;Gd.prototype=F(pa.prototype,{l:Gd});q["com.babylonhx.postprocess.GlowBlurPostProcess"]=Od;Od.i=["com","babylonhx",
"postprocess","GlowBlurPostProcess"];Od.U=pa;Od.prototype=F(pa.prototype,{l:Od});var qf=J.BABYLON.PostProcessManager=function(a){this.ua=new W;this.f=a};q["com.babylonhx.postprocess.PostProcessManager"]=qf;qf.i=["com","babylonhx","postprocess","PostProcessManager"];qf.prototype={Py:function(){var a=this.ua;if(null==(null!=t.position?a.H("position"):a.h.position)){var a=this.ua,b=new Id(this.f.c,[1,1,-1,1,-1,-1,1,-1],"position",!1,!1,2);null!=t.position?a.C("position",b):a.h.position=b;var a=[0,1,
2,0,2,3],b=this.f.c,c=b.b.createBuffer(),c=new ub(c);b.V.get(34963)!=c&&(b.b.bindBuffer(34963,null==c?null:c.buffer),b.V.set(34963,null==c?null:c));var d=null,e=!1;if(b.T.Ul){for(var f=0,g=a.length;f<g;){var h=f++;if(65535<a[h]){e=!0;break}}e?d=new Int32Array(a):d=new Int16Array(a)}else d=new Int16Array(a);b.b.bufferData(34963,d,35044);null!=b.V.get(34963)&&(b.b.bindBuffer(34963,null),b.V.set(34963,null));b.kb=null;c.ia=1;c.Sc=e;this.wa=c}},Qy:function(a){var b=this.f.L.cc;if(0==b.length||!this.f.tC)return!1;
b[0].du(this.f.L,a);return!0},cI:function(a,b){for(var c=this.f.c,d=0,e=a.length;d<e;){var f=d++;if(f<a.length-1)a[f+1].du(this.f.L,b);else if(null!=b)c.bindFramebuffer(b);else{c.pg=null;null!=c.uc&&(c.b.bindFramebuffer(36160,null),c.uc=null);var g=c.af,h=c.Wb(),k=c.Lb(),l=g.x,m=g.y;c.af=g;c.b.viewport(l*h|0,m*k|0,h*g.width|0,k*g.height|0);c.Xl()}f=a[f];g=f.apply();if(null!=g){f.sc.la(g);this.Py();h=this.ua;k=this.wa;if(c.qb!=h||c.Qb!=g)for(c.qb=h,c.Qb=g,p.sa=g.we,l=0,m=p.sa.length;l<m;){var n=l++;
p.g=g.sa[n];0<=p.g&&(n=p.sa[n],p.F=null!=t[n]?h.H(n):h.h[n],null==p.F?c.na[p.g]&&(c.b.disableVertexAttribArray(p.g),c.na[p.g]=!1):(c.na[p.g]||(c.b.enableVertexAttribArray(p.g),c.na[p.g]=!0),n=p.F.R.R,c.vertexAttribPointer(n,p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(c.T.Kc.vertexAttribDivisorANGLE(p.g,1),c.ad.push(p.g),c.td.push(n))))}null!=k&&c.kb!=k&&(c.kb=k,c.V.get(34963)!=k&&(c.b.bindBuffer(34963,null==k?null:k.buffer),c.V.set(34963,null==k?null:k)),c.Ud=k.Sc);c.Ic(!0,0,6);f.Lc.la(g)}}c.G.Re(!0);
c.G.vb(!0)},Xx:function(a,b,c,d){null==c&&(c=0);null==a&&(a=!1);null==d&&(d=this.f.L.cc);if(0!=d.length&&this.f.tC){for(var e=this.f.c,f=0,g=d.length;f<g;){var h=f++;if(h<d.length-1)d[h+1].du(this.f.L,b);else if(null!=b)e.bindFramebuffer(b,c);else{e.pg=null;null!=e.uc&&(e.b.bindFramebuffer(36160,null),e.uc=null);var k=e.af,l=e.Wb(),m=e.Lb(),n=k.x,q=k.y;e.af=k;e.b.viewport(n*l|0,q*m|0,l*k.width|0,m*k.height|0);e.Xl()}if(a)break;h=d[h];k=h.apply();if(null!=k){h.sc.la(k);this.Py();l=this.ua;m=this.wa;
if(e.qb!=l||e.Qb!=k)for(e.qb=l,e.Qb=k,p.sa=k.we,n=0,q=p.sa.length;n<q;){var r=n++;p.g=k.sa[r];0<=p.g&&(r=p.sa[r],p.F=null!=t[r]?l.H(r):l.h[r],null==p.F?e.na[p.g]&&(e.b.disableVertexAttribArray(p.g),e.na[p.g]=!1):(e.na[p.g]||(e.b.enableVertexAttribArray(p.g),e.na[p.g]=!0),r=p.F.R.R,e.vertexAttribPointer(r,p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(e.T.Kc.vertexAttribDivisorANGLE(p.g,1),e.ad.push(p.g),e.td.push(r))))}null!=m&&e.kb!=m&&(e.kb=m,e.V.get(34963)!=m&&(e.b.bindBuffer(34963,null==m?null:
m.buffer),e.V.set(34963,null==m?null:m)),e.Ud=m.Sc);e.Ic(!0,0,6);h.Lc.la(k)}}e.G.Re(!0);e.G.vb(!0)}},dispose:function(){var a=this.ua,a=null!=t.position?a.H("position"):a.h.position;null!=a&&(a.Gf&&a.R.dispose(),a=this.ua,null!=t.position?a.C("position",null):a.h.position=null);null!=this.wa&&(a=this.wa,a.ia--,0==a.ia&&this.f.c.b.deleteBuffer(a.buffer),this.wa=null)},l:qf};q["com.babylonhx.postprocess.StereoscopicInterlacePostProcess"]=ie;ie.i=["com","babylonhx","postprocess","StereoscopicInterlacePostProcess"];
ie.U=pa;ie.prototype=F(pa.prototype,{l:ie});q["com.babylonhx.postprocess.VRDistortionCorrectionPostProcess"]=Nd;Nd.i=["com","babylonhx","postprocess","VRDistortionCorrectionPostProcess"];Nd.U=pa;Nd.prototype=F(pa.prototype,{l:Nd});var ig=J.BABYLON.PostProcessRenderEffect=function(){};q["com.babylonhx.postprocess.renderpipeline.PostProcessRenderEffect"]=ig;ig.i=["com","babylonhx","postprocess","renderpipeline","PostProcessRenderEffect"];ig.prototype={Tf:function(){for(var a=this.cc.keys();a.Ca();){var b=
a.next(),c=this.cc;if(!(null!=t[b]?c.H(b):c.h[b]).Tf())return!1}return!0},ed:function(){for(var a=this.xG.keys();a.Ca();){var b=a.next(),c=this.xG,b=null!=t[b]?c.H(b):c.h[b];b.IN.lc=b.HN}},l:ig,ha:{Tf:"get_isSupported"}};var jg=J.BABYLON.PostProcessRenderPass=function(){};q["com.babylonhx.postprocess.renderpipeline.PostProcessRenderPass"]=jg;jg.i=["com","babylonhx","postprocess","renderpipeline","PostProcessRenderPass"];jg.prototype={l:jg};var kg=J.BABYLON.PostProcessRenderPipeline=function(){};q["com.babylonhx.postprocess.renderpipeline.PostProcessRenderPipeline"]=
kg;kg.i=["com","babylonhx","postprocess","renderpipeline","PostProcessRenderPipeline"];kg.prototype={Tf:function(){for(var a=this.Lt.keys();a.Ca();){var b=a.next(),c=this.Lt;if(!(null!=t[b]?c.H(b):c.h[b]).Tf())return!1}return!0},ed:function(){for(var a=this.Lt.keys();a.Ca();){var b=a.next(),c=this.Lt;(null!=t[b]?c.H(b):c.h[b]).ed()}for(a=this.hF.keys();a.Ca();)if(b=a.next(),c=this.hF,b=(null!=t[b]?c.H(b):c.h[b]).name,c=this.vG,null!=t[b]?c.Id(b):c.h.hasOwnProperty(b))c=this.vG,(null!=t[b]?c.H(b):
c.h[b]).ed()},dispose:function(){},l:kg,ha:{Tf:"get_isSupported"}};var rf=J.BABYLON.PostProcessRenderPipelineManager=function(){this.jq=new W};q["com.babylonhx.postprocess.renderpipeline.PostProcessRenderPipelineManager"]=rf;rf.i=["com","babylonhx","postprocess","renderpipeline","PostProcessRenderPipelineManager"];rf.prototype={update:function(){for(var a=this.jq.keys();a.Ca();){var b=a.next(),c=this.jq,c=null!=t[b]?c.H(b):c.h[b];c.Tf()?c.ed():(c.dispose(),c=this.jq,null!=t[b]?c.C(b,null):c.h[b]=
null,this.jq.remove(b))}},l:rf};var sf=J.BABYLON.BoundingBoxRenderer=function(a){this.ua=new W;this.lc=new Ga(32);this.OL=!0;this.qH=new L(.1,.1,.1);this.CI=new L(1,1,1);this.f=a};q["com.babylonhx.rendering.BoundingBoxRenderer"]=sf;sf.i=["com","babylonhx","rendering","BoundingBoxRenderer"];sf.prototype={oG:function(){if(null==this.sd){this.sd=new rc("colorShader",this.f,"color",{attributes:["position"],wb:["worldViewProjection","color"]});var a=this.f.c,b=I.yh(1),c=this.ua,b=new Id(a,b.Na,"position",
!1);null!=t.position?c.C("position",b):c.h.position=b;c=[0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,7,1,6,2,5,3,4];b=a.b.createBuffer();b=new ub(b);a.V.get(34963)!=b&&(a.b.bindBuffer(34963,null==b?null:b.buffer),a.V.set(34963,null==b?null:b));var d=null,e=!1;if(a.T.Ul){for(var f=0,g=c.length;f<g;){var h=f++;if(65535<c[h]){e=!0;break}}e?d=new Int32Array(c):d=new Int16Array(c)}else d=new Int16Array(c);a.b.bufferData(34963,d,35044);null!=a.V.get(34963)&&(a.b.bindBuffer(34963,null),a.V.set(34963,null));a.kb=null;
b.ia=1;b.Sc=e;this.wa=b}},reset:function(){var a=this.lc;a.length=0;a.Ka++},hb:function(){if(0!=this.lc.length&&(this.oG(),this.sd.pa())){var a=this.f.c;a.G.vb(!1);this.sd.Ct();for(var b=0,c=this.lc.length;b<c;){var d=b++,d=this.lc.data[d],e=d.Gb,f=d.Mb,g,h,k=f.x-e.x;h=f.y-e.y;g=f.z-e.z;var l,m,f=.5*k;l=.5*h;m=.5*g;f=e.x+f;l=e.y+l;e=e.z+m;m=new r;m.a[0]=0;m.a[1]=0;m.a[2]=0;m.a[3]=0;m.a[4]=0;m.a[5]=0;m.a[6]=0;m.a[7]=0;m.a[8]=0;m.a[9]=0;m.a[10]=0;m.a[11]=0;m.a[12]=0;m.a[13]=0;m.a[14]=0;m.a[15]=0;m.a[0]=
k;m.a[1]=0;m.a[2]=0;m.a[3]=0;m.a[4]=0;m.a[5]=h;m.a[6]=0;m.a[7]=0;m.a[8]=0;m.a[9]=0;m.a[10]=g;m.a[11]=0;m.a[12]=0;m.a[13]=0;m.a[14]=0;m.a[15]=1;h=m;k=new r;k.a[0]=1;k.a[1]=0;k.a[2]=0;k.a[3]=0;k.a[4]=0;k.a[5]=1;k.a[6]=0;k.a[7]=0;k.a[8]=0;k.a[9]=0;k.a[10]=1;k.a[11]=0;k.a[12]=0;k.a[13]=0;k.a[14]=0;k.a[15]=1;r.aa(1,0,0,0,1,0,0,0,1,f,l,e,k);f=new r;h.qa(k,f.a,0);d=d.Ea;h=new r;f.qa(d,h.a,0);d=h;f=this.ua;h=this.wa;k=this.sd.s;if(a.qb!=f||a.Qb!=k)for(a.qb=f,a.Qb=k,p.sa=k.we,l=0,g=p.sa.length;l<g;)e=l++,
p.g=k.sa[e],0<=p.g&&(e=p.sa[e],p.F=null!=t[e]?f.H(e):f.h[e],null==p.F?a.na[p.g]&&(a.b.disableVertexAttribArray(p.g),a.na[p.g]=!1):(a.na[p.g]||(a.b.enableVertexAttribArray(p.g),a.na[p.g]=!0),e=p.F.R.R,a.vertexAttribPointer(e,p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(a.T.Kc.vertexAttribDivisorANGLE(p.g,1),a.ad.push(p.g),a.td.push(e))));null!=h&&a.kb!=h&&(a.kb=h,a.V.get(34963)!=h&&(a.b.bindBuffer(34963,null==h?null:h.buffer),a.V.set(34963,null==h?null:h)),a.Ud=h.Sc);this.OL&&(a.G.bk(518),this.f.$e=
null,f=this.sd,h=this.qH,h=new ca(h.r,h.v,h.m,1),-1==f.Da.wb.indexOf("color")&&f.Da.wb.push("color"),f.Zg.set("color",h),this.sd.bind(d),a.Ic(!1,0,24));a.G.bk(513);this.f.$e=null;f=this.sd;h=this.CI;h=new ca(h.r,h.v,h.m,1);-1==f.Da.wb.indexOf("color")&&f.Da.wb.push("color");f.Zg.set("color",h);this.sd.bind(d);a.Ic(!1,0,24)}this.sd.Io();a.G.bk(515);a.G.vb(!0)}},dispose:function(){if(null!=this.sd){this.sd.dispose();var a=this.ua,a=null!=t.position?a.H("position"):a.h.position;null!=a&&(a.Gf&&a.R.dispose(),
a=this.ua,null!=t.position?a.C("position",null):a.h.position=null);a=this.wa;a.ia--;0==a.ia&&this.f.c.b.deleteBuffer(a.buffer)}},l:sf};var lg=J.BABYLON.DepthRenderer=function(){};q["com.babylonhx.rendering.DepthRenderer"]=lg;lg.i=["com","babylonhx","rendering","DepthRenderer"];lg.prototype={dispose:function(){this.zF.dispose()},l:lg};q["com.babylonhx.rendering.EdgesRenderer"]=bf;bf.i=["com","babylonhx","rendering","EdgesRenderer"];bf.xb=[$a];bf.prototype={dispose:function(){var a=this.JN;a.Gf&&a.R.dispose();
a=this.KN;a.Gf&&a.R.dispose();a=this.QF;a.ia--;0==a.ia&&this.dn.f.c.b.deleteBuffer(a.buffer);this.fh.dispose()},hb:function(){if(this.fh.pa()){var a=this.dn.f,b=a.c;this.fh.Ct();var c=this.bF,d=this.QF,e=this.fh.s;if(b.qb!=c||b.Qb!=e){b.qb=c;b.Qb=e;p.sa=e.we;for(var f=0,g=p.sa.length;f<g;){var h=f++;p.g=e.sa[h];0<=p.g&&(h=p.sa[h],p.F=null!=t[h]?c.H(h):c.h[h],null==p.F?b.na[p.g]&&(b.b.disableVertexAttribArray(p.g),b.na[p.g]=!1):(b.na[p.g]||(b.b.enableVertexAttribArray(p.g),b.na[p.g]=!0),h=p.F.R.R,
b.vertexAttribPointer(h,p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(b.T.Kc.vertexAttribDivisorANGLE(p.g,1),b.ad.push(p.g),b.td.push(h))))}}null!=d&&b.kb!=d&&(b.kb=d,b.V.get(34963)!=d&&(b.b.bindBuffer(34963,null==d?null:d.buffer),b.V.set(34963,null==d?null:d)),b.Ud=d.Sc);a.$e=null;c=this.fh;d=this.dn.Ju;-1==c.Da.wb.indexOf("color")&&c.Da.wb.push("color");c.Zg.set("color",d);1==a.L.mode?(c=this.fh,d=this.dn.Vq/this.iI):(c=this.fh,d=this.dn.Vq/this.jI);-1==c.Da.wb.indexOf("width")&&c.Da.wb.push("width");
c.ji.set("width",d);c=this.fh;a=b.ll(a.L);-1==c.Da.wb.indexOf("aspectRatio")&&c.Da.wb.push("aspectRatio");c.ji.set("aspectRatio",a);this.fh.bind(this.dn.va());b.Ic(!0,0,this.CN);this.fh.Io();b.G.vb(!0)}},l:bf};var tf=J.BABYLON.OutlineRenderer=function(a){this.f=a};q["com.babylonhx.rendering.OutlineRenderer"]=tf;tf.i=["com","babylonhx","rendering","OutlineRenderer"];tf.prototype={hb:function(a,b,c){null==c&&(c=!1);var d=this,e=this.f,f=this.f.c,g=null!=f.T.Kc&&null!=b.Nd[a.eb];if(this.pa(a,g)){var h=
a.ph,k=a.Of(),l=this.s,m=l.zd;f.vc!=m&&(f.b.useProgram(m),f.vc=m);f.Ff=l;null!=l.Tc&&l.Tc(l);l=this.s;f=c?0:h.outlineWidth;m=l.Qa.get("offset");if(null==m||m[0]!=f)l.Qa.set("offset",[f]),m=l.c,l=l.u.get("offset"),m.b.uniform1f(l,f);l=this.s;f=c?h.Qv:h.outlineColor;c=c?h.Pv:1;l.Oa("color",f.r,f.v,f.m,c)&&(m=l.c,l=l.u.get("color"),m.b.uniform4f(l,f.r,f.v,f.m,c));c=this.s;e=e.sb;c.Wa("viewProjection",e)&&(f=c.c,c=c.u.get("viewProjection"),f.b.uniformMatrix4fv(c,!1,e.a));h.Hg()&&h.nf&&(e=this.s,c=h.gd(),
c.Pi&&null!=h.ee?c=h.ee:(null==c.Fe&&c.Hl(),c=c.Fe),e.Qa.set("mBones",null),f=e.c,e=e.u.get("mBones"),f.b.uniformMatrix4fv(e,!1,c));h.wp(a,this.s,0);null!=k&&k.Yf()&&(e=k.br(),this.s.Hb("diffuseSampler",e),k=this.s,e=e.Le(),k.Wa("diffuseMatrix",e)&&(c=k.c,k=k.u.get("diffuseMatrix"),c.b.uniformMatrix4fv(k,!1,e.a)));h.Gt(a,this.s,0,b,g,function(a,b){var c=d.s;if(c.Wa("world",b)){var e=c.c,c=c.u.get("world");e.b.uniformMatrix4fv(c,!1,b.a)}})}},pa:function(a,b){var c=[],d=["position","normal"],e=a.ta,
f=a.Of();null!=f&&f.Yf()&&(c.push("#define ALPHATEST"),e.fb("uv")&&(d.push("uv"),c.push("#define UV1")),e.fb("uv2")&&(d.push("uv2"),c.push("#define UV2")));e.Hg()&&e.nf?(d.push("matricesIndices"),d.push("matricesWeights"),4<e.Me&&(d.push("matricesIndicesExtra"),d.push("matricesWeightsExtra")),c.push("#define NUM_BONE_INFLUENCERS "+e.Me),c.push("#define BonesPerMesh "+(e.gd().Ie.length+1))):c.push("#define NUM_BONE_INFLUENCERS 0");b&&(c.push("#define INSTANCES"),d.push("world0"),d.push("world1"),d.push("world2"),
d.push("world3"));c=c.join("\n");this.Yg!=c&&(this.Yg=c,this.s=this.f.c.Aj("outline",d,"world mBones viewProjection diffuseMatrix offset color".split(" "),["diffuseSampler"],c));return this.s.Nc},l:tf};var Oa=J.BABYLON.RenderingGroup=function(a,b,c,d,e){this.bm=new Ga;this.Vk=new Ga;this.Pm=new Ga;this.f=b;this.index=a;this.ZC(c);this.TC(d);this.bD(e)};q["com.babylonhx.rendering.RenderingGroup"]=Oa;Oa.i=["com","babylonhx","rendering","RenderingGroup"];Oa.D=function(a,b,c,d){for(var e,f=0,g=a.length;f<
g;){e=f++;e=a.data[e];e.sp=e.ta.Yk;var h,k,l;h=(e.Rf()?e.ta.fd():e.ra).Pc.Hc;l=h.x-c.x;k=h.y-c.y;h=h.z-c.z;e.Gp=Math.sqrt(l*l+k*k+h*h)}a=a.data.slice(0,a.length);a.sort(b);b=0;for(c=a.length;b<c;)e=b++,e=a[e],e.ph.hb(e,d)};Oa.Za=function(a){for(var b=0,c=a.length;b<c;){var d=b++,d=a.data[d];d.ph.hb(d,!1)}};Oa.Pb=function(a,b){return a.sp>b.sp?1:a.sp<b.sp?-1:Oa.Ib(a,b)};Oa.Ib=function(a,b){return a.Gp<b.Gp?1:a.Gp>b.Gp?-1:0};Oa.prototype={ZC:function(a){this.lG=a;null!=a?this.Zy=B(this,this.sL):this.Zy=
Oa.Za;return a},TC:function(a){this.VE=a;null!=a?this.Vy=B(this,this.pL):this.Vy=Oa.Za;return a},bD:function(a){null!=a?this.sz=a:this.sz=Oa.Pb;this.zG=B(this,this.vL);return a},hb:function(a){if(null!=a)return a(this.Pm,this.bm,this.Vk),!0;if(0==this.Pm.length&&0==this.bm.length&&0==this.Vk.length)return null!=this.lo&&this.lo(),!1;a=this.f.c;this.Zy(this.Pm);a.Bs=!0;this.Vy(this.bm);a.Bs=!1;null!=this.lo&&this.lo();0<this.Vk.length&&(this.zG(this.Vk),0!=a.bb&&(a.J.za(!1),a.G.vb(!0),a.bb=0));return!0},
sL:function(a){Oa.D(a,this.lG,this.f.L.Dh(),!1)},pL:function(a){Oa.D(a,this.VE,this.f.L.Dh(),!1)},vL:function(a){Oa.D(a,this.sz,this.f.L.Dh(),!0)},l:Oa,ha:{bD:"set_transparentSortCompareFn",TC:"set_alphaTestSortCompareFn",ZC:"set_opaqueSortCompareFn"}};var mg=J.BABYLON.Sprite=function(){this.ln=0;this.AF=1;this.MF=this.RG=this.Sx=0;this.nJ=this.oJ=this.vr=this.jx=this.dG=!1;this.Cd=this.cellIndex=0;this.width=this.height=1;this.color=new ca(1,1,1,1)};q["com.babylonhx.sprites.Sprite"]=mg;mg.i=["com",
"babylonhx","sprites","Sprite"];mg.prototype={dispose:function(){for(var a=0,b=this.zy.dk.length;a<b;){var c=a++;this.zy.dk[c]==this&&this.zy.dk.splice(c,1)}},l:mg};var ng=J.BABYLON.SpriteManager=function(){this.ua=new W;this.Nb=new R;this.vr=!1;this.qf=!0;this.tb=268435455;this.dg=0;this.dk=[]};q["com.babylonhx.sprites.SpriteManager"]=ng;ng.i=["com","babylonhx","sprites","SpriteManager"];ng.prototype={up:function(a,b,c,d,e){a*=16;0==c?c=this.Vs:1==c&&(c=1-this.Vs);0==d?d=this.Vs:1==d&&(d=1-this.Vs);
this.ga[a]=b.position.x;this.ga[a+1]=b.position.y;this.ga[a+2]=b.position.z;this.ga[a+3]=b.Cd;this.ga[a+4]=b.width;this.ga[a+5]=b.height;this.ga[a+6]=c;this.ga[a+7]=d;this.ga[a+8]=b.nJ?1:0;this.ga[a+9]=b.oJ?1:0;c=b.cellIndex/e|0;this.ga[a+10]=b.cellIndex-c*e;this.ga[a+11]=c;this.ga[a+12]=b.color.r;this.ga[a+13]=b.color.v;this.ga[a+14]=b.color.m;this.ga[a+15]=b.color.W},Ki:function(a,b,c,d){null==d&&(d=!1);var e=Math.min(this.bj,this.dk.length)|0,f=new n(0,0,0),g=new n(0,0,0),h=Infinity,k=null,l,m,
p;b=b.rf();for(var q=0;q<e;){var r=q++,r=this.dk[r];if(null!=r){if(null!=c){if(!c(r))continue}else if(!r.vr)continue;l=r.position;m=l.x;p=l.y;var t=l.z,v=b.a,z=m*v[1]+p*v[5]+t*v[9]+v[13];l=m*v[2]+p*v[6]+t*v[10]+v[14];var A=m*v[3]+p*v[7]+t*v[11]+v[15];p=(m*v[0]+p*v[4]+t*v[8]+v[12])/A;m=z/A;l/=A;f.x=p-r.width/2;f.y=m-r.height/2;f.z=l;g.x=p+r.width/2;g.y=m+r.height/2;g.z=l;if(a.rr(f,g)&&(A=a.origin,p-=A.x,m-=A.y,l-=A.z,l=Math.sqrt(p*p+m*m+l*l),h>l&&(h=l,k=r,d)))break}}return null!=k?(a=new Cd,a.uf=!0,
a.Zb=k,a.Sb=h,a):null},hb:function(){if(this.DF.Nc&&this.EF.Nc&&null!=this.Qk&&this.Qk.pa()){for(var a=this.f.c,b=this.Qk.GI(),c=a.el,d=Math.min(this.bj,this.dk.length),e=b.width/this.GH,f=0,g=0;g<d;){var h=g++,h=this.dk[h];null!=h&&(h.jx&&(h.ln+=c,h.ln>h.Sx&&(h.ln%=h.Sx,h.cellIndex+=h.AF,h.cellIndex==h.RG&&(h.dG?h.cellIndex=h.MF:(h.jx=!1,h.ZN&&h.dispose())))),this.up(f++,h,0,0,e),this.up(f++,h,1,0,e),this.up(f++,h,1,1,e),this.up(f++,h,0,1,e))}this.R.create(this.ga);c=this.DF;this.f.qf&&this.f.Fj!=
Aa.g&&this.qf&&(c=this.EF);e=c.zd;a.vc!=e&&(a.b.useProgram(e),a.vc=e);a.Ff=c;null!=c.Tc&&c.Tc(c);e=this.f.Aa;c.Hb("diffuseSampler",this.Qk);c.Wa("view",e)&&(f=c.c,g=c.u.get("view"),f.b.uniformMatrix4fv(g,!1,e.a));e=this.f.Va;c.Wa("projection",e)&&(f=c.c,g=c.u.get("projection"),f.b.uniformMatrix4fv(g,!1,e.a));e=this.GH/b.width;b=this.VN/b.height;c.Jb("textureInfos",e,b)&&(f=c.c,g=c.u.get("textureInfos"),f.b.uniform2f(g,e,b));this.f.qf&&this.f.Fj!=Aa.g&&this.qf&&(b=this.f.Fj,e=this.f.AA,f=this.f.zA,
g=this.f.yA,c.Oa("vFogInfos",b,e,f,g)&&c.c.Ub(c.u.get("vFogInfos"),b,e,f,g),b=this.f.xA,c.xe("vFogColor",b.r,b.v,b.m)&&(e=c.c,f=c.u.get("vFogColor"),e.b.uniform3f(f,b.r,b.v,b.m)));b=this.ua;e=this.wa;if(a.qb!=b||a.Qb!=c)for(a.qb=b,a.Qb=c,p.sa=c.we,f=0,g=p.sa.length;f<g;)h=f++,p.g=c.sa[h],0<=p.g&&(h=p.sa[h],p.F=null!=t[h]?b.H(h):b.h[h],null==p.F?a.na[p.g]&&(a.b.disableVertexAttribArray(p.g),a.na[p.g]=!1):(a.na[p.g]||(a.b.enableVertexAttribArray(p.g),a.na[p.g]=!0),h=p.F.R.R,a.vertexAttribPointer(h,
p.g,p.F.Db,5126,!1,4*p.F.Bd,4*p.F.Cb),p.F.R.ge&&(a.T.Kc.vertexAttribDivisorANGLE(p.g,1),a.ad.push(p.g),a.td.push(h))));null!=e&&a.kb!=e&&(a.kb=e,a.V.get(34963)!=e&&(a.b.bindBuffer(34963,null==e?null:e.buffer),a.V.set(34963,null==e?null:e)),a.Ud=e.Sc);a.G.bk(515);b=c.Qa.get("alphaTest");if(null==b||1!=b[0])c.Qa.set("alphaTest",[1]),b=c.c,e=c.u.get("alphaTest"),b.b.uniform1i(e,1);a.b.colorMask(!1,!1,!1,!1);a.Ic(!0,0,6*d);a.b.colorMask(!0,!0,!0,!0);b=c.Qa.get("alphaTest");if(null==b||0!=b[0])c.Qa.set("alphaTest",
[0]),b=c.c,c=c.u.get("alphaTest"),b.b.uniform1i(c,0);2!=a.bb&&(a.J.Ya(770,771,1,1),a.J.za(!0),a.G.vb(!1),a.bb=2);a.Ic(!0,0,6*d);0!=a.bb&&(a.J.za(!1),a.G.vb(!0),a.bb=0)}},dispose:function(){null!=this.R&&(this.R.dispose(),this.R=null);if(null!=this.wa){var a=this.wa;a.ia--;0==a.ia&&this.f.c.b.deleteBuffer(a.buffer);this.wa=null}null!=this.Qk&&(this.Qk.dispose(),this.Qk=null);Q.remove(this.f.gg,this);this.Nb.la(this);this.Nb.clear()},l:ng};var mf=J.BABYLON._AlphaState=function(){this.rd=[];this.sm=
this.tm=this.rp=!1};q["com.babylonhx.states._AlphaState"]=mf;mf.i=["com","babylonhx","states","_AlphaState"];mf.prototype={Qn:function(){return this.sm?!0:this.tm},za:function(a){if(this.rp==a)return a;this.rp=a;this.sm=!0;return a},Ya:function(a,b,c,d){if(this.rd[0]!=a||this.rd[1]!=b||this.rd[2]!=c||this.rd[3]!=d)this.rd[0]=a,this.rd[1]=b,this.rd[2]=c,this.rd[3]=d,this.tm=!0},reset:function(){this.rp=!1;this.rd[0]=-1;this.rd[1]=-1;this.rd[2]=-1;this.rd[3]=-1;this.sm=!0;this.tm=!1},apply:function(a){this.Qn()&&
(this.sm&&(this.rp?a.enable(3042):a.disable(3042),this.sm=!1),this.tm&&(a.blendFuncSeparate(this.rd[0],this.rd[1],this.rd[2],this.rd[3]),this.tm=!1))},l:mf,ha:{za:"set_alphaBlend",Qn:"get_isDirty"}};var nf=J.BABYLON._DepthCullingState=function(){this.xq=0;this.ym=this.xm=this.wm=this.vm=this.um=this.Em=!1;this.reset()};q["com.babylonhx.states._DepthCullingState"]=nf;nf.i=["com","babylonhx","states","_DepthCullingState"];nf.prototype={Qn:function(){return this.wm||this.ym||this.xm||this.vm||this.um?
!0:this.Em},gv:function(){return this.xq},Qh:function(a){if(this.xq==a)return a;this.xq=a;this.Em=!0;return a},Fg:function(){return this.Ls},mw:function(a){if(this.Ls==a)return a;this.Ls=a;this.vm=!0;return a},Sf:function(){return this.Ks},fg:function(a){if(this.Ks==a)return a;this.Ks=a;this.um=!0;return a},PA:function(){return this.Ps},bk:function(a){if(this.Ps==a)return a;this.Ps=a;this.wm=!0;return a},gr:function(){return this.Qs},vb:function(a){if(this.Qs==a)return a;this.Qs=a;this.xm=!0;return a},
QA:function(){return this.Ss},Re:function(a){if(this.Ss==a)return a;this.Ss=a;this.ym=!0;return a},reset:function(){this.Ss=this.Qs=!0;this.Ks=this.Ls=this.Ps=null;this.xq=0;this.xm=this.ym=!0;this.Em=this.um=this.vm=this.wm=!1},apply:function(a){this.Qn()&&(this.um&&(null!=this.Sf()&&this.Sf()?a.enable(2884):a.disable(2884),this.um=!1),this.vm&&(a.cullFace(this.Fg()),this.vm=!1),this.xm&&(a.depthMask(this.gr()),this.xm=!1),this.ym&&(this.QA()?a.enable(2929):a.disable(2929),this.ym=!1),this.wm&&(a.depthFunc(this.PA()),
this.wm=!1),this.Em&&(0!=this.gv()?(a.enable(32823),a.polygonOffset(this.gv(),0)):a.disable(32823),this.Em=!1))},l:nf,ha:{Re:"set_depthTest",QA:"get_depthTest",vb:"set_depthMask",gr:"get_depthMask",bk:"set_depthFunc",PA:"get_depthFunc",fg:"set_cull",Sf:"get_cull",mw:"set_cullFace",Fg:"get_cullFace",Qh:"set_zOffset",gv:"get_zOffset",Qn:"get_isDirty"}};q["com.babylonhx.states._StencilState"]=af;af.i=["com","babylonhx","states","_StencilState"];af.prototype={Ur:function(a){if(this.fn==a)return a;this.fn=
a;this.Ck=!0;return a},$C:function(a){if(this.rq==a)return a;this.rq=a;this.Ck=!0;return a},pw:function(a){if(this.gn==a)return a;this.gn=a;this.Bm=!0;return a},yo:function(a){if(this.Rk==a)return a;this.Rk=a;this.Cm=!0;return a},apply:function(a){if(this.Cm||this.Bm||this.Ck||this.Wp)this.Cm&&(this.Rk?a.enable(2960):a.disable(2960),this.Cm=!1),this.Bm&&(a.stencilMask(this.gn),this.Bm=!1),this.Ck&&(a.stencilFunc(this.fn,this.rq,this.oz),this.Ck=!1),this.Wp&&(a.stencilOp(this.rz,this.pz,this.qz),this.Wp=
!1)},l:af,ha:{yo:"set_stencilTest",pw:"set_stencilMask",$C:"set_stencilFuncRef",Ur:"set_stencilFunc"}};var yb=J.BABYLON.AsyncLoop=function(a,b,c,d){null==d&&(d=0);this.qJ=a;this.KF=b;this.OG=c;this.index=d-1;this.Wx=!1};q["com.babylonhx.tools.AsyncLoop"]=yb;yb.i=["com","babylonhx","tools","AsyncLoop"];yb.Za=function(a,b,c){var d;null==d&&(d=0);(new yb(a,b,c,d)).zh()};yb.Ta=function(a,b,c,d,e){var f;null==f&&(f=0);yb.Za(Math.ceil(a/b),function(d){null!=e&&e()?d.Gq():ga.Ah(function(){for(var f=0;f<
b;){var k=f++,k=d.index*b+k;if(k>=a)break;c(k);if(null!=e&&e()){d.Gq();break}}d.zh()},f)},d)};yb.prototype={zh:function(){this.Wx||(this.index+1<this.qJ?(++this.index,this.KF(this)):this.Gq())},Gq:function(){this.Wx=!0;this.OG()},l:yb};q["com.babylonhx.tools.EventState"]=$e;$e.i=["com","babylonhx","tools","EventState"];$e.prototype={l:$e};q["com.babylonhx.tools.Observable"]=R;R.i=["com","babylonhx","tools","Observable"];R.prototype={add:function(a,b,c){null==c&&(c=!1);null==b&&(b=-1);if(null==a)return null;
a=new Ze(a,b);c?this.tg.unshift(a):this.tg.push(a);return a},remove:function(a){a=this.tg.indexOf(a);return-1!=a?(this.tg.splice(a,1),!0):!1},iL:function(a){for(var b=0,c=this.tg.length;b<c;){var d=b++;if(this.tg[d].Uz==a)return this.tg.splice(d,1),!0}return!1},la:function(a,b){null==b&&(b=-1);var c;null!=R.So?(c=R.So,c.Cv=b,c.jD=!1):c=new $e(b);R.So=null;for(var d=0,e=this.tg;d<e.length;){var f=e[d];++d;0!=(f.Cv&b)&&f.Uz(a,c);if(c.jD)break}R.So=c},Fh:function(){return 0<this.tg.length},clear:function(){this.tg=
[]},l:R};q["com.babylonhx.tools.Observer"]=Ze;Ze.i=["com","babylonhx","tools","Observer"];Ze.prototype={l:Ze};var Ga=J.BABYLON.SmartArray=function(){this.length=this.Ka=0;this.data=[];this.eb=Ga.$a++};q["com.babylonhx.tools.SmartArray"]=Ga;Ga.i=["com","babylonhx","tools","SmartArray"];Ga.prototype={ag:function(a){if(a.yb[this.eb]==this.Ka)return!1;this.data[this.length++]=a;a.yb[this.eb]=this.Ka;return!0},l:Ga};var zf=J.BABYLON.SmartCollection=function(){this.count=0;this.items=new Ob;this.ba=[]};
q["com.babylonhx.tools.SmartCollection"]=zf;zf.i=["com","babylonhx","tools","SmartCollection"];zf.prototype={add:function(a,b){if(null!=this.items.h[a.Ef])return-1;this.items.set(a,b);this.ba[this.count++]=a;return this.count},item:function(a){return null!=a?this.items.h[a.Ef]:null},dr:function(a){return a<this.count&&-1<a?this.items.h[this.ba[a].Ef]:null},empty:function(){0<this.count&&(this.count=0,this.items=new Ob,this.ba=[])},l:zf};q["com.babylonhx.tools.StringDictionary"]=Rf;Rf.i=["com","babylonhx",
"tools","StringDictionary"];Rf.prototype={l:Rf};q["com.babylonhx.tools.Ts2Hx"]=Yb;Yb.i=["com","babylonhx","tools","Ts2Hx"];Yb.pE=function(a){return 0!=a?a==a:!1};Yb.nE=function(a){return 0!=a?a==a:!1};Yb.lE=function(a){return X.hE(a)&&("string"!=typeof a||0<v.g(a,String).length)||"boolean"==typeof a&&1==v.g(a,xg)||"number"==typeof a&&(a|0)===a&&Yb.pE(v.g(a,qg))?!0:"number"==typeof a?Yb.nE(v.g(a,yg)):!1};q["com.babylonhx.utils.Image"]=Ye;Ye.i=["com","babylonhx","utils","Image"];Ye.prototype={l:Ye};
q["com.babylonhx.utils.Keycodes"]=Qf;Qf.i=["com","babylonhx","utils","Keycodes"];Qf.Vc=function(a){if(0!=(a&1073741824))return Ca.Vc(a&-1073741825);switch(a){case 8:return Ca.Vc(42);case 9:return Ca.Vc(43);case 13:return Ca.Vc(40);case 27:return Ca.Vc(41);case 32:return Ca.Vc(44);case 127:return Ca.Vc(76);default:var b=new Xe;b.vs+=String.fromCharCode(a);return b.vs}};q["com.babylonhx.utils.Scancodes"]=Ca;Ca.i=["com","babylonhx","utils","Scancodes"];Ca.Vc=function(a){var b=null;0<=a&&a<Ca.Vw.length&&
(b=Ca.Vw[a]);return null!=b?b:""};q["haxe.IMap"]=hd;hd.i=["haxe","IMap"];hd.prototype={l:hd};q["haxe.Timer"]=vb;vb.i=["haxe","Timer"];vb.aa=function(a,b){var c=new vb(b);c.fw=function(){c.stop();a()}};vb.prototype={stop:function(){null!=this.id&&(clearInterval(this.id),this.id=null)},fw:function(){},l:vb};q["haxe.Utf8"]=Xe;Xe.i=["haxe","Utf8"];Xe.prototype={l:Xe};q["haxe.io.Bytes"]=Cb;Cb.i=["haxe","io","Bytes"];Cb.Ec=function(a){return new Cb(new Lf(a))};Cb.ya=function(a){for(var b=[],c=0;c<a.length;){var d=
a.charCodeAt(c++);55296<=d&&56319>=d&&(d=d-55232<<10|a.charCodeAt(c++)&1023);127>=d?b.push(d):(2047>=d?b.push(192|d>>6):(65535>=d?b.push(224|d>>12):(b.push(240|d>>18),b.push(128|d>>12&63)),b.push(128|d>>6&63)),b.push(128|d&63))}return new Cb((new Ka(b)).buffer)};Cb.Pb=function(a){var b=a.ZI;return null!=b?b:new Cb(a)};Cb.Vc=function(a,b){return a.EH[b]};Cb.prototype={QI:function(a,b){if(0>a||0>b||a+b>this.length)throw new ja(kb.ss);for(var c="",d=this.m,e=String.fromCharCode,f=a,g=a+b;f<g;){var h=
d[f++];if(128>h){if(0==h)break;c+=e(h)}else if(224>h)c+=e((h&63)<<6|d[f++]&127);else if(240>h)var k=d[f++],c=c+e((h&31)<<12|(k&127)<<6|d[f++]&127);else var k=d[f++],l=d[f++],h=(h&15)<<18|(k&127)<<12|(l&127)<<6|d[f++]&127,c=c+e((h>>10)+55232),c=c+e(h&1023|56320)}return c},toString:function(){return this.QI(0,this.length)},l:Cb};q["haxe.crypto.BaseCode"]=We;We.i=["haxe","crypto","BaseCode"];We.prototype={nI:function(a){for(var b=this.ZJ,c=this.rH,d=8*a.length/b|0,e=new Cb(new Lf(d+(0==8*a.length%b?
0:1))),f=0,g=0,h=(1<<b)-1,k=0,l=0;l<d;){for(;g<b;)g+=8,f<<=8,f|=a.m[k++];g-=b;e.m[l++]=c.m[f>>g&h]&255}0<g&&(e.m[l++]=c.m[f<<b-g&h]&255);return e},l:We};q["haxe.ds.IntMap"]=sc;sc.i=["haxe","ds","IntMap"];sc.xb=[hd];sc.prototype={set:function(a,b){this.h[a]=b},get:function(a){return this.h[a]},keys:function(){var a=[],b;for(b in this.h)this.h.hasOwnProperty(b)&&a.push(b|0);return Q.Sw(a)},l:sc};q["haxe.ds.ObjectMap"]=Ob;Ob.i=["haxe","ds","ObjectMap"];Ob.xb=[hd];Ob.$P=function(a){return a.Ef=++Ob.count};
Ob.kN=function(a){return a.Ef};Ob.prototype={set:function(a,b){var c=a.Ef||(a.Ef=++Ob.count);this.h[c]=b;this.h.RE[c]=a},get:function(a){return this.h[a.Ef]},l:Ob};q["haxe.ds._StringMap.StringMapIterator"]=he;he.i=["haxe","ds","_StringMap","StringMapIterator"];he.prototype={Ca:function(){return this.index<this.count},next:function(){var a=this.map,b=this.keys[this.index++];return null!=t[b]?a.H(b):a.h[b]},l:he};q["haxe.ds.StringMap"]=W;W.i=["haxe","ds","StringMap"];W.xb=[hd];W.prototype={set:function(a,
b){null!=t[a]?this.C(a,b):this.h[a]=b},get:function(a){return null!=t[a]?this.H(a):this.h[a]},C:function(a,b){null==this.eg&&(this.eg={});this.eg["$"+a]=b},H:function(a){return null==this.eg?null:this.eg["$"+a]},Id:function(a){return null==this.eg?!1:this.eg.hasOwnProperty("$"+a)},remove:function(a){if(null!=t[a]){a="$"+a;if(null==this.eg||!this.eg.hasOwnProperty(a))return!1;delete this.eg[a]}else{if(!this.h.hasOwnProperty(a))return!1;delete this.h[a]}return!0},keys:function(){return Q.Sw(this.mu())},
mu:function(){var a=[],b;for(b in this.h)this.h.hasOwnProperty(b)&&a.push(b);if(null!=this.eg)for(b in this.eg)36==b.charCodeAt(0)&&a.push(b.substr(1));return a},l:W};var kb={$i:!0,bx:["Blocked","Overflow","OutsideBounds","Custom"],Tw:["Blocked",0]};kb.Tw.toString=wb;kb.Tw.jb=kb;kb.Xw=["Overflow",1];kb.Xw.toString=wb;kb.Xw.jb=kb;kb.ss=["OutsideBounds",2];kb.ss.toString=wb;kb.ss.jb=kb;kb.cN=function(a){a=["Custom",3,a];a.jb=kb;a.toString=wb;return a};q["haxe.io.FPHelper"]=ge;ge.i=["haxe","io","FPHelper"];
ge.SM=function(a){var b=a>>>23&255,c=a&8388607;return 0==c&&0==b?0:(1-(a>>>31<<1))*(1+Math.pow(2,-23)*c)*Math.pow(2,b-127)};ge.SJ=function(a){if(0==a)return 0;var b=0>a?-a:a,c=Math.floor(Math.log(b)/.6931471805599453);-127>c?c=-127:128<c&&(c=128);b=Math.round(8388608*(b/Math.pow(2,c)-1));8388608==b&&128>c&&(b=0,++c);return(0>a?-2147483648:0)|c+127<<23|b};q["haxe.io.Path"]=gd;gd.i=["haxe","io","Path"];gd.lb=function(a){a=new gd(a);return null==a.ext?"":a.ext};gd.prototype={l:gd};q["js._Boot.HaxeError"]=
ja;ja.i=["js","_Boot","HaxeError"];ja.pd=function(a){return a instanceof Error?a:new ja(a)};ja.U=Error;ja.prototype=F(Error.prototype,{l:ja});q["js.html.compat.ArrayBuffer"]=Xa;Xa.i=["js","html","compat","ArrayBuffer"];Xa.$b=function(a,b){var c=new Ka(this,a,null==b?null:b-a),d=new Lf(c.byteLength);(new Ka(d)).set(c);return d};Xa.prototype={slice:function(a,b){return new Xa(this.W.slice(a,b))},l:Xa};q["js.html.compat.Float32Array"]=nc;nc.i=["js","html","compat","Float32Array"];nc.Cg=function(a,b,
c){var d;if("number"==typeof a){d=[];for(b=0;b<a;){var e=b++;d[e]=0}d.byteLength=d.length<<2;d.byteOffset=0;a=[];b=0;for(e=d.length<<2;b<e;)b++,a.push(0);d.buffer=new Xa(a)}else if(v.D(a,Xa)){null==b&&(b=0);null==c&&(c=a.byteLength-b>>2);d=[];for(e=0;e<c;){e++;var f=a.W[b++]|a.W[b++]<<8|a.W[b++]<<16|a.W[b++]<<24;d.push(ge.SM(f))}d.byteLength=d.length<<2;d.byteOffset=b;d.buffer=a}else if(a instanceof Array&&null==a.jb){d=a.slice();a=[];for(b=0;b<d.length;)e=d[b],++b,e=ge.SJ(e),a.push(e&255),a.push(e>>
8&255),a.push(e>>16&255),a.push(e>>>24);d.byteLength=d.length<<2;d.byteOffset=0;d.buffer=new Xa(a)}else throw new ja("TODO "+na.Pb(a));d.subarray=nc.Vo;d.set=nc.Uo;return d};nc.Uo=function(a,b){if(v.D(a.buffer,Xa)){if(a.byteLength+b>this.byteLength)throw new ja("set() outside of range");for(var c=0,d=a.byteLength;c<d;){var e=c++;this[e+b]=a[e]}}else if(a instanceof Array&&null==a.jb){if(a.length+b>this.byteLength)throw new ja("set() outside of range");c=0;for(d=a.length;c<d;)e=c++,this[e+b]=a[e]}else throw new ja("TODO");
};nc.Vo=function(a,b){var c=nc.Cg(this.slice(a,b));c.byteOffset=4*a;return c};q["js.html.compat.Uint8Array"]=Nb;Nb.i=["js","html","compat","Uint8Array"];Nb.Cg=function(a,b,c){if("number"==typeof a){c=[];for(b=0;b<a;){var d=b++;c[d]=0}c.byteLength=c.length;c.byteOffset=0;c.buffer=new Xa(c)}else if(v.D(a,Xa))null==b&&(b=0),null==c&&(c=a.byteLength-b),c=0==b?a.W:a.W.slice(b,b+c),c.byteLength=c.length,c.byteOffset=b,c.buffer=a;else if(a instanceof Array&&null==a.jb)c=a.slice(),c.byteLength=c.length,c.byteOffset=
0,c.buffer=new Xa(c);else throw new ja("TODO "+na.Pb(a));c.subarray=Nb.Vo;c.set=Nb.Uo;return c};Nb.Uo=function(a,b){if(v.D(a.buffer,Xa)){if(a.byteLength+b>this.byteLength)throw new ja("set() outside of range");for(var c=0,d=a.byteLength;c<d;){var e=c++;this[e+b]=a[e]}}else if(a instanceof Array&&null==a.jb){if(a.length+b>this.byteLength)throw new ja("set() outside of range");c=0;for(d=a.length;c<d;)e=c++,this[e+b]=a[e]}else throw new ja("TODO");};Nb.Vo=function(a,b){var c=Nb.Cg(this.slice(a,b));c.byteOffset=
a;return c};q["lime._backend.html5.HTML5HTTPRequest"]=Te;Te.i=["lime","_backend","html5","HTML5HTTPRequest"];Te.prototype={Yn:function(a){this.parent=a},load:function(a,b,c){this.request=new XMLHttpRequest;this.request.addEventListener("progress",b,!1);this.request.onreadystatechange=c;b="";if(null==this.parent.data){for(c=this.parent.formData.keys();c.Ca();){var d=c.next();0<b.length&&(b+="&");var e=encodeURIComponent(d)+"=",f=this.parent.formData,d=na.Pb(null!=t[d]?f.H(d):f.h[d]);b+=e+encodeURIComponent(d)}"GET"==
this.parent.method&&""!=b&&(a=-1<a.indexOf("?")?a+("&"+b):a+("?"+b),b="")}this.request.open(na.Pb(this.parent.method),a,!0);0<this.parent.timeout&&(this.request.timeout=this.parent.timeout);this.uH&&(this.request.responseType="arraybuffer");a=!1;c=0;for(e=this.parent.headers;c<e.length;)d=e[c],++c,"Content-Type"==d.name&&(a=!0),this.request.setRequestHeader(d.name,d.value);a||this.request.setRequestHeader("Content-Type",this.parent.contentType);null!=this.parent.data?this.request.send(this.parent.data.m.BH):
this.request.send(b)},CJ:function(a){var b=this,c=new fc;this.uH=!0;this.load(a,function(a){c.Jr(a.loaded,a.total)},function(){if(4==b.request.readyState){if(null!=b.request.status&&200<=b.request.status&&400>=b.request.status){var a;a=""==b.request.responseType?Cb.ya(b.request.responseText):Cb.Pb(b.request.response);b.vC();c.complete(a)}else b.vC(),c.error(b.request.status);b.request=null}});return c.pc},vC:function(){if(this.parent.fO){this.parent.xL=[];for(var a,b,c=0,d=this.request.getAllResponseHeaders().split("\n");c<
d.length;)b=d[c],++c,a=wa.Kl(Q.substr(b,0,b.indexOf(":"))),b=wa.Kl(Q.substr(b,b.indexOf(":")+1,null)),""!=a&&this.parent.xL.push(new Se(a,b))}this.parent.uP=this.request.status},l:Te};q["lime.app.IModule"]=og;og.i=["lime","app","IModule"];q["lime.app.Module"]=xc;xc.i=["lime","app","Module"];xc.xb=[og];xc.prototype={l:xc};q["lime.app.Application"]=Xc;Xc.i=["lime","app","Application"];Xc.U=xc;Xc.prototype=F(xc.prototype,{l:Xc});q["lime.app.Future"]=Ac;Ac.i=["lime","app","Future"];Ac.$c=function(){var a=
new Ac;a.yl=!0;a.value=null;return a};Ac.prototype={Uj:function(a){null!=a&&(this.yl?a(this.value):this.$n||(null==this.Yl&&(this.Yl=[]),this.Yl.push(a)));return this},Mh:function(a){null!=a&&(this.$n?a(this.error):this.yl||(null==this.Zl&&(this.Zl=[]),this.Zl.push(a)));return this},CK:function(a){null!=a&&(null==this.lp&&(this.lp=[]),this.lp.push(a));return this},l:Ac};q["lime.app._Future.FutureWork"]=La;La.i=["lime","app","_Future","FutureWork"];La.Vv=function(a){null==La.ve&&(La.ve=new Re,La.ve.pA.add(La.AE),
La.ve.Uj.add(La.CE),La.ve.Mh.add(La.EE));La.ve.Vv(a)};La.AE=function(a){try{var b=a.OM();La.ve.CL({Il:a.Il,result:b})}catch(c){c instanceof ja&&(c=c.Lo),La.ve.DL({Il:a.Il,error:c})}};La.CE=function(a){a.Il.complete(a.result)};La.EE=function(a){a.Il.error(a.error)};q["lime.app.Promise"]=fc;fc.i=["lime","app","Promise"];fc.prototype={complete:function(a){if(!this.pc.$n&&(this.pc.yl=!0,this.pc.value=a,null!=this.pc.Yl)){for(var b=0,c=this.pc.Yl;b<c.length;){var d=c[b];++b;d(a)}this.pc.Yl=null}return this},
error:function(a){if(!this.pc.yl&&(this.pc.$n=!0,this.pc.error=a,null!=this.pc.Zl)){for(var b=0,c=this.pc.Zl;b<c.length;){var d=c[b];++b;d(a)}this.pc.Zl=null}return this},Jr:function(a,b){if(!this.pc.$n&&!this.pc.yl&&null!=this.pc.lp)for(var c=0,d=this.pc.lp;c<d.length;){var e=d[c];++c;e(a,b)}return this},l:fc};q["lime.app._Event_Dynamic_Void"]=Md;Md.i=["lime","app","_Event_Dynamic_Void"];Md.prototype={add:function(a,b,c){null==c&&(c=0);null==b&&(b=!1);for(var d=0,e=this.$l.length;d<e;){var f=d++;
if(c>this.$l[f]){this.nk.splice(f,0,a);this.$l.splice(f,0,c);this.mp.splice(f,0,!b);return}}this.nk.push(a);this.$l.push(c);this.mp.push(!b)},remove:function(a){for(var b=this.nk.length;0<=--b;)X.El(this.nk[b],a)&&(this.nk.splice(b,1),this.$l.splice(b,1),this.mp.splice(b,1))},pf:function(a){this.Wz=!1;for(var b=this.nk,c=this.mp,d=0;d<b.length&&(b[d](a),c[d]?++d:this.remove(b[d]),!this.Wz););},l:Md};q["lime.graphics.Image"]=ha;ha.i=["lime","graphics","Image"];ha.Bb=function(a,b,c){if(null==a)return null;
var d=new ha;d.cx(a,b,c);return d};ha.Ib=function(a){return null==a?null:a.bJ};ha.Ru=function(a,b){if(null==a)return null;var c=new ha;c.OE(a,b);return c};ha.Pb=function(a){if(null==a)return null;var b=new ec(null,a.width,a.height);b.ow(a);a=new ha(b);a.type=ua.mg;return a};ha.$b=function(a,b,c){if(null==a)return null;var d=new ha;d.PE(a,b,c);return d};ha.$a=function(a){if(null==a)return null;var b=new ec(null,a.width,a.height);b.ow(a);a=new ha(b);a.type=ua.mg;return a};ha.lb=function(a,b){if(null==
a||null==b)return Ac.$c();var c=new fc,d=new Image;d.addEventListener("load",function(){var a=new ec(null,d.width,d.height);a.We=d;c.complete(new ha(a))},!1);d.addEventListener("progress",function(a){c.Jr(a.loaded,a.total)},!1);d.addEventListener("error",function(a){c.error(a.detail)},!1);d.src="data:"+b+";base64,"+a;return c.pc};ha.mc=function(a){if(null==a)return Ac.$c();var b;if(ha.Fa(a))b="image/png";else if(ha.ya(a))b="image/jpeg";else if(ha.aa(a))b="image/gif";else throw new ja("Image tried to read PNG/JPG Bytes, but found an invalid header.");
return ha.lb(ha.g(a),b)};ha.tc=function(a){if(null==a)return Ac.$c();var b=new fc,c=new Image;c.crossOrigin="Anonymous";c.addEventListener("load",function(){var a=new ec(null,c.width,c.height);a.We=c;b.complete(new ha(a))},!1);c.addEventListener("progress",function(a){b.Jr(a.loaded,a.total)},!1);c.addEventListener("error",function(a){b.error(a.detail)},!1);c.src=a;return b.pc};ha.g=function(a){var b;switch(a.length%3){case 1:b="==";break;case 2:b="=";break;default:b=""}null==ha.D&&(ha.D=new We(Cb.ya(ha.Za)));
return ha.D.nI(a).toString()+b};ha.ya=function(a){return 255==a.m[0]?216==a.m[1]:!1};ha.Fa=function(a){return 137==a.m[0]&&80==a.m[1]&&78==a.m[2]&&71==a.m[3]&&13==a.m[4]&&10==a.m[5]&&26==a.m[6]?10==a.m[7]:!1};ha.aa=function(a){if(71==a.m[0]&&73==a.m[1]&&70==a.m[2]&&56==a.m[3]){var b=a.m[4];if(55==b||57==b)return 97==a.m[5]}return!1};ha.prototype={fillRect:function(a,b,c){a=this.NE(a);if(null!=this.buffer&&null!=a)switch(this.type[1]){case 0:ta.fillRect(this,a,b,c);break;case 1:ta.Xo(this);if(0==this.buffer.data.length)break;
Of.fillRect(this,a,b,c);break;case 2:a.offset(this.offsetX,this.offsetY);if(null==c)a=(b&255)<<24|(b>>>24&255)<<16|(b>>>16&255)<<8|b>>>8&255;else switch(c){case 1:a=b;break;case 2:a=(b&255)<<24|(b>>>8&255)<<16|(b>>>16&255)<<8|b>>>24&255;break;default:a=(b&255)<<24|(b>>>24&255)<<16|(b>>>16&255)<<8|b>>>8&255}this.buffer.yN.fillRect(null,a)}},NE:function(a){return null==a||0>a.x&&(a.width-=-a.x,a.x=0,0>=a.x+a.width)||0>a.y&&(a.height-=-a.y,a.y=0,0>=a.y+a.height)||a.x+a.width>=this.width&&(a.width-=a.x+
a.width-this.width,0>=a.width)||a.y+a.height>=this.height&&(a.height-=a.y+a.height-this.height,0>=a.height)?null:a},cx:function(a,b,c){var d=this,e=new Image;e.addEventListener("load",function(){d.buffer=new ec(null,e.width,e.height);d.buffer.We=e;d.offsetX=0;d.offsetY=0;d.width=d.buffer.width;d.height=d.buffer.height;null!=c&&c(d)},!1);e.src="data:"+b+";base64,"+a},OE:function(a,b){var c;if(ha.Fa(a))c="image/png";else if(ha.ya(a))c="image/jpeg";else if(ha.aa(a))c="image/gif";else throw new ja("Image tried to read PNG/JPG Bytes, but found an invalid header.");
this.cx(ha.g(a),c,b)},PE:function(a,b,c){var d=this,e=new Image;e.crossOrigin="Anonymous";e.onload=function(){d.buffer=new ec(null,e.width,e.height);d.buffer.We=e;d.width=e.width;d.height=e.height;null!=b&&b(d)};e.onerror=function(){null!=c&&c()};e.src=a},QE:function(a){this.buffer=a;null!=a&&(-1==this.width&&(this.width=a.width),-1==this.height&&(this.height=a.height))},OA:function(){null==this.buffer.data&&0<this.buffer.width&&0<this.buffer.height&&ta.Xo(this);return this.buffer.data},$A:function(){return new dc(0,
0,this.width,this.height)},Un:function(){null==this.buffer.qd&&ta.xh(this);return this.buffer.Un()},Hj:function(){return null==this.buffer?!1:this.buffer.xD},aD:function(a){return null==this.buffer?!1:this.buffer.xD=a},l:ha,ha:{$A:"get_rect",aD:"set_transparent",Hj:"get_transparent",Un:"get_src",OA:"get_data"}};q["lime.graphics.ImageBuffer"]=ec;ec.i=["lime","graphics","ImageBuffer"];ec.prototype={Un:function(){return null!=this.We?this.We:this.qd},ow:function(a){v.D(a,Image)?this.We=a:v.D(a,HTMLCanvasElement)&&
(this.qd=a,this.nc=this.qd.getContext("2d"));return a},cB:function(){return 4*this.width},l:ec,ha:{cB:"get_stride",ow:"set_src",Un:"get_src"}};var ua={$i:!0,bx:["CANVAS","DATA","FLASH","CUSTOM"],mg:["CANVAS",0]};ua.mg.toString=wb;ua.mg.jb=ua;ua.mk=["DATA",1];ua.mk.toString=wb;ua.mk.jb=ua;ua.To=["FLASH",2];ua.To.toString=wb;ua.To.jb=ua;ua.rs=["CUSTOM",3];ua.rs.toString=wb;ua.rs.jb=ua;var Mc={$i:!0,bx:"OPENGL CANVAS DOM FLASH CAIRO CONSOLE CUSTOM NONE".split(" "),pN:function(a){a=["OPENGL",0,a];a.jb=
Mc;a.toString=wb;return a},mg:function(a){a=["CANVAS",1,a];a.jb=Mc;a.toString=wb;return a},dN:function(a){a=["DOM",2,a];a.jb=Mc;a.toString=wb;return a},To:function(a){a=["FLASH",3,a];a.jb=Mc;a.toString=wb;return a},$M:function(a){a=["CAIRO",4,a];a.jb=Mc;a.toString=wb;return a},aN:function(a){a=["CONSOLE",5,a];a.jb=Mc;a.toString=wb;return a},rs:function(a){a=["CUSTOM",6,a];a.jb=Mc;a.toString=wb;return a},NONE:["NONE",7]};Mc.NONE.toString=wb;Mc.NONE.jb=Mc;q["lime.graphics.Renderer"]=Pf;Pf.i=["lime",
"graphics","Renderer"];Pf.prototype={l:Pf};q["lime.graphics.utils.ImageCanvasUtil"]=ta;ta.i=["lime","graphics","utils","ImageCanvasUtil"];ta.xh=function(a,b){null==b&&(b=!1);var c=a.buffer;null!=c.We?(null==c.qd&&(ta.Yo(a,c.We.width,c.We.height),c.nc.drawImage(c.We,0,0)),c.We=null):null==c.qd&&null!=c.data?(a.aD(!0),ta.Yo(a,c.width,c.height),ta.createImageData(a),c.nc.putImageData(c.de,0,0)):a.type==ua.mk&&null!=c.de&&a.fl&&(c.nc.putImageData(c.de,0,0),a.fl=!1);b?(c.data=null,c.de=null):null==c.data&&
null!=c.de&&(c.data=c.de.data);a.type=ua.mg};ta.Xo=function(a,b){null==b&&(b=!1);var c=a.buffer;null!=c.We&&ta.xh(a);if(null!=c.qd&&null==c.data)ta.createImageData(a),a.type==ua.mg&&(a.fl=!1);else if(a.type==ua.mg&&null!=c.qd&&a.fl){if(null==c.de)ta.createImageData(a);else{c.de=c.nc.getImageData(0,0,c.width,c.height);var d=c.de.data.buffer,e;null!=d?e=new Ka(d):e=null;c.data=e}a.fl=!1}b&&(a.buffer.qd=null,a.buffer.nc=null);a.type=ua.mk};ta.Yo=function(a,b,c){var d=a.buffer;null==d.qd&&(d.qd=window.document.createElement("canvas"),
d.qd.width=b,d.qd.height=c,a.Hj()?d.nc=d.qd.getContext("2d"):(a.Hj()||d.qd.setAttribute("moz-opaque","true"),d.nc=d.qd.getContext("2d",{alpha:!1})),d.nc.KB=!1,d.nc.MB=!1,d.nc.lB=!1)};ta.createImageData=function(a){a=a.buffer;if(null==a.de){null==a.data?a.de=a.nc.getImageData(0,0,a.width,a.height):(a.de=a.nc.createImageData(a.width,a.height),a.de.data.set(a.data));var b=a.de.data.buffer,c;null!=b?c=new Ka(b):c=null;a.data=c}};ta.fillRect=function(a,b,c,d){ta.xh(a);var e,f;1==d?(d=c>>16&255,e=c>>8&
255,f=c&255,c=a.Hj()?c>>24&255:255):(d=c>>24&255,e=c>>16&255,f=c>>8&255,c=a.Hj()?c&255:255);0==b.x&&0==b.y&&b.width==a.width&&b.height==a.height&&a.Hj()&&0==c?a.buffer.qd.width=a.buffer.width:(a.buffer.nc.fillStyle="rgba("+d+", "+e+", "+f+", "+c/255+")",a.buffer.nc.fillRect(b.x+a.offsetX,b.y+a.offsetY,b.width+a.offsetX,b.height+a.offsetY),a.fl=!0,a.version++)};ta.Ww=function(a,b){null!=a&&(a.type==ua.mg?ta.xh(a,b):ta.Xo(a,b))};q["lime.graphics.utils.ImageDataUtil"]=Of;Of.i=["lime","graphics","utils",
"ImageDataUtil"];Of.fillRect=function(a,b,c,d){switch(d){case 1:c=(c>>>16&255)<<24|(c>>>8&255)<<16|(c&255)<<8|c>>>24&255;break;case 2:c=(c>>>8&255)<<24|(c>>>16&255)<<16|(c>>>24&255)<<8|c&255;break}a.Hj()||(c=(c>>>24&255)<<24|(c>>>16&255)<<16|(c>>>8&255)<<8|255);d=a.buffer.data;if(null!=d){var e=a.buffer.format;a.buffer.WK&&(0==(c&255)?0!=c&&(c=0):255!=(c&255)&&(Xb.cu=Xb.$w[c&255],c=((c>>>24&255)*Xb.cu>>16&255)<<24|((c>>>16&255)*Xb.cu>>16&255)<<16|((c>>>8&255)*Xb.cu>>16&255)<<8|c&255));b=new Ve(a,
b);for(var f,g=0,h=b.height;g<h;){f=g++;f=b.offset+b.Co*f;for(var k=0,l=b.width;k<l;){var m=k++,m=f+4*m;switch(e){case 0:d[m]=c>>>24&255;d[m+1]=c>>>16&255;d[m+2]=c>>>8&255;d[m+3]=c&255;break;case 1:d[m]=c&255;d[m+1]=c>>>24&255;d[m+2]=c>>>16&255;d[m+3]=c>>>8&255;break;case 2:d[m]=c>>>8&255,d[m+1]=c>>>16&255,d[m+2]=c>>>24&255,d[m+3]=c&255}}}a.fl=!0;a.version++}};q["lime.graphics.utils._ImageDataUtil.ImageDataView"]=Ve;Ve.i=["lime","graphics","utils","_ImageDataUtil","ImageDataView"];Ve.prototype={l:Ve};
q["lime.math.Matrix3"]=Wc;Wc.i=["lime","math","Matrix3"];Wc.prototype={scale:function(a,b){this.W*=a;this.m*=b;this.Iq*=a;this.d*=b;this.Cc*=a;this.Dc*=b},l:Wc};q["lime.math.Rectangle"]=dc;dc.i=["lime","math","Rectangle"];dc.prototype={offset:function(a,b){this.x+=a;this.y+=b},l:dc};q["lime.math.Vector2"]=zg;zg.i=["lime","math","Vector2"];var Xb={};q["lime.math.color._RGBA.RGBA_Impl_"]=Xb;Xb.i=["lime","math","color","_RGBA","RGBA_Impl_"];q["lime.net._IHTTPRequest"]=Ue;Ue.i=["lime","net","_IHTTPRequest"];
Ue.prototype={l:Ue};q["lime.net._HTTPRequest.AbstractHTTPRequest"]=Vc;Vc.i=["lime","net","_HTTPRequest","AbstractHTTPRequest"];Vc.xb=[Ue];Vc.prototype={l:Vc};q["lime.net._HTTPRequest_Bytes"]=fe;fe.i=["lime","net","_HTTPRequest_Bytes"];fe.U=Vc;fe.prototype=F(Vc.prototype,{Ru:function(a){return a},load:function(a){var b=this;null!=a&&(this.uri=a);var c=new fc;a=this.Rz.CJ(this.uri);a.CK(B(c,c.Jr));a.Mh(B(c,c.error));a.Uj(function(a){b.wL=b.Ru(a);c.complete(b.wL)});return c.pc},l:fe});q["lime.net.HTTPRequestHeader"]=
Se;Se.i=["lime","net","HTTPRequestHeader"];Se.prototype={l:Se};q["lime.system.ThreadPool"]=Re;Re.i=["lime","system","ThreadPool"];Re.prototype={Vv:function(a){this.pA.pf(a)},CL:function(a){this.Uj.pf(a)},DL:function(a){this.Mh.pf(a)},l:Re};q["lime.utils.Assets"]=Qe;Qe.i=["lime","utils","Assets"];Qe.lN=function(){return!1};Qe.mN=function(){return null};Qe.nN=function(){return null};var Mb=J.CAPTURA.Extension.Signal.Signal=function(a){null==a&&(a=[]);this.valueClasses=a;this.Se=lb.Pb;this.Uv=!1};q["msignal.Signal"]=
Mb;Mb.i=["msignal","Signal"];Mb.prototype={add:function(a){return this.fL(a)},remove:function(a){var b=this.Se.find(a);if(null==b)return null;this.Se=this.Se.uI(a);return b},fL:function(a,b,c){null==c&&(c=0);null==b&&(b=!1);return this.gL(a,b)?(a=this.Qq(a,b,c),this.Uv||0==c||(this.Uv=!0),this.Se=this.Uv||0!=c?this.Se.hJ(a):this.Se.Tv(a),a):this.Se.find(a)},gL:function(a){return this.Se.pe&&null!=this.Se.find(a)?!1:!0},Qq:function(){return null},SI:function(){return this.Se.tl()},l:Mb,ha:{SI:"get_numListeners"}};
var xe=J.CAPTURA.Extension.Signal.Signal=function(){Mb.call(this)};q["msignal.Signal0"]=xe;xe.i=["msignal","Signal0"];xe.U=Mb;xe.prototype=F(Mb.prototype,{pf:function(){for(var a=this.Se;a.pe;)a.head.Ej(),a=a.nd},Qq:function(a,b,c){null==c&&(c=0);null==b&&(b=!1);return new Ne(this,a,b,c)},l:xe});var ud=J.CAPTURA.Extension.Signal.Signal=function(a){Mb.call(this,[a])};q["msignal.Signal1"]=ud;ud.i=["msignal","Signal1"];ud.U=Mb;ud.prototype=F(Mb.prototype,{pf:function(a){for(var b=this.Se;b.pe;)b.head.Ej(a),
b=b.nd},Qq:function(a,b,c){null==c&&(c=0);null==b&&(b=!1);return new Oe(this,a,b,c)},l:ud});var Mf=J.CAPTURA.Extension.Signal.Signal=function(a,b){Mb.call(this,[a,b])};q["msignal.Signal2"]=Mf;Mf.i=["msignal","Signal2"];Mf.U=Mb;Mf.prototype=F(Mb.prototype,{pf:function(a,b){for(var c=this.Se;c.pe;)c.head.Ej(a,b),c=c.nd},Qq:function(a,b,c){null==c&&(c=0);null==b&&(b=!1);return new Pe(this,a,b,c)},l:Mf});var cc=J.CAPTURA.Extension.Signal.Slot=function(a,b,c,d){null==d&&(d=0);null==c&&(c=!1);this.PL=a;
this.YC(b);this.once=c;this.priority=d;this.enabled=!0};q["msignal.Slot"]=cc;cc.i=["msignal","Slot"];cc.prototype={remove:function(){this.PL.remove(this.listener)},YC:function(a){return this.listener=a},l:cc,ha:{YC:"set_listener"}};var Ne=J.CAPTURA.Extension.Signal.Slot=function(a,b,c,d){null==d&&(d=0);null==c&&(c=!1);cc.call(this,a,b,c,d)};q["msignal.Slot0"]=Ne;Ne.i=["msignal","Slot0"];Ne.U=cc;Ne.prototype=F(cc.prototype,{Ej:function(){this.enabled&&(this.once&&this.remove(),this.listener())},l:Ne});
var Oe=J.CAPTURA.Extension.Signal.Slot=function(a,b,c,d){null==d&&(d=0);null==c&&(c=!1);cc.call(this,a,b,c,d)};q["msignal.Slot1"]=Oe;Oe.i=["msignal","Slot1"];Oe.U=cc;Oe.prototype=F(cc.prototype,{Ej:function(a){this.enabled&&(this.once&&this.remove(),null!=this.KK&&(a=this.KK),this.listener(a))},l:Oe});var Pe=J.CAPTURA.Extension.Signal.Slot=function(a,b,c,d){null==d&&(d=0);null==c&&(c=!1);cc.call(this,a,b,c,d)};q["msignal.Slot2"]=Pe;Pe.i=["msignal","Slot2"];Pe.U=cc;Pe.prototype=F(cc.prototype,{Ej:function(a,
b){this.enabled&&(this.once&&this.remove(),null!=this.LK&&(a=this.LK),null!=this.MK&&(b=this.MK),this.listener(a,b))},l:Pe});q["msignal.SlotList"]=lb;lb.i=["msignal","SlotList"];lb.prototype={tl:function(){if(!this.pe)return 0;if(this.nd==lb.Pb)return 1;for(var a=0,b=this;b.pe;)++a,b=b.nd;return a},Tv:function(a){return new lb(a,this)},hJ:function(a){if(!this.pe)return new lb(a);var b=a.priority;if(b>=this.head.priority)return this.Tv(a);for(var c=new lb(this.head),d=c,e=this.nd;e.pe;){if(b>e.head.priority)return d.nd=
e.Tv(a),c;d=d.nd=new lb(e.head);e=e.nd}d.nd=new lb(a);return c},uI:function(a){if(!this.pe||null==a)return this;if(X.El(this.head.listener,a))return this.nd;for(var b=new lb(this.head),c=b,d=this.nd;d.pe;){if(X.El(d.head.listener,a))return c.nd=d.nd,b;c=c.nd=new lb(d.head);d=d.nd}return this},find:function(a){if(!this.pe)return null;for(var b=this;b.pe;){if(X.El(b.head.listener,a))return b.head;b=b.nd}return null},l:lb,ha:{tl:"get_length"}};var mb,Lg=0;q.Math=Math;String.prototype.l=q.String=String;
String.i=["String"];q.Array=Array;Array.i=["Array"];Date.prototype.l=q.Date=Date;Date.i=["Date"];var qg=q.Int={i:["Int"]},Mg=q.Dynamic={i:["Dynamic"]},yg=q.Float=Number;yg.i=["Float"];var xg=Boolean;xg.$i=["Bool"];var Ng=q.Class={i:["Class"]},Og={};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame;var t={},Lf=Nf.ArrayBuffer||Xa;Lf.prototype.slice||(Lf.prototype.slice=
Xa.$b);var ib=Nf.Float32Array||nc.Cg,Ka=Nf.Uint8Array||Nb.Cg,Pg=new Uint32Array(256);Xb.$w=Pg;for(var Gg=0;256>Gg;){var Hg=Gg++;Xb.$w[Hg]=Math.ceil(257.00392156862745*Hg)}var Qg=new Ka(510);Xb.ax=Qg;for(var Ig=0;255>Ig;){var Jg=Ig++;Xb.ax[Jg]=Jg}for(var Kg=255;511>Kg;){var Rg=Kg++;Xb.ax[Rg]=255}lb.Pb=new lb(null,null);Y.ns=Math.PI/180;Y.zC=!1;Y.wC=!1;Y.Qo=!0;Pc.Bb="0.94";fa.Ve={Eg:{name:{S:null},id:{S:null},ig:{S:null},state:{S:null},zr:{S:null}}};oa.lb={Eg:{position:{vo:null},Bf:{vo:null},Mg:{S:null},
Ng:{S:null},Lg:{S:null},Og:{S:null},Sa:{S:null},Tb:{S:null},Fb:{S:null},vf:{S:null},mode:{S:null},tb:{S:null},Yc:{S:null},Rb:{S:null},Hh:{S:null},PO:{S:null}}};oa.Ah=0;oa.xh=1;oa.ae=0;oa.pd=1;oa.Lj=0;oa.Qj=10;oa.Bl=11;oa.Tj=12;oa.Rj=13;oa.El=20;oa.Uo=21;n.g=Array(4);aa.lb={Eg:{rotation:{vo:null},speed:{vo:null},jd:{AP:["lockedTargetId"]}}};aa.kp=new n(0,1,0);aa.aa=new n(0,0,0);Ma.Fa=new da;Ma.mc=new da;Za.Bg=.02;Za.Cf=.1;Ia.wA=new Ia;Ia.BE=new Ia;Oc.$a=new Ya;Oc.aa=new Ia;lc.$c={Eg:{volume:{Wv:[0,
1]}}};lc.mc="//cdn.dashjs.org/latest/dash.all.min.js";lc.tc="//cdn.jsdelivr.net/hls.js/latest/hls.min.js";va.Ll=[[.5,.25],[.5,.375],[.25,.5],[.375,.5],[.5,.5],[.625,.5],[.75,.5],[.5,.625],[.5,.75]];va.uE=[.05,.1,.05,.1,.4,.1,.05,.1,.05];va.hN=Math.PI/180;va.kM=180/Math.PI;sa.lb={Eg:{id:{S:null},name:{S:null},tu:{S:null},Zk:{S:null},alpha:{S:null},xn:{S:null},$:{S:null},Iz:{S:null},gl:{S:null},qf:{S:null},pC:{S:null},XD:{S:null},NM:{S:null},oP:{S:null},jO:{S:null}}};sa.Oo=0;sa.Ro=1;sa.Eh=2;sa.tc=0;
sa.Ec=1;Rd.Ag=512;U.D=Math.PI/180;U.aa=180/Math.PI;U.ve="cameras";U.Ve="input";ye.$c="layersController";Bd.$c="layersController";Bd.Cg=100;p.ce=36193;p.lb=.001;p.Bb="assets/shaders/";p.g=0;qb.tB=1;qb.wB=2;qb.uB=4;qb.GE=16;Aa.g=0;Aa.Za=1;Aa.Ta=1E3;Na.Ta=1E-8;Na.Fa=1E9;Gb.Eh=new ca(0,0,0,0);Gb.PM=2;Ea.Ve={Eg:{Gu:{uo:null},as:{uo:null},qr:{S:null},Wv:{S:null},Xn:{S:null},Mn:{S:null},sv:{S:null}}};Ea.yh=0;Ea.Bh=1;Ea.Ah=2;bc.Fa={Eg:{position:{vo:null},direction:{vo:null},Cd:{S:null},Mu:{S:null}}};Bb.rE=
0;Bb.Xz=1;Bb.tE=2;Bb.Sz=3;eg.vE=!1;v.tI={}.toString;ka.D=0;ka.Df=1;ka.Cf=2;ka.Ag=4;ka.pd=7;ka.Fa=new da;ka.Gi=new n(0,0,0);S.ce=0;S.tc=1;S.be=2;S.ae=0;S.ue=0;S.$c=1;S.Vc=2;S.Ec=3;ga.eE="";ga.ce=(new Date).getTime()/1E3;r.Ta=new da;r.ya=new n(0,0,0);r.Ib=new n(0,0,0);r.Za=new n(0,0,0);I.pd=new n(0,0,0);T.Ve={Eg:{Xc:{Ph:null},He:{Ph:null},Zd:{Ph:null},jc:{Ph:null},Fd:{Ph:null},Te:{Ph:null},Je:{Ph:null},Vf:{Ph:null},kc:{Ph:null},vn:{uo:["ambient"]},Kn:{uo:["diffuse"]},Bo:{uo:["specular"]},Ku:{uo:["emissive"]},
bs:{S:null},GD:{S:null},ds:{S:null},EB:{S:null},es:{S:null},gs:{S:null},fs:{S:null},Ln:{S:null},KD:{S:null},LD:{S:null},lC:{S:null},ew:{S:null},pr:{S:null},tr:{S:null},JD:{S:null},Mf:{Qr:null},Oe:{Qr:null},cg:{Qr:null},Vi:{Qr:null},Nf:{Qr:null},ID:{S:null},Sj:{S:null},oB:{S:null},pB:{S:null},yj:{Ph:null},Jq:{zP:null},SP:{S:null}}};T.$a=!0;T.Ta=!0;T.$b=!0;T.mc=!0;T.be=!0;T.Ec=!0;T.Za=!0;T.lb=!0;T.Ib=!0;T.tc=!0;T.ae=!0;L.Ll=.45454545454545453;L.Fo=2.2;Sa.Pb=0;Sa.$a=function(){var a=new r;a.a[0]=0;a.a[1]=
0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=0;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=0;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=0;return a}(this);ya.jN={Eg:{jy:{S:null},hy:{S:null},ky:{S:null},iy:{S:null},oy:{S:null},my:{S:null},py:{S:null},ny:{S:null},Gy:{S:null},Ey:{S:null},Hy:{S:null},Fy:{S:null}}};ae.Bb=function(){var a=new W;null!=t.bonesDeclaration?a.C("bonesDeclaration","#if NUM_BONE_INFLUENCERS>0\nuniform mat4 mBones[BonesPerMesh];\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#endif"):
a.h.bonesDeclaration="#if NUM_BONE_INFLUENCERS>0\nuniform mat4 mBones[BonesPerMesh];\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#endif";null!=t.bonesVertex?a.C("bonesVertex","#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif \nfinalWorld=finalWorld*influence;\n#endif"):
a.h.bonesVertex="#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif \nfinalWorld=finalWorld*influence;\n#endif";
null!=t.bumpFragment?a.C("bumpFragment","vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX)\nmat3 TBN=cotangent_frame(normalW*vBumpInfos.y,-viewDirectionW,vBumpUV);\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef BUMP\nnormalW=perturbNormal(viewDirectionW,TBN,vBumpUV+uvOffset);\n#endif"):
a.h.bumpFragment="vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX)\nmat3 TBN=cotangent_frame(normalW*vBumpInfos.y,-viewDirectionW,vBumpUV);\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef BUMP\nnormalW=perturbNormal(viewDirectionW,TBN,vBumpUV+uvOffset);\n#endif";
null!=t.bumpFragmentFunctions?a.C("bumpFragmentFunctions","#ifdef BUMP\nvarying vec2 vBumpUV;\nuniform vec3 vBumpInfos;\nuniform sampler2D bumpSampler;\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));\nreturn mat3(tangent*invmax,binormal*invmax,normal);\n}\nvec3 perturbNormal(vec3 viewDir,mat3 cotangentFrame,vec2 uv)\n{\nvec3 map=texture2D(bumpSampler,uv).xyz;\n#ifdef INVERTNORMALMAPX\nmap.x=1.0-map.x;\n#endif\n#ifdef INVERTNORMALMAPY\nmap.y=1.0-map.y;\n#endif\nmap=map*255./127.-128./127.;\nreturn normalize(cotangentFrame*map);\n}\n#ifdef PARALLAX\nconst float minSamples=4.;\nconst float maxSamples=15.;\nconst int iMaxSamples=15;\n\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\nparallaxLimit*=parallaxScale;\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\nfloat stepSize=1.0/numSamples;\n\nfloat currRayHeight=1.0;\nvec2 vCurrOffset=vec2(0,0);\nvec2 vLastOffset=vec2(0,0);\nfloat lastSampledHeight=1.0;\nfloat currSampledHeight=1.0;\nfor (int i=0; i<iMaxSamples; i++)\n{\ncurrSampledHeight=texture2D(bumpSampler,vBumpUV+vCurrOffset).w;\n\nif (currSampledHeight>currRayHeight)\n{\nfloat delta1=currSampledHeight-currRayHeight;\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\nfloat ratio=delta1/(delta1+delta2);\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\n\nbreak;\n}\nelse\n{\ncurrRayHeight-=stepSize;\nvLastOffset=vCurrOffset;\nvCurrOffset+=stepSize*vMaxOffset;\nlastSampledHeight=currSampledHeight;\n}\n}\nreturn vCurrOffset;\n}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{\n\nfloat height=texture2D(bumpSampler,vBumpUV).w;\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\nreturn -texCoordOffset;\n}\n#endif\n#endif"):
a.h.bumpFragmentFunctions="#ifdef BUMP\nvarying vec2 vBumpUV;\nuniform vec3 vBumpInfos;\nuniform sampler2D bumpSampler;\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));\nreturn mat3(tangent*invmax,binormal*invmax,normal);\n}\nvec3 perturbNormal(vec3 viewDir,mat3 cotangentFrame,vec2 uv)\n{\nvec3 map=texture2D(bumpSampler,uv).xyz;\n#ifdef INVERTNORMALMAPX\nmap.x=1.0-map.x;\n#endif\n#ifdef INVERTNORMALMAPY\nmap.y=1.0-map.y;\n#endif\nmap=map*255./127.-128./127.;\nreturn normalize(cotangentFrame*map);\n}\n#ifdef PARALLAX\nconst float minSamples=4.;\nconst float maxSamples=15.;\nconst int iMaxSamples=15;\n\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\nparallaxLimit*=parallaxScale;\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\nfloat stepSize=1.0/numSamples;\n\nfloat currRayHeight=1.0;\nvec2 vCurrOffset=vec2(0,0);\nvec2 vLastOffset=vec2(0,0);\nfloat lastSampledHeight=1.0;\nfloat currSampledHeight=1.0;\nfor (int i=0; i<iMaxSamples; i++)\n{\ncurrSampledHeight=texture2D(bumpSampler,vBumpUV+vCurrOffset).w;\n\nif (currSampledHeight>currRayHeight)\n{\nfloat delta1=currSampledHeight-currRayHeight;\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\nfloat ratio=delta1/(delta1+delta2);\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\n\nbreak;\n}\nelse\n{\ncurrRayHeight-=stepSize;\nvLastOffset=vCurrOffset;\nvCurrOffset+=stepSize*vMaxOffset;\nlastSampledHeight=currSampledHeight;\n}\n}\nreturn vCurrOffset;\n}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{\n\nfloat height=texture2D(bumpSampler,vBumpUV).w;\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\nreturn -texCoordOffset;\n}\n#endif\n#endif";
null!=t.clipPlaneFragment?a.C("clipPlaneFragment","#ifdef CLIPPLANE\nif (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif"):a.h.clipPlaneFragment="#ifdef CLIPPLANE\nif (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif";null!=t.clipPlaneFragmentDeclaration?a.C("clipPlaneFragmentDeclaration","#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif"):a.h.clipPlaneFragmentDeclaration="#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif";null!=t.clipPlaneVertex?a.C("clipPlaneVertex","#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif"):
a.h.clipPlaneVertex="#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif";null!=t.clipPlaneVertexDeclaration?a.C("clipPlaneVertexDeclaration","#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif"):a.h.clipPlaneVertexDeclaration="#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif";null!=t.colorCurves?a.C("colorCurves","const vec3 HDTVRec709_RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);\nvec3 applyColorCurves(vec3 original) {\nvec3 result=original;\n\n\n\nfloat luma=dot(result.rgb,HDTVRec709_RGBLuminanceCoefficients);\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0,0.0),vec2(1.0,1.0));\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\nresult.rgb*=colorCurve.rgb;\nresult.rgb=mix(vec3(luma,luma,luma),result.rgb,colorCurve.a);\nreturn result;\n}"):
a.h.colorCurves="const vec3 HDTVRec709_RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);\nvec3 applyColorCurves(vec3 original) {\nvec3 result=original;\n\n\n\nfloat luma=dot(result.rgb,HDTVRec709_RGBLuminanceCoefficients);\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0,0.0),vec2(1.0,1.0));\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\nresult.rgb*=colorCurve.rgb;\nresult.rgb=mix(vec3(luma,luma,luma),result.rgb,colorCurve.a);\nreturn result;\n}";
null!=t.colorCurvesDefinition?a.C("colorCurvesDefinition","uniform vec4 vCameraColorCurveNeutral;\nuniform vec4 vCameraColorCurvePositive;\nuniform vec4 vCameraColorCurveNegative;"):a.h.colorCurvesDefinition="uniform vec4 vCameraColorCurveNeutral;\nuniform vec4 vCameraColorCurvePositive;\nuniform vec4 vCameraColorCurveNegative;";null!=t.colorGrading?a.C("colorGrading","vec4 colorGrades(vec4 color) \n{ \n\nfloat sliceContinuous=color.z*vCameraColorGradingInfos.z;\nfloat sliceInteger=floor(sliceContinuous);\n\n\nfloat sliceFraction=sliceContinuous-sliceInteger; \n\nvec2 sliceUV=color.xy*vCameraColorGradingScaleOffset.xy+vCameraColorGradingScaleOffset.zw;\n\n\nsliceUV.x+=sliceInteger*vCameraColorGradingInfos.w;\nvec4 slice0Color=texture2D(cameraColorGrading2DSampler,sliceUV);\nsliceUV.x+=vCameraColorGradingInfos.w;\nvec4 slice1Color=texture2D(cameraColorGrading2DSampler,sliceUV);\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\ncolor.rgb=mix(color.rgb,result,vCameraColorGradingInfos.x);\nreturn color;\n}"):
a.h.colorGrading="vec4 colorGrades(vec4 color) \n{ \n\nfloat sliceContinuous=color.z*vCameraColorGradingInfos.z;\nfloat sliceInteger=floor(sliceContinuous);\n\n\nfloat sliceFraction=sliceContinuous-sliceInteger; \n\nvec2 sliceUV=color.xy*vCameraColorGradingScaleOffset.xy+vCameraColorGradingScaleOffset.zw;\n\n\nsliceUV.x+=sliceInteger*vCameraColorGradingInfos.w;\nvec4 slice0Color=texture2D(cameraColorGrading2DSampler,sliceUV);\nsliceUV.x+=vCameraColorGradingInfos.w;\nvec4 slice1Color=texture2D(cameraColorGrading2DSampler,sliceUV);\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\ncolor.rgb=mix(color.rgb,result,vCameraColorGradingInfos.x);\nreturn color;\n}";
null!=t.colorGradingDefinition?a.C("colorGradingDefinition","uniform sampler2D cameraColorGrading2DSampler;\nuniform vec4 vCameraColorGradingInfos;\nuniform vec4 vCameraColorGradingScaleOffset;"):a.h.colorGradingDefinition="uniform sampler2D cameraColorGrading2DSampler;\nuniform vec4 vCameraColorGradingInfos;\nuniform vec4 vCameraColorGradingScaleOffset;";null!=t.fogFragment?a.C("fogFragment","#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif"):a.h.fogFragment=
"#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif";null!=t.fogFragmentDeclaration?a.C("fogFragmentDeclaration","#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;\nuniform vec3 vFogColor;\nvarying float fFogDistance;\nfloat CalcFogFactor()\n{\nfloat fogCoeff=1.0;\nfloat fogStart=vFogInfos.y;\nfloat fogEnd=vFogInfos.z;\nfloat fogDensity=vFogInfos.w;\nif (FOGMODE_LINEAR == vFogInfos.x)\n{\nfogCoeff=(fogEnd-fFogDistance)/(fogEnd-fogStart);\n}\nelse if (FOGMODE_EXP == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fFogDistance*fogDensity);\n}\nelse if (FOGMODE_EXP2 == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fFogDistance*fFogDistance*fogDensity*fogDensity);\n}\nreturn clamp(fogCoeff,0.0,1.0);\n}\n#endif"):
a.h.fogFragmentDeclaration="#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;\nuniform vec3 vFogColor;\nvarying float fFogDistance;\nfloat CalcFogFactor()\n{\nfloat fogCoeff=1.0;\nfloat fogStart=vFogInfos.y;\nfloat fogEnd=vFogInfos.z;\nfloat fogDensity=vFogInfos.w;\nif (FOGMODE_LINEAR == vFogInfos.x)\n{\nfogCoeff=(fogEnd-fFogDistance)/(fogEnd-fogStart);\n}\nelse if (FOGMODE_EXP == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fFogDistance*fogDensity);\n}\nelse if (FOGMODE_EXP2 == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fFogDistance*fFogDistance*fogDensity*fogDensity);\n}\nreturn clamp(fogCoeff,0.0,1.0);\n}\n#endif";
null!=t.fogVertex?a.C("fogVertex","#ifdef FOG\nfFogDistance=(view*worldPos).z;\n#endif"):a.h.fogVertex="#ifdef FOG\nfFogDistance=(view*worldPos).z;\n#endif";null!=t.fogVertexDeclaration?a.C("fogVertexDeclaration","#ifdef FOG\nvarying float fFogDistance;\n#endif"):a.h.fogVertexDeclaration="#ifdef FOG\nvarying float fFogDistance;\n#endif";null!=t.fresnelFunction?a.C("fresnelFunction","#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\nreturn clamp(fresnelTerm,0.,1.);\n}\n#endif"):
a.h.fresnelFunction="#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\nreturn clamp(fresnelTerm,0.,1.);\n}\n#endif";null!=t.harmonicsFunctions?a.C("harmonicsFunctions","#ifdef USESPHERICALFROMREFLECTIONMAP\nuniform vec3 vSphericalX;\nuniform vec3 vSphericalY;\nuniform vec3 vSphericalZ;\nuniform vec3 vSphericalXX;\nuniform vec3 vSphericalYY;\nuniform vec3 vSphericalZZ;\nuniform vec3 vSphericalXY;\nuniform vec3 vSphericalYZ;\nuniform vec3 vSphericalZX;\nvec3 EnvironmentIrradiance(vec3 normal)\n{\n\n\n\nvec3 result =\nvSphericalX*normal.x +\nvSphericalY*normal.y +\nvSphericalZ*normal.z +\nvSphericalXX*normal.x*normal.x +\nvSphericalYY*normal.y*normal.y +\nvSphericalZZ*normal.z*normal.z +\nvSphericalYZ*normal.y*normal.z +\nvSphericalZX*normal.z*normal.x +\nvSphericalXY*normal.x*normal.y;\nreturn result.rgb;\n}\n#endif"):
a.h.harmonicsFunctions="#ifdef USESPHERICALFROMREFLECTIONMAP\nuniform vec3 vSphericalX;\nuniform vec3 vSphericalY;\nuniform vec3 vSphericalZ;\nuniform vec3 vSphericalXX;\nuniform vec3 vSphericalYY;\nuniform vec3 vSphericalZZ;\nuniform vec3 vSphericalXY;\nuniform vec3 vSphericalYZ;\nuniform vec3 vSphericalZX;\nvec3 EnvironmentIrradiance(vec3 normal)\n{\n\n\n\nvec3 result =\nvSphericalX*normal.x +\nvSphericalY*normal.y +\nvSphericalZ*normal.z +\nvSphericalXX*normal.x*normal.x +\nvSphericalYY*normal.y*normal.y +\nvSphericalZZ*normal.z*normal.z +\nvSphericalYZ*normal.y*normal.z +\nvSphericalZX*normal.z*normal.x +\nvSphericalXY*normal.x*normal.y;\nreturn result.rgb;\n}\n#endif";
null!=t.helperFunctions?a.C("helperFunctions","mat3 transposeMat3(mat3 inMatrix) {\nvec3 i0=inMatrix[0];\nvec3 i1=inMatrix[1];\nvec3 i2=inMatrix[2];\nmat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);\nreturn outMatrix;\n}"):a.h.helperFunctions="mat3 transposeMat3(mat3 inMatrix) {\nvec3 i0=inMatrix[0];\nvec3 i1=inMatrix[1];\nvec3 i2=inMatrix[2];\nmat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);\nreturn outMatrix;\n}";
null!=t.instancesDeclaration?a.C("instancesDeclaration","#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#else\nuniform mat4 world;\n#endif"):a.h.instancesDeclaration="#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#else\nuniform mat4 world;\n#endif";null!=t.instancesVertex?a.C("instancesVertex","#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#else\nmat4 finalWorld=world;\n#endif"):
a.h.instancesVertex="#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#else\nmat4 finalWorld=world;\n#endif";null!=t.lightFragment?a.C("lightFragment","#ifdef LIGHT{X}\n#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n\n#else\n#ifndef SPECULARTERM\nvec3 vLightSpecular{X}=vec3(0.);\n#endif\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,vLightData{X},vLightDirection{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightDiffuse{X}.a,glossiness);\n#endif\n#ifdef HEMILIGHT{X}\ninfo=computeHemisphericLighting(viewDirectionW,normalW,vLightData{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightGround{X},glossiness);\n#endif\n#if defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,vLightData{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightDiffuse{X}.a,glossiness);\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWVSM{X}\nshadow=computeShadowWithVSM(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.z,shadowsInfo{X}.x);\n#else\n#ifdef SHADOWPCF{X}\n#if defined(POINTLIGHT{X})\nshadow=computeShadowWithPCFCube(vLightData{X}.xyz,shadowSampler{X},shadowsInfo{X}.y,shadowsInfo{X}.z,shadowsInfo{X}.x);\n#else\nshadow=computeShadowWithPCF(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.y,shadowsInfo{X}.z,shadowsInfo{X}.x);\n#endif\n#else\n#if defined(POINTLIGHT{X})\nshadow=computeShadowCube(vLightData{X}.xyz,shadowSampler{X},shadowsInfo{X}.x,shadowsInfo{X}.z);\n#else\nshadow=computeShadow(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.x,shadowsInfo{X}.z);\n#endif\n#endif\n#endif\n#else\nshadow=1.;\n#endif\n#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor;\n#endif\n#endif\n#else\ndiffuseBase+=info.diffuse*shadow;\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#endif\n#endif"):
a.h.lightFragment="#ifdef LIGHT{X}\n#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n\n#else\n#ifndef SPECULARTERM\nvec3 vLightSpecular{X}=vec3(0.);\n#endif\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,vLightData{X},vLightDirection{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightDiffuse{X}.a,glossiness);\n#endif\n#ifdef HEMILIGHT{X}\ninfo=computeHemisphericLighting(viewDirectionW,normalW,vLightData{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightGround{X},glossiness);\n#endif\n#if defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,vLightData{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightDiffuse{X}.a,glossiness);\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWVSM{X}\nshadow=computeShadowWithVSM(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.z,shadowsInfo{X}.x);\n#else\n#ifdef SHADOWPCF{X}\n#if defined(POINTLIGHT{X})\nshadow=computeShadowWithPCFCube(vLightData{X}.xyz,shadowSampler{X},shadowsInfo{X}.y,shadowsInfo{X}.z,shadowsInfo{X}.x);\n#else\nshadow=computeShadowWithPCF(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.y,shadowsInfo{X}.z,shadowsInfo{X}.x);\n#endif\n#else\n#if defined(POINTLIGHT{X})\nshadow=computeShadowCube(vLightData{X}.xyz,shadowSampler{X},shadowsInfo{X}.x,shadowsInfo{X}.z);\n#else\nshadow=computeShadow(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.x,shadowsInfo{X}.z);\n#endif\n#endif\n#endif\n#else\nshadow=1.;\n#endif\n#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor;\n#endif\n#endif\n#else\ndiffuseBase+=info.diffuse*shadow;\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#endif\n#endif";
null!=t.lightFragmentDeclaration?a.C("lightFragmentDeclaration","#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec3 vLightSpecular{X};\n#endif\n#ifdef SHADOW{X}\n#if defined(SPOTLIGHT{X}) || defined(DIRLIGHT{X})\nvarying vec4 vPositionFromLight{X};\nuniform sampler2D shadowSampler{X};\n#else\nuniform samplerCube shadowSampler{X};\n#endif\nuniform vec3 shadowsInfo{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\n#endif\n#ifdef HEMILIGHT{X}\nuniform vec3 vLightGround{X};\n#endif\n#endif"):
a.h.lightFragmentDeclaration="#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec3 vLightSpecular{X};\n#endif\n#ifdef SHADOW{X}\n#if defined(SPOTLIGHT{X}) || defined(DIRLIGHT{X})\nvarying vec4 vPositionFromLight{X};\nuniform sampler2D shadowSampler{X};\n#else\nuniform samplerCube shadowSampler{X};\n#endif\nuniform vec3 shadowsInfo{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\n#endif\n#ifdef HEMILIGHT{X}\nuniform vec3 vLightGround{X};\n#endif\n#endif";
null!=t.lightsFragmentFunctions?a.C("lightsFragmentFunctions","\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n};\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 lightVectorW;\nfloat attenuation=1.0;\nif (lightData.w == 0.)\n{\nvec3 direction=lightData.xyz-vPositionW;\nattenuation=max(0.,1.0-length(direction)/range);\nlightVectorW=normalize(direction);\n}\nelse\n{\nlightVectorW=normalize(-lightData.xyz);\n}\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 direction=lightData.xyz-vPositionW;\nvec3 lightVectorW=normalize(direction);\nfloat attenuation=max(0.,1.0-length(direction)/range);\n\nfloat cosAngle=max(0.,dot(-lightDirection.xyz,lightVectorW));\nif (cosAngle>=lightDirection.w)\n{\ncosAngle=max(0.,pow(cosAngle,lightData.w));\nattenuation*=cosAngle;\n\nfloat ndl=max(0.,dot(vNormal,-lightDirection.xyz));\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW-lightDirection.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nresult.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\nlightingInfo result;\n\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor;\n#endif\nreturn result;\n}\n"):
a.h.lightsFragmentFunctions="\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n};\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 lightVectorW;\nfloat attenuation=1.0;\nif (lightData.w == 0.)\n{\nvec3 direction=lightData.xyz-vPositionW;\nattenuation=max(0.,1.0-length(direction)/range);\nlightVectorW=normalize(direction);\n}\nelse\n{\nlightVectorW=normalize(-lightData.xyz);\n}\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 direction=lightData.xyz-vPositionW;\nvec3 lightVectorW=normalize(direction);\nfloat attenuation=max(0.,1.0-length(direction)/range);\n\nfloat cosAngle=max(0.,dot(-lightDirection.xyz,lightVectorW));\nif (cosAngle>=lightDirection.w)\n{\ncosAngle=max(0.,pow(cosAngle,lightData.w));\nattenuation*=cosAngle;\n\nfloat ndl=max(0.,dot(vNormal,-lightDirection.xyz));\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW-lightDirection.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nresult.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\nlightingInfo result;\n\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor;\n#endif\nreturn result;\n}\n";
null!=t.logDepthDeclaration?a.C("logDepthDeclaration","#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif"):a.h.logDepthDeclaration="#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif";null!=t.logDepthFragment?a.C("logDepthFragment","#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif"):a.h.logDepthFragment="#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif";
null!=t.logDepthVertex?a.C("logDepthVertex","#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+gl_Position.w;\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif"):a.h.logDepthVertex="#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+gl_Position.w;\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif";null!=t.pbrFunctions?a.C("pbrFunctions","\n#define RECIPROCAL_PI2 0.15915494\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n\nconst float kPi=3.1415926535897932384626433832795;\nconst float kRougnhessToAlphaScale=0.1;\nconst float kRougnhessToAlphaOffset=0.29248125;\nfloat Square(float value)\n{\nreturn value*value;\n}\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);\n}\nfloat convertRoughnessToAverageSlope(float roughness)\n{\n\nconst float kMinimumVariance=0.0005;\nfloat alphaG=Square(roughness)+kMinimumVariance;\nreturn alphaG;\n}\n\nfloat getMipMapIndexFromAverageSlope(float maxMipLevel,float alpha)\n{\n\n\n\n\n\n\n\nfloat mip=kRougnhessToAlphaOffset+maxMipLevel+(maxMipLevel*kRougnhessToAlphaScale*log2(alpha));\nreturn clamp(mip,0.,maxMipLevel);\n}\nfloat getMipMapIndexFromAverageSlopeWithPMREM(float maxMipLevel,float alphaG)\n{\nfloat specularPower=clamp(2./alphaG-2.,0.000001,2048.);\n\nreturn clamp(- 0.5*log2(specularPower)+5.5,0.,maxMipLevel);\n}\n\nfloat smithVisibilityG1_TrowbridgeReitzGGX(float dot,float alphaG)\n{\nfloat tanSquared=(1.0-dot*dot)/(dot*dot);\nreturn 2.0/(1.0+sqrt(1.0+alphaG*alphaG*tanSquared));\n}\nfloat smithVisibilityG_TrowbridgeReitzGGX_Walter(float NdotL,float NdotV,float alphaG)\n{\nreturn smithVisibilityG1_TrowbridgeReitzGGX(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGX(NdotV,alphaG);\n}\n\n\nfloat normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)\n{\n\n\n\nfloat a2=Square(alphaG);\nfloat d=NdotH*NdotH*(a2-1.0)+1.0;\nreturn a2/(kPi*d*d);\n}\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow(clamp(1.0-VdotH,0.,1.),5.0);\n}\nvec3 FresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow(clamp(1.0-VdotN,0.,1.),5.0);\n}\n\nvec3 computeSpecularTerm(float NdotH,float NdotL,float NdotV,float VdotH,float roughness,vec3 specularColor,vec3 reflectance90)\n{\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\nfloat visibility=smithVisibilityG_TrowbridgeReitzGGX_Walter(NdotL,NdotV,alphaG);\nvisibility/=(4.0*NdotL*NdotV); \nvec3 fresnel=fresnelSchlickGGX(VdotH,specularColor,reflectance90);\nfloat specTerm=max(0.,visibility*distribution)*NdotL;\nreturn fresnel*specTerm*kPi; \n}\nfloat computeDiffuseTerm(float NdotL,float NdotV,float VdotH,float roughness)\n{\n\n\nfloat diffuseFresnelNV=pow(clamp(1.0-NdotL,0.000001,1.),5.0);\nfloat diffuseFresnelNL=pow(clamp(1.0-NdotV,0.000001,1.),5.0);\nfloat diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;\nfloat diffuseFresnelTerm =\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);\nreturn diffuseFresnelTerm*NdotL;\n\n\n}\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\n\nfloat lightRoughness=lightRadius/lightDistance;\n\nfloat totalRoughness=clamp(lightRoughness+roughness,0.,1.);\nreturn totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\n{\nfloat kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\nreturn microSurface;\n}\nvec3 toLinearSpace(vec3 color)\n{\nreturn vec3(pow(color.r,2.2),pow(color.g,2.2),pow(color.b,2.2));\n}\nvec3 toGammaSpace(vec3 color)\n{\nreturn vec3(pow(color.r,1.0/2.2),pow(color.g,1.0/2.2),pow(color.b,1.0/2.2));\n}\n#ifdef CAMERATONEMAP\nvec3 toneMaps(vec3 color)\n{\ncolor=max(color,0.0);\n\ncolor.rgb=color.rgb*vCameraInfos.x;\nfloat tuning=1.5; \n\n\nvec3 tonemapped=1.0-exp2(-color.rgb*tuning); \ncolor.rgb=mix(color.rgb,tonemapped,1.0);\nreturn color;\n}\n#endif\n#ifdef CAMERACONTRAST\nvec4 contrasts(vec4 color)\n{\ncolor=clamp(color,0.0,1.0);\nvec3 resultHighContrast=color.rgb*color.rgb*(3.0-2.0*color.rgb);\nfloat contrast=vCameraInfos.y;\nif (contrast<1.0)\n{\n\ncolor.rgb=mix(vec3(0.5,0.5,0.5),color.rgb,contrast);\n}\nelse\n{\n\ncolor.rgb=mix(color.rgb,resultHighContrast,contrast-1.0);\n}\nreturn color;\n}\n#endif"):
a.h.pbrFunctions="\n#define RECIPROCAL_PI2 0.15915494\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n\nconst float kPi=3.1415926535897932384626433832795;\nconst float kRougnhessToAlphaScale=0.1;\nconst float kRougnhessToAlphaOffset=0.29248125;\nfloat Square(float value)\n{\nreturn value*value;\n}\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);\n}\nfloat convertRoughnessToAverageSlope(float roughness)\n{\n\nconst float kMinimumVariance=0.0005;\nfloat alphaG=Square(roughness)+kMinimumVariance;\nreturn alphaG;\n}\n\nfloat getMipMapIndexFromAverageSlope(float maxMipLevel,float alpha)\n{\n\n\n\n\n\n\n\nfloat mip=kRougnhessToAlphaOffset+maxMipLevel+(maxMipLevel*kRougnhessToAlphaScale*log2(alpha));\nreturn clamp(mip,0.,maxMipLevel);\n}\nfloat getMipMapIndexFromAverageSlopeWithPMREM(float maxMipLevel,float alphaG)\n{\nfloat specularPower=clamp(2./alphaG-2.,0.000001,2048.);\n\nreturn clamp(- 0.5*log2(specularPower)+5.5,0.,maxMipLevel);\n}\n\nfloat smithVisibilityG1_TrowbridgeReitzGGX(float dot,float alphaG)\n{\nfloat tanSquared=(1.0-dot*dot)/(dot*dot);\nreturn 2.0/(1.0+sqrt(1.0+alphaG*alphaG*tanSquared));\n}\nfloat smithVisibilityG_TrowbridgeReitzGGX_Walter(float NdotL,float NdotV,float alphaG)\n{\nreturn smithVisibilityG1_TrowbridgeReitzGGX(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGX(NdotV,alphaG);\n}\n\n\nfloat normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)\n{\n\n\n\nfloat a2=Square(alphaG);\nfloat d=NdotH*NdotH*(a2-1.0)+1.0;\nreturn a2/(kPi*d*d);\n}\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow(clamp(1.0-VdotH,0.,1.),5.0);\n}\nvec3 FresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow(clamp(1.0-VdotN,0.,1.),5.0);\n}\n\nvec3 computeSpecularTerm(float NdotH,float NdotL,float NdotV,float VdotH,float roughness,vec3 specularColor,vec3 reflectance90)\n{\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\nfloat visibility=smithVisibilityG_TrowbridgeReitzGGX_Walter(NdotL,NdotV,alphaG);\nvisibility/=(4.0*NdotL*NdotV); \nvec3 fresnel=fresnelSchlickGGX(VdotH,specularColor,reflectance90);\nfloat specTerm=max(0.,visibility*distribution)*NdotL;\nreturn fresnel*specTerm*kPi; \n}\nfloat computeDiffuseTerm(float NdotL,float NdotV,float VdotH,float roughness)\n{\n\n\nfloat diffuseFresnelNV=pow(clamp(1.0-NdotL,0.000001,1.),5.0);\nfloat diffuseFresnelNL=pow(clamp(1.0-NdotV,0.000001,1.),5.0);\nfloat diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;\nfloat diffuseFresnelTerm =\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);\nreturn diffuseFresnelTerm*NdotL;\n\n\n}\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\n\nfloat lightRoughness=lightRadius/lightDistance;\n\nfloat totalRoughness=clamp(lightRoughness+roughness,0.,1.);\nreturn totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\n{\nfloat kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\nreturn microSurface;\n}\nvec3 toLinearSpace(vec3 color)\n{\nreturn vec3(pow(color.r,2.2),pow(color.g,2.2),pow(color.b,2.2));\n}\nvec3 toGammaSpace(vec3 color)\n{\nreturn vec3(pow(color.r,1.0/2.2),pow(color.g,1.0/2.2),pow(color.b,1.0/2.2));\n}\n#ifdef CAMERATONEMAP\nvec3 toneMaps(vec3 color)\n{\ncolor=max(color,0.0);\n\ncolor.rgb=color.rgb*vCameraInfos.x;\nfloat tuning=1.5; \n\n\nvec3 tonemapped=1.0-exp2(-color.rgb*tuning); \ncolor.rgb=mix(color.rgb,tonemapped,1.0);\nreturn color;\n}\n#endif\n#ifdef CAMERACONTRAST\nvec4 contrasts(vec4 color)\n{\ncolor=clamp(color,0.0,1.0);\nvec3 resultHighContrast=color.rgb*color.rgb*(3.0-2.0*color.rgb);\nfloat contrast=vCameraInfos.y;\nif (contrast<1.0)\n{\n\ncolor.rgb=mix(vec3(0.5,0.5,0.5),color.rgb,contrast);\n}\nelse\n{\n\ncolor.rgb=mix(color.rgb,resultHighContrast,contrast-1.0);\n}\nreturn color;\n}\n#endif";
null!=t.pbrLightFunctions?a.C("pbrLightFunctions","\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n};\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range)\n{ \n#ifdef USEPHYSICALLIGHTFALLOFF\nfloat lightDistanceFalloff=1.0/((lightDistanceSquared+0.0001));\n#else\nfloat lightDistanceFalloff=max(0.,1.0-length(lightOffset)/range);\n#endif\nreturn lightDistanceFalloff;\n}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngle,float exponent)\n{\nfloat falloff=0.0;\n#ifdef USEPHYSICALLIGHTFALLOFF\nfloat cosHalfAngle=cos(lightAngle*0.5);\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977; \n\n\n\n\n\nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\n\n\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\nfalloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\n#else\nfloat cosAngle=max(0.000000000000001,dot(-lightDirection,directionToLightCenterW));\nif (cosAngle>=lightAngle)\n{\nfalloff=max(0.,pow(cosAngle,exponent));\n}\n#endif\nreturn falloff;\n}\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float rangeRadius,float roughness,float NdotV,vec3 reflectance90,out float NdotL) {\nlightingInfo result;\nvec3 lightDirection;\nfloat attenuation=1.0;\nfloat lightDistance;\n\nif (lightData.w == 0.)\n{\nvec3 lightOffset=lightData.xyz-vPositionW;\nfloat lightDistanceSquared=dot(lightOffset,lightOffset);\nattenuation=computeDistanceLightFalloff(lightOffset,lightDistanceSquared,rangeRadius);\nlightDistance=sqrt(lightDistanceSquared);\nlightDirection=normalize(lightOffset);\n}\n\nelse\n{\nlightDistance=length(-lightData.xyz);\nlightDirection=normalize(-lightData.xyz);\n}\n\nroughness=adjustRoughnessFromLightProperties(roughness,rangeRadius,lightDistance);\n\nvec3 H=normalize(viewDirectionW+lightDirection);\nNdotL=max(0.00000000001,dot(vNormal,lightDirection));\nfloat VdotH=clamp(0.00000000001,1.0,dot(viewDirectionW,H));\nfloat diffuseTerm=computeDiffuseTerm(NdotL,NdotV,VdotH,roughness);\nresult.diffuse=diffuseTerm*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nfloat NdotH=max(0.00000000001,dot(vNormal,H));\nvec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,specularColor,reflectance90);\nresult.specular=specTerm*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float rangeRadius,float roughness,float NdotV,vec3 reflectance90,out float NdotL) {\nlightingInfo result;\nvec3 lightOffset=lightData.xyz-vPositionW;\nvec3 directionToLightCenterW=normalize(lightOffset);\n\nfloat lightDistanceSquared=dot(lightOffset,lightOffset);\nfloat attenuation=computeDistanceLightFalloff(lightOffset,lightDistanceSquared,rangeRadius);\n\nfloat directionalAttenuation=computeDirectionalLightFalloff(lightDirection.xyz,directionToLightCenterW,lightDirection.w,lightData.w);\nattenuation*=directionalAttenuation;\n\nfloat lightDistance=sqrt(lightDistanceSquared);\nroughness=adjustRoughnessFromLightProperties(roughness,rangeRadius,lightDistance);\n\nvec3 H=normalize(viewDirectionW-lightDirection.xyz);\nNdotL=max(0.00000000001,dot(vNormal,-lightDirection.xyz));\nfloat VdotH=clamp(dot(viewDirectionW,H),0.00000000001,1.0);\nfloat diffuseTerm=computeDiffuseTerm(NdotL,NdotV,VdotH,roughness);\nresult.diffuse=diffuseTerm*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nfloat NdotH=max(0.00000000001,dot(vNormal,H));\nvec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,specularColor,reflectance90);\nresult.specular=specTerm*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float roughness,float NdotV,vec3 reflectance90,out float NdotL) {\nlightingInfo result;\n\n\n\nNdotL=dot(vNormal,lightData.xyz)*0.5+0.5;\nresult.diffuse=mix(groundColor,diffuseColor,NdotL);\n#ifdef SPECULARTERM\n\nvec3 lightVectorW=normalize(lightData.xyz);\nvec3 H=normalize(viewDirectionW+lightVectorW);\nfloat NdotH=max(0.00000000001,dot(vNormal,H));\nNdotL=max(0.00000000001,NdotL);\nfloat VdotH=clamp(0.00000000001,1.0,dot(viewDirectionW,H));\nvec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,specularColor,reflectance90);\nresult.specular=specTerm;\n#endif\nreturn result;\n}"):
a.h.pbrLightFunctions="\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n};\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range)\n{ \n#ifdef USEPHYSICALLIGHTFALLOFF\nfloat lightDistanceFalloff=1.0/((lightDistanceSquared+0.0001));\n#else\nfloat lightDistanceFalloff=max(0.,1.0-length(lightOffset)/range);\n#endif\nreturn lightDistanceFalloff;\n}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngle,float exponent)\n{\nfloat falloff=0.0;\n#ifdef USEPHYSICALLIGHTFALLOFF\nfloat cosHalfAngle=cos(lightAngle*0.5);\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977; \n\n\n\n\n\nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\n\n\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\nfalloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\n#else\nfloat cosAngle=max(0.000000000000001,dot(-lightDirection,directionToLightCenterW));\nif (cosAngle>=lightAngle)\n{\nfalloff=max(0.,pow(cosAngle,exponent));\n}\n#endif\nreturn falloff;\n}\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float rangeRadius,float roughness,float NdotV,vec3 reflectance90,out float NdotL) {\nlightingInfo result;\nvec3 lightDirection;\nfloat attenuation=1.0;\nfloat lightDistance;\n\nif (lightData.w == 0.)\n{\nvec3 lightOffset=lightData.xyz-vPositionW;\nfloat lightDistanceSquared=dot(lightOffset,lightOffset);\nattenuation=computeDistanceLightFalloff(lightOffset,lightDistanceSquared,rangeRadius);\nlightDistance=sqrt(lightDistanceSquared);\nlightDirection=normalize(lightOffset);\n}\n\nelse\n{\nlightDistance=length(-lightData.xyz);\nlightDirection=normalize(-lightData.xyz);\n}\n\nroughness=adjustRoughnessFromLightProperties(roughness,rangeRadius,lightDistance);\n\nvec3 H=normalize(viewDirectionW+lightDirection);\nNdotL=max(0.00000000001,dot(vNormal,lightDirection));\nfloat VdotH=clamp(0.00000000001,1.0,dot(viewDirectionW,H));\nfloat diffuseTerm=computeDiffuseTerm(NdotL,NdotV,VdotH,roughness);\nresult.diffuse=diffuseTerm*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nfloat NdotH=max(0.00000000001,dot(vNormal,H));\nvec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,specularColor,reflectance90);\nresult.specular=specTerm*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float rangeRadius,float roughness,float NdotV,vec3 reflectance90,out float NdotL) {\nlightingInfo result;\nvec3 lightOffset=lightData.xyz-vPositionW;\nvec3 directionToLightCenterW=normalize(lightOffset);\n\nfloat lightDistanceSquared=dot(lightOffset,lightOffset);\nfloat attenuation=computeDistanceLightFalloff(lightOffset,lightDistanceSquared,rangeRadius);\n\nfloat directionalAttenuation=computeDirectionalLightFalloff(lightDirection.xyz,directionToLightCenterW,lightDirection.w,lightData.w);\nattenuation*=directionalAttenuation;\n\nfloat lightDistance=sqrt(lightDistanceSquared);\nroughness=adjustRoughnessFromLightProperties(roughness,rangeRadius,lightDistance);\n\nvec3 H=normalize(viewDirectionW-lightDirection.xyz);\nNdotL=max(0.00000000001,dot(vNormal,-lightDirection.xyz));\nfloat VdotH=clamp(dot(viewDirectionW,H),0.00000000001,1.0);\nfloat diffuseTerm=computeDiffuseTerm(NdotL,NdotV,VdotH,roughness);\nresult.diffuse=diffuseTerm*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nfloat NdotH=max(0.00000000001,dot(vNormal,H));\nvec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,specularColor,reflectance90);\nresult.specular=specTerm*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float roughness,float NdotV,vec3 reflectance90,out float NdotL) {\nlightingInfo result;\n\n\n\nNdotL=dot(vNormal,lightData.xyz)*0.5+0.5;\nresult.diffuse=mix(groundColor,diffuseColor,NdotL);\n#ifdef SPECULARTERM\n\nvec3 lightVectorW=normalize(lightData.xyz);\nvec3 H=normalize(viewDirectionW+lightVectorW);\nfloat NdotH=max(0.00000000001,dot(vNormal,H));\nNdotL=max(0.00000000001,NdotL);\nfloat VdotH=clamp(0.00000000001,1.0,dot(viewDirectionW,H));\nvec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,specularColor,reflectance90);\nresult.specular=specTerm;\n#endif\nreturn result;\n}";
null!=t.pbrLightFunctionsCall?a.C("pbrLightFunctionsCall","#ifdef LIGHT{X}\n#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n\n#else\n#ifndef SPECULARTERM\nvec3 vLightSpecular{X}=vec3(0.0);\n#endif\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,vLightData{X},vLightDirection{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightDiffuse{X}.a,roughness,NdotV,specularEnvironmentR90,NdotL);\n#endif\n#ifdef HEMILIGHT{X}\ninfo=computeHemisphericLighting(viewDirectionW,normalW,vLightData{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightGround{X},roughness,NdotV,specularEnvironmentR90,NdotL);\n#endif\n#if defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,vLightData{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightDiffuse{X}.a,roughness,NdotV,specularEnvironmentR90,NdotL);\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWVSM{X}\nnotShadowLevel=computeShadowWithVSM(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.z,shadowsInfo{X}.x);\n#else\n#ifdef SHADOWPCF{X}\n#if defined(POINTLIGHT{X})\nnotShadowLevel=computeShadowWithPCFCube(vLightData{X}.xyz,shadowSampler{X},shadowsInfo{X}.y,shadowsInfo{X}.z,shadowsInfo{X}.x);\n#else\nnotShadowLevel=computeShadowWithPCF(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.y,shadowsInfo{X}.z,shadowsInfo{X}.x);\n#endif\n#else\n#if defined(POINTLIGHT{X})\nnotShadowLevel=computeShadowCube(vLightData{X}.xyz,shadowSampler{X},shadowsInfo{X}.x,shadowsInfo{X}.z);\n#else\nnotShadowLevel=computeShadow(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.x,shadowsInfo{X}.z);\n#endif\n#endif\n#endif\n#else\nnotShadowLevel=1.;\n#endif\n#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\nlightDiffuseContribution+=lightmapColor*notShadowLevel;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nlightSpecularContribution+=info.specular*notShadowLevel*lightmapColor;\n#endif\n#endif\n#else\nlightDiffuseContribution+=info.diffuse*notShadowLevel;\n#ifdef OVERLOADEDSHADOWVALUES\nif (NdotL<0.000000000011)\n{\nnotShadowLevel=1.;\n}\nshadowedOnlyLightDiffuseContribution*=notShadowLevel;\n#endif\n#ifdef SPECULARTERM\nlightSpecularContribution+=info.specular*notShadowLevel;\n#endif\n#endif\n#endif"):
a.h.pbrLightFunctionsCall="#ifdef LIGHT{X}\n#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n\n#else\n#ifndef SPECULARTERM\nvec3 vLightSpecular{X}=vec3(0.0);\n#endif\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,vLightData{X},vLightDirection{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightDiffuse{X}.a,roughness,NdotV,specularEnvironmentR90,NdotL);\n#endif\n#ifdef HEMILIGHT{X}\ninfo=computeHemisphericLighting(viewDirectionW,normalW,vLightData{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightGround{X},roughness,NdotV,specularEnvironmentR90,NdotL);\n#endif\n#if defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,vLightData{X},vLightDiffuse{X}.rgb,vLightSpecular{X},vLightDiffuse{X}.a,roughness,NdotV,specularEnvironmentR90,NdotL);\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWVSM{X}\nnotShadowLevel=computeShadowWithVSM(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.z,shadowsInfo{X}.x);\n#else\n#ifdef SHADOWPCF{X}\n#if defined(POINTLIGHT{X})\nnotShadowLevel=computeShadowWithPCFCube(vLightData{X}.xyz,shadowSampler{X},shadowsInfo{X}.y,shadowsInfo{X}.z,shadowsInfo{X}.x);\n#else\nnotShadowLevel=computeShadowWithPCF(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.y,shadowsInfo{X}.z,shadowsInfo{X}.x);\n#endif\n#else\n#if defined(POINTLIGHT{X})\nnotShadowLevel=computeShadowCube(vLightData{X}.xyz,shadowSampler{X},shadowsInfo{X}.x,shadowsInfo{X}.z);\n#else\nnotShadowLevel=computeShadow(vPositionFromLight{X},shadowSampler{X},shadowsInfo{X}.x,shadowsInfo{X}.z);\n#endif\n#endif\n#endif\n#else\nnotShadowLevel=1.;\n#endif\n#if defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\nlightDiffuseContribution+=lightmapColor*notShadowLevel;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nlightSpecularContribution+=info.specular*notShadowLevel*lightmapColor;\n#endif\n#endif\n#else\nlightDiffuseContribution+=info.diffuse*notShadowLevel;\n#ifdef OVERLOADEDSHADOWVALUES\nif (NdotL<0.000000000011)\n{\nnotShadowLevel=1.;\n}\nshadowedOnlyLightDiffuseContribution*=notShadowLevel;\n#endif\n#ifdef SPECULARTERM\nlightSpecularContribution+=info.specular*notShadowLevel;\n#endif\n#endif\n#endif";
null!=t.pbrShadowFunctions?a.C("pbrShadowFunctions","\n#ifdef SHADOWS\n#ifndef SHADOWFULLFLOAT\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nuniform vec2 depthValues;\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float bias)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y =-directionToLight.y;\n#ifndef SHADOWFULLFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight))+bias;\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x+bias;\n#endif\nif (depth>shadow)\n{\n#ifdef OVERLOADEDSHADOWVALUES\nreturn mix(1.0,darkness,vOverloadedShadowIntensity.x);\n#else\nreturn darkness;\n#endif\n}\nreturn 1.0;\n}\nfloat computeShadowWithPCFCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float bias,float darkness)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth-depthValues.x)/(depthValues.y-depthValues.x);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n\nfloat biasedDepth=depth-bias;\n#ifndef SHADOWFULLFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<biasedDepth) visibility-=0.25;\n#else\nif (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<biasedDepth) visibility-=0.25;\n#endif\n#ifdef OVERLOADEDSHADOWVALUES\nreturn min(1.0,mix(1.0,visibility+darkness,vOverloadedShadowIntensity.x));\n#else\nreturn min(1.0,visibility+darkness);\n#endif\n}\nfloat computeShadow(vec4 vPositionFromLight,sampler2D shadowSampler,float darkness,float bias)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\n#ifndef SHADOWFULLFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uv))+bias;\n#else\nfloat shadow=texture2D(shadowSampler,uv).x+bias;\n#endif\nif (depth.z>shadow)\n{\n#ifdef OVERLOADEDSHADOWVALUES\nreturn mix(1.0,darkness,vOverloadedShadowIntensity.x);\n#else\nreturn darkness;\n#endif\n}\nreturn 1.;\n}\nfloat computeShadowWithPCF(vec4 vPositionFromLight,sampler2D shadowSampler,float mapSize,float bias,float darkness)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n\nfloat biasedDepth=depth.z-bias;\n#ifndef SHADOWFULLFLOAT\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[1]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[2]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[3]*mapSize))<biasedDepth) visibility-=0.25;\n#else\nif (texture2D(shadowSampler,uv+poissonDisk[0]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[1]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[2]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[3]*mapSize).x<biasedDepth) visibility-=0.25;\n#endif\n#ifdef OVERLOADEDSHADOWVALUES\nreturn min(1.0,mix(1.0,visibility+darkness,vOverloadedShadowIntensity.x));\n#else\nreturn min(1.0,visibility+darkness);\n#endif\n}\n#ifndef SHADOWFULLFLOAT\n\nfloat unpackHalf(vec2 color)\n{\nreturn color.x+(color.y/255.0);\n}\n#endif\nfloat linstep(float low,float high,float v) {\nreturn clamp((v-low)/(high-low),0.0,1.0);\n}\nfloat ChebychevInequality(vec2 moments,float compare,float bias)\n{\nfloat p=smoothstep(compare-bias,compare,moments.x);\nfloat variance=max(moments.y-moments.x*moments.x,0.02);\nfloat d=compare-moments.x;\nfloat p_max=linstep(0.2,1.0,variance/(variance+d*d));\nreturn clamp(max(p,p_max),0.0,1.0);\n}\nfloat computeShadowWithVSM(vec4 vPositionFromLight,sampler2D shadowSampler,float bias,float darkness)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0 || depth.z>=1.0)\n{\nreturn 1.0;\n}\nvec4 texel=texture2D(shadowSampler,uv);\n#ifndef SHADOWFULLFLOAT\nvec2 moments=vec2(unpackHalf(texel.xy),unpackHalf(texel.zw));\n#else\nvec2 moments=texel.xy;\n#endif\n#ifdef OVERLOADEDSHADOWVALUES\nreturn min(1.0,mix(1.0,1.0-ChebychevInequality(moments,depth.z,bias)+darkness,vOverloadedShadowIntensity.x));\n#else\nreturn min(1.0,1.0-ChebychevInequality(moments,depth.z,bias)+darkness);\n#endif\n}\n#endif"):
a.h.pbrShadowFunctions="\n#ifdef SHADOWS\n#ifndef SHADOWFULLFLOAT\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nuniform vec2 depthValues;\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float bias)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y =-directionToLight.y;\n#ifndef SHADOWFULLFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight))+bias;\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x+bias;\n#endif\nif (depth>shadow)\n{\n#ifdef OVERLOADEDSHADOWVALUES\nreturn mix(1.0,darkness,vOverloadedShadowIntensity.x);\n#else\nreturn darkness;\n#endif\n}\nreturn 1.0;\n}\nfloat computeShadowWithPCFCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float bias,float darkness)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth-depthValues.x)/(depthValues.y-depthValues.x);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n\nfloat biasedDepth=depth-bias;\n#ifndef SHADOWFULLFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<biasedDepth) visibility-=0.25;\n#else\nif (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<biasedDepth) visibility-=0.25;\n#endif\n#ifdef OVERLOADEDSHADOWVALUES\nreturn min(1.0,mix(1.0,visibility+darkness,vOverloadedShadowIntensity.x));\n#else\nreturn min(1.0,visibility+darkness);\n#endif\n}\nfloat computeShadow(vec4 vPositionFromLight,sampler2D shadowSampler,float darkness,float bias)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\n#ifndef SHADOWFULLFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uv))+bias;\n#else\nfloat shadow=texture2D(shadowSampler,uv).x+bias;\n#endif\nif (depth.z>shadow)\n{\n#ifdef OVERLOADEDSHADOWVALUES\nreturn mix(1.0,darkness,vOverloadedShadowIntensity.x);\n#else\nreturn darkness;\n#endif\n}\nreturn 1.;\n}\nfloat computeShadowWithPCF(vec4 vPositionFromLight,sampler2D shadowSampler,float mapSize,float bias,float darkness)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n\nfloat biasedDepth=depth.z-bias;\n#ifndef SHADOWFULLFLOAT\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[1]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[2]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[3]*mapSize))<biasedDepth) visibility-=0.25;\n#else\nif (texture2D(shadowSampler,uv+poissonDisk[0]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[1]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[2]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[3]*mapSize).x<biasedDepth) visibility-=0.25;\n#endif\n#ifdef OVERLOADEDSHADOWVALUES\nreturn min(1.0,mix(1.0,visibility+darkness,vOverloadedShadowIntensity.x));\n#else\nreturn min(1.0,visibility+darkness);\n#endif\n}\n#ifndef SHADOWFULLFLOAT\n\nfloat unpackHalf(vec2 color)\n{\nreturn color.x+(color.y/255.0);\n}\n#endif\nfloat linstep(float low,float high,float v) {\nreturn clamp((v-low)/(high-low),0.0,1.0);\n}\nfloat ChebychevInequality(vec2 moments,float compare,float bias)\n{\nfloat p=smoothstep(compare-bias,compare,moments.x);\nfloat variance=max(moments.y-moments.x*moments.x,0.02);\nfloat d=compare-moments.x;\nfloat p_max=linstep(0.2,1.0,variance/(variance+d*d));\nreturn clamp(max(p,p_max),0.0,1.0);\n}\nfloat computeShadowWithVSM(vec4 vPositionFromLight,sampler2D shadowSampler,float bias,float darkness)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0 || depth.z>=1.0)\n{\nreturn 1.0;\n}\nvec4 texel=texture2D(shadowSampler,uv);\n#ifndef SHADOWFULLFLOAT\nvec2 moments=vec2(unpackHalf(texel.xy),unpackHalf(texel.zw));\n#else\nvec2 moments=texel.xy;\n#endif\n#ifdef OVERLOADEDSHADOWVALUES\nreturn min(1.0,mix(1.0,1.0-ChebychevInequality(moments,depth.z,bias)+darkness,vOverloadedShadowIntensity.x));\n#else\nreturn min(1.0,1.0-ChebychevInequality(moments,depth.z,bias)+darkness);\n#endif\n}\n#endif";
null!=t.pointCloudVertex?a.C("pointCloudVertex","#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif"):a.h.pointCloudVertex="#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif";null!=t.pointCloudVertexDeclaration?a.C("pointCloudVertexDeclaration","#ifdef POINTSIZE\nuniform float pointSize;\n#endif"):a.h.pointCloudVertexDeclaration="#ifdef POINTSIZE\nuniform float pointSize;\n#endif";null!=t.reflectionFunction?a.C("reflectionFunction","vec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\n{\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);\nfloat t=clamp(direction.y*-0.5+0.5,0.,1.0);\nfloat s=atan(direction.z,direction.x)*RECIPROCAL_PI2+0.5;\nreturn vec3(s,t,0);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\nvec3 cameraToVertex=normalize(worldPos.xyz-vEyePosition);\nvec3 r=reflect(cameraToVertex,worldNormal);\nfloat t=clamp(r.y*-0.5+0.5,0.,1.0);\nfloat s=atan(r.z,r.x)*RECIPROCAL_PI2+0.5;\nreturn vec3(s,t,0);\n#endif\n#ifdef REFLECTIONMAP_SPHERICAL\nvec3 viewDir=normalize(vec3(view*worldPos));\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\nvec3 r=reflect(viewDir,viewNormal);\nr.z=r.z-1.0;\nfloat m=2.0*length(r);\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\n#endif\n#ifdef REFLECTIONMAP_PLANAR\nvec3 viewDir=worldPos.xyz-vEyePosition;\nvec3 coords=normalize(reflect(viewDir,worldNormal));\nreturn vec3(reflectionMatrix*vec4(coords,1));\n#endif\n#ifdef REFLECTIONMAP_CUBIC\nvec3 viewDir=worldPos.xyz-vEyePosition;\nvec3 coords=reflect(viewDir,worldNormal);\n#ifdef INVERTCUBICMAP\ncoords.y=1.0-coords.y;\n#endif\nreturn vec3(reflectionMatrix*vec4(coords,0));\n#endif\n#ifdef REFLECTIONMAP_PROJECTION\nreturn vec3(reflectionMatrix*(view*worldPos));\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nreturn vPositionUVW;\n#endif\n#ifdef REFLECTIONMAP_EXPLICIT\nreturn vec3(0,0,0);\n#endif\n}"):
a.h.reflectionFunction="vec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\n{\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);\nfloat t=clamp(direction.y*-0.5+0.5,0.,1.0);\nfloat s=atan(direction.z,direction.x)*RECIPROCAL_PI2+0.5;\nreturn vec3(s,t,0);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\nvec3 cameraToVertex=normalize(worldPos.xyz-vEyePosition);\nvec3 r=reflect(cameraToVertex,worldNormal);\nfloat t=clamp(r.y*-0.5+0.5,0.,1.0);\nfloat s=atan(r.z,r.x)*RECIPROCAL_PI2+0.5;\nreturn vec3(s,t,0);\n#endif\n#ifdef REFLECTIONMAP_SPHERICAL\nvec3 viewDir=normalize(vec3(view*worldPos));\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\nvec3 r=reflect(viewDir,viewNormal);\nr.z=r.z-1.0;\nfloat m=2.0*length(r);\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\n#endif\n#ifdef REFLECTIONMAP_PLANAR\nvec3 viewDir=worldPos.xyz-vEyePosition;\nvec3 coords=normalize(reflect(viewDir,worldNormal));\nreturn vec3(reflectionMatrix*vec4(coords,1));\n#endif\n#ifdef REFLECTIONMAP_CUBIC\nvec3 viewDir=worldPos.xyz-vEyePosition;\nvec3 coords=reflect(viewDir,worldNormal);\n#ifdef INVERTCUBICMAP\ncoords.y=1.0-coords.y;\n#endif\nreturn vec3(reflectionMatrix*vec4(coords,0));\n#endif\n#ifdef REFLECTIONMAP_PROJECTION\nreturn vec3(reflectionMatrix*(view*worldPos));\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nreturn vPositionUVW;\n#endif\n#ifdef REFLECTIONMAP_EXPLICIT\nreturn vec3(0,0,0);\n#endif\n}";
null!=t.shadowsFragmentFunctions?a.C("shadowsFragmentFunctions","#ifdef SHADOWS\n#ifndef SHADOWFULLFLOAT\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nuniform vec2 depthValues;\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float bias)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth-depthValues.x)/(depthValues.y-depthValues.x);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFULLFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight))+bias;\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x+bias;\n#endif\nif (depth>shadow)\n{\nreturn darkness;\n}\nreturn 1.0;\n}\nfloat computeShadowWithPCFCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float bias,float darkness)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth-depthValues.x)/(depthValues.y-depthValues.x);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n\nfloat biasedDepth=depth-bias;\n#ifndef SHADOWFULLFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<biasedDepth) visibility-=0.25;\n#else\nif (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<biasedDepth) visibility-=0.25;\n#endif\nreturn min(1.0,visibility+darkness);\n}\nfloat computeShadow(vec4 vPositionFromLight,sampler2D shadowSampler,float darkness,float bias)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\n#ifndef SHADOWFULLFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uv))+bias;\n#else\nfloat shadow=texture2D(shadowSampler,uv).x+bias;\n#endif\nif (depth.z>shadow)\n{\nreturn darkness;\n}\nreturn 1.;\n}\nfloat computeShadowWithPCF(vec4 vPositionFromLight,sampler2D shadowSampler,float mapSize,float bias,float darkness)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n\nfloat biasedDepth=depth.z-bias;\n#ifndef SHADOWFULLFLOAT\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[1]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[2]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[3]*mapSize))<biasedDepth) visibility-=0.25;\n#else\nif (texture2D(shadowSampler,uv+poissonDisk[0]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[1]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[2]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[3]*mapSize).x<biasedDepth) visibility-=0.25;\n#endif\nreturn min(1.0,visibility+darkness);\n}\n#ifndef SHADOWFULLFLOAT\n\nfloat unpackHalf(vec2 color)\n{\nreturn color.x+(color.y/255.0);\n}\n#endif\nfloat linstep(float low,float high,float v) {\nreturn clamp((v-low)/(high-low),0.0,1.0);\n}\nfloat ChebychevInequality(vec2 moments,float compare,float bias)\n{\nfloat p=smoothstep(compare-bias,compare,moments.x);\nfloat variance=max(moments.y-moments.x*moments.x,0.02);\nfloat d=compare-moments.x;\nfloat p_max=linstep(0.2,1.0,variance/(variance+d*d));\nreturn clamp(max(p,p_max),0.0,1.0);\n}\nfloat computeShadowWithVSM(vec4 vPositionFromLight,sampler2D shadowSampler,float bias,float darkness)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0 || depth.z>=1.0)\n{\nreturn 1.0;\n}\nvec4 texel=texture2D(shadowSampler,uv);\n#ifndef SHADOWFULLFLOAT\nvec2 moments=vec2(unpackHalf(texel.xy),unpackHalf(texel.zw));\n#else\nvec2 moments=texel.xy;\n#endif\nreturn min(1.0,1.0-ChebychevInequality(moments,depth.z,bias)+darkness);\n}\n#endif"):
a.h.shadowsFragmentFunctions="#ifdef SHADOWS\n#ifndef SHADOWFULLFLOAT\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nuniform vec2 depthValues;\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float bias)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth-depthValues.x)/(depthValues.y-depthValues.x);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFULLFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight))+bias;\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x+bias;\n#endif\nif (depth>shadow)\n{\nreturn darkness;\n}\nreturn 1.0;\n}\nfloat computeShadowWithPCFCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float bias,float darkness)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth-depthValues.x)/(depthValues.y-depthValues.x);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n\nfloat biasedDepth=depth-bias;\n#ifndef SHADOWFULLFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<biasedDepth) visibility-=0.25;\n#else\nif (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<biasedDepth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<biasedDepth) visibility-=0.25;\n#endif\nreturn min(1.0,visibility+darkness);\n}\nfloat computeShadow(vec4 vPositionFromLight,sampler2D shadowSampler,float darkness,float bias)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\n#ifndef SHADOWFULLFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uv))+bias;\n#else\nfloat shadow=texture2D(shadowSampler,uv).x+bias;\n#endif\nif (depth.z>shadow)\n{\nreturn darkness;\n}\nreturn 1.;\n}\nfloat computeShadowWithPCF(vec4 vPositionFromLight,sampler2D shadowSampler,float mapSize,float bias,float darkness)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n\nfloat biasedDepth=depth.z-bias;\n#ifndef SHADOWFULLFLOAT\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[1]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[2]*mapSize))<biasedDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[3]*mapSize))<biasedDepth) visibility-=0.25;\n#else\nif (texture2D(shadowSampler,uv+poissonDisk[0]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[1]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[2]*mapSize).x<biasedDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[3]*mapSize).x<biasedDepth) visibility-=0.25;\n#endif\nreturn min(1.0,visibility+darkness);\n}\n#ifndef SHADOWFULLFLOAT\n\nfloat unpackHalf(vec2 color)\n{\nreturn color.x+(color.y/255.0);\n}\n#endif\nfloat linstep(float low,float high,float v) {\nreturn clamp((v-low)/(high-low),0.0,1.0);\n}\nfloat ChebychevInequality(vec2 moments,float compare,float bias)\n{\nfloat p=smoothstep(compare-bias,compare,moments.x);\nfloat variance=max(moments.y-moments.x*moments.x,0.02);\nfloat d=compare-moments.x;\nfloat p_max=linstep(0.2,1.0,variance/(variance+d*d));\nreturn clamp(max(p,p_max),0.0,1.0);\n}\nfloat computeShadowWithVSM(vec4 vPositionFromLight,sampler2D shadowSampler,float bias,float darkness)\n{\nvec3 depth=vPositionFromLight.xyz/vPositionFromLight.w;\ndepth=0.5*depth+vec3(0.5);\nvec2 uv=depth.xy;\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0 || depth.z>=1.0)\n{\nreturn 1.0;\n}\nvec4 texel=texture2D(shadowSampler,uv);\n#ifndef SHADOWFULLFLOAT\nvec2 moments=vec2(unpackHalf(texel.xy),unpackHalf(texel.zw));\n#else\nvec2 moments=texel.xy;\n#endif\nreturn min(1.0,1.0-ChebychevInequality(moments,depth.z,bias)+darkness);\n}\n#endif";
null!=t.shadowsVertex?a.C("shadowsVertex","#ifdef SHADOWS\n#if defined(SPOTLIGHT{X}) || defined(DIRLIGHT{X})\nvPositionFromLight{X}=lightMatrix{X}*worldPos;\n#endif\n#endif"):a.h.shadowsVertex="#ifdef SHADOWS\n#if defined(SPOTLIGHT{X}) || defined(DIRLIGHT{X})\nvPositionFromLight{X}=lightMatrix{X}*worldPos;\n#endif\n#endif";null!=t.shadowsVertexDeclaration?a.C("shadowsVertexDeclaration","#ifdef SHADOWS\n#if defined(SPOTLIGHT{X}) || defined(DIRLIGHT{X})\nuniform mat4 lightMatrix{X};\nvarying vec4 vPositionFromLight{X};\n#endif\n#endif\n"):
a.h.shadowsVertexDeclaration="#ifdef SHADOWS\n#if defined(SPOTLIGHT{X}) || defined(DIRLIGHT{X})\nuniform mat4 lightMatrix{X};\nvarying vec4 vPositionFromLight{X};\n#endif\n#endif\n";return a}(this);Db.Bb=function(){var a=new W;null!=t["anaglyph.fragment"]?a.C("anaglyph.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D leftSampler;\nvoid main(void)\n{\nvec4 leftFrag=texture2D(leftSampler,vUV);\nleftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);\nvec4 rightFrag=texture2D(textureSampler,vUV);\nrightFrag=vec4(rightFrag.r,1.0,1.0,1.0);\ngl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);\n}"):
a.h["anaglyph.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D leftSampler;\nvoid main(void)\n{\nvec4 leftFrag=texture2D(leftSampler,vUV);\nleftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);\nvec4 rightFrag=texture2D(textureSampler,vUV);\nrightFrag=vec4(rightFrag.r,1.0,1.0,1.0);\ngl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);\n}";null!=t["blackAndWhite.fragment"]?a.C("blackAndWhite.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void) \n{\nfloat luminance=dot(texture2D(textureSampler,vUV).rgb,vec3(0.3,0.59,0.11));\ngl_FragColor=vec4(luminance,luminance,luminance,1.0);\n}"):
a.h["blackAndWhite.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void) \n{\nfloat luminance=dot(texture2D(textureSampler,vUV).rgb,vec3(0.3,0.59,0.11));\ngl_FragColor=vec4(luminance,luminance,luminance,1.0);\n}";null!=t["blur.fragment"]?a.C("blur.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nuniform vec2 direction;\nuniform float blurWidth;\nvoid main(void)\n{\nfloat weights[7];\nweights[0]=0.05;\nweights[1]=0.1;\nweights[2]=0.2;\nweights[3]=0.3;\nweights[4]=0.2;\nweights[5]=0.1;\nweights[6]=0.05;\nvec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);\nvec2 texelStep=texelSize*direction*blurWidth;\nvec2 start=vUV-3.0*texelStep;\nvec4 baseColor=vec4(0.,0.,0.,0.);\nvec2 texelOffset=vec2(0.,0.);\nfor (int i=0; i<7; i++)\n{\nbaseColor+=texture2D(textureSampler,start+texelOffset)*weights[i];\ntexelOffset+=texelStep;\n}\ngl_FragColor=baseColor;\n}"):
a.h["blur.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nuniform vec2 direction;\nuniform float blurWidth;\nvoid main(void)\n{\nfloat weights[7];\nweights[0]=0.05;\nweights[1]=0.1;\nweights[2]=0.2;\nweights[3]=0.3;\nweights[4]=0.2;\nweights[5]=0.1;\nweights[6]=0.05;\nvec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);\nvec2 texelStep=texelSize*direction*blurWidth;\nvec2 start=vUV-3.0*texelStep;\nvec4 baseColor=vec4(0.,0.,0.,0.);\nvec2 texelOffset=vec2(0.,0.);\nfor (int i=0; i<7; i++)\n{\nbaseColor+=texture2D(textureSampler,start+texelOffset)*weights[i];\ntexelOffset+=texelStep;\n}\ngl_FragColor=baseColor;\n}";
null!=t["chromaticAberration.fragment"]?a.C("chromaticAberration.fragment","\nuniform sampler2D textureSampler; \n\nuniform float chromatic_aberration;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\nvoid main(void)\n{\nvec2 centered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\nfloat radius2=centered_screen_pos.x*centered_screen_pos.x\n+centered_screen_pos.y*centered_screen_pos.y;\nfloat radius=sqrt(radius2);\nvec4 original=texture2D(textureSampler,vUV);\nif (chromatic_aberration>0.0) {\n\nvec3 ref_indices=vec3(-0.3,0.0,0.3);\nfloat ref_shiftX=chromatic_aberration*radius*17.0/screen_width;\nfloat ref_shiftY=chromatic_aberration*radius*17.0/screen_height;\n\nvec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);\nvec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);\nvec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);\noriginal.r=texture2D(textureSampler,ref_coords_r).r;\noriginal.g=texture2D(textureSampler,ref_coords_g).g;\noriginal.b=texture2D(textureSampler,ref_coords_b).b;\n}\ngl_FragColor=original;\n}"):
a.h["chromaticAberration.fragment"]="\nuniform sampler2D textureSampler; \n\nuniform float chromatic_aberration;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\nvoid main(void)\n{\nvec2 centered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\nfloat radius2=centered_screen_pos.x*centered_screen_pos.x\n+centered_screen_pos.y*centered_screen_pos.y;\nfloat radius=sqrt(radius2);\nvec4 original=texture2D(textureSampler,vUV);\nif (chromatic_aberration>0.0) {\n\nvec3 ref_indices=vec3(-0.3,0.0,0.3);\nfloat ref_shiftX=chromatic_aberration*radius*17.0/screen_width;\nfloat ref_shiftY=chromatic_aberration*radius*17.0/screen_height;\n\nvec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);\nvec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);\nvec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);\noriginal.r=texture2D(textureSampler,ref_coords_r).r;\noriginal.g=texture2D(textureSampler,ref_coords_g).g;\noriginal.b=texture2D(textureSampler,ref_coords_b).b;\n}\ngl_FragColor=original;\n}";
null!=t["color.fragment"]?a.C("color.fragment","uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}"):a.h["color.fragment"]="uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}";null!=t["color.vertex"]?a.C("color.vertex","\nattribute vec3 position;\n\nuniform mat4 worldViewProjection;\nvoid main(void) {\ngl_Position=worldViewProjection*vec4(position,1.0);\n}"):a.h["color.vertex"]="\nattribute vec3 position;\n\nuniform mat4 worldViewProjection;\nvoid main(void) {\ngl_Position=worldViewProjection*vec4(position,1.0);\n}";
null!=t["colorCorrection.fragment"]?a.C("colorCorrection.fragment","\nuniform sampler2D textureSampler; \nuniform sampler2D colorTable; \n\nvarying vec2 vUV;\n\nconst float SLICE_COUNT=16.0; \n\nvec4 sampleAs3DTexture(sampler2D texture,vec3 uv,float width) {\nfloat sliceSize=1.0/width; \nfloat slicePixelSize=sliceSize/width; \nfloat sliceInnerSize=slicePixelSize*(width-1.0); \nfloat zSlice0=min(floor(uv.z*width),width-1.0);\nfloat zSlice1=min(zSlice0+1.0,width-1.0);\nfloat xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;\nfloat s0=xOffset+(zSlice0*sliceSize);\nfloat s1=xOffset+(zSlice1*sliceSize);\nvec4 slice0Color=texture2D(texture,vec2(s0,uv.y));\nvec4 slice1Color=texture2D(texture,vec2(s1,uv.y));\nfloat zOffset=mod(uv.z*width,1.0);\nvec4 result=mix(slice0Color,slice1Color,zOffset);\nreturn result;\n}\nvoid main(void)\n{\nvec4 screen_color=texture2D(textureSampler,vUV);\ngl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);\n}"):
a.h["colorCorrection.fragment"]="\nuniform sampler2D textureSampler; \nuniform sampler2D colorTable; \n\nvarying vec2 vUV;\n\nconst float SLICE_COUNT=16.0; \n\nvec4 sampleAs3DTexture(sampler2D texture,vec3 uv,float width) {\nfloat sliceSize=1.0/width; \nfloat slicePixelSize=sliceSize/width; \nfloat sliceInnerSize=slicePixelSize*(width-1.0); \nfloat zSlice0=min(floor(uv.z*width),width-1.0);\nfloat zSlice1=min(zSlice0+1.0,width-1.0);\nfloat xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;\nfloat s0=xOffset+(zSlice0*sliceSize);\nfloat s1=xOffset+(zSlice1*sliceSize);\nvec4 slice0Color=texture2D(texture,vec2(s0,uv.y));\nvec4 slice1Color=texture2D(texture,vec2(s1,uv.y));\nfloat zOffset=mod(uv.z*width,1.0);\nvec4 result=mix(slice0Color,slice1Color,zOffset);\nreturn result;\n}\nvoid main(void)\n{\nvec4 screen_color=texture2D(textureSampler,vUV);\ngl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);\n}";
null!=t["convolution.fragment"]?a.C("convolution.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform float kernel[9];\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 colorSum =\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];\nfloat kernelWeight =\nkernel[0] +\nkernel[1] +\nkernel[2] +\nkernel[3] +\nkernel[4] +\nkernel[5] +\nkernel[6] +\nkernel[7] +\nkernel[8];\nif (kernelWeight<=0.0) {\nkernelWeight=1.0;\n}\ngl_FragColor=vec4((colorSum/kernelWeight).rgb,1);\n}"):
a.h["convolution.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform float kernel[9];\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 colorSum =\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];\nfloat kernelWeight =\nkernel[0] +\nkernel[1] +\nkernel[2] +\nkernel[3] +\nkernel[4] +\nkernel[5] +\nkernel[6] +\nkernel[7] +\nkernel[8];\nif (kernelWeight<=0.0) {\nkernelWeight=1.0;\n}\ngl_FragColor=vec4((colorSum/kernelWeight).rgb,1);\n}";
null!=t["default.fragment"]?a.C("default.fragment","#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n\n#define RECIPROCAL_PI2 0.15915494\nuniform vec3 vEyePosition;\nuniform vec3 vAmbientColor;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<helperFunctions>\n\n#include<lightFragmentDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nvarying vec2 vAmbientUV;\nuniform sampler2D ambientSampler;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY \nvarying vec2 vOpacityUV;\nuniform sampler2D opacitySampler;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vEmissiveUV;\nuniform vec2 vEmissiveInfos;\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\nvarying vec2 vLightmapUV;\nuniform vec2 vLightmapInfos;\nuniform sampler2D lightmapSampler;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;\nuniform vec4 refractionRightColor;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nvarying vec2 vSpecularUV;\nuniform vec2 vSpecularInfos;\nuniform sampler2D specularSampler;\n#endif\n\n#include<fresnelFunction>\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;\nuniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvarying vec3 vDirectionW;\n#endif\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION)\nuniform mat4 reflectionMatrix;\n#endif\n#endif\n#include<reflectionFunction>\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif\n#ifdef CAMERACOLORGRADING\n#include<colorGradingDefinition> \n#include<colorGrading>\n#endif\n#ifdef CAMERACOLORCURVES\n#include<colorCurvesDefinition>\n#include<colorCurves>\n#endif\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nvoid main(void) {\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#include<bumpFragment>\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#ifdef ALPHAFROMDIFFUSE\nalpha*=baseColor.a;\n#endif\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\nspecularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;\n#ifdef LIGHTMAP\nvec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb*vLightmapInfos.y;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n\nvec3 refractionColor=vec3(0.,0.,0.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0)\n{\nrefractionColor=textureCube(refractionCubeSampler,refractionVector).rgb*vRefractionInfos.x;\n}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\nrefractionColor=texture2D(refraction2DSampler,refractionCoords).rgb*vRefractionInfos.x;\n#endif\n#endif\n\nvec3 reflectionColor=vec3(0.,0.,0.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias).rgb*vReflectionInfos.x;\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW).rgb*vReflectionInfos.x;\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\nreflectionColor=texture2D(reflection2DSampler,coords).rgb*vReflectionInfos.x;\n#endif\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\nrefractionColor*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);\nemissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);\ndiffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+emissiveColor+refractionColor,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+refractionColor,alpha);\n#endif\n\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor;\n#else\ncolor.rgb+=lightmapColor;\n#endif\n#endif\n#endif\n#include<logDepthFragment>\n#include<fogFragment>\n#ifdef CAMERACOLORGRADING\ncolor=colorGrades(color);\n#endif\n#ifdef CAMERACOLORCURVES\ncolor.rgb=applyColorCurves(color.rgb);\n#endif\ngl_FragColor=color;\n}"):
a.h["default.fragment"]="#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n\n#define RECIPROCAL_PI2 0.15915494\nuniform vec3 vEyePosition;\nuniform vec3 vAmbientColor;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<helperFunctions>\n\n#include<lightFragmentDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nvarying vec2 vAmbientUV;\nuniform sampler2D ambientSampler;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY \nvarying vec2 vOpacityUV;\nuniform sampler2D opacitySampler;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vEmissiveUV;\nuniform vec2 vEmissiveInfos;\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\nvarying vec2 vLightmapUV;\nuniform vec2 vLightmapInfos;\nuniform sampler2D lightmapSampler;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;\nuniform vec4 refractionRightColor;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nvarying vec2 vSpecularUV;\nuniform vec2 vSpecularInfos;\nuniform sampler2D specularSampler;\n#endif\n\n#include<fresnelFunction>\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;\nuniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvarying vec3 vDirectionW;\n#endif\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION)\nuniform mat4 reflectionMatrix;\n#endif\n#endif\n#include<reflectionFunction>\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif\n#ifdef CAMERACOLORGRADING\n#include<colorGradingDefinition> \n#include<colorGrading>\n#endif\n#ifdef CAMERACOLORCURVES\n#include<colorCurvesDefinition>\n#include<colorCurves>\n#endif\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nvoid main(void) {\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#include<bumpFragment>\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#ifdef ALPHAFROMDIFFUSE\nalpha*=baseColor.a;\n#endif\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\nspecularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;\n#ifdef LIGHTMAP\nvec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb*vLightmapInfos.y;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n\nvec3 refractionColor=vec3(0.,0.,0.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0)\n{\nrefractionColor=textureCube(refractionCubeSampler,refractionVector).rgb*vRefractionInfos.x;\n}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\nrefractionColor=texture2D(refraction2DSampler,refractionCoords).rgb*vRefractionInfos.x;\n#endif\n#endif\n\nvec3 reflectionColor=vec3(0.,0.,0.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias).rgb*vReflectionInfos.x;\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW).rgb*vReflectionInfos.x;\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\nreflectionColor=texture2D(reflection2DSampler,coords).rgb*vReflectionInfos.x;\n#endif\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\nrefractionColor*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);\nemissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);\ndiffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+emissiveColor+refractionColor,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+refractionColor,alpha);\n#endif\n\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor;\n#else\ncolor.rgb+=lightmapColor;\n#endif\n#endif\n#endif\n#include<logDepthFragment>\n#include<fogFragment>\n#ifdef CAMERACOLORGRADING\ncolor=colorGrades(color);\n#endif\n#ifdef CAMERACOLORCURVES\ncolor.rgb=applyColorCurves(color.rgb);\n#endif\ngl_FragColor=color;\n}";
null!=t["default.vertex"]?a.C("default.vertex","\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nvarying vec2 vAmbientUV;\nuniform mat4 ambientMatrix;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vEmissiveUV;\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nvarying vec2 vLightmapUV;\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nvarying vec2 vSpecularUV;\nuniform vec2 vSpecularInfos;\nuniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nvarying vec2 vBumpUV;\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#include<pointCloudVertexDeclaration>\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<shadowsVertexDeclaration>[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvarying vec3 vDirectionW;\n#endif\n#include<logDepthDeclaration>\nvoid main(void) {\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=position;\n#endif \n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef AMBIENT\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef OPACITY\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef EMISSIVE\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef LIGHTMAP\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nif (vSpecularInfos.x == 0.)\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef BUMP\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include<pointCloudVertex>\n#include<logDepthVertex>\n}"):
a.h["default.vertex"]="\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nvarying vec2 vAmbientUV;\nuniform mat4 ambientMatrix;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vEmissiveUV;\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nvarying vec2 vLightmapUV;\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nvarying vec2 vSpecularUV;\nuniform vec2 vSpecularInfos;\nuniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nvarying vec2 vBumpUV;\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#include<pointCloudVertexDeclaration>\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<shadowsVertexDeclaration>[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvarying vec3 vDirectionW;\n#endif\n#include<logDepthDeclaration>\nvoid main(void) {\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=position;\n#endif \n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef AMBIENT\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef OPACITY\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef EMISSIVE\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef LIGHTMAP\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nif (vSpecularInfos.x == 0.)\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef BUMP\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include<pointCloudVertex>\n#include<logDepthVertex>\n}";
null!=t["depth.fragment"]?a.C("depth.fragment","#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nuniform float far;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nfloat depth=(gl_FragCoord.z/gl_FragCoord.w)/far;\ngl_FragColor=vec4(depth,depth*depth,0.0,1.0);\n}"):a.h["depth.fragment"]="#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nuniform float far;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nfloat depth=(gl_FragCoord.z/gl_FragCoord.w)/far;\ngl_FragColor=vec4(depth,depth*depth,0.0,1.0);\n}";
null!=t["depth.vertex"]?a.C("depth.vertex","\nattribute vec3 position;\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}"):
a.h["depth.vertex"]="\nattribute vec3 position;\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}";
null!=t["depthBoxBlur.fragment"]?a.C("depthBoxBlur.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nvoid main(void)\n{\nvec4 colorDepth=vec4(0.0);\nfor (int x=-OFFSET; x<=OFFSET; x++)\nfor (int y=-OFFSET; y<=OFFSET; y++)\ncolorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);\ngl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));\n}"):a.h["depthBoxBlur.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nvoid main(void)\n{\nvec4 colorDepth=vec4(0.0);\nfor (int x=-OFFSET; x<=OFFSET; x++)\nfor (int y=-OFFSET; y<=OFFSET; y++)\ncolorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);\ngl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));\n}";
null!=t["depthOfField.fragment"]?a.C("depthOfField.fragment","\n\n\n\n\nuniform sampler2D textureSampler;\nuniform sampler2D highlightsSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D grainSampler;\n\nuniform float grain_amount;\nuniform bool blur_noise;\nuniform float screen_width;\nuniform float screen_height;\nuniform float distortion;\nuniform bool dof_enabled;\n\nuniform float screen_distance; \nuniform float aperture;\nuniform float darken;\nuniform float edge_blur;\nuniform bool highlights;\n\nuniform float near;\nuniform float far;\n\nvarying vec2 vUV;\n\n#define PI 3.14159265\n#define TWOPI 6.28318530\n#define inverse_focal_length 0.1 \n\nvec2 centered_screen_pos;\nvec2 distorted_coords;\nfloat radius2;\nfloat radius;\n\nvec2 rand(vec2 co)\n{\nfloat noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));\nfloat noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));\nreturn clamp(vec2(noise1,noise2),0.0,1.0);\n}\n\nvec2 getDistortedCoords(vec2 coords) {\nif (distortion == 0.0) { return coords; }\nvec2 direction=1.0*normalize(centered_screen_pos);\nvec2 dist_coords=vec2(0.5,0.5);\ndist_coords.x=0.5+direction.x*radius2*1.0;\ndist_coords.y=0.5+direction.y*radius2*1.0;\nfloat dist_amount=clamp(distortion*0.23,0.0,1.0);\ndist_coords=mix(coords,dist_coords,dist_amount);\nreturn dist_coords;\n}\n\nfloat sampleScreen(inout vec4 color,const in vec2 offset,const in float weight) {\n\nvec2 coords=distorted_coords;\nfloat angle=rand(coords*100.0).x*TWOPI;\ncoords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));\ncolor+=texture2D(textureSampler,coords)*weight;\nreturn weight;\n}\n\nfloat getBlurLevel(float size) {\nreturn min(3.0,ceil(size/1.0));\n}\n\nvec4 getBlurColor(float size) {\nvec4 col=texture2D(textureSampler,distorted_coords);\nif (size == 0.0) { return col; }\n\n\nfloat blur_level=getBlurLevel(size);\nfloat w=(size/screen_width);\nfloat h=(size/screen_height);\nfloat total_weight=1.0;\nvec2 sample_coords;\ntotal_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);\ntotal_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);\ntotal_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);\ntotal_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);\ntotal_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);\ntotal_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);\ntotal_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);\ntotal_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);\ntotal_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);\nif (blur_level>1.0) {\ntotal_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);\ntotal_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);\ntotal_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);\ntotal_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);\ntotal_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);\ntotal_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);\ntotal_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);\ntotal_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);\ntotal_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);\n}\nif (blur_level>2.0) {\ntotal_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);\ntotal_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);\ntotal_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);\ntotal_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);\ntotal_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);\ntotal_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);\ntotal_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);\ntotal_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);\ntotal_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);\n}\ncol/=total_weight; \n\nif (darken>0.0) {\ncol.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);\n}\n\n\n\n\nreturn col;\n}\nvoid main(void)\n{\n\ncentered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\nradius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;\nradius=sqrt(radius2);\ndistorted_coords=getDistortedCoords(vUV); \nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height); \nfloat depth=texture2D(depthSampler,distorted_coords).r; \nfloat distance=near+(far-near)*depth; \nvec4 color=texture2D(textureSampler,vUV); \n\n\nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));\n\nif (dof_enabled == false || coc<0.07) { coc=0.0; }\n\nfloat edge_blur_amount=0.0;\nif (edge_blur>0.0) {\nedge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;\n}\n\nfloat blur_amount=max(edge_blur_amount,coc);\n\nif (blur_amount == 0.0) {\ngl_FragColor=texture2D(textureSampler,distorted_coords);\n}\nelse {\n\ngl_FragColor=getBlurColor(blur_amount*1.7);\n\nif (highlights) {\ngl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;\n}\nif (blur_noise) {\n\nvec2 noise=rand(distorted_coords)*0.01*blur_amount;\nvec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);\ngl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;\n}\n}\n\nif (grain_amount>0.0) {\nvec4 grain_color=texture2D(grainSampler,texels_coords*0.003);\ngl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;\n}\n}\n"):
a.h["depthOfField.fragment"]="\n\n\n\n\nuniform sampler2D textureSampler;\nuniform sampler2D highlightsSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D grainSampler;\n\nuniform float grain_amount;\nuniform bool blur_noise;\nuniform float screen_width;\nuniform float screen_height;\nuniform float distortion;\nuniform bool dof_enabled;\n\nuniform float screen_distance; \nuniform float aperture;\nuniform float darken;\nuniform float edge_blur;\nuniform bool highlights;\n\nuniform float near;\nuniform float far;\n\nvarying vec2 vUV;\n\n#define PI 3.14159265\n#define TWOPI 6.28318530\n#define inverse_focal_length 0.1 \n\nvec2 centered_screen_pos;\nvec2 distorted_coords;\nfloat radius2;\nfloat radius;\n\nvec2 rand(vec2 co)\n{\nfloat noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));\nfloat noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));\nreturn clamp(vec2(noise1,noise2),0.0,1.0);\n}\n\nvec2 getDistortedCoords(vec2 coords) {\nif (distortion == 0.0) { return coords; }\nvec2 direction=1.0*normalize(centered_screen_pos);\nvec2 dist_coords=vec2(0.5,0.5);\ndist_coords.x=0.5+direction.x*radius2*1.0;\ndist_coords.y=0.5+direction.y*radius2*1.0;\nfloat dist_amount=clamp(distortion*0.23,0.0,1.0);\ndist_coords=mix(coords,dist_coords,dist_amount);\nreturn dist_coords;\n}\n\nfloat sampleScreen(inout vec4 color,const in vec2 offset,const in float weight) {\n\nvec2 coords=distorted_coords;\nfloat angle=rand(coords*100.0).x*TWOPI;\ncoords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));\ncolor+=texture2D(textureSampler,coords)*weight;\nreturn weight;\n}\n\nfloat getBlurLevel(float size) {\nreturn min(3.0,ceil(size/1.0));\n}\n\nvec4 getBlurColor(float size) {\nvec4 col=texture2D(textureSampler,distorted_coords);\nif (size == 0.0) { return col; }\n\n\nfloat blur_level=getBlurLevel(size);\nfloat w=(size/screen_width);\nfloat h=(size/screen_height);\nfloat total_weight=1.0;\nvec2 sample_coords;\ntotal_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);\ntotal_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);\ntotal_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);\ntotal_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);\ntotal_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);\ntotal_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);\ntotal_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);\ntotal_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);\ntotal_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);\nif (blur_level>1.0) {\ntotal_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);\ntotal_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);\ntotal_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);\ntotal_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);\ntotal_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);\ntotal_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);\ntotal_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);\ntotal_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);\ntotal_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);\n}\nif (blur_level>2.0) {\ntotal_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);\ntotal_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);\ntotal_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);\ntotal_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);\ntotal_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);\ntotal_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);\ntotal_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);\ntotal_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);\ntotal_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);\n}\ncol/=total_weight; \n\nif (darken>0.0) {\ncol.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);\n}\n\n\n\n\nreturn col;\n}\nvoid main(void)\n{\n\ncentered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\nradius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;\nradius=sqrt(radius2);\ndistorted_coords=getDistortedCoords(vUV); \nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height); \nfloat depth=texture2D(depthSampler,distorted_coords).r; \nfloat distance=near+(far-near)*depth; \nvec4 color=texture2D(textureSampler,vUV); \n\n\nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));\n\nif (dof_enabled == false || coc<0.07) { coc=0.0; }\n\nfloat edge_blur_amount=0.0;\nif (edge_blur>0.0) {\nedge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;\n}\n\nfloat blur_amount=max(edge_blur_amount,coc);\n\nif (blur_amount == 0.0) {\ngl_FragColor=texture2D(textureSampler,distorted_coords);\n}\nelse {\n\ngl_FragColor=getBlurColor(blur_amount*1.7);\n\nif (highlights) {\ngl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;\n}\nif (blur_noise) {\n\nvec2 noise=rand(distorted_coords)*0.01*blur_amount;\nvec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);\ngl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;\n}\n}\n\nif (grain_amount>0.0) {\nvec4 grain_color=texture2D(grainSampler,texels_coords*0.003);\ngl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;\n}\n}\n";
null!=t["displayPass.fragment"]?a.C("displayPass.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D passSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(passSampler,vUV);\n}"):a.h["displayPass.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D passSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(passSampler,vUV);\n}";null!=t["filter.fragment"]?a.C("filter.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform mat4 kernelMatrix;\nvoid main(void)\n{\nvec3 baseColor=texture2D(textureSampler,vUV).rgb;\nvec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;\ngl_FragColor=vec4(updatedColor,1.0);\n}"):
a.h["filter.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform mat4 kernelMatrix;\nvoid main(void)\n{\nvec3 baseColor=texture2D(textureSampler,vUV).rgb;\nvec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;\ngl_FragColor=vec4(updatedColor,1.0);\n}";null!=t["fxaa.fragment"]?a.C("fxaa.fragment","#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 texelSize;\nvoid main(){\nvec2 localTexelSize=texelSize;\nvec4 rgbNW=texture2D(textureSampler,(vUV+vec2(-1.0,-1.0)*localTexelSize));\nvec4 rgbNE=texture2D(textureSampler,(vUV+vec2(1.0,-1.0)*localTexelSize));\nvec4 rgbSW=texture2D(textureSampler,(vUV+vec2(-1.0,1.0)*localTexelSize));\nvec4 rgbSE=texture2D(textureSampler,(vUV+vec2(1.0,1.0)*localTexelSize));\nvec4 rgbM=texture2D(textureSampler,vUV);\nvec4 luma=vec4(0.299,0.587,0.114,1.0);\nfloat lumaNW=dot(rgbNW,luma);\nfloat lumaNE=dot(rgbNE,luma);\nfloat lumaSW=dot(rgbSW,luma);\nfloat lumaSE=dot(rgbSE,luma);\nfloat lumaM=dot(rgbM,luma);\nfloat lumaMin=min(lumaM,min(min(lumaNW,lumaNE),min(lumaSW,lumaSE)));\nfloat lumaMax=max(lumaM,max(max(lumaNW,lumaNE),max(lumaSW,lumaSE)));\nvec2 dir=vec2(-((lumaNW+lumaNE)-(lumaSW+lumaSE)),((lumaNW+lumaSW)-(lumaNE+lumaSE)));\nfloat dirReduce=max(\n(lumaNW+lumaNE+lumaSW+lumaSE)*(0.25*FXAA_REDUCE_MUL),\nFXAA_REDUCE_MIN);\nfloat rcpDirMin=1.0/(min(abs(dir.x),abs(dir.y))+dirReduce);\ndir=min(vec2(FXAA_SPAN_MAX,FXAA_SPAN_MAX),\nmax(vec2(-FXAA_SPAN_MAX,-FXAA_SPAN_MAX),\ndir*rcpDirMin))*localTexelSize;\nvec4 rgbA=0.5*(\ntexture2D(textureSampler,vUV+dir*(1.0/3.0-0.5)) +\ntexture2D(textureSampler,vUV+dir*(2.0/3.0-0.5)));\nvec4 rgbB=rgbA*0.5+0.25*(\ntexture2D(textureSampler,vUV+dir*-0.5) +\ntexture2D(textureSampler,vUV+dir*0.5));\nfloat lumaB=dot(rgbB,luma);\nif ((lumaB<lumaMin) || (lumaB>lumaMax)) {\ngl_FragColor=rgbA;\n}\nelse {\ngl_FragColor=rgbB;\n}\n}"):
a.h["fxaa.fragment"]="#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 texelSize;\nvoid main(){\nvec2 localTexelSize=texelSize;\nvec4 rgbNW=texture2D(textureSampler,(vUV+vec2(-1.0,-1.0)*localTexelSize));\nvec4 rgbNE=texture2D(textureSampler,(vUV+vec2(1.0,-1.0)*localTexelSize));\nvec4 rgbSW=texture2D(textureSampler,(vUV+vec2(-1.0,1.0)*localTexelSize));\nvec4 rgbSE=texture2D(textureSampler,(vUV+vec2(1.0,1.0)*localTexelSize));\nvec4 rgbM=texture2D(textureSampler,vUV);\nvec4 luma=vec4(0.299,0.587,0.114,1.0);\nfloat lumaNW=dot(rgbNW,luma);\nfloat lumaNE=dot(rgbNE,luma);\nfloat lumaSW=dot(rgbSW,luma);\nfloat lumaSE=dot(rgbSE,luma);\nfloat lumaM=dot(rgbM,luma);\nfloat lumaMin=min(lumaM,min(min(lumaNW,lumaNE),min(lumaSW,lumaSE)));\nfloat lumaMax=max(lumaM,max(max(lumaNW,lumaNE),max(lumaSW,lumaSE)));\nvec2 dir=vec2(-((lumaNW+lumaNE)-(lumaSW+lumaSE)),((lumaNW+lumaSW)-(lumaNE+lumaSE)));\nfloat dirReduce=max(\n(lumaNW+lumaNE+lumaSW+lumaSE)*(0.25*FXAA_REDUCE_MUL),\nFXAA_REDUCE_MIN);\nfloat rcpDirMin=1.0/(min(abs(dir.x),abs(dir.y))+dirReduce);\ndir=min(vec2(FXAA_SPAN_MAX,FXAA_SPAN_MAX),\nmax(vec2(-FXAA_SPAN_MAX,-FXAA_SPAN_MAX),\ndir*rcpDirMin))*localTexelSize;\nvec4 rgbA=0.5*(\ntexture2D(textureSampler,vUV+dir*(1.0/3.0-0.5)) +\ntexture2D(textureSampler,vUV+dir*(2.0/3.0-0.5)));\nvec4 rgbB=rgbA*0.5+0.25*(\ntexture2D(textureSampler,vUV+dir*-0.5) +\ntexture2D(textureSampler,vUV+dir*0.5));\nfloat lumaB=dot(rgbB,luma);\nif ((lumaB<lumaMin) || (lumaB>lumaMax)) {\ngl_FragColor=rgbA;\n}\nelse {\ngl_FragColor=rgbB;\n}\n}";
null!=t["glowBlurPostProcess.fragment"]?a.C("glowBlurPostProcess.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nuniform vec2 direction;\nuniform float blurWidth;\n\nfloat getLuminance(vec3 color)\n{\nreturn dot(color,vec3(0.2126,0.7152,0.0722));\n}\nvoid main(void)\n{\nfloat weights[7];\nweights[0]=0.05;\nweights[1]=0.1;\nweights[2]=0.2;\nweights[3]=0.3;\nweights[4]=0.2;\nweights[5]=0.1;\nweights[6]=0.05;\nvec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);\nvec2 texelStep=texelSize*direction*blurWidth;\nvec2 start=vUV-3.0*texelStep;\nvec4 baseColor=vec4(0.,0.,0.,0.);\nvec2 texelOffset=vec2(0.,0.);\nfor (int i=0; i<7; i++)\n{\n\nvec4 texel=texture2D(textureSampler,start+texelOffset);\nbaseColor.a+=texel.a*weights[i];\n\nfloat luminance=getLuminance(baseColor.rgb);\nfloat luminanceTexel=getLuminance(texel.rgb);\nfloat choice=step(luminanceTexel,luminance);\nbaseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;\ntexelOffset+=texelStep;\n}\ngl_FragColor=baseColor;\n}"):
a.h["glowBlurPostProcess.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nuniform vec2 direction;\nuniform float blurWidth;\n\nfloat getLuminance(vec3 color)\n{\nreturn dot(color,vec3(0.2126,0.7152,0.0722));\n}\nvoid main(void)\n{\nfloat weights[7];\nweights[0]=0.05;\nweights[1]=0.1;\nweights[2]=0.2;\nweights[3]=0.3;\nweights[4]=0.2;\nweights[5]=0.1;\nweights[6]=0.05;\nvec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);\nvec2 texelStep=texelSize*direction*blurWidth;\nvec2 start=vUV-3.0*texelStep;\nvec4 baseColor=vec4(0.,0.,0.,0.);\nvec2 texelOffset=vec2(0.,0.);\nfor (int i=0; i<7; i++)\n{\n\nvec4 texel=texture2D(textureSampler,start+texelOffset);\nbaseColor.a+=texel.a*weights[i];\n\nfloat luminance=getLuminance(baseColor.rgb);\nfloat luminanceTexel=getLuminance(texel.rgb);\nfloat choice=step(luminanceTexel,luminance);\nbaseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;\ntexelOffset+=texelStep;\n}\ngl_FragColor=baseColor;\n}";
null!=t["glowMapGeneration.fragment"]?a.C("glowMapGeneration.fragment","#ifdef ALPHATEST\nvarying vec2 vUVDiffuse;\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform sampler2D emissiveSampler;\n#endif\nuniform vec4 color;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUVDiffuse).a<0.4)\ndiscard;\n#endif\n#ifdef EMISSIVE\ngl_FragColor=texture2D(emissiveSampler,vUVEmissive);\n#else\ngl_FragColor=color;\n#endif\n}"):a.h["glowMapGeneration.fragment"]=
"#ifdef ALPHATEST\nvarying vec2 vUVDiffuse;\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform sampler2D emissiveSampler;\n#endif\nuniform vec4 color;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUVDiffuse).a<0.4)\ndiscard;\n#endif\n#ifdef EMISSIVE\ngl_FragColor=texture2D(emissiveSampler,vUVEmissive);\n#else\ngl_FragColor=color;\n#endif\n}";null!=t["glowMapGeneration.vertex"]?a.C("glowMapGeneration.vertex","\nattribute vec3 position;\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nvarying vec4 vPosition;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef ALPHATEST\nvarying vec2 vUVDiffuse;\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform mat4 emissiveMatrix;\n#endif\nvoid main(void)\n{\n#include<instancesVertex>\n#include<bonesVertex>\n#ifdef CUBEMAP\nvPosition=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#else\nvPosition=viewProjection*finalWorld*vec4(position,1.0);\ngl_Position=vPosition;\n#endif\n#ifdef ALPHATEST\n#ifdef DIFFUSEUV1\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef DIFFUSEUV2\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef EMISSIVE\n#ifdef EMISSIVEUV1\nvUVEmissive=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef EMISSIVEUV2\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}"):
a.h["glowMapGeneration.vertex"]="\nattribute vec3 position;\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nvarying vec4 vPosition;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef ALPHATEST\nvarying vec2 vUVDiffuse;\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform mat4 emissiveMatrix;\n#endif\nvoid main(void)\n{\n#include<instancesVertex>\n#include<bonesVertex>\n#ifdef CUBEMAP\nvPosition=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#else\nvPosition=viewProjection*finalWorld*vec4(position,1.0);\ngl_Position=vPosition;\n#endif\n#ifdef ALPHATEST\n#ifdef DIFFUSEUV1\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef DIFFUSEUV2\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef EMISSIVE\n#ifdef EMISSIVEUV1\nvUVEmissive=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef EMISSIVEUV2\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}";
null!=t["glowMapMerge.fragment"]?a.C("glowMapMerge.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform float offset;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\nbaseColor.a=abs(offset-baseColor.a);\ngl_FragColor=baseColor;\n}"):a.h["glowMapMerge.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform float offset;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\nbaseColor.a=abs(offset-baseColor.a);\ngl_FragColor=baseColor;\n}";
null!=t["glowMapMerge.vertex"]?a.C("glowMapMerge.vertex","\nattribute vec2 position;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}"):a.h["glowMapMerge.vertex"]="\nattribute vec2 position;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}";null!=t["hdr.fragment"]?a.C("hdr.fragment","uniform sampler2D textureSampler;\nvarying vec2 vUV;\n#if defined(GAUSSIAN_BLUR_H) || defined(GAUSSIAN_BLUR_V)\nuniform float blurOffsets[9];\nuniform float blurWeights[9];\nuniform float multiplier;\nvoid main(void) {\nvec4 color=vec4(0.0,0.0,0.0,0.0);\nfor (int i=0; i<9; i++) {\n#ifdef GAUSSIAN_BLUR_H\ncolor+=(texture2D(textureSampler,vUV+vec2(blurOffsets[i]*multiplier,0.0))*blurWeights[i]);\n#else\ncolor+=(texture2D(textureSampler,vUV+vec2(0.0,blurOffsets[i]*multiplier))*blurWeights[i]);\n#endif\n}\ncolor.a=1.0;\ngl_FragColor=color;\n}\n#endif\n#if defined(TEXTURE_ADDER)\nuniform sampler2D otherSampler;\nvoid main() {\nvec4 sum=texture2D(textureSampler,vUV)+texture2D(otherSampler,vUV);\nsum.a=clamp(sum.a,0.0,1.0);\ngl_FragColor=sum;\n}\n#endif\n#if defined(LUMINANCE_GENERATOR)\nuniform vec2 lumOffsets[4];\nvoid main() {\nfloat average=0.0;\nvec4 color=vec4(0.0,0.0,0.0,0.0);\nfloat maximum=-1e20;\nfor (int i=0; i<4; i++) {\ncolor=texture2D(textureSampler,vUV+lumOffsets[i]);\nfloat GreyValue=length(color.rgb);\nmaximum=max(maximum,GreyValue);\naverage+=(0.25*log(1e-5+GreyValue));\n}\naverage=exp(average);\ngl_FragColor=vec4(average,maximum,0.0,1.0);\n}\n#endif\n#if defined(DOWN_SAMPLE)\nuniform vec2 dsOffsets[9];\nuniform float halfDestPixelSize;\n#ifdef FINAL_DOWN_SAMPLE\nvec4 pack(float value) {\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(value*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\n#endif\nvoid main() {\nvec4 color=vec4(0.0,0.0,0.0,0.0);\nfloat average=0.0;\nfor (int i=0; i<9; i++) {\ncolor=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);\naverage+=color.r;\n}\naverage/=9.0;\n#ifndef FINAL_DOWN_SAMPLE\ngl_FragColor=vec4(average,average,0.0,1.0);\n#else\ngl_FragColor=pack(average);\n#endif\n}\n#endif\n#if defined(BRIGHT_PASS)\nuniform vec2 dsOffsets[4];\nuniform float brightThreshold;\nvoid main() {\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+vec2(dsOffsets[0].x,dsOffsets[0].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[1].x,dsOffsets[1].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[2].x,dsOffsets[2].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[3].x,dsOffsets[3].y));\naverage*=0.25;\nfloat luminance=length(average.rgb);\nif (luminance<brightThreshold) {\naverage=vec4(0.0,0.0,0.0,1.0);\n}\ngl_FragColor=average;\n}\n#endif\n#if defined(DOWN_SAMPLE_X4)\nuniform vec2 dsOffsets[16];\nvoid main() {\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+dsOffsets[0]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[1]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[2]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[3]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[4]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[5]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[6]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[7]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[8]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[9]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[10]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[11]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[12]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[13]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[14]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[15]);\naverage/=16.0;\ngl_FragColor=average;\n}\n#endif\n#if defined(HDR)\nuniform sampler2D otherSampler;\nuniform float exposure;\nuniform float avgLuminance;\nvoid main() {\nvec4 color=texture2D(textureSampler,vUV)+texture2D(otherSampler,vUV);\nvec4 adjustedColor=color/avgLuminance*exposure;\ncolor=adjustedColor;\ncolor.a=1.0;\ngl_FragColor=color;\n}\n#endif\n"):
a.h["hdr.fragment"]="uniform sampler2D textureSampler;\nvarying vec2 vUV;\n#if defined(GAUSSIAN_BLUR_H) || defined(GAUSSIAN_BLUR_V)\nuniform float blurOffsets[9];\nuniform float blurWeights[9];\nuniform float multiplier;\nvoid main(void) {\nvec4 color=vec4(0.0,0.0,0.0,0.0);\nfor (int i=0; i<9; i++) {\n#ifdef GAUSSIAN_BLUR_H\ncolor+=(texture2D(textureSampler,vUV+vec2(blurOffsets[i]*multiplier,0.0))*blurWeights[i]);\n#else\ncolor+=(texture2D(textureSampler,vUV+vec2(0.0,blurOffsets[i]*multiplier))*blurWeights[i]);\n#endif\n}\ncolor.a=1.0;\ngl_FragColor=color;\n}\n#endif\n#if defined(TEXTURE_ADDER)\nuniform sampler2D otherSampler;\nvoid main() {\nvec4 sum=texture2D(textureSampler,vUV)+texture2D(otherSampler,vUV);\nsum.a=clamp(sum.a,0.0,1.0);\ngl_FragColor=sum;\n}\n#endif\n#if defined(LUMINANCE_GENERATOR)\nuniform vec2 lumOffsets[4];\nvoid main() {\nfloat average=0.0;\nvec4 color=vec4(0.0,0.0,0.0,0.0);\nfloat maximum=-1e20;\nfor (int i=0; i<4; i++) {\ncolor=texture2D(textureSampler,vUV+lumOffsets[i]);\nfloat GreyValue=length(color.rgb);\nmaximum=max(maximum,GreyValue);\naverage+=(0.25*log(1e-5+GreyValue));\n}\naverage=exp(average);\ngl_FragColor=vec4(average,maximum,0.0,1.0);\n}\n#endif\n#if defined(DOWN_SAMPLE)\nuniform vec2 dsOffsets[9];\nuniform float halfDestPixelSize;\n#ifdef FINAL_DOWN_SAMPLE\nvec4 pack(float value) {\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(value*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\n#endif\nvoid main() {\nvec4 color=vec4(0.0,0.0,0.0,0.0);\nfloat average=0.0;\nfor (int i=0; i<9; i++) {\ncolor=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);\naverage+=color.r;\n}\naverage/=9.0;\n#ifndef FINAL_DOWN_SAMPLE\ngl_FragColor=vec4(average,average,0.0,1.0);\n#else\ngl_FragColor=pack(average);\n#endif\n}\n#endif\n#if defined(BRIGHT_PASS)\nuniform vec2 dsOffsets[4];\nuniform float brightThreshold;\nvoid main() {\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+vec2(dsOffsets[0].x,dsOffsets[0].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[1].x,dsOffsets[1].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[2].x,dsOffsets[2].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[3].x,dsOffsets[3].y));\naverage*=0.25;\nfloat luminance=length(average.rgb);\nif (luminance<brightThreshold) {\naverage=vec4(0.0,0.0,0.0,1.0);\n}\ngl_FragColor=average;\n}\n#endif\n#if defined(DOWN_SAMPLE_X4)\nuniform vec2 dsOffsets[16];\nvoid main() {\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+dsOffsets[0]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[1]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[2]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[3]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[4]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[5]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[6]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[7]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[8]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[9]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[10]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[11]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[12]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[13]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[14]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[15]);\naverage/=16.0;\ngl_FragColor=average;\n}\n#endif\n#if defined(HDR)\nuniform sampler2D otherSampler;\nuniform float exposure;\nuniform float avgLuminance;\nvoid main() {\nvec4 color=texture2D(textureSampler,vUV)+texture2D(otherSampler,vUV);\nvec4 adjustedColor=color/avgLuminance*exposure;\ncolor=adjustedColor;\ncolor.a=1.0;\ngl_FragColor=color;\n}\n#endif\n";
null!=t["layer.fragment"]?a.C("layer.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n}"):a.h["layer.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n}";
null!=t["layer.vertex"]?a.C("layer.vertex","\nattribute vec2 position;\n\nuniform vec2 scale;\nuniform vec2 offset;\nuniform mat4 textureMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvec2 shiftedPosition=position*scale+offset;\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\ngl_Position=vec4(shiftedPosition,0.0,1.0);\n}"):a.h["layer.vertex"]="\nattribute vec2 position;\n\nuniform vec2 scale;\nuniform vec2 offset;\nuniform mat4 textureMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvec2 shiftedPosition=position*scale+offset;\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\ngl_Position=vec4(shiftedPosition,0.0,1.0);\n}";
null!=t["lensFlare.fragment"]?a.C("lensFlare.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\ngl_FragColor=baseColor*color;\n}"):a.h["lensFlare.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\ngl_FragColor=baseColor*color;\n}";null!=t["lensFlare.vertex"]?a.C("lensFlare.vertex","\nattribute vec2 position;\n\nuniform mat4 viewportMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvUV=position*madd+madd;\ngl_Position=viewportMatrix*vec4(position,0.0,1.0);\n}"):
a.h["lensFlare.vertex"]="\nattribute vec2 position;\n\nuniform mat4 viewportMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvUV=position*madd+madd;\ngl_Position=viewportMatrix*vec4(position,0.0,1.0);\n}";null!=t["lensHighlights.fragment"]?a.C("lensHighlights.fragment","\nuniform sampler2D textureSampler; \n\nuniform float gain;\nuniform float threshold;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\n\nvec4 highlightColor(vec4 color) {\nvec4 highlight=color;\nfloat luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));\nfloat lum_threshold;\nif (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }\nelse { lum_threshold=0.5+0.44*threshold; }\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);\nhighlight*=luminance*gain;\nhighlight.a=1.0;\nreturn highlight;\n}\nvoid main(void)\n{\nvec4 original=texture2D(textureSampler,vUV);\n\nif (gain == -1.0) {\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\nreturn;\n}\nfloat w=2.0/screen_width;\nfloat h=2.0/screen_height;\nfloat weight=1.0;\n\nvec4 blurred=vec4(0.0,0.0,0.0,0.0);\n#ifdef PENTAGON\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\n#else\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\n#endif\nblurred/=39.0;\ngl_FragColor=blurred;\n\n}"):
a.h["lensHighlights.fragment"]="\nuniform sampler2D textureSampler; \n\nuniform float gain;\nuniform float threshold;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\n\nvec4 highlightColor(vec4 color) {\nvec4 highlight=color;\nfloat luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));\nfloat lum_threshold;\nif (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }\nelse { lum_threshold=0.5+0.44*threshold; }\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);\nhighlight*=luminance*gain;\nhighlight.a=1.0;\nreturn highlight;\n}\nvoid main(void)\n{\nvec4 original=texture2D(textureSampler,vUV);\n\nif (gain == -1.0) {\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\nreturn;\n}\nfloat w=2.0/screen_width;\nfloat h=2.0/screen_height;\nfloat weight=1.0;\n\nvec4 blurred=vec4(0.0,0.0,0.0,0.0);\n#ifdef PENTAGON\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\n#else\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\n#endif\nblurred/=39.0;\ngl_FragColor=blurred;\n\n}";
null!=t["line.fragment"]?a.C("line.fragment","uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}"):a.h["line.fragment"]="uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}";null!=t["line.vertex"]?a.C("line.vertex","\nattribute vec3 position;\nattribute vec4 normal;\n\nuniform mat4 worldViewProjection;\nuniform float width;\nuniform float aspectRatio;\nvoid main(void) {\nvec4 viewPosition=worldViewProjection*vec4(position,1.0);\nvec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);\nvec2 currentScreen=viewPosition.xy/viewPosition.w;\nvec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;\ncurrentScreen.x*=aspectRatio;\nnextScreen.x*=aspectRatio;\nvec2 dir=normalize(nextScreen-currentScreen);\nvec2 normalDir=vec2(-dir.y,dir.x);\nnormalDir*=width/2.0;\nnormalDir.x/=aspectRatio;\nvec4 offset=vec4(normalDir*normal.w,0.0,0.0);\ngl_Position=viewPosition+offset;\n}"):
a.h["line.vertex"]="\nattribute vec3 position;\nattribute vec4 normal;\n\nuniform mat4 worldViewProjection;\nuniform float width;\nuniform float aspectRatio;\nvoid main(void) {\nvec4 viewPosition=worldViewProjection*vec4(position,1.0);\nvec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);\nvec2 currentScreen=viewPosition.xy/viewPosition.w;\nvec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;\ncurrentScreen.x*=aspectRatio;\nnextScreen.x*=aspectRatio;\nvec2 dir=normalize(nextScreen-currentScreen);\nvec2 normalDir=vec2(-dir.y,dir.x);\nnormalDir*=width/2.0;\nnormalDir.x/=aspectRatio;\nvec4 offset=vec4(normalDir*normal.w,0.0,0.0);\ngl_Position=viewPosition+offset;\n}";
null!=t["outline.fragment"]?a.C("outline.fragment","uniform vec4 color;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nvoid main(void) {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\ngl_FragColor=color;\n}"):a.h["outline.fragment"]="uniform vec4 color;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nvoid main(void) {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\ngl_FragColor=color;\n}";
null!=t["outline.vertex"]?a.C("outline.vertex","\nattribute vec3 position;\nattribute vec3 normal;\n#include<bonesDeclaration>\n\nuniform float offset;\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\nvec3 offsetPosition=position+normal*offset;\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(offsetPosition,1.0);\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}\n"):
a.h["outline.vertex"]="\nattribute vec3 position;\nattribute vec3 normal;\n#include<bonesDeclaration>\n\nuniform float offset;\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\nvec3 offsetPosition=position+normal*offset;\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(offsetPosition,1.0);\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}\n";
null!=t["particles.fragment"]?a.C("particles.fragment","\nvarying vec2 vUV;\nvarying vec4 vColor;\nuniform vec4 textureMask;\nuniform sampler2D diffuseSampler;\n#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\nvoid main(void) {\n#ifdef CLIPPLANE\nif (fClipDistance>0.0)\ndiscard;\n#endif\nvec4 baseColor=texture2D(diffuseSampler,vUV);\ngl_FragColor=(baseColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;\n}"):a.h["particles.fragment"]="\nvarying vec2 vUV;\nvarying vec4 vColor;\nuniform vec4 textureMask;\nuniform sampler2D diffuseSampler;\n#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\nvoid main(void) {\n#ifdef CLIPPLANE\nif (fClipDistance>0.0)\ndiscard;\n#endif\nvec4 baseColor=texture2D(diffuseSampler,vUV);\ngl_FragColor=(baseColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;\n}";
null!=t["particles.vertex"]?a.C("particles.vertex","\nattribute vec3 position;\nattribute vec4 color;\nattribute vec4 options;\n\nuniform mat4 view;\nuniform mat4 projection;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nuniform mat4 invView;\nvarying float fClipDistance;\n#endif\nvoid main(void) { \nvec3 viewPos=(view*vec4(position,1.0)).xyz; \nvec3 cornerPos;\nfloat size=options.y;\nfloat angle=options.x;\nvec2 offset=options.zw;\ncornerPos=vec3(offset.x-0.5,offset.y-0.5,0.)*size;\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0); \nvColor=color;\nvUV=offset;\n\n#ifdef CLIPPLANE\nvec4 worldPos=invView*vec4(viewPos,1.0);\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n}"):
a.h["particles.vertex"]="\nattribute vec3 position;\nattribute vec4 color;\nattribute vec4 options;\n\nuniform mat4 view;\nuniform mat4 projection;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nuniform mat4 invView;\nvarying float fClipDistance;\n#endif\nvoid main(void) { \nvec3 viewPos=(view*vec4(position,1.0)).xyz; \nvec3 cornerPos;\nfloat size=options.y;\nfloat angle=options.x;\nvec2 offset=options.zw;\ncornerPos=vec3(offset.x-0.5,offset.y-0.5,0.)*size;\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0); \nvColor=color;\nvUV=offset;\n\n#ifdef CLIPPLANE\nvec4 worldPos=invView*vec4(viewPos,1.0);\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n}";
null!=t["pass.fragment"]?a.C("pass.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void) \n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}"):a.h["pass.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void) \n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}";null!=t["pbr.fragment"]?a.C("pbr.fragment","#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef LODBASEDMICROSFURACE\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\nuniform vec3 vEyePosition;\nuniform vec3 vAmbientColor;\nuniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\n\nuniform vec4 vLightingIntensity;\nuniform vec4 vCameraInfos;\n#ifdef OVERLOADEDVALUES\nuniform vec4 vOverloadedIntensity;\nuniform vec3 vOverloadedAmbient;\nuniform vec3 vOverloadedAlbedo;\nuniform vec3 vOverloadedReflectivity;\nuniform vec3 vOverloadedEmissive;\nuniform vec3 vOverloadedReflection;\nuniform vec3 vOverloadedMicroSurface;\n#endif\n#ifdef OVERLOADEDSHADOWVALUES\nuniform vec4 vOverloadedShadowIntensity;\n#endif\n#if defined(REFLECTION) || defined(REFRACTION)\nuniform vec2 vMicrosurfaceTextureLods;\n#endif\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<lightFragmentDeclaration>[0..maxSimultaneousLights]\n\n#ifdef ALBEDO\nvarying vec2 vAlbedoUV;\nuniform sampler2D albedoSampler;\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nvarying vec2 vAmbientUV;\nuniform sampler2D ambientSampler;\nuniform vec3 vAmbientInfos;\n#endif\n#ifdef OPACITY \nvarying vec2 vOpacityUV;\nuniform sampler2D opacitySampler;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vEmissiveUV;\nuniform vec2 vEmissiveInfos;\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\nvarying vec2 vLightmapUV;\nuniform vec2 vLightmapInfos;\nuniform sampler2D lightmapSampler;\n#endif\n#if defined(REFLECTIVITY) || defined(METALLICWORKFLOW) \nvarying vec2 vReflectivityUV;\nuniform vec2 vReflectivityInfos;\nuniform sampler2D reflectivitySampler;\n#endif\n\n#include<fresnelFunction>\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\nuniform mat4 refractionMatrix;\n#endif\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvarying vec3 vDirectionW;\n#endif\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION)\nuniform mat4 reflectionMatrix;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n#ifdef CAMERACOLORGRADING\n#include<colorGradingDefinition>\n#endif\n#ifdef CAMERACOLORCURVES\n#include<colorCurvesDefinition>\n#endif\n\n#include<pbrShadowFunctions>\n#include<pbrFunctions>\n#ifdef CAMERACOLORGRADING\n#include<colorGrading>\n#endif\n#ifdef CAMERACOLORCURVES\n#include<colorCurves>\n#endif\n#include<harmonicsFunctions>\n#include<pbrLightFunctions>\n#include<helperFunctions>\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n\n#include<fogFragmentDeclaration>\nvoid main(void) {\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#include<bumpFragment>\n\nvec4 surfaceAlbedo=vec4(1.,1.,1.,1.);\nvec3 surfaceAlbedoContribution=vAlbedoColor.rgb;\n\nfloat alpha=vAlbedoColor.a;\n#ifdef ALBEDO\nsurfaceAlbedo=texture2D(albedoSampler,vAlbedoUV+uvOffset);\nsurfaceAlbedo=vec4(toLinearSpace(surfaceAlbedo.rgb),surfaceAlbedo.a);\n#ifndef LINKREFRACTIONTOTRANSPARENCY\n#ifdef ALPHATEST\nif (surfaceAlbedo.a<0.4)\ndiscard;\n#endif\n#endif\n#ifdef ALPHAFROMALBEDO\nalpha*=surfaceAlbedo.a;\n#endif\nsurfaceAlbedo.rgb*=vAlbedoInfos.y;\n#else\n\nsurfaceAlbedo.rgb=surfaceAlbedoContribution;\nsurfaceAlbedoContribution=vec3(1.,1.,1.);\n#endif\n#ifdef VERTEXCOLOR\nsurfaceAlbedo.rgb*=vColor.rgb;\n#endif\n#ifdef OVERLOADEDVALUES\nsurfaceAlbedo.rgb=mix(surfaceAlbedo.rgb,vOverloadedAlbedo,vOverloadedIntensity.y);\n#endif\n\nvec3 ambientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nambientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\nambientColor=vec3(1.,1.,1.)-((vec3(1.,1.,1.)-ambientColor)*vAmbientInfos.z);\n#ifdef OVERLOADEDVALUES\nambientColor.rgb=mix(ambientColor.rgb,vOverloadedAmbient,vOverloadedIntensity.x);\n#endif\n#endif\n\nfloat microSurface=vReflectivityColor.a;\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\n#ifdef OVERLOADEDVALUES\nsurfaceReflectivityColor.rgb=mix(surfaceReflectivityColor.rgb,vOverloadedReflectivity,vOverloadedIntensity.z);\n#endif\n#ifdef REFLECTIVITY\nvec4 surfaceReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\nsurfaceReflectivityColor=surfaceReflectivityColorMap.rgb;\nsurfaceReflectivityColor=toLinearSpace(surfaceReflectivityColor);\n#ifdef OVERLOADEDVALUES\nsurfaceReflectivityColor=mix(surfaceReflectivityColor,vOverloadedReflectivity,vOverloadedIntensity.z);\n#endif\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\nmicroSurface=surfaceReflectivityColorMap.a;\n#else\n#ifdef MICROSURFACEAUTOMATIC\nmicroSurface=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\n#endif\n#endif\n#endif\n#ifdef METALLICWORKFLOW\nvec4 surfaceMetallicColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\n\nfloat metallic=surfaceMetallicColorMap.r; \n\nvec3 baseColor=surfaceAlbedo.rgb;\n\nsurfaceAlbedo.rgb*=(1.0-metallic);\n\n\nconst vec3 DefaultSpecularReflectanceDielectric=vec3(0.04,0.04,0.04);\n\nsurfaceReflectivityColor=mix(DefaultSpecularReflectanceDielectric,baseColor,metallic);\n#ifdef OVERLOADEDVALUES\nsurfaceReflectivityColor=mix(surfaceReflectivityColor,vOverloadedReflectivity,vOverloadedIntensity.z);\n#endif\n#ifdef METALLICROUGHNESSGSTOREINALPHA\nmicroSurface=1.0-surfaceMetallicColorMap.a;\n#else\n#ifdef METALLICROUGHNESSGSTOREINGREEN\nmicroSurface=1.0-surfaceMetallicColorMap.g;\n#endif\n#endif\n#endif\n#ifdef OVERLOADEDVALUES\nmicroSurface=mix(microSurface,vOverloadedMicroSurface.x,vOverloadedMicroSurface.y);\n#endif\n\nfloat NdotV=max(0.00000000001,dot(normalW,viewDirectionW));\n\nmicroSurface=clamp(microSurface,0.,1.)*0.98;\n\nfloat roughness=clamp(1.-microSurface,0.000001,1.0);\n\nvec3 lightDiffuseContribution=vec3(0.,0.,0.);\n#ifdef OVERLOADEDSHADOWVALUES\nvec3 shadowedOnlyLightDiffuseContribution=vec3(1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nvec3 lightSpecularContribution=vec3(0.,0.,0.);\n#endif\nfloat notShadowLevel=1.; \n#ifdef LIGHTMAP\nvec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb*vLightmapInfos.y;\n#endif\nfloat NdotL=-1.;\nlightingInfo info;\n\nfloat reflectance=max(max(surfaceReflectivityColor.r,surfaceReflectivityColor.g),surfaceReflectivityColor.b);\n\n\nfloat reflectance90=clamp(reflectance*25.0,0.0,1.0);\nvec3 specularEnvironmentR0=surfaceReflectivityColor.rgb;\nvec3 specularEnvironmentR90=vec3(1.0,1.0,1.0)*reflectance90;\n#include<pbrLightFunctionsCall>[0..maxSimultaneousLights]\n#ifdef SPECULARTERM\nlightSpecularContribution*=vLightingIntensity.w;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n\nvec3 surfaceRefractionColor=vec3(0.,0.,0.);\n\n#ifdef LODBASEDMICROSFURACE\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\n#endif\n#ifdef REFRACTION\nvec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);\n#ifdef LODBASEDMICROSFURACE\n#ifdef USEPMREMREFRACTION\nfloat lodRefraction=getMipMapIndexFromAverageSlopeWithPMREM(vMicrosurfaceTextureLods.y,alphaG);\n#else\nfloat lodRefraction=getMipMapIndexFromAverageSlope(vMicrosurfaceTextureLods.y,alphaG);\n#endif\n#else\nfloat biasRefraction=(vMicrosurfaceTextureLods.y+2.)*(1.0-microSurface);\n#endif\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0)\n{\n#ifdef LODBASEDMICROSFURACE\n#ifdef USEPMREMREFRACTION\n\nif ((vMicrosurfaceTextureLods.y-lodRefraction)>4.0)\n{\n\nfloat scaleRefraction=1.-exp2(lodRefraction)/exp2(vMicrosurfaceTextureLods.y); \nfloat maxRefraction=max(max(abs(refractionVector.x),abs(refractionVector.y)),abs(refractionVector.z));\nif (abs(refractionVector.x) != maxRefraction) refractionVector.x*=scaleRefraction;\nif (abs(refractionVector.y) != maxRefraction) refractionVector.y*=scaleRefraction;\nif (abs(refractionVector.z) != maxRefraction) refractionVector.z*=scaleRefraction;\n}\n#endif\nsurfaceRefractionColor=textureCubeLodEXT(refractionCubeSampler,refractionVector,lodRefraction).rgb*vRefractionInfos.x;\n#else\nsurfaceRefractionColor=textureCube(refractionCubeSampler,refractionVector,biasRefraction).rgb*vRefractionInfos.x;\n#endif\n}\n#ifndef REFRACTIONMAPINLINEARSPACE\nsurfaceRefractionColor=toLinearSpace(surfaceRefractionColor.rgb);\n#endif\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\n#ifdef LODBASEDMICROSFURACE\nsurfaceRefractionColor=texture2DLodEXT(refraction2DSampler,refractionCoords,lodRefraction).rgb*vRefractionInfos.x;\n#else\nsurfaceRefractionColor=texture2D(refraction2DSampler,refractionCoords,biasRefraction).rgb*vRefractionInfos.x;\n#endif \nsurfaceRefractionColor=toLinearSpace(surfaceRefractionColor.rgb);\n#endif\n#endif\n\nvec3 environmentRadiance=vReflectionColor.rgb;\nvec3 environmentIrradiance=vReflectionColor.rgb;\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef LODBASEDMICROSFURACE\n#ifdef USEPMREMREFLECTION\nfloat lodReflection=getMipMapIndexFromAverageSlopeWithPMREM(vMicrosurfaceTextureLods.x,alphaG);\n#else\nfloat lodReflection=getMipMapIndexFromAverageSlope(vMicrosurfaceTextureLods.x,alphaG);\n#endif\n#else\nfloat biasReflection=(vMicrosurfaceTextureLods.x+2.)*(1.0-microSurface);\n#endif\n#ifdef REFLECTIONMAP_3D\n#ifdef LODBASEDMICROSFURACE\n#ifdef USEPMREMREFLECTION\n\nif ((vMicrosurfaceTextureLods.y-lodReflection)>4.0)\n{\n\nfloat scaleReflection=1.-exp2(lodReflection)/exp2(vMicrosurfaceTextureLods.x); \nfloat maxReflection=max(max(abs(vReflectionUVW.x),abs(vReflectionUVW.y)),abs(vReflectionUVW.z));\nif (abs(vReflectionUVW.x) != maxReflection) vReflectionUVW.x*=scaleReflection;\nif (abs(vReflectionUVW.y) != maxReflection) vReflectionUVW.y*=scaleReflection;\nif (abs(vReflectionUVW.z) != maxReflection) vReflectionUVW.z*=scaleReflection;\n}\n#endif\nenvironmentRadiance=textureCubeLodEXT(reflectionCubeSampler,vReflectionUVW,lodReflection).rgb*vReflectionInfos.x;\n#else\nenvironmentRadiance=textureCube(reflectionCubeSampler,vReflectionUVW,biasReflection).rgb*vReflectionInfos.x;\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifndef REFLECTIONMAP_SKYBOX\nvec3 normalEnvironmentSpace=(reflectionMatrix*vec4(normalW,1)).xyz;\nenvironmentIrradiance=EnvironmentIrradiance(normalEnvironmentSpace);\n#endif\n#else\nenvironmentRadiance=toLinearSpace(environmentRadiance.rgb);\nenvironmentIrradiance=textureCube(reflectionCubeSampler,normalW,20.).rgb*vReflectionInfos.x;\nenvironmentIrradiance=toLinearSpace(environmentIrradiance.rgb);\nenvironmentIrradiance*=0.2; \n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\n#ifdef LODBASEDMICROSFURACE\nenvironmentRadiance=texture2DLodEXT(reflection2DSampler,coords,lodReflection).rgb*vReflectionInfos.x;\n#else\nenvironmentRadiance=texture2D(reflection2DSampler,coords,biasReflection).rgb*vReflectionInfos.x;\n#endif\nenvironmentRadiance=toLinearSpace(environmentRadiance.rgb);\nenvironmentIrradiance=texture2D(reflection2DSampler,coords,20.).rgb*vReflectionInfos.x;\nenvironmentIrradiance=toLinearSpace(environmentIrradiance.rgb);\n#endif\n#endif\n#ifdef OVERLOADEDVALUES\nenvironmentIrradiance=mix(environmentIrradiance,vOverloadedReflection,vOverloadedMicroSurface.z);\nenvironmentRadiance=mix(environmentRadiance,vOverloadedReflection,vOverloadedMicroSurface.z);\n#endif\nenvironmentRadiance*=vLightingIntensity.z;\nenvironmentIrradiance*=vLightingIntensity.z;\n\nvec3 specularEnvironmentReflectance=FresnelSchlickEnvironmentGGX(clamp(NdotV,0.,1.),specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\n\nvec3 refractance=vec3(0.0,0.0,0.0);\n#ifdef REFRACTION\nvec3 transmission=vec3(1.0,1.0,1.0);\n#ifdef LINKREFRACTIONTOTRANSPARENCY\n\ntransmission*=(1.0-alpha);\n\n\nvec3 mixedAlbedo=surfaceAlbedoContribution.rgb*surfaceAlbedo.rgb;\nfloat maxChannel=max(max(mixedAlbedo.r,mixedAlbedo.g),mixedAlbedo.b);\nvec3 tint=clamp(maxChannel*mixedAlbedo,0.0,1.0);\n\nsurfaceAlbedoContribution*=alpha;\n\nenvironmentIrradiance*=alpha;\n\nsurfaceRefractionColor*=tint;\n\nalpha=1.0;\n#endif\n\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\nspecularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,alpha);\n\ntransmission*=1.0-specularEnvironmentReflectance;\n\nrefractance=surfaceRefractionColor*transmission;\n#endif\n\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\nrefractance*=vLightingIntensity.z;\nenvironmentRadiance*=specularEnvironmentReflectance;\n\nvec3 surfaceEmissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\nsurfaceEmissiveColor=toLinearSpace(emissiveColorTex.rgb)*surfaceEmissiveColor*vEmissiveInfos.y;\n#endif\n#ifdef OVERLOADEDVALUES\nsurfaceEmissiveColor=mix(surfaceEmissiveColor,vOverloadedEmissive,vOverloadedIntensity.w);\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);\nsurfaceEmissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=max(lightDiffuseContribution*surfaceAlbedoContribution+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#ifdef OVERLOADEDSHADOWVALUES\nshadowedOnlyLightDiffuseContribution=max(shadowedOnlyLightDiffuseContribution*surfaceAlbedoContribution+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#endif\n#else\n#ifdef LINKEMISSIVEWITHALBEDO\nvec3 finalDiffuse=max((lightDiffuseContribution+surfaceEmissiveColor)*surfaceAlbedoContribution+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#ifdef OVERLOADEDSHADOWVALUES\nshadowedOnlyLightDiffuseContribution=max((shadowedOnlyLightDiffuseContribution+surfaceEmissiveColor)*surfaceAlbedoContribution+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#endif\n#else\nvec3 finalDiffuse=max(lightDiffuseContribution*surfaceAlbedoContribution+surfaceEmissiveColor+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#ifdef OVERLOADEDSHADOWVALUES\nshadowedOnlyLightDiffuseContribution=max(shadowedOnlyLightDiffuseContribution*surfaceAlbedoContribution+surfaceEmissiveColor+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#endif\n#endif\n#endif\n#ifdef OVERLOADEDSHADOWVALUES\nfinalDiffuse=mix(finalDiffuse,shadowedOnlyLightDiffuseContribution,(1.0-vOverloadedShadowIntensity.y));\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=lightSpecularContribution*surfaceReflectivityColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+getLuminance(finalSpecular),0.,1.);\n#endif\n#ifdef RADIANCEOVERALPHA\nalpha=clamp(alpha+getLuminance(environmentRadiance),0.,1.);\n#endif\n\n\n#ifdef EMISSIVEASILLUMINATION\nvec4 finalColor=vec4(finalDiffuse*ambientColor*vLightingIntensity.x+surfaceAlbedo.rgb*environmentIrradiance+finalSpecular*vLightingIntensity.x+environmentRadiance+surfaceEmissiveColor*vLightingIntensity.y+refractance,alpha);\n#else\nvec4 finalColor=vec4(finalDiffuse*ambientColor*vLightingIntensity.x+surfaceAlbedo.rgb*environmentIrradiance+finalSpecular*vLightingIntensity.x+environmentRadiance+refractance,alpha);\n#endif\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\nfinalColor.rgb*=lightmapColor;\n#else\nfinalColor.rgb+=lightmapColor;\n#endif\n#endif\n#endif\nfinalColor=max(finalColor,0.0);\n#ifdef CAMERATONEMAP\nfinalColor.rgb=toneMaps(finalColor.rgb);\n#endif\nfinalColor.rgb=toGammaSpace(finalColor.rgb);\n#include<logDepthFragment>\n#include<fogFragment>(color,finalColor)\n#ifdef CAMERACONTRAST\nfinalColor=contrasts(finalColor);\n#endif\nfinalColor.rgb=clamp(finalColor.rgb,0.,1.);\n#ifdef CAMERACOLORGRADING\nfinalColor=colorGrades(finalColor);\n#endif\n#ifdef CAMERACOLORCURVES\nfinalColor.rgb=applyColorCurves(finalColor.rgb);\n#endif\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ngl_FragColor=finalColor;\n}"):
a.h["pbr.fragment"]="#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef LODBASEDMICROSFURACE\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\nuniform vec3 vEyePosition;\nuniform vec3 vAmbientColor;\nuniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\n\nuniform vec4 vLightingIntensity;\nuniform vec4 vCameraInfos;\n#ifdef OVERLOADEDVALUES\nuniform vec4 vOverloadedIntensity;\nuniform vec3 vOverloadedAmbient;\nuniform vec3 vOverloadedAlbedo;\nuniform vec3 vOverloadedReflectivity;\nuniform vec3 vOverloadedEmissive;\nuniform vec3 vOverloadedReflection;\nuniform vec3 vOverloadedMicroSurface;\n#endif\n#ifdef OVERLOADEDSHADOWVALUES\nuniform vec4 vOverloadedShadowIntensity;\n#endif\n#if defined(REFLECTION) || defined(REFRACTION)\nuniform vec2 vMicrosurfaceTextureLods;\n#endif\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<lightFragmentDeclaration>[0..maxSimultaneousLights]\n\n#ifdef ALBEDO\nvarying vec2 vAlbedoUV;\nuniform sampler2D albedoSampler;\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nvarying vec2 vAmbientUV;\nuniform sampler2D ambientSampler;\nuniform vec3 vAmbientInfos;\n#endif\n#ifdef OPACITY \nvarying vec2 vOpacityUV;\nuniform sampler2D opacitySampler;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vEmissiveUV;\nuniform vec2 vEmissiveInfos;\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\nvarying vec2 vLightmapUV;\nuniform vec2 vLightmapInfos;\nuniform sampler2D lightmapSampler;\n#endif\n#if defined(REFLECTIVITY) || defined(METALLICWORKFLOW) \nvarying vec2 vReflectivityUV;\nuniform vec2 vReflectivityInfos;\nuniform sampler2D reflectivitySampler;\n#endif\n\n#include<fresnelFunction>\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\nuniform mat4 refractionMatrix;\n#endif\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvarying vec3 vDirectionW;\n#endif\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION)\nuniform mat4 reflectionMatrix;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n#ifdef CAMERACOLORGRADING\n#include<colorGradingDefinition>\n#endif\n#ifdef CAMERACOLORCURVES\n#include<colorCurvesDefinition>\n#endif\n\n#include<pbrShadowFunctions>\n#include<pbrFunctions>\n#ifdef CAMERACOLORGRADING\n#include<colorGrading>\n#endif\n#ifdef CAMERACOLORCURVES\n#include<colorCurves>\n#endif\n#include<harmonicsFunctions>\n#include<pbrLightFunctions>\n#include<helperFunctions>\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n\n#include<fogFragmentDeclaration>\nvoid main(void) {\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#include<bumpFragment>\n\nvec4 surfaceAlbedo=vec4(1.,1.,1.,1.);\nvec3 surfaceAlbedoContribution=vAlbedoColor.rgb;\n\nfloat alpha=vAlbedoColor.a;\n#ifdef ALBEDO\nsurfaceAlbedo=texture2D(albedoSampler,vAlbedoUV+uvOffset);\nsurfaceAlbedo=vec4(toLinearSpace(surfaceAlbedo.rgb),surfaceAlbedo.a);\n#ifndef LINKREFRACTIONTOTRANSPARENCY\n#ifdef ALPHATEST\nif (surfaceAlbedo.a<0.4)\ndiscard;\n#endif\n#endif\n#ifdef ALPHAFROMALBEDO\nalpha*=surfaceAlbedo.a;\n#endif\nsurfaceAlbedo.rgb*=vAlbedoInfos.y;\n#else\n\nsurfaceAlbedo.rgb=surfaceAlbedoContribution;\nsurfaceAlbedoContribution=vec3(1.,1.,1.);\n#endif\n#ifdef VERTEXCOLOR\nsurfaceAlbedo.rgb*=vColor.rgb;\n#endif\n#ifdef OVERLOADEDVALUES\nsurfaceAlbedo.rgb=mix(surfaceAlbedo.rgb,vOverloadedAlbedo,vOverloadedIntensity.y);\n#endif\n\nvec3 ambientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nambientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\nambientColor=vec3(1.,1.,1.)-((vec3(1.,1.,1.)-ambientColor)*vAmbientInfos.z);\n#ifdef OVERLOADEDVALUES\nambientColor.rgb=mix(ambientColor.rgb,vOverloadedAmbient,vOverloadedIntensity.x);\n#endif\n#endif\n\nfloat microSurface=vReflectivityColor.a;\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\n#ifdef OVERLOADEDVALUES\nsurfaceReflectivityColor.rgb=mix(surfaceReflectivityColor.rgb,vOverloadedReflectivity,vOverloadedIntensity.z);\n#endif\n#ifdef REFLECTIVITY\nvec4 surfaceReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\nsurfaceReflectivityColor=surfaceReflectivityColorMap.rgb;\nsurfaceReflectivityColor=toLinearSpace(surfaceReflectivityColor);\n#ifdef OVERLOADEDVALUES\nsurfaceReflectivityColor=mix(surfaceReflectivityColor,vOverloadedReflectivity,vOverloadedIntensity.z);\n#endif\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\nmicroSurface=surfaceReflectivityColorMap.a;\n#else\n#ifdef MICROSURFACEAUTOMATIC\nmicroSurface=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\n#endif\n#endif\n#endif\n#ifdef METALLICWORKFLOW\nvec4 surfaceMetallicColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\n\nfloat metallic=surfaceMetallicColorMap.r; \n\nvec3 baseColor=surfaceAlbedo.rgb;\n\nsurfaceAlbedo.rgb*=(1.0-metallic);\n\n\nconst vec3 DefaultSpecularReflectanceDielectric=vec3(0.04,0.04,0.04);\n\nsurfaceReflectivityColor=mix(DefaultSpecularReflectanceDielectric,baseColor,metallic);\n#ifdef OVERLOADEDVALUES\nsurfaceReflectivityColor=mix(surfaceReflectivityColor,vOverloadedReflectivity,vOverloadedIntensity.z);\n#endif\n#ifdef METALLICROUGHNESSGSTOREINALPHA\nmicroSurface=1.0-surfaceMetallicColorMap.a;\n#else\n#ifdef METALLICROUGHNESSGSTOREINGREEN\nmicroSurface=1.0-surfaceMetallicColorMap.g;\n#endif\n#endif\n#endif\n#ifdef OVERLOADEDVALUES\nmicroSurface=mix(microSurface,vOverloadedMicroSurface.x,vOverloadedMicroSurface.y);\n#endif\n\nfloat NdotV=max(0.00000000001,dot(normalW,viewDirectionW));\n\nmicroSurface=clamp(microSurface,0.,1.)*0.98;\n\nfloat roughness=clamp(1.-microSurface,0.000001,1.0);\n\nvec3 lightDiffuseContribution=vec3(0.,0.,0.);\n#ifdef OVERLOADEDSHADOWVALUES\nvec3 shadowedOnlyLightDiffuseContribution=vec3(1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nvec3 lightSpecularContribution=vec3(0.,0.,0.);\n#endif\nfloat notShadowLevel=1.; \n#ifdef LIGHTMAP\nvec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb*vLightmapInfos.y;\n#endif\nfloat NdotL=-1.;\nlightingInfo info;\n\nfloat reflectance=max(max(surfaceReflectivityColor.r,surfaceReflectivityColor.g),surfaceReflectivityColor.b);\n\n\nfloat reflectance90=clamp(reflectance*25.0,0.0,1.0);\nvec3 specularEnvironmentR0=surfaceReflectivityColor.rgb;\nvec3 specularEnvironmentR90=vec3(1.0,1.0,1.0)*reflectance90;\n#include<pbrLightFunctionsCall>[0..maxSimultaneousLights]\n#ifdef SPECULARTERM\nlightSpecularContribution*=vLightingIntensity.w;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n\nvec3 surfaceRefractionColor=vec3(0.,0.,0.);\n\n#ifdef LODBASEDMICROSFURACE\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\n#endif\n#ifdef REFRACTION\nvec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);\n#ifdef LODBASEDMICROSFURACE\n#ifdef USEPMREMREFRACTION\nfloat lodRefraction=getMipMapIndexFromAverageSlopeWithPMREM(vMicrosurfaceTextureLods.y,alphaG);\n#else\nfloat lodRefraction=getMipMapIndexFromAverageSlope(vMicrosurfaceTextureLods.y,alphaG);\n#endif\n#else\nfloat biasRefraction=(vMicrosurfaceTextureLods.y+2.)*(1.0-microSurface);\n#endif\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0)\n{\n#ifdef LODBASEDMICROSFURACE\n#ifdef USEPMREMREFRACTION\n\nif ((vMicrosurfaceTextureLods.y-lodRefraction)>4.0)\n{\n\nfloat scaleRefraction=1.-exp2(lodRefraction)/exp2(vMicrosurfaceTextureLods.y); \nfloat maxRefraction=max(max(abs(refractionVector.x),abs(refractionVector.y)),abs(refractionVector.z));\nif (abs(refractionVector.x) != maxRefraction) refractionVector.x*=scaleRefraction;\nif (abs(refractionVector.y) != maxRefraction) refractionVector.y*=scaleRefraction;\nif (abs(refractionVector.z) != maxRefraction) refractionVector.z*=scaleRefraction;\n}\n#endif\nsurfaceRefractionColor=textureCubeLodEXT(refractionCubeSampler,refractionVector,lodRefraction).rgb*vRefractionInfos.x;\n#else\nsurfaceRefractionColor=textureCube(refractionCubeSampler,refractionVector,biasRefraction).rgb*vRefractionInfos.x;\n#endif\n}\n#ifndef REFRACTIONMAPINLINEARSPACE\nsurfaceRefractionColor=toLinearSpace(surfaceRefractionColor.rgb);\n#endif\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\n#ifdef LODBASEDMICROSFURACE\nsurfaceRefractionColor=texture2DLodEXT(refraction2DSampler,refractionCoords,lodRefraction).rgb*vRefractionInfos.x;\n#else\nsurfaceRefractionColor=texture2D(refraction2DSampler,refractionCoords,biasRefraction).rgb*vRefractionInfos.x;\n#endif \nsurfaceRefractionColor=toLinearSpace(surfaceRefractionColor.rgb);\n#endif\n#endif\n\nvec3 environmentRadiance=vReflectionColor.rgb;\nvec3 environmentIrradiance=vReflectionColor.rgb;\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef LODBASEDMICROSFURACE\n#ifdef USEPMREMREFLECTION\nfloat lodReflection=getMipMapIndexFromAverageSlopeWithPMREM(vMicrosurfaceTextureLods.x,alphaG);\n#else\nfloat lodReflection=getMipMapIndexFromAverageSlope(vMicrosurfaceTextureLods.x,alphaG);\n#endif\n#else\nfloat biasReflection=(vMicrosurfaceTextureLods.x+2.)*(1.0-microSurface);\n#endif\n#ifdef REFLECTIONMAP_3D\n#ifdef LODBASEDMICROSFURACE\n#ifdef USEPMREMREFLECTION\n\nif ((vMicrosurfaceTextureLods.y-lodReflection)>4.0)\n{\n\nfloat scaleReflection=1.-exp2(lodReflection)/exp2(vMicrosurfaceTextureLods.x); \nfloat maxReflection=max(max(abs(vReflectionUVW.x),abs(vReflectionUVW.y)),abs(vReflectionUVW.z));\nif (abs(vReflectionUVW.x) != maxReflection) vReflectionUVW.x*=scaleReflection;\nif (abs(vReflectionUVW.y) != maxReflection) vReflectionUVW.y*=scaleReflection;\nif (abs(vReflectionUVW.z) != maxReflection) vReflectionUVW.z*=scaleReflection;\n}\n#endif\nenvironmentRadiance=textureCubeLodEXT(reflectionCubeSampler,vReflectionUVW,lodReflection).rgb*vReflectionInfos.x;\n#else\nenvironmentRadiance=textureCube(reflectionCubeSampler,vReflectionUVW,biasReflection).rgb*vReflectionInfos.x;\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifndef REFLECTIONMAP_SKYBOX\nvec3 normalEnvironmentSpace=(reflectionMatrix*vec4(normalW,1)).xyz;\nenvironmentIrradiance=EnvironmentIrradiance(normalEnvironmentSpace);\n#endif\n#else\nenvironmentRadiance=toLinearSpace(environmentRadiance.rgb);\nenvironmentIrradiance=textureCube(reflectionCubeSampler,normalW,20.).rgb*vReflectionInfos.x;\nenvironmentIrradiance=toLinearSpace(environmentIrradiance.rgb);\nenvironmentIrradiance*=0.2; \n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\n#ifdef LODBASEDMICROSFURACE\nenvironmentRadiance=texture2DLodEXT(reflection2DSampler,coords,lodReflection).rgb*vReflectionInfos.x;\n#else\nenvironmentRadiance=texture2D(reflection2DSampler,coords,biasReflection).rgb*vReflectionInfos.x;\n#endif\nenvironmentRadiance=toLinearSpace(environmentRadiance.rgb);\nenvironmentIrradiance=texture2D(reflection2DSampler,coords,20.).rgb*vReflectionInfos.x;\nenvironmentIrradiance=toLinearSpace(environmentIrradiance.rgb);\n#endif\n#endif\n#ifdef OVERLOADEDVALUES\nenvironmentIrradiance=mix(environmentIrradiance,vOverloadedReflection,vOverloadedMicroSurface.z);\nenvironmentRadiance=mix(environmentRadiance,vOverloadedReflection,vOverloadedMicroSurface.z);\n#endif\nenvironmentRadiance*=vLightingIntensity.z;\nenvironmentIrradiance*=vLightingIntensity.z;\n\nvec3 specularEnvironmentReflectance=FresnelSchlickEnvironmentGGX(clamp(NdotV,0.,1.),specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\n\nvec3 refractance=vec3(0.0,0.0,0.0);\n#ifdef REFRACTION\nvec3 transmission=vec3(1.0,1.0,1.0);\n#ifdef LINKREFRACTIONTOTRANSPARENCY\n\ntransmission*=(1.0-alpha);\n\n\nvec3 mixedAlbedo=surfaceAlbedoContribution.rgb*surfaceAlbedo.rgb;\nfloat maxChannel=max(max(mixedAlbedo.r,mixedAlbedo.g),mixedAlbedo.b);\nvec3 tint=clamp(maxChannel*mixedAlbedo,0.0,1.0);\n\nsurfaceAlbedoContribution*=alpha;\n\nenvironmentIrradiance*=alpha;\n\nsurfaceRefractionColor*=tint;\n\nalpha=1.0;\n#endif\n\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\nspecularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,alpha);\n\ntransmission*=1.0-specularEnvironmentReflectance;\n\nrefractance=surfaceRefractionColor*transmission;\n#endif\n\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\nrefractance*=vLightingIntensity.z;\nenvironmentRadiance*=specularEnvironmentReflectance;\n\nvec3 surfaceEmissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\nsurfaceEmissiveColor=toLinearSpace(emissiveColorTex.rgb)*surfaceEmissiveColor*vEmissiveInfos.y;\n#endif\n#ifdef OVERLOADEDVALUES\nsurfaceEmissiveColor=mix(surfaceEmissiveColor,vOverloadedEmissive,vOverloadedIntensity.w);\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);\nsurfaceEmissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=max(lightDiffuseContribution*surfaceAlbedoContribution+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#ifdef OVERLOADEDSHADOWVALUES\nshadowedOnlyLightDiffuseContribution=max(shadowedOnlyLightDiffuseContribution*surfaceAlbedoContribution+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#endif\n#else\n#ifdef LINKEMISSIVEWITHALBEDO\nvec3 finalDiffuse=max((lightDiffuseContribution+surfaceEmissiveColor)*surfaceAlbedoContribution+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#ifdef OVERLOADEDSHADOWVALUES\nshadowedOnlyLightDiffuseContribution=max((shadowedOnlyLightDiffuseContribution+surfaceEmissiveColor)*surfaceAlbedoContribution+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#endif\n#else\nvec3 finalDiffuse=max(lightDiffuseContribution*surfaceAlbedoContribution+surfaceEmissiveColor+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#ifdef OVERLOADEDSHADOWVALUES\nshadowedOnlyLightDiffuseContribution=max(shadowedOnlyLightDiffuseContribution*surfaceAlbedoContribution+surfaceEmissiveColor+vAmbientColor,0.0)*surfaceAlbedo.rgb;\n#endif\n#endif\n#endif\n#ifdef OVERLOADEDSHADOWVALUES\nfinalDiffuse=mix(finalDiffuse,shadowedOnlyLightDiffuseContribution,(1.0-vOverloadedShadowIntensity.y));\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=lightSpecularContribution*surfaceReflectivityColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+getLuminance(finalSpecular),0.,1.);\n#endif\n#ifdef RADIANCEOVERALPHA\nalpha=clamp(alpha+getLuminance(environmentRadiance),0.,1.);\n#endif\n\n\n#ifdef EMISSIVEASILLUMINATION\nvec4 finalColor=vec4(finalDiffuse*ambientColor*vLightingIntensity.x+surfaceAlbedo.rgb*environmentIrradiance+finalSpecular*vLightingIntensity.x+environmentRadiance+surfaceEmissiveColor*vLightingIntensity.y+refractance,alpha);\n#else\nvec4 finalColor=vec4(finalDiffuse*ambientColor*vLightingIntensity.x+surfaceAlbedo.rgb*environmentIrradiance+finalSpecular*vLightingIntensity.x+environmentRadiance+refractance,alpha);\n#endif\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\nfinalColor.rgb*=lightmapColor;\n#else\nfinalColor.rgb+=lightmapColor;\n#endif\n#endif\n#endif\nfinalColor=max(finalColor,0.0);\n#ifdef CAMERATONEMAP\nfinalColor.rgb=toneMaps(finalColor.rgb);\n#endif\nfinalColor.rgb=toGammaSpace(finalColor.rgb);\n#include<logDepthFragment>\n#include<fogFragment>(color,finalColor)\n#ifdef CAMERACONTRAST\nfinalColor=contrasts(finalColor);\n#endif\nfinalColor.rgb=clamp(finalColor.rgb,0.,1.);\n#ifdef CAMERACOLORGRADING\nfinalColor=colorGrades(finalColor);\n#endif\n#ifdef CAMERACOLORCURVES\nfinalColor.rgb=applyColorCurves(finalColor.rgb);\n#endif\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ngl_FragColor=finalColor;\n}";
null!=t["pbr.vertex"]?a.C("pbr.vertex","precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef ALBEDO\nvarying vec2 vAlbedoUV;\nuniform mat4 albedoMatrix;\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nvarying vec2 vAmbientUV;\nuniform mat4 ambientMatrix;\nuniform vec3 vAmbientInfos;\n#endif\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vEmissiveUV;\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nvarying vec2 vLightmapUV;\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(REFLECTIVITY) || defined(METALLICWORKFLOW) \nvarying vec2 vReflectivityUV;\nuniform vec2 vReflectivityInfos;\nuniform mat4 reflectivityMatrix;\n#endif\n#ifdef BUMP\nvarying vec2 vBumpUV;\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<shadowsVertexDeclaration>[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvarying vec3 vDirectionW;\n#endif\n#include<logDepthDeclaration>\nvoid main(void) {\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=position;\n#endif \n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef ALBEDO\nif (vAlbedoInfos.x == 0.)\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef AMBIENT\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef OPACITY\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef EMISSIVE\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef LIGHTMAP\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(REFLECTIVITY) || defined(METALLICWORKFLOW) \nif (vReflectivityInfos.x == 0.)\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef BUMP\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n\n#include<logDepthVertex>\n}"):
a.h["pbr.vertex"]="precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef ALBEDO\nvarying vec2 vAlbedoUV;\nuniform mat4 albedoMatrix;\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nvarying vec2 vAmbientUV;\nuniform mat4 ambientMatrix;\nuniform vec3 vAmbientInfos;\n#endif\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vEmissiveUV;\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nvarying vec2 vLightmapUV;\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(REFLECTIVITY) || defined(METALLICWORKFLOW) \nvarying vec2 vReflectivityUV;\nuniform vec2 vReflectivityInfos;\nuniform mat4 reflectivityMatrix;\n#endif\n#ifdef BUMP\nvarying vec2 vBumpUV;\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<shadowsVertexDeclaration>[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvarying vec3 vDirectionW;\n#endif\n#include<logDepthDeclaration>\nvoid main(void) {\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=position;\n#endif \n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef ALBEDO\nif (vAlbedoInfos.x == 0.)\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef AMBIENT\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef OPACITY\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef EMISSIVE\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef LIGHTMAP\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(REFLECTIVITY) || defined(METALLICWORKFLOW) \nif (vReflectivityInfos.x == 0.)\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef BUMP\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n\n#include<logDepthVertex>\n}";
null!=t["postprocess.vertex"]?a.C("postprocess.vertex","\nattribute vec2 position;\nuniform vec2 scale;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvUV=(position*madd+madd)*scale;\ngl_Position=vec4(position,0.0,1.0);\n}"):a.h["postprocess.vertex"]="\nattribute vec2 position;\nuniform vec2 scale;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvUV=(position*madd+madd)*scale;\ngl_Position=vec4(position,0.0,1.0);\n}";null!=t["procedural.vertex"]?
a.C("procedural.vertex","\nattribute vec2 position;\n\nvarying vec2 vPosition;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvPosition=position;\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}"):a.h["procedural.vertex"]="\nattribute vec2 position;\n\nvarying vec2 vPosition;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvPosition=position;\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}";null!=t["refraction.fragment"]?
a.C("refraction.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D refractionSampler;\n\nuniform vec3 baseColor;\nuniform float depth;\nuniform float colorLevel;\nvoid main() {\nfloat ref=1.0-texture2D(refractionSampler,vUV).r;\nvec2 uv=vUV-vec2(0.5);\nvec2 offset=uv*depth*ref;\nvec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;\ngl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);\n}"):a.h["refraction.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D refractionSampler;\n\nuniform vec3 baseColor;\nuniform float depth;\nuniform float colorLevel;\nvoid main() {\nfloat ref=1.0-texture2D(refractionSampler,vUV).r;\nvec2 uv=vUV-vec2(0.5);\nvec2 offset=uv*depth*ref;\nvec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;\ngl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);\n}";
null!=t["shadowMap.fragment"]?a.C("shadowMap.fragment","#ifndef FULLFLOAT\nvec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\n\nvec2 packHalf(float depth) \n{ \nconst vec2 bitOffset=vec2(1.0/255.,0.);\nvec2 color=vec2(depth,fract(depth*255.));\nreturn color-(color.yy*bitOffset);\n}\n#endif\nvarying vec4 vPosition;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef CUBEMAP\nuniform vec3 lightPosition;\nuniform vec2 depthValues;\n#endif\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#ifdef CUBEMAP\nvec3 directionToLight=vPosition.xyz-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth-depthValues.x)/(depthValues.y-depthValues.x);\ndepth=clamp(depth,0.,1.0);\n#else\nfloat depth=vPosition.z/vPosition.w;\ndepth=depth*0.5+0.5;\n#endif\n#ifdef VSM\nfloat moment1=depth;\nfloat moment2=moment1*moment1;\n#ifndef FULLFLOAT\ngl_FragColor=vec4(packHalf(moment1),packHalf(moment2));\n#else\ngl_FragColor=vec4(moment1,moment2,1.0,1.0);\n#endif\n#else\n#ifndef FULLFLOAT\ngl_FragColor=pack(depth);\n#else\ngl_FragColor=vec4(depth,1.0,1.0,1.0);\n#endif\n#endif\n}"):
a.h["shadowMap.fragment"]="#ifndef FULLFLOAT\nvec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\n\nvec2 packHalf(float depth) \n{ \nconst vec2 bitOffset=vec2(1.0/255.,0.);\nvec2 color=vec2(depth,fract(depth*255.));\nreturn color-(color.yy*bitOffset);\n}\n#endif\nvarying vec4 vPosition;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef CUBEMAP\nuniform vec3 lightPosition;\nuniform vec2 depthValues;\n#endif\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#ifdef CUBEMAP\nvec3 directionToLight=vPosition.xyz-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth-depthValues.x)/(depthValues.y-depthValues.x);\ndepth=clamp(depth,0.,1.0);\n#else\nfloat depth=vPosition.z/vPosition.w;\ndepth=depth*0.5+0.5;\n#endif\n#ifdef VSM\nfloat moment1=depth;\nfloat moment2=moment1*moment1;\n#ifndef FULLFLOAT\ngl_FragColor=vec4(packHalf(moment1),packHalf(moment2));\n#else\ngl_FragColor=vec4(moment1,moment2,1.0,1.0);\n#endif\n#else\n#ifndef FULLFLOAT\ngl_FragColor=pack(depth);\n#else\ngl_FragColor=vec4(depth,1.0,1.0,1.0);\n#endif\n#endif\n}";
null!=t["shadowMap.vertex"]?a.C("shadowMap.vertex","\nattribute vec3 position;\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nvarying vec4 vPosition;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\n#include<instancesVertex>\n#include<bonesVertex>\n#ifdef CUBEMAP\nvPosition=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#else\nvPosition=viewProjection*finalWorld*vec4(position,1.0);\ngl_Position=vPosition;\n#endif\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}"):
a.h["shadowMap.vertex"]="\nattribute vec3 position;\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nvarying vec4 vPosition;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\n#include<instancesVertex>\n#include<bonesVertex>\n#ifdef CUBEMAP\nvPosition=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#else\nvPosition=viewProjection*finalWorld*vec4(position,1.0);\ngl_Position=vPosition;\n#endif\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}";
null!=t["sprites.fragment"]?a.C("sprites.fragment","uniform bool alphaTest;\nvarying vec4 vColor;\n\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n\n#include<fogFragmentDeclaration>\nvoid main(void) {\nvec4 color=texture2D(diffuseSampler,vUV);\nif (alphaTest) \n{\nif (color.a<0.95)\ndiscard;\n}\ncolor*=vColor;\n#include<fogFragment>\ngl_FragColor=color;\n}"):a.h["sprites.fragment"]="uniform bool alphaTest;\nvarying vec4 vColor;\n\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n\n#include<fogFragmentDeclaration>\nvoid main(void) {\nvec4 color=texture2D(diffuseSampler,vUV);\nif (alphaTest) \n{\nif (color.a<0.95)\ndiscard;\n}\ncolor*=vColor;\n#include<fogFragment>\ngl_FragColor=color;\n}";
null!=t["sprites.vertex"]?a.C("sprites.vertex","\nattribute vec4 position;\nattribute vec4 options;\nattribute vec4 cellInfo;\nattribute vec4 color;\n\nuniform vec2 textureInfos;\nuniform mat4 view;\nuniform mat4 projection;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include<fogVertexDeclaration>\nvoid main(void) { \nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz; \nvec2 cornerPos;\nfloat angle=position.w;\nvec2 size=vec2(options.x,options.y);\nvec2 offset=options.zw;\nvec2 uvScale=textureInfos.xy;\ncornerPos=vec2(offset.x-0.5,offset.y-0.5)*size;\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0); \n\nvColor=color;\n\nvec2 uvOffset=vec2(abs(offset.x-cellInfo.x),1.0-abs(offset.y-cellInfo.y));\nvUV=(uvOffset+cellInfo.zw)*uvScale;\n\n#ifdef FOG\nfFogDistance=viewPos.z;\n#endif\n}"):
a.h["sprites.vertex"]="\nattribute vec4 position;\nattribute vec4 options;\nattribute vec4 cellInfo;\nattribute vec4 color;\n\nuniform vec2 textureInfos;\nuniform mat4 view;\nuniform mat4 projection;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include<fogVertexDeclaration>\nvoid main(void) { \nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz; \nvec2 cornerPos;\nfloat angle=position.w;\nvec2 size=vec2(options.x,options.y);\nvec2 offset=options.zw;\nvec2 uvScale=textureInfos.xy;\ncornerPos=vec2(offset.x-0.5,offset.y-0.5)*size;\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0); \n\nvColor=color;\n\nvec2 uvOffset=vec2(abs(offset.x-cellInfo.x),1.0-abs(offset.y-cellInfo.y));\nvUV=(uvOffset+cellInfo.zw)*uvScale;\n\n#ifdef FOG\nfFogDistance=viewPos.z;\n#endif\n}";
null!=t["ssao.fragment"]?a.C("ssao.fragment","\nuniform sampler2D textureSampler;\nvarying vec2 vUV;\n#ifdef SSAO\nuniform sampler2D randomSampler;\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float radius;\nuniform float area;\nuniform float fallOff;\nuniform float base;\nvec3 normalFromDepth(float depth,vec2 coords)\n{\nvec2 offset1=vec2(0.0,radius);\nvec2 offset2=vec2(radius,0.0);\nfloat depth1=texture2D(textureSampler,coords+offset1).r;\nfloat depth2=texture2D(textureSampler,coords+offset2).r;\nvec3 p1=vec3(offset1,depth1-depth);\nvec3 p2=vec3(offset2,depth2-depth);\nvec3 normal=cross(p1,p2);\nnormal.z=-normal.z;\nreturn normalize(normal);\n}\nvoid main()\n{\nvec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);\nfloat depth=texture2D(textureSampler,vUV).r;\nvec3 position=vec3(vUV,depth);\nvec3 normal=normalFromDepth(depth,vUV);\nfloat radiusDepth=radius/depth;\nfloat occlusion=0.0;\nvec3 ray;\nvec3 hemiRay;\nfloat occlusionDepth;\nfloat difference;\nfor (int i=0; i<SAMPLES; i++)\n{\nray=radiusDepth*reflect(sampleSphere[i],random);\nhemiRay=position+sign(dot(ray,normal))*ray;\nocclusionDepth=texture2D(textureSampler,clamp(hemiRay.xy,vec2(0.001,0.001),vec2(0.999,0.999))).r;\ndifference=depth-occlusionDepth;\nocclusion+=step(fallOff,difference)*(1.0-smoothstep(fallOff,area,difference));\n}\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\nfloat result=clamp(ao+base,0.0,1.0);\ngl_FragColor.r=result;\ngl_FragColor.g=result;\ngl_FragColor.b=result;\ngl_FragColor.a=1.0;\n}\n#endif\n#ifdef BILATERAL_BLUR\nuniform sampler2D depthSampler;\nuniform float outSize;\nuniform float samplerOffsets[SAMPLES];\nvoid main()\n{\nfloat texelsize=1.0/outSize;\nfloat compareDepth=texture2D(depthSampler,vUV).r;\nfloat result=0.0;\nfloat weightSum=0.0;\nfor (int i=0; i<SAMPLES; ++i)\n{\n#ifdef BILATERAL_BLUR_H\nvec2 sampleOffset=vec2(texelsize*samplerOffsets[i],0.0);\n#else\nvec2 sampleOffset=vec2(0.0,texelsize*samplerOffsets[i]);\n#endif\nvec2 samplePos=vUV+sampleOffset;\nfloat sampleDepth=texture2D(depthSampler,samplePos).r;\nfloat weight=(1.0/(0.0001+abs(compareDepth-sampleDepth)));\nresult+=texture2D(textureSampler,samplePos).r*weight;\nweightSum+=weight;\n}\nresult/=weightSum;\ngl_FragColor.rgb=vec3(result);\ngl_FragColor.a=1.0;\n}\n#endif\n"):
a.h["ssao.fragment"]="\nuniform sampler2D textureSampler;\nvarying vec2 vUV;\n#ifdef SSAO\nuniform sampler2D randomSampler;\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float radius;\nuniform float area;\nuniform float fallOff;\nuniform float base;\nvec3 normalFromDepth(float depth,vec2 coords)\n{\nvec2 offset1=vec2(0.0,radius);\nvec2 offset2=vec2(radius,0.0);\nfloat depth1=texture2D(textureSampler,coords+offset1).r;\nfloat depth2=texture2D(textureSampler,coords+offset2).r;\nvec3 p1=vec3(offset1,depth1-depth);\nvec3 p2=vec3(offset2,depth2-depth);\nvec3 normal=cross(p1,p2);\nnormal.z=-normal.z;\nreturn normalize(normal);\n}\nvoid main()\n{\nvec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);\nfloat depth=texture2D(textureSampler,vUV).r;\nvec3 position=vec3(vUV,depth);\nvec3 normal=normalFromDepth(depth,vUV);\nfloat radiusDepth=radius/depth;\nfloat occlusion=0.0;\nvec3 ray;\nvec3 hemiRay;\nfloat occlusionDepth;\nfloat difference;\nfor (int i=0; i<SAMPLES; i++)\n{\nray=radiusDepth*reflect(sampleSphere[i],random);\nhemiRay=position+sign(dot(ray,normal))*ray;\nocclusionDepth=texture2D(textureSampler,clamp(hemiRay.xy,vec2(0.001,0.001),vec2(0.999,0.999))).r;\ndifference=depth-occlusionDepth;\nocclusion+=step(fallOff,difference)*(1.0-smoothstep(fallOff,area,difference));\n}\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\nfloat result=clamp(ao+base,0.0,1.0);\ngl_FragColor.r=result;\ngl_FragColor.g=result;\ngl_FragColor.b=result;\ngl_FragColor.a=1.0;\n}\n#endif\n#ifdef BILATERAL_BLUR\nuniform sampler2D depthSampler;\nuniform float outSize;\nuniform float samplerOffsets[SAMPLES];\nvoid main()\n{\nfloat texelsize=1.0/outSize;\nfloat compareDepth=texture2D(depthSampler,vUV).r;\nfloat result=0.0;\nfloat weightSum=0.0;\nfor (int i=0; i<SAMPLES; ++i)\n{\n#ifdef BILATERAL_BLUR_H\nvec2 sampleOffset=vec2(texelsize*samplerOffsets[i],0.0);\n#else\nvec2 sampleOffset=vec2(0.0,texelsize*samplerOffsets[i]);\n#endif\nvec2 samplePos=vUV+sampleOffset;\nfloat sampleDepth=texture2D(depthSampler,samplePos).r;\nfloat weight=(1.0/(0.0001+abs(compareDepth-sampleDepth)));\nresult+=texture2D(textureSampler,samplePos).r*weight;\nweightSum+=weight;\n}\nresult/=weightSum;\ngl_FragColor.rgb=vec3(result);\ngl_FragColor.a=1.0;\n}\n#endif\n";
null!=t["ssaoCombine.fragment"]?a.C("ssaoCombine.fragment","uniform sampler2D textureSampler;\nuniform sampler2D originalColor;\nvarying vec2 vUV;\nvoid main(void) {\nvec4 ssaoColor=texture2D(textureSampler,vUV);\nvec4 sceneColor=texture2D(originalColor,vUV);\ngl_FragColor=sceneColor*ssaoColor;\n}\n"):a.h["ssaoCombine.fragment"]="uniform sampler2D textureSampler;\nuniform sampler2D originalColor;\nvarying vec2 vUV;\nvoid main(void) {\nvec4 ssaoColor=texture2D(textureSampler,vUV);\nvec4 sceneColor=texture2D(originalColor,vUV);\ngl_FragColor=sceneColor*ssaoColor;\n}\n";
null!=t["standard.fragment"]?a.C("standard.fragment","uniform sampler2D textureSampler;\nvarying vec2 vUV;\n#if defined(PASS_POST_PROCESS)\nvoid main(void)\n{\nvec4 color=texture2D(textureSampler,vUV);\ngl_FragColor=color;\n}\n#endif\n#if defined(DOWN_SAMPLE_X4)\nuniform vec2 dsOffsets[16];\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+dsOffsets[0]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[1]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[2]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[3]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[4]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[5]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[6]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[7]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[8]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[9]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[10]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[11]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[12]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[13]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[14]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[15]);\naverage/=16.0;\ngl_FragColor=average;\n}\n#endif\n#if defined(BRIGHT_PASS)\nuniform vec2 dsOffsets[4];\nuniform float brightThreshold;\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+vec2(dsOffsets[0].x,dsOffsets[0].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[1].x,dsOffsets[1].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[2].x,dsOffsets[2].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[3].x,dsOffsets[3].y));\naverage*=0.25;\nfloat luminance=length(average.rgb);\nif (luminance<brightThreshold) {\naverage=vec4(0.0,0.0,0.0,1.0);\n}\ngl_FragColor=average;\n}\n#endif\n#if defined(GAUSSIAN_BLUR_H) || defined(GAUSSIAN_BLUR_V)\nuniform float blurOffsets[9];\nuniform float blurWeights[9];\nuniform float blurWidth;\nvoid main(void)\n{\nvec4 color=vec4(0.0,0.0,0.0,0.0);\nfor (int i=0; i<9; i++) {\n#ifdef GAUSSIAN_BLUR_H\ncolor+=(texture2D(textureSampler,vUV+vec2(blurOffsets[i]*blurWidth,0.0))*blurWeights[i]);\ncolor+=(texture2D(textureSampler,vUV-vec2(blurOffsets[i]*blurWidth,0.0))*blurWeights[i]);\n#else\ncolor+=(texture2D(textureSampler,vUV+vec2(0.0,blurOffsets[i]*blurWidth))*blurWeights[i]);\ncolor+=(texture2D(textureSampler,vUV-vec2(0.0,blurOffsets[i]*blurWidth))*blurWeights[i]);\n#endif\n}\ncolor.a=1.0;\ngl_FragColor=color;\n}\n#endif\n#if defined(TEXTURE_ADDER)\nuniform sampler2D otherSampler;\nuniform sampler2D lensSampler;\nuniform float exposure;\nvoid main(void)\n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\ncolour*=exposure;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\ncolour+=colour*texture2D(lensSampler,vUV).rgb;\nvec4 finalColor=vec4(colour.rgb,1.0)+texture2D(otherSampler,vUV);\ngl_FragColor=finalColor;\n}\n#endif\n#if defined(LENS_FLARE)\n#define GHOSTS 3\nuniform sampler2D lensColorSampler;\nuniform float strength;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform vec2 resolution;\nuniform float distortionStrength;\nfloat hash(vec2 p)\n{\nfloat h=dot(p,vec2(127.1,311.7));\nreturn -1.0+2.0*fract(sin(h)*43758.5453123);\n}\nfloat noise(in vec2 p)\n{\nvec2 i=floor(p);\nvec2 f=fract(p);\nvec2 u=f*f*(3.0-2.0*f);\nreturn mix(mix(hash(i+vec2(0.0,0.0)),\nhash(i+vec2(1.0,0.0)),u.x),\nmix(hash(i+vec2(0.0,1.0)),\nhash(i+vec2(1.0,1.0)),u.x),u.y);\n}\nfloat fbm(vec2 p)\n{\nfloat f=0.0;\nf+=0.5000*noise(p); p*=2.02;\nf+=0.2500*noise(p); p*=2.03;\nf+=0.1250*noise(p); p*=2.01;\nf+=0.0625*noise(p); p*=2.04;\nf/=0.9375;\nreturn f;\n}\nvec3 pattern(vec2 uv)\n{\nvec2 p=-1.0+2.0*uv;\nfloat p2=dot(p,p);\nfloat f=fbm(vec2(15.0*p2))/2.0;\nfloat r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));\nfloat g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));\nfloat b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));\nreturn (1.0-f)*vec3(r,g,b);\n}\nfloat luminance(vec3 color)\n{\nreturn dot(color.rgb,vec3(0.2126,0.7152,0.0722));\n}\nvec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)\n{\nreturn vec4(\ntexture2D(tex,texcoord+direction*distortion.r).r,\ntexture2D(tex,texcoord+direction*distortion.g).g,\ntexture2D(tex,texcoord+direction*distortion.b).b,\n1.0\n);\n}\nvoid main(void)\n{\nvec2 uv=-vUV+vec2(1.0);\nvec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;\nvec2 texelSize=1.0/resolution;\nvec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);\nvec4 result=vec4(0.0);\nfloat ghostIndice=1.0;\nfor (int i=0; i<GHOSTS; ++i)\n{\nvec2 offset=fract(uv+ghostDir*ghostIndice);\nfloat weight=length(vec2(0.5)-offset)/length(vec2(0.5));\nweight=pow(1.0-weight,10.0);\nresult+=textureDistorted(textureSampler,offset,normalize(ghostDir),distortion)*weight*strength;\nghostIndice+=1.0;\n}\nvec2 haloVec=normalize(ghostDir)*haloWidth;\nfloat weight=length(vec2(0.5)-fract(uv+haloVec))/length(vec2(0.5));\nweight=pow(1.0-weight,10.0);\nresult+=textureDistorted(textureSampler,fract(uv+haloVec),normalize(ghostDir),distortion)*weight*strength;\nresult*=texture2D(lensColorSampler,vec2(length(vec2(0.5)-uv)/length(vec2(0.5))));\ngl_FragColor=result;\n}\n#endif\n#if defined(LENS_FLARE_COMPOSE)\nuniform sampler2D otherSampler;\nuniform sampler2D lensDirtSampler;\nuniform sampler2D lensStarSampler;\nuniform mat4 lensStarMatrix;\nvoid main(void)\n{\nvec2 lensFlareCoords=(lensStarMatrix*vec4(vUV,1.0,1.0)).xy;\nvec4 lensMod=texture2D(lensDirtSampler,vUV);\nlensMod+=texture2D(lensStarSampler,vUV);\nvec4 result=texture2D(textureSampler,vUV)*lensMod;\ngl_FragColor=texture2D(otherSampler,vUV)+result;\n}\n#endif\n#if defined(DEPTH_OF_FIELD)\nuniform sampler2D otherSampler;\nuniform sampler2D depthSampler;\nuniform float distance;\nvoid main(void)\n{\nvec4 sharp=texture2D(otherSampler,vUV);\nvec4 blur=texture2D(textureSampler,vUV);\nfloat dist=clamp(texture2D(depthSampler,vUV).r*distance,0.0,1.0);\nfloat factor=0.0;\nif (dist<0.05)\nfactor=1.0;\nelse if (dist<0.1)\nfactor=20.0*(0.1-dist);\nelse if (dist<0.5)\nfactor=0.0;\nelse\nfactor=2.0*(dist-0.5);\nfactor=clamp(factor,0.0,0.90);\ngl_FragColor=mix(sharp,blur,factor);\n}\n#endif\n"):
a.h["standard.fragment"]="uniform sampler2D textureSampler;\nvarying vec2 vUV;\n#if defined(PASS_POST_PROCESS)\nvoid main(void)\n{\nvec4 color=texture2D(textureSampler,vUV);\ngl_FragColor=color;\n}\n#endif\n#if defined(DOWN_SAMPLE_X4)\nuniform vec2 dsOffsets[16];\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+dsOffsets[0]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[1]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[2]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[3]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[4]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[5]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[6]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[7]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[8]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[9]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[10]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[11]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[12]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[13]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[14]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[15]);\naverage/=16.0;\ngl_FragColor=average;\n}\n#endif\n#if defined(BRIGHT_PASS)\nuniform vec2 dsOffsets[4];\nuniform float brightThreshold;\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+vec2(dsOffsets[0].x,dsOffsets[0].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[1].x,dsOffsets[1].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[2].x,dsOffsets[2].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[3].x,dsOffsets[3].y));\naverage*=0.25;\nfloat luminance=length(average.rgb);\nif (luminance<brightThreshold) {\naverage=vec4(0.0,0.0,0.0,1.0);\n}\ngl_FragColor=average;\n}\n#endif\n#if defined(GAUSSIAN_BLUR_H) || defined(GAUSSIAN_BLUR_V)\nuniform float blurOffsets[9];\nuniform float blurWeights[9];\nuniform float blurWidth;\nvoid main(void)\n{\nvec4 color=vec4(0.0,0.0,0.0,0.0);\nfor (int i=0; i<9; i++) {\n#ifdef GAUSSIAN_BLUR_H\ncolor+=(texture2D(textureSampler,vUV+vec2(blurOffsets[i]*blurWidth,0.0))*blurWeights[i]);\ncolor+=(texture2D(textureSampler,vUV-vec2(blurOffsets[i]*blurWidth,0.0))*blurWeights[i]);\n#else\ncolor+=(texture2D(textureSampler,vUV+vec2(0.0,blurOffsets[i]*blurWidth))*blurWeights[i]);\ncolor+=(texture2D(textureSampler,vUV-vec2(0.0,blurOffsets[i]*blurWidth))*blurWeights[i]);\n#endif\n}\ncolor.a=1.0;\ngl_FragColor=color;\n}\n#endif\n#if defined(TEXTURE_ADDER)\nuniform sampler2D otherSampler;\nuniform sampler2D lensSampler;\nuniform float exposure;\nvoid main(void)\n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\ncolour*=exposure;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\ncolour+=colour*texture2D(lensSampler,vUV).rgb;\nvec4 finalColor=vec4(colour.rgb,1.0)+texture2D(otherSampler,vUV);\ngl_FragColor=finalColor;\n}\n#endif\n#if defined(LENS_FLARE)\n#define GHOSTS 3\nuniform sampler2D lensColorSampler;\nuniform float strength;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform vec2 resolution;\nuniform float distortionStrength;\nfloat hash(vec2 p)\n{\nfloat h=dot(p,vec2(127.1,311.7));\nreturn -1.0+2.0*fract(sin(h)*43758.5453123);\n}\nfloat noise(in vec2 p)\n{\nvec2 i=floor(p);\nvec2 f=fract(p);\nvec2 u=f*f*(3.0-2.0*f);\nreturn mix(mix(hash(i+vec2(0.0,0.0)),\nhash(i+vec2(1.0,0.0)),u.x),\nmix(hash(i+vec2(0.0,1.0)),\nhash(i+vec2(1.0,1.0)),u.x),u.y);\n}\nfloat fbm(vec2 p)\n{\nfloat f=0.0;\nf+=0.5000*noise(p); p*=2.02;\nf+=0.2500*noise(p); p*=2.03;\nf+=0.1250*noise(p); p*=2.01;\nf+=0.0625*noise(p); p*=2.04;\nf/=0.9375;\nreturn f;\n}\nvec3 pattern(vec2 uv)\n{\nvec2 p=-1.0+2.0*uv;\nfloat p2=dot(p,p);\nfloat f=fbm(vec2(15.0*p2))/2.0;\nfloat r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));\nfloat g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));\nfloat b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));\nreturn (1.0-f)*vec3(r,g,b);\n}\nfloat luminance(vec3 color)\n{\nreturn dot(color.rgb,vec3(0.2126,0.7152,0.0722));\n}\nvec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)\n{\nreturn vec4(\ntexture2D(tex,texcoord+direction*distortion.r).r,\ntexture2D(tex,texcoord+direction*distortion.g).g,\ntexture2D(tex,texcoord+direction*distortion.b).b,\n1.0\n);\n}\nvoid main(void)\n{\nvec2 uv=-vUV+vec2(1.0);\nvec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;\nvec2 texelSize=1.0/resolution;\nvec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);\nvec4 result=vec4(0.0);\nfloat ghostIndice=1.0;\nfor (int i=0; i<GHOSTS; ++i)\n{\nvec2 offset=fract(uv+ghostDir*ghostIndice);\nfloat weight=length(vec2(0.5)-offset)/length(vec2(0.5));\nweight=pow(1.0-weight,10.0);\nresult+=textureDistorted(textureSampler,offset,normalize(ghostDir),distortion)*weight*strength;\nghostIndice+=1.0;\n}\nvec2 haloVec=normalize(ghostDir)*haloWidth;\nfloat weight=length(vec2(0.5)-fract(uv+haloVec))/length(vec2(0.5));\nweight=pow(1.0-weight,10.0);\nresult+=textureDistorted(textureSampler,fract(uv+haloVec),normalize(ghostDir),distortion)*weight*strength;\nresult*=texture2D(lensColorSampler,vec2(length(vec2(0.5)-uv)/length(vec2(0.5))));\ngl_FragColor=result;\n}\n#endif\n#if defined(LENS_FLARE_COMPOSE)\nuniform sampler2D otherSampler;\nuniform sampler2D lensDirtSampler;\nuniform sampler2D lensStarSampler;\nuniform mat4 lensStarMatrix;\nvoid main(void)\n{\nvec2 lensFlareCoords=(lensStarMatrix*vec4(vUV,1.0,1.0)).xy;\nvec4 lensMod=texture2D(lensDirtSampler,vUV);\nlensMod+=texture2D(lensStarSampler,vUV);\nvec4 result=texture2D(textureSampler,vUV)*lensMod;\ngl_FragColor=texture2D(otherSampler,vUV)+result;\n}\n#endif\n#if defined(DEPTH_OF_FIELD)\nuniform sampler2D otherSampler;\nuniform sampler2D depthSampler;\nuniform float distance;\nvoid main(void)\n{\nvec4 sharp=texture2D(otherSampler,vUV);\nvec4 blur=texture2D(textureSampler,vUV);\nfloat dist=clamp(texture2D(depthSampler,vUV).r*distance,0.0,1.0);\nfloat factor=0.0;\nif (dist<0.05)\nfactor=1.0;\nelse if (dist<0.1)\nfactor=20.0*(0.1-dist);\nelse if (dist<0.5)\nfactor=0.0;\nelse\nfactor=2.0*(dist-0.5);\nfactor=clamp(factor,0.0,0.90);\ngl_FragColor=mix(sharp,blur,factor);\n}\n#endif\n";
null!=t["stereoscopicInterlace.fragment"]?a.C("stereoscopicInterlace.fragment","const vec3 TWO=vec3(2.0,2.0,2.0);\nvarying vec2 vUV;\nuniform sampler2D camASampler;\nuniform sampler2D textureSampler;\nuniform vec2 stepSize;\nvoid main(void)\n{\nbool useCamB;\nvec2 texCoord1;\nvec2 texCoord2;\nvec3 frag1;\nvec3 frag2;\n#ifdef IS_STEREOSCOPIC_HORIZ\nuseCamB=vUV.x>0.5;\ntexCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);\ntexCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);\n#else\nuseCamB=vUV.y>0.5;\ntexCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);\ntexCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);\n#endif\n\nif (useCamB){\nfrag1=texture2D(textureSampler,texCoord1).rgb;\nfrag2=texture2D(textureSampler,texCoord2).rgb;\n}else{\nfrag1=texture2D(camASampler ,texCoord1).rgb;\nfrag2=texture2D(camASampler ,texCoord2).rgb;\n}\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);\n}"):
a.h["stereoscopicInterlace.fragment"]="const vec3 TWO=vec3(2.0,2.0,2.0);\nvarying vec2 vUV;\nuniform sampler2D camASampler;\nuniform sampler2D textureSampler;\nuniform vec2 stepSize;\nvoid main(void)\n{\nbool useCamB;\nvec2 texCoord1;\nvec2 texCoord2;\nvec3 frag1;\nvec3 frag2;\n#ifdef IS_STEREOSCOPIC_HORIZ\nuseCamB=vUV.x>0.5;\ntexCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);\ntexCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);\n#else\nuseCamB=vUV.y>0.5;\ntexCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);\ntexCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);\n#endif\n\nif (useCamB){\nfrag1=texture2D(textureSampler,texCoord1).rgb;\nfrag2=texture2D(textureSampler,texCoord2).rgb;\n}else{\nfrag1=texture2D(camASampler ,texCoord1).rgb;\nfrag2=texture2D(camASampler ,texCoord2).rgb;\n}\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);\n}";
null!=t["tonemap.fragment"]?a.C("tonemap.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform float _ExposureAdjustment;\n#if defined(HABLE_TONEMAPPING)\nconst float A=0.15;\nconst float B=0.50;\nconst float C=0.10;\nconst float D=0.20;\nconst float E=0.02;\nconst float F=0.30;\nconst float W=11.2;\n#endif\nfloat Luminance(vec3 c)\n{\nreturn dot(c,vec3(0.22,0.707,0.071));\n}\nvoid main(void) \n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\n#if defined(REINHARD_TONEMAPPING)\nfloat lum=Luminance(colour.rgb); \nfloat lumTm=lum*_ExposureAdjustment;\nfloat scale=lumTm/(1.0+lumTm); \ncolour*=scale/lum;\n#elif defined(HABLE_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nconst float ExposureBias=2.0;\nvec3 x=ExposureBias*colour;\nvec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\nx=vec3(W,W,W);\nvec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);\ncolour=curr*whiteScale;\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\ncolour=vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);\n#endif\ngl_FragColor=vec4(colour.rgb,1.0);\n}"):
a.h["tonemap.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform float _ExposureAdjustment;\n#if defined(HABLE_TONEMAPPING)\nconst float A=0.15;\nconst float B=0.50;\nconst float C=0.10;\nconst float D=0.20;\nconst float E=0.02;\nconst float F=0.30;\nconst float W=11.2;\n#endif\nfloat Luminance(vec3 c)\n{\nreturn dot(c,vec3(0.22,0.707,0.071));\n}\nvoid main(void) \n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\n#if defined(REINHARD_TONEMAPPING)\nfloat lum=Luminance(colour.rgb); \nfloat lumTm=lum*_ExposureAdjustment;\nfloat scale=lumTm/(1.0+lumTm); \ncolour*=scale/lum;\n#elif defined(HABLE_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nconst float ExposureBias=2.0;\nvec3 x=ExposureBias*colour;\nvec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\nx=vec3(W,W,W);\nvec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);\ncolour=curr*whiteScale;\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\ncolour=vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);\n#endif\ngl_FragColor=vec4(colour.rgb,1.0);\n}";
null!=t["volumetricLightScattering.fragment"]?a.C("volumetricLightScattering.fragment","uniform sampler2D textureSampler;\nuniform sampler2D lightScatteringSampler;\nuniform float decay;\nuniform float exposure;\nuniform float weight;\nuniform float density;\nuniform vec2 meshPositionOnScreen;\nvarying vec2 vUV;\nvoid main(void) {\nvec2 tc=vUV;\nvec2 deltaTexCoord=(tc-meshPositionOnScreen.xy);\ndeltaTexCoord*=1.0/float(NUM_SAMPLES)*density;\nfloat illuminationDecay=1.0;\nvec4 color=texture2D(lightScatteringSampler,tc)*0.4;\nfor(int i=0; i<NUM_SAMPLES; i++) {\ntc-=deltaTexCoord;\nvec4 sample=texture2D(lightScatteringSampler,tc)*0.4;\nsample*=illuminationDecay*weight;\ncolor+=sample;\nilluminationDecay*=decay;\n}\nvec4 realColor=texture2D(textureSampler,vUV);\ngl_FragColor=((vec4((vec3(color.r,color.g,color.b)*exposure),1))+(realColor*(1.5-0.4)));\n}\n"):
a.h["volumetricLightScattering.fragment"]="uniform sampler2D textureSampler;\nuniform sampler2D lightScatteringSampler;\nuniform float decay;\nuniform float exposure;\nuniform float weight;\nuniform float density;\nuniform vec2 meshPositionOnScreen;\nvarying vec2 vUV;\nvoid main(void) {\nvec2 tc=vUV;\nvec2 deltaTexCoord=(tc-meshPositionOnScreen.xy);\ndeltaTexCoord*=1.0/float(NUM_SAMPLES)*density;\nfloat illuminationDecay=1.0;\nvec4 color=texture2D(lightScatteringSampler,tc)*0.4;\nfor(int i=0; i<NUM_SAMPLES; i++) {\ntc-=deltaTexCoord;\nvec4 sample=texture2D(lightScatteringSampler,tc)*0.4;\nsample*=illuminationDecay*weight;\ncolor+=sample;\nilluminationDecay*=decay;\n}\nvec4 realColor=texture2D(textureSampler,vUV);\ngl_FragColor=((vec4((vec3(color.r,color.g,color.b)*exposure),1))+(realColor*(1.5-0.4)));\n}\n";
null!=t["volumetricLightScatteringPass.fragment"]?a.C("volumetricLightScatteringPass.fragment","#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\n#endif\n#if defined(ALPHATEST)\nuniform sampler2D diffuseSampler;\n#endif\nvoid main(void)\n{\n#if defined(ALPHATEST)\nvec4 diffuseColor=texture2D(diffuseSampler,vUV);\nif (diffuseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\n}\n"):a.h["volumetricLightScatteringPass.fragment"]="#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\n#endif\n#if defined(ALPHATEST)\nuniform sampler2D diffuseSampler;\n#endif\nvoid main(void)\n{\n#if defined(ALPHATEST)\nvec4 diffuseColor=texture2D(diffuseSampler,vUV);\nif (diffuseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\n}\n";
null!=t["vrDistortionCorrection.fragment"]?a.C("vrDistortionCorrection.fragment","\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 LensCenter;\nuniform vec2 Scale;\nuniform vec2 ScaleIn;\nuniform vec4 HmdWarpParam;\nvec2 HmdWarp(vec2 in01) {\nvec2 theta=(in01-LensCenter)*ScaleIn; \nfloat rSq=theta.x*theta.x+theta.y*theta.y;\nvec2 rvector=theta*(HmdWarpParam.x+HmdWarpParam.y*rSq+HmdWarpParam.z*rSq*rSq+HmdWarpParam.w*rSq*rSq*rSq);\nreturn LensCenter+Scale*rvector;\n}\nvoid main(void)\n{\nvec2 tc=HmdWarp(vUV);\nif (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0)\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\nelse{\ngl_FragColor=vec4(texture2D(textureSampler,tc).rgb,1.0);\n}\n}"):
a.h["vrDistortionCorrection.fragment"]="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 LensCenter;\nuniform vec2 Scale;\nuniform vec2 ScaleIn;\nuniform vec4 HmdWarpParam;\nvec2 HmdWarp(vec2 in01) {\nvec2 theta=(in01-LensCenter)*ScaleIn; \nfloat rSq=theta.x*theta.x+theta.y*theta.y;\nvec2 rvector=theta*(HmdWarpParam.x+HmdWarpParam.y*rSq+HmdWarpParam.z*rSq*rSq+HmdWarpParam.w*rSq*rSq*rSq);\nreturn LensCenter+Scale*rvector;\n}\nvoid main(void)\n{\nvec2 tc=HmdWarp(vUV);\nif (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0)\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\nelse{\ngl_FragColor=vec4(texture2D(textureSampler,tc).rgb,1.0);\n}\n}";
null!=t["compose.fragment"]?a.C("compose.fragment","varying vec2 vUV; \n uniform sampler2D textureSampler; \n uniform sampler2D sceneSampler; \n uniform vec2 screenSize; \n uniform float sceneIntensity; \n uniform float glowIntensity; \n uniform float highlightIntensity; \n void main(void) \n { \n \tvec4 orig = texture2D(sceneSampler, vUV); \n vec4 blur = texture2D(textureSampler, vUV); \n vec4 final = sceneIntensity * orig + glowIntensity * blur + highlightIntensity * blur.a; \n final.a = 1.0; \n gl_FragColor = final; \n }"):
a.h["compose.fragment"]="varying vec2 vUV; \n uniform sampler2D textureSampler; \n uniform sampler2D sceneSampler; \n uniform vec2 screenSize; \n uniform float sceneIntensity; \n uniform float glowIntensity; \n uniform float highlightIntensity; \n void main(void) \n { \n \tvec4 orig = texture2D(sceneSampler, vUV); \n vec4 blur = texture2D(textureSampler, vUV); \n vec4 final = sceneIntensity * orig + glowIntensity * blur + highlightIntensity * blur.a; \n final.a = 1.0; \n gl_FragColor = final; \n }";
null!=t["downsample.fragment"]?a.C("downsample.fragment","varying vec2 vUV; \n uniform sampler2D textureSampler; \n uniform vec2 screenSize; \n uniform float highlightThreshold; \n float highlights(vec3 color) { return smoothstep(highlightThreshold, 1.0, dot(color, vec3(0.3, 0.59, 0.11))); } \n void main(void) \n { \n vec2 texelSize = vec2(1.0 / screenSize.x, 1.0 / screenSize.y); \n vec4 baseColor = texture2D(textureSampler, vUV + vec2(-1.0, -1.0) * texelSize) * 0.25; \n baseColor += texture2D(textureSampler, vUV + vec2(1.0, -1.0) * texelSize) * 0.25; \n baseColor += texture2D(textureSampler, vUV + vec2(1.0, 1.0) * texelSize) * 0.25; \n baseColor += texture2D(textureSampler, vUV + vec2(-1.0, 1.0) * texelSize) * 0.25; \n baseColor.a = highlights(baseColor.rgb); \n gl_FragColor = baseColor; \n }"):
a.h["downsample.fragment"]="varying vec2 vUV; \n uniform sampler2D textureSampler; \n uniform vec2 screenSize; \n uniform float highlightThreshold; \n float highlights(vec3 color) { return smoothstep(highlightThreshold, 1.0, dot(color, vec3(0.3, 0.59, 0.11))); } \n void main(void) \n { \n vec2 texelSize = vec2(1.0 / screenSize.x, 1.0 / screenSize.y); \n vec4 baseColor = texture2D(textureSampler, vUV + vec2(-1.0, -1.0) * texelSize) * 0.25; \n baseColor += texture2D(textureSampler, vUV + vec2(1.0, -1.0) * texelSize) * 0.25; \n baseColor += texture2D(textureSampler, vUV + vec2(1.0, 1.0) * texelSize) * 0.25; \n baseColor += texture2D(textureSampler, vUV + vec2(-1.0, 1.0) * texelSize) * 0.25; \n baseColor.a = highlights(baseColor.rgb); \n gl_FragColor = baseColor; \n }";
return a}(this);Bc.DI=new jc("\\S+","");gb.X=new n(1,0,0);gb.Y=new n(0,1,0);gb.Z=new n(0,0,1);ba.Bl=[new L(0,0,0),new L(0,0,0),new L(0,0,0)];ba.Ec=[new n(0,0,0),new n(0,0,0),new n(0,0,0),new n(0,0,0),new n(0,0,0),new n(0,0,0),new n(0,0,0),new n(0,0,0),new n(0,0,0)];ba.Ra=function(){var a=new r;a.a[0]=0;a.a[1]=0;a.a[2]=0;a.a[3]=0;a.a[4]=0;a.a[5]=0;a.a[6]=0;a.a[7]=0;a.a[8]=0;a.a[9]=0;a.a[10]=0;a.a[11]=0;a.a[12]=0;a.a[13]=0;a.a[14]=0;a.a[15]=0;var b=new r;b.a[0]=0;b.a[1]=0;b.a[2]=0;b.a[3]=0;b.a[4]=0;
b.a[5]=0;b.a[6]=0;b.a[7]=0;b.a[8]=0;b.a[9]=0;b.a[10]=0;b.a[11]=0;b.a[12]=0;b.a[13]=0;b.a[14]=0;b.a[15]=0;var c=new r;c.a[0]=0;c.a[1]=0;c.a[2]=0;c.a[3]=0;c.a[4]=0;c.a[5]=0;c.a[6]=0;c.a[7]=0;c.a[8]=0;c.a[9]=0;c.a[10]=0;c.a[11]=0;c.a[12]=0;c.a[13]=0;c.a[14]=0;c.a[15]=0;var d=new r;d.a[0]=0;d.a[1]=0;d.a[2]=0;d.a[3]=0;d.a[4]=0;d.a[5]=0;d.a[6]=0;d.a[7]=0;d.a[8]=0;d.a[9]=0;d.a[10]=0;d.a[11]=0;d.a[12]=0;d.a[13]=0;d.a[14]=0;d.a[15]=0;var e=new r;e.a[0]=0;e.a[1]=0;e.a[2]=0;e.a[3]=0;e.a[4]=0;e.a[5]=0;e.a[6]=
0;e.a[7]=0;e.a[8]=0;e.a[9]=0;e.a[10]=0;e.a[11]=0;e.a[12]=0;e.a[13]=0;e.a[14]=0;e.a[15]=0;var f=new r;f.a[0]=0;f.a[1]=0;f.a[2]=0;f.a[3]=0;f.a[4]=0;f.a[5]=0;f.a[6]=0;f.a[7]=0;f.a[8]=0;f.a[9]=0;f.a[10]=0;f.a[11]=0;f.a[12]=0;f.a[13]=0;f.a[14]=0;f.a[15]=0;var g=new r;g.a[0]=0;g.a[1]=0;g.a[2]=0;g.a[3]=0;g.a[4]=0;g.a[5]=0;g.a[6]=0;g.a[7]=0;g.a[8]=0;g.a[9]=0;g.a[10]=0;g.a[11]=0;g.a[12]=0;g.a[13]=0;g.a[14]=0;g.a[15]=0;var h=new r;h.a[0]=0;h.a[1]=0;h.a[2]=0;h.a[3]=0;h.a[4]=0;h.a[5]=0;h.a[6]=0;h.a[7]=0;h.a[8]=
0;h.a[9]=0;h.a[10]=0;h.a[11]=0;h.a[12]=0;h.a[13]=0;h.a[14]=0;h.a[15]=0;return[a,b,c,d,e,f,g,h]}(this);A.kE=new n(0,0,1);A.Zw=new n(0,0,0);A.UD=new r;A.WD=new r;A.Ho=[];A.Ni=[];A.Gi=[];A.Qw=new r;A.Fz=new r;A.mc=new I;Wb.OD=0;zb.ue=1E-5;Ga.$a=0;Ca.Vw=[null,null,null,null,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0","Enter","Escape","Backspace","Tab","Space","-","=","[","]","\\","#",";","'","`",",",".",
"/","CapsLock","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","PrintScreen","ScrollLock","Pause","Insert","Home","PageUp","Delete","End","PageDown","Right","Left","Down","Up","Numlock","Keypad /","Keypad *","Keypad -","Keypad +","Keypad Enter","Keypad 1","Keypad 2","Keypad 3","Keypad 4","Keypad 5","Keypad 6","Keypad 7","Keypad 8","Keypad 9","Keypad 0","Keypad .",null,"Application","Power","Keypad =","F13","F14","F15","F16","F17","F18","F19","F20","F21","F22","F23","F24","Execute",
"Help","Menu","Select","Stop","Again","Undo","Cut","Copy","Paste","Find","Mute","VolumeUp","VolumeDown",null,null,null,"Keypad ,","Keypad = (AS400)",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"AltErase","SysReq","Cancel","Clear","Prior","Enter","Separator","Out","Oper","Clear / Again","CrSel","ExSel",null,null,null,null,null,null,null,null,null,null,null,"Keypad 00","Keypad 000","ThousandsSeparator","DecimalSeparator","CurrencyUnit","CurrencySubUnit",
"Keypad (","Keypad )","Keypad {","Keypad }","Keypad Tab","Keypad Backspace","Keypad A","Keypad B","Keypad C","Keypad D","Keypad E","Keypad F","Keypad XOR","Keypad ^","Keypad %","Keypad <","Keypad >","Keypad &","Keypad &&","Keypad |","Keypad ||","Keypad :","Keypad #","Keypad Space","Keypad @","Keypad !","Keypad MemStore","Keypad MemRecall","Keypad MemClear","Keypad MemAdd","Keypad MemSubtract","Keypad MemMultiply","Keypad MemDivide","Keypad +/-","Keypad Clear","Keypad ClearEntry","Keypad Binary","Keypad Octal",
"Keypad Decimal","Keypad Hexadecimal",null,null,"Left Ctrl","Left Shift","Left Alt","Left Meta","Right Ctrl","Right Shift","Right Alt","Right Meta",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"ModeSwitch","AudioNext","AudioPrev","AudioStop","AudioPlay","AudioMute","MediaSelect","WWW","Mail","Calculator","Computer","AC Search","AC Home","AC Back","AC Forward","AC Stop","AC Refresh","AC Bookmarks","BrightnessDown","BrightnessUp",
"DisplaySwitch","KBDIllumToggle","KBDIllumDown","KBDIllumUp","Eject","Sleep"];Ob.count=0;nc.BYTES_PER_ELEMENT=4;Nb.BYTES_PER_ELEMENT=1;ha.Za="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";Pc.Ib()})("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this);
