@uptimizr/dashboard 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404.html +1 -1
- package/out/__next.__PAGE__.txt +4 -4
- package/out/__next._full.txt +11 -11
- package/out/__next._head.txt +4 -4
- package/out/__next._index.txt +4 -4
- package/out/__next._tree.txt +2 -2
- package/out/_next/static/chunks/002cjeoit6-up.js +1 -0
- package/out/_next/static/chunks/02n1uiltexy3w.js +1 -0
- package/out/_next/static/chunks/03ab2khhe8-x5.js +1 -0
- package/out/_next/static/chunks/04_yytpc2paxy.js +1 -0
- package/out/_next/static/chunks/06qot1qvlsqaz.js +1 -0
- package/out/_next/static/chunks/07eeopuufsqp-.js +1501 -0
- package/out/_next/static/chunks/08a5xek662n8n.js +1 -0
- package/out/_next/static/chunks/08wuc9--s8zn_.js +1 -0
- package/out/_next/static/chunks/0927l-ygd5c8d.js +1 -0
- package/out/_next/static/chunks/09510356f0lad.js +1 -0
- package/out/_next/static/chunks/0_eu72k69lxj7.js +1 -0
- package/out/_next/static/chunks/0beajlqy8p8b5.js +1 -0
- package/out/_next/static/chunks/0c83pe1mpx456.js +1 -0
- package/out/_next/static/chunks/0echnagbkyx79.js +1198 -0
- package/out/_next/static/chunks/0eh1ml86u8dh7.js +1 -0
- package/out/_next/static/chunks/0fh-9h9ylxskr.js +674 -0
- package/out/_next/static/chunks/0fzmc1up21g1i.js +1 -0
- package/out/_next/static/chunks/0g_v2zswo4l6f.js +1 -0
- package/out/_next/static/chunks/0grlb9lo8e502.js +1 -0
- package/out/_next/static/chunks/0h22pg-0xrxnm.js +1 -0
- package/out/_next/static/chunks/0j6p1pmc14t96.js +1 -0
- package/out/_next/static/chunks/0j_6dx-sttgsy.js +1 -0
- package/out/_next/static/chunks/0j__xaq_8_di1.js +1 -0
- package/out/_next/static/chunks/0kfd-cvj5fvtz.js +1 -0
- package/out/_next/static/chunks/0o_mp98xzqfyf.js +1 -0
- package/out/_next/static/chunks/0otsec99kdkt7.js +213 -0
- package/out/_next/static/chunks/0ql-s-tsmel_u.js +151 -0
- package/out/_next/static/chunks/0r47gs_e93cka.js +1 -0
- package/out/_next/static/chunks/0sqys6o2pbe1q.js +1328 -0
- package/out/_next/static/chunks/0titqrn1qmcsv.js +1 -0
- package/out/_next/static/chunks/0tnlbw78tgaxp.js +4 -0
- package/out/_next/static/chunks/0tw4dyl-cp-hd.js +1 -0
- package/out/_next/static/chunks/0vbce-8omgurc.js +1 -0
- package/out/_next/static/chunks/0vfsg5byzep_0.js +1 -0
- package/out/_next/static/chunks/{0gv7mblzv3dl3.js → 0w8_1yjvol1f0.js} +20 -20
- package/out/_next/static/chunks/0xh144a5fz58h.js +1 -0
- package/out/_next/static/chunks/0xjltg_pph0c8.js +1 -0
- package/out/_next/static/chunks/0yeqgh0dnas8d.js +1 -0
- package/out/_next/static/chunks/101-7e_7up7rk.js +1 -0
- package/out/_next/static/chunks/128e51hj_04r0.js +1 -0
- package/out/_next/static/chunks/{10fnxpln_5xfd.js → 12kv810lohbsx.js} +2 -2
- package/out/_next/static/chunks/137xbvd4nd41j.js +3 -0
- package/out/_next/static/chunks/14bws-suyy5zu.js +1 -0
- package/out/_next/static/chunks/14ggsmqwej_tt.js +1656 -0
- package/out/_next/static/chunks/17genz6pkmty_.js +1 -0
- package/out/_next/static/chunks/17xd8hnazzr0g.js +1454 -0
- package/out/_next/static/chunks/18dczy9ylt2s_.js +1 -0
- package/out/_next/static/chunks/18xs_kvsaolb0.js +1 -0
- package/out/_next/static/chunks/19016f8-ry0z6.js +1 -0
- package/out/_next/static/chunks/1_6oejyxj39li.js +1 -0
- package/out/_next/static/chunks/1_aon8nz9p1fr.js +1 -0
- package/out/_next/static/chunks/1_qzlkuxukhpq.js +779 -0
- package/out/_next/static/chunks/1akaj5rhgitn3.js +1 -0
- package/out/_next/static/chunks/1bvl1ws7b_3gn.js +1 -0
- package/out/_next/static/chunks/1cdbk6kxyr1c9.js +1 -0
- package/out/_next/static/chunks/1fbjkk55uu4_g.js +1 -0
- package/out/_next/static/chunks/1furcfsgrw_3g.js +1 -0
- package/out/_next/static/chunks/1g0-f1g3gn_rs.js +1 -0
- package/out/_next/static/chunks/1g7emwu85bifo.js +557 -0
- package/out/_next/static/chunks/{37vzwr3ciejf1.js → 1gs-5722l4u59.js} +1 -1
- package/out/_next/static/chunks/1gt4kh0_xmigy.js +1 -0
- package/out/_next/static/chunks/1h8xzuuhhglu9.js +1 -0
- package/out/_next/static/chunks/1hatz-jlztrn0.js +1 -0
- package/out/_next/static/chunks/1iioifo7i0t0_.js +1 -0
- package/out/_next/static/chunks/{0impkpmxx3ttp.js → 1iiz7jqgj20z0.js} +1 -1
- package/out/_next/static/chunks/1kujmd5n0j9nk.js +1 -0
- package/out/_next/static/chunks/{2kazjq29jeamx.js → 1ltux4lwz7muf.js} +160 -372
- package/out/_next/static/chunks/1m_buecgcq67j.js +740 -0
- package/out/_next/static/chunks/1n9sy0yt5d2vq.js +1 -0
- package/out/_next/static/chunks/1p1gz6dseck--.js +1 -0
- package/out/_next/static/chunks/1p1xtsfwvpuqo.js +1 -0
- package/out/_next/static/chunks/1p8f6okk2ewbz.js +1 -0
- package/out/_next/static/chunks/1qg_etglhvp9h.js +740 -0
- package/out/_next/static/chunks/1th_t5ujeqlkf.js +1 -0
- package/out/_next/static/chunks/1thr-mdzbu96v.js +1 -0
- package/out/_next/static/chunks/1tta1a064979p.js +1 -0
- package/out/_next/static/chunks/1u_riwm0nfww7.js +1 -0
- package/out/_next/static/chunks/1ua15kzid0_8p.js +2560 -0
- package/out/_next/static/chunks/1uu-rt_8p1edp.js +2712 -0
- package/out/_next/static/chunks/1uu93wuxigx4k.js +1 -0
- package/out/_next/static/chunks/{1flb8adpj6_2o.js → 1xpwp4m1tqugp.js} +1 -1
- package/out/_next/static/chunks/1ynju1jqfrcv0.js +1 -0
- package/out/_next/static/chunks/1zfojlgb15okk.js +1 -0
- package/out/_next/static/chunks/1zj8x5wbgnzz-.js +1 -0
- package/out/_next/static/chunks/1zl6t15gh34nn.js +1 -0
- package/out/_next/static/chunks/{1thjncpj7u6pq.js → 223vrr_4sfhsj.js} +1 -1
- package/out/_next/static/chunks/22cr2b04btguf.js +1 -0
- package/out/_next/static/chunks/242xhzxxetctz.js +1 -0
- package/out/_next/static/chunks/24essz5mmvx-6.js +1 -0
- package/out/_next/static/chunks/256k1jw1m--l7.js +146 -0
- package/out/_next/static/chunks/259obyrpxcv6r.js +1 -0
- package/out/_next/static/chunks/26v9yqicofqba.js +1 -0
- package/out/_next/static/chunks/290d93hmm_e8b.js +1 -0
- package/out/_next/static/chunks/2_2fk7iddrs43.js +1 -0
- package/out/_next/static/chunks/{00k_j_r7bv_eb.js → 2bjlls8-qe05r.js} +9 -9
- package/out/_next/static/chunks/2ckd7f1wbfod-.js +1 -0
- package/out/_next/static/chunks/{163fa70v4mgxj.js → 2d6hru4qo23tt.js} +1 -1
- package/out/_next/static/chunks/2ejvntxtvf5o9.js +1 -0
- package/out/_next/static/chunks/2f7_3tzf7xhps.js +1 -0
- package/out/_next/static/chunks/2gxd_o1g89_bv.js +1 -0
- package/out/_next/static/chunks/2hd2txb4-m9k1.js +1 -0
- package/out/_next/static/chunks/2hpxou_cnp4f_.js +1 -0
- package/out/_next/static/chunks/2izioctrfc0s5.js +1 -0
- package/out/_next/static/chunks/2jhnk4h4n0udv.js +1 -0
- package/out/_next/static/chunks/2jpkhkk9zi8-f.js +1 -0
- package/out/_next/static/chunks/2kpet_l1kq2sx.js +1 -0
- package/out/_next/static/chunks/2mdbvf1b5h00_.css +3 -0
- package/out/_next/static/chunks/2nck5w4c7leb7.js +1 -0
- package/out/_next/static/chunks/2our10fwtj87e.js +1 -0
- package/out/_next/static/chunks/2qq3uzsbiicw3.js +1194 -0
- package/out/_next/static/chunks/2qqqpu0ahfdda.js +1 -0
- package/out/_next/static/chunks/2u-f7mmxvk8wj.js +1 -0
- package/out/_next/static/chunks/2ue1wo4ryk87z.js +1 -0
- package/out/_next/static/chunks/2uk-vwlxe9-xr.js +1 -0
- package/out/_next/static/chunks/2ur5-lxdvv1jm.js +1 -0
- package/out/_next/static/chunks/2veqsohwfhfqc.js +1 -0
- package/out/_next/static/chunks/2vqlv9wnewhu9.js +1 -0
- package/out/_next/static/chunks/{1zvc1tv--w8nn.js → 2wzshintp5lf8.js} +1 -1
- package/out/_next/static/chunks/2x-00glogc485.js +1 -0
- package/out/_next/static/chunks/2yfxy0f5fqs4o.js +1 -0
- package/out/_next/static/chunks/2z88mt3ixktu3.js +1 -0
- package/out/_next/static/chunks/2z_jn9ud28fk7.js +1 -0
- package/out/_next/static/chunks/3-eswqjobiqk1.js +1 -0
- package/out/_next/static/chunks/30-tbi7pys6fp.js +4 -0
- package/out/_next/static/chunks/30c-nsedy_ce0.js +1 -0
- package/out/_next/static/chunks/31u5lbu1vxznh.js +1 -0
- package/out/_next/static/chunks/{2feca0xcipcyt.js → 32ahba5ezp467.js} +156 -156
- package/out/_next/static/chunks/337hn35kts7ud.js +1 -0
- package/out/_next/static/chunks/33dgpebv-tf73.js +1 -0
- package/out/_next/static/chunks/36jkdhq6kb-cf.js +1 -0
- package/out/_next/static/chunks/37epa8fz59vba.js +1166 -0
- package/out/_next/static/chunks/3833xfnz0a-ub.js +1 -0
- package/out/_next/static/chunks/38awrh_qxn22k.js +1 -0
- package/out/_next/static/chunks/{0wrm9jr-9bw0e.js → 38x3c1ra5slhe.js} +383 -913
- package/out/_next/static/chunks/39idqlqlcp5b9.js +1 -0
- package/out/_next/static/chunks/{2a3spdq-m8drh.js → 3_gku1pwluoo0.js} +1 -1
- package/out/_next/static/chunks/3_mu-4rdjajna.js +1450 -0
- package/out/_next/static/chunks/3coacc4-g-g5c.js +1 -0
- package/out/_next/static/chunks/3e00fzdfkclzq.js +1 -0
- package/out/_next/static/chunks/3e8fmlq0k5wkg.js +1 -0
- package/out/_next/static/chunks/3e9tzyrt4_98z.js +1 -0
- package/out/_next/static/chunks/3edelqkq92pil.js +1 -0
- package/out/_next/static/chunks/3figbil1t4ssj.js +593 -0
- package/out/_next/static/chunks/3gimb3z_mteou.js +1 -0
- package/out/_next/static/chunks/{2p2vv6cc9i-3q.js → 3idaz_s77e-j_.js} +9 -9
- package/out/_next/static/chunks/3j-4wuhs5weba.js +1 -0
- package/out/_next/static/chunks/3jjfnwvybayy7.js +1 -0
- package/out/_next/static/chunks/3jwm5dfk_78gc.js +1 -0
- package/out/_next/static/chunks/3k9d4ylc3li2t.js +1352 -0
- package/out/_next/static/chunks/3l3_0ack3gy4k.js +1 -0
- package/out/_next/static/chunks/3lwhs5ja7tun3.js +1 -0
- package/out/_next/static/chunks/3m6nmp2dca6un.js +1342 -0
- package/out/_next/static/chunks/3mbnfpufs2-7e.js +7 -0
- package/out/_next/static/chunks/3mcd08gmt038z.js +1 -0
- package/out/_next/static/chunks/3mt5th7b1i_u9.js +1 -0
- package/out/_next/static/chunks/3ne77mjdz2y7o.js +1 -0
- package/out/_next/static/chunks/3puhrqtujktyv.js +1 -0
- package/out/_next/static/chunks/3rdifucupcgkg.js +1 -0
- package/out/_next/static/chunks/3riekaxl3uxfb.js +1195 -0
- package/out/_next/static/chunks/3sdoskq_buttj.js +1 -0
- package/out/_next/static/chunks/3tg-ma9tv9xu4.js +1 -0
- package/out/_next/static/chunks/3tm-pqpmq_ppw.js +1 -0
- package/out/_next/static/chunks/3w9go565cjhq3.js +1636 -0
- package/out/_next/static/chunks/3wi9gzq2mtr_q.js +8 -0
- package/out/_next/static/chunks/3xagd_2_9zft2.js +1 -0
- package/out/_next/static/chunks/3xsq_anpad-fb.js +1 -0
- package/out/_next/static/chunks/3ycv2qq7vpbua.js +1 -0
- package/out/_next/static/chunks/3z84au-mitjjw.js +1 -0
- package/out/_next/static/chunks/4030dhur2h70-.js +1 -0
- package/out/_next/static/chunks/40ffffml4h_3r.js +4 -0
- package/out/_next/static/chunks/{3-shckrcpvbxu.js → 41wt50z9tx9cx.js} +108 -711
- package/out/_next/static/chunks/431slrqh0wa0g.js +1 -0
- package/out/_next/static/chunks/43s_lbd1i2krj.js +1 -0
- package/out/_next/static/chunks/{0-2y-_oomza2l.js → 44nxswtahaq4w.js} +18 -18
- package/out/_next/static/chunks/45bwefvdpztfs.js +1 -0
- package/out/_next/static/chunks/{turbopack-0sgd6pfbe1fy6.js → turbopack-19105pdhzxp1x.js} +1 -1
- package/out/_not-found/__next._full.txt +9 -9
- package/out/_not-found/__next._head.txt +4 -4
- package/out/_not-found/__next._index.txt +4 -4
- package/out/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/out/_not-found/__next._not-found.txt +3 -3
- package/out/_not-found/__next._tree.txt +2 -2
- package/out/_not-found.html +1 -1
- package/out/_not-found.txt +9 -9
- package/out/index.html +1 -1
- package/out/index.txt +11 -11
- package/package.json +5 -4
- package/out/_next/static/chunks/068j6934u8j16.js +0 -1
- package/out/_next/static/chunks/09e4adtr6w0xe.js +0 -1
- package/out/_next/static/chunks/0_rf76jneiwal.js +0 -176
- package/out/_next/static/chunks/0aznt7717miff.js +0 -1
- package/out/_next/static/chunks/0cu-q5q3a7uf3.js +0 -1
- package/out/_next/static/chunks/0fskcfh9vbhtv.js +0 -1
- package/out/_next/static/chunks/0gg-ii7i6d_p6.js +0 -1
- package/out/_next/static/chunks/0tx1j_ghpz7rc.css +0 -3
- package/out/_next/static/chunks/0ufbyo1x3qkmo.js +0 -1
- package/out/_next/static/chunks/0wwcfw8i3j_zx.js +0 -1
- package/out/_next/static/chunks/0wwkrsvxwi57d.js +0 -1
- package/out/_next/static/chunks/0ys9-ozuluawt.js +0 -1
- package/out/_next/static/chunks/1-61zh4waha61.js +0 -1
- package/out/_next/static/chunks/10r_824wzt8hj.js +0 -1
- package/out/_next/static/chunks/123xxske5c9na.js +0 -1
- package/out/_next/static/chunks/13isnf0--pmx1.js +0 -1
- package/out/_next/static/chunks/157d9euci08yu.js +0 -1
- package/out/_next/static/chunks/18u58lorfahxi.js +0 -4
- package/out/_next/static/chunks/1_aahautsz2v_.js +0 -1
- package/out/_next/static/chunks/1o1d0p-v1z8ty.js +0 -1
- package/out/_next/static/chunks/1vdjn0pkoyypn.js +0 -1
- package/out/_next/static/chunks/1yehxf-fmeicg.js +0 -1
- package/out/_next/static/chunks/1zx2q-r32thv1.js +0 -4
- package/out/_next/static/chunks/2-sjjedfr0kfq.js +0 -1
- package/out/_next/static/chunks/25b9x-li-tvk2.js +0 -1
- package/out/_next/static/chunks/2aelw3far6rii.js +0 -1
- package/out/_next/static/chunks/2aor7m-wbis85.js +0 -1
- package/out/_next/static/chunks/2clzipqap01hp.js +0 -1
- package/out/_next/static/chunks/2fh-_9b6tqhvb.js +0 -1
- package/out/_next/static/chunks/2g5gecypj0rqe.js +0 -1
- package/out/_next/static/chunks/2szdcpl41-kzv.js +0 -1
- package/out/_next/static/chunks/2u6shh3oeycm-.js +0 -1
- package/out/_next/static/chunks/2unhhuv0arlcv.js +0 -1
- package/out/_next/static/chunks/2z5eqx5do5std.js +0 -1
- package/out/_next/static/chunks/310uz81hnnzsu.js +0 -1
- package/out/_next/static/chunks/3aqbf_wkg2sih.js +0 -3
- package/out/_next/static/chunks/3i3gbhccmhu7j.js +0 -210
- package/out/_next/static/chunks/3mqy-84_ul3t2.js +0 -1
- package/out/_next/static/chunks/3nz-dh9d7cehk.js +0 -1
- package/out/_next/static/chunks/3pufs8g4ui943.js +0 -1
- package/out/_next/static/chunks/3t06schbtqonl.js +0 -1
- package/out/_next/static/chunks/3v3-7fio3nw_t.js +0 -1
- package/out/_next/static/chunks/3v5ha25nxo43j.js +0 -1
- package/out/_next/static/chunks/3zskk1hxu3-_o.js +0 -1
- /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_buildManifest.js +0 -0
- /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_clientMiddlewareManifest.js +0 -0
- /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,23507,70227,54196,3717,92040,33457,97001,e=>{"use strict";var t,i=e.i(10272),r=e.i(37143),s=e.i(65740),n=e.i(99267),a=e.i(81623),l=e.i(35407),o=e.i(49007),h=e.i(48657),c=e.i(96265),u=e.i(89030);class d{constructor(e,t,i){this.vectors=(0,h.BuildArray)(8,c.Vector3.Zero),this.center=c.Vector3.Zero(),this.centerWorld=c.Vector3.Zero(),this.extendSize=c.Vector3.Zero(),this.extendSizeWorld=c.Vector3.Zero(),this.directions=(0,h.BuildArray)(3,c.Vector3.Zero),this.vectorsWorld=(0,h.BuildArray)(8,c.Vector3.Zero),this.minimumWorld=c.Vector3.Zero(),this.maximumWorld=c.Vector3.Zero(),this.minimum=c.Vector3.Zero(),this.maximum=c.Vector3.Zero(),this._drawWrapperFront=null,this._drawWrapperBack=null,this.reConstruct(e,t,i)}reConstruct(e,t,i){let r=e.x,s=e.y,n=e.z,a=t.x,l=t.y,o=t.z,h=this.vectors;this.minimum.copyFromFloats(r,s,n),this.maximum.copyFromFloats(a,l,o),h[0].copyFromFloats(r,s,n),h[1].copyFromFloats(a,l,o),h[2].copyFromFloats(a,s,n),h[3].copyFromFloats(r,l,n),h[4].copyFromFloats(r,s,o),h[5].copyFromFloats(a,l,n),h[6].copyFromFloats(r,l,o),h[7].copyFromFloats(a,s,o),t.addToRef(e,this.center).scaleInPlace(.5),t.subtractToRef(e,this.extendSize).scaleInPlace(.5),this._worldMatrix=i||c.Matrix.IdentityReadOnly,this._update(this._worldMatrix)}scale(e){let t=d._TmpVector3,i=this.maximum.subtractToRef(this.minimum,t[0]),r=i.length();i.normalizeFromLength(r);let s=r*e,n=i.scaleInPlace(.5*s),a=this.center.subtractToRef(n,t[1]),l=this.center.addToRef(n,t[2]);return this.reConstruct(a,l,this._worldMatrix),this}getWorldMatrix(){return this._worldMatrix}_update(e){let t=this.minimumWorld,i=this.maximumWorld,r=this.directions,s=this.vectorsWorld,n=this.vectors;if(e.isIdentity()){t.copyFrom(this.minimum),i.copyFrom(this.maximum);for(let e=0;e<8;++e)s[e].copyFrom(n[e]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{t.setAll(Number.MAX_VALUE),i.setAll(-Number.MAX_VALUE);for(let r=0;r<8;++r){let a=s[r];c.Vector3.TransformCoordinatesToRef(n[r],e,a),t.minimizeInPlace(a),i.maximizeInPlace(a)}i.subtractToRef(t,this.extendSizeWorld).scaleInPlace(.5),i.addToRef(t,this.centerWorld).scaleInPlace(.5)}c.Vector3.FromArrayToRef(e.m,0,r[0]),c.Vector3.FromArrayToRef(e.m,4,r[1]),c.Vector3.FromArrayToRef(e.m,8,r[2]),this._worldMatrix=e}isInFrustum(e){return d.IsInFrustum(this.vectorsWorld,e)}isCompletelyInFrustum(e){return d.IsCompletelyInFrustum(this.vectorsWorld,e)}intersectsPoint(e){let t=this.minimumWorld,i=this.maximumWorld,r=t.x,s=t.y,n=t.z,a=i.x,l=i.y,o=i.z,h=e.x,c=e.y,d=e.z,_=-u.Epsilon;return!(a-h<_)&&!(_>h-r)&&!(l-c<_)&&!(_>c-s)&&!(o-d<_)&&!(_>d-n)}intersectsSphere(e){return d.IntersectsSphere(this.minimumWorld,this.maximumWorld,e.centerWorld,e.radiusWorld)}intersectsMinMax(e,t){let i=this.minimumWorld,r=this.maximumWorld,s=i.x,n=i.y,a=i.z,l=r.x,o=r.y,h=r.z,c=e.x,u=e.y,d=e.z,_=t.x,p=t.y,E=t.z;return!(l<c)&&!(s>_)&&!(o<u)&&!(n>p)&&!(h<d)&&!(a>E)}dispose(){this._drawWrapperFront?.dispose(),this._drawWrapperBack?.dispose()}static Intersects(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)}static IntersectsSphere(e,t,i,r){let s=d._TmpVector3[0];return c.Vector3.ClampToRef(i,e,t,s),c.Vector3.DistanceSquared(i,s)<=r*r}static IsCompletelyInFrustum(e,t){for(let i=0;i<6;++i){let r=t[i];for(let t=0;t<8;++t)if(0>r.dotCoordinate(e[t]))return!1}return!0}static IsInFrustum(e,t){for(let i=0;i<6;++i){let r=!0,s=t[i];for(let t=0;t<8;++t)if(s.dotCoordinate(e[t])>=0){r=!1;break}if(r)return!1}return!0}}d._TmpVector3=(0,h.BuildArray)(3,c.Vector3.Zero);class _{constructor(e,t,i){this.center=c.Vector3.Zero(),this.centerWorld=c.Vector3.Zero(),this.minimum=c.Vector3.Zero(),this.maximum=c.Vector3.Zero(),this.reConstruct(e,t,i)}reConstruct(e,t,i){this.minimum.copyFrom(e),this.maximum.copyFrom(t);let r=c.Vector3.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*r,this._update(i||c.Matrix.IdentityReadOnly)}scale(e){let t=this.radius*e,i=_._TmpVector3,r=i[0].setAll(t),s=this.center.subtractToRef(r,i[1]),n=this.center.addToRef(r,i[2]);return this.reConstruct(s,n,this._worldMatrix),this}getWorldMatrix(){return this._worldMatrix}_update(e){if(e.isIdentity())this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius;else{c.Vector3.TransformCoordinatesToRef(this.center,e,this.centerWorld);let t=_._TmpVector3[0];c.Vector3.TransformNormalFromFloatsToRef(1,1,1,e,t),this.radiusWorld=Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.radius}}isInFrustum(e){let t=this.centerWorld,i=this.radiusWorld;for(let r=0;r<6;r++)if(e[r].dotCoordinate(t)<=-i)return!1;return!0}isCenterInFrustum(e){let t=this.centerWorld;for(let i=0;i<6;i++)if(0>e[i].dotCoordinate(t))return!1;return!0}intersectsPoint(e){let t=c.Vector3.DistanceSquared(this.centerWorld,e);return!(this.radiusWorld*this.radiusWorld<t)}static Intersects(e,t){let i=c.Vector3.DistanceSquared(e.centerWorld,t.centerWorld),r=e.radiusWorld+t.radiusWorld;return!(r*r<i)}static CreateFromCenterAndRadius(e,t,i){this._TmpVector3[0].copyFrom(e),this._TmpVector3[1].copyFromFloats(0,0,t),this._TmpVector3[2].copyFrom(e),this._TmpVector3[0].addInPlace(this._TmpVector3[1]),this._TmpVector3[2].subtractInPlace(this._TmpVector3[1]);let r=new _(this._TmpVector3[0],this._TmpVector3[2]);return i?r._worldMatrix=i:r._worldMatrix=c.Matrix.Identity(),r}}_._TmpVector3=(0,h.BuildArray)(3,c.Vector3.Zero);let p={min:0,max:0},E={min:0,max:0},A=(e,t,i)=>{let r=c.Vector3.Dot(t.centerWorld,e),s=Math.abs(c.Vector3.Dot(t.directions[0],e))*t.extendSize.x+Math.abs(c.Vector3.Dot(t.directions[1],e))*t.extendSize.y+Math.abs(c.Vector3.Dot(t.directions[2],e))*t.extendSize.z;i.min=r-s,i.max=r+s},T=(e,t,i)=>(A(e,t,p),A(e,i,E),!(p.min>E.max||E.min>p.max));class f{constructor(e,t,i){this._isLocked=!1,this.boundingBox=new d(e,t,i),this.boundingSphere=new _(e,t,i)}reConstruct(e,t,i){this.boundingBox.reConstruct(e,t,i),this.boundingSphere.reConstruct(e,t,i)}get minimum(){return this.boundingBox.minimum}get maximum(){return this.boundingBox.maximum}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked=e}update(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))}centerOn(e,t){let i=f._TmpVector3[0].copyFrom(e).subtractInPlace(t),r=f._TmpVector3[1].copyFrom(e).addInPlace(t);return this.boundingBox.reConstruct(i,r,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(i,r,this.boundingBox.getWorldMatrix()),this}encapsulate(e){let t=c.Vector3.Minimize(this.minimum,e),i=c.Vector3.Maximize(this.maximum,e);return this.reConstruct(t,i,this.boundingBox.getWorldMatrix()),this}encapsulateBoundingInfo(e){let t=c.TmpVectors.Matrix[0];this.boundingBox.getWorldMatrix().invertToRef(t);let i=c.TmpVectors.Vector3[0];return c.Vector3.TransformCoordinatesToRef(e.boundingBox.minimumWorld,t,i),this.encapsulate(i),c.Vector3.TransformCoordinatesToRef(e.boundingBox.maximumWorld,t,i),this.encapsulate(i),this}scale(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this}isInFrustum(e,t=0){return!!((2===t||3===t)&&this.boundingSphere.isCenterInFrustum(e))||!!this.boundingSphere.isInFrustum(e)&&(1===t||3===t||this.boundingBox.isInFrustum(e))}get diagonalLength(){let e=this.boundingBox;return e.maximumWorld.subtractToRef(e.minimumWorld,f._TmpVector3[0]).length()}isCompletelyInFrustum(e){return this.boundingBox.isCompletelyInFrustum(e)}_checkCollision(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)}intersectsPoint(e){return!!this.boundingSphere.centerWorld&&!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e)}intersects(e,t){if(!_.Intersects(this.boundingSphere,e.boundingSphere)||!d.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;let i=this.boundingBox,r=e.boundingBox;return!!T(i.directions[0],i,r)&&!!T(i.directions[1],i,r)&&!!T(i.directions[2],i,r)&&!!T(r.directions[0],i,r)&&!!T(r.directions[1],i,r)&&!!T(r.directions[2],i,r)&&!!T(c.Vector3.Cross(i.directions[0],r.directions[0]),i,r)&&!!T(c.Vector3.Cross(i.directions[0],r.directions[1]),i,r)&&!!T(c.Vector3.Cross(i.directions[0],r.directions[2]),i,r)&&!!T(c.Vector3.Cross(i.directions[1],r.directions[0]),i,r)&&!!T(c.Vector3.Cross(i.directions[1],r.directions[1]),i,r)&&!!T(c.Vector3.Cross(i.directions[1],r.directions[2]),i,r)&&!!T(c.Vector3.Cross(i.directions[2],r.directions[0]),i,r)&&!!T(c.Vector3.Cross(i.directions[2],r.directions[1]),i,r)&&!!T(c.Vector3.Cross(i.directions[2],r.directions[2]),i,r)&&!0}}f._TmpVector3=(0,h.BuildArray)(2,c.Vector3.Zero),e.s(["BoundingInfo",0,f],70227);class g{static extractMinAndMaxIndexed(e,t,i,r,s,n){for(let a=i;a<i+r;a++){let i=3*t[a],r=e[i],l=e[i+1],o=e[i+2];s.minimizeInPlaceFromFloats(r,l,o),n.maximizeInPlaceFromFloats(r,l,o)}}static extractMinAndMax(e,t,i,r,s,n){for(let a=t,l=t*r;a<t+i;a++,l+=r){let t=e[l],i=e[l+1],r=e[l+2];s.minimizeInPlaceFromFloats(t,i,r),n.maximizeInPlaceFromFloats(t,i,r)}}}function m(e,t,i,r,s=null){let n=new c.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new c.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return g.extractMinAndMaxIndexed(e,t,i,r,n,a),s&&(n.x-=n.x*s.x+s.y,n.y-=n.y*s.x+s.y,n.z-=n.z*s.x+s.y,a.x+=a.x*s.x+s.y,a.y+=a.y*s.x+s.y,a.z+=a.z*s.x+s.y),{minimum:n,maximum:a}}(0,i.__decorate)([r.nativeOverride.filter((...e)=>!Array.isArray(e[0])&&!Array.isArray(e[1]))],g,"extractMinAndMaxIndexed",null),(0,i.__decorate)([r.nativeOverride.filter((...e)=>!Array.isArray(e[0]))],g,"extractMinAndMax",null),e.s(["extractMinAndMax",0,function(e,t,i,r=null,s){let n=new c.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new c.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return s||(s=3),g.extractMinAndMax(e,t,i,s,n,a),r&&(n.x-=n.x*r.x+r.y,n.y-=n.y*r.x+r.y,n.z-=n.z*r.x+r.y,a.x+=a.x*r.x+r.y,a.y+=a.y*r.x+r.y,a.z+=a.z*r.x+r.y),{minimum:n,maximum:a}},"extractMinAndMaxIndexed",0,m],54196);var M=e.i(44939),S=e.i(75405);class b{get materialDefines(){let e=this._mainDrawWrapperOverride?this._mainDrawWrapperOverride.defines:this._getDrawWrapper()?.defines;return"string"==typeof e?null:e}set materialDefines(e){(this._mainDrawWrapperOverride??this._getDrawWrapper(void 0,!0)).defines=e}_getDrawWrapper(e,t=!1){e=e??this._engine.currentRenderPassId;let i=this._drawWrappers[e];return!i&&t&&(this._drawWrappers[e]=i=new M.DrawWrapper(this._mesh.getScene().getEngine())),i}_removeDrawWrapper(e,t=!0,i=!1){t&&this._drawWrappers[e]?.dispose(i),this._drawWrappers[e]=void 0}get effect(){return this._mainDrawWrapperOverride?this._mainDrawWrapperOverride.effect:this._getDrawWrapper()?.effect??null}get _drawWrapper(){return this._mainDrawWrapperOverride??this._getDrawWrapper(void 0,!0)}get _drawWrapperOverride(){return this._mainDrawWrapperOverride}_setMainDrawWrapperOverride(e){this._mainDrawWrapperOverride=e}setEffect(e,t=null,i,r=!0){let s=this._drawWrapper;s.setEffect(e,t,r),void 0!==i&&(s.materialContext=i),e||(s.defines=null,s.materialContext=void 0)}resetDrawCache(e,t=!1){if(this._drawWrappers)if(void 0!==e)return void this._removeDrawWrapper(e,!0,t);else for(let e of this._drawWrappers)e?.dispose(t);this._drawWrappers=[]}static AddToMesh(e,t,i,r,s,n,a,l=!0){return new b(e,t,i,r,s,n,a,l)}constructor(e,t,i,r,s,n,a,l=!0,o=!0){this.materialIndex=e,this.verticesStart=t,this.verticesCount=i,this.indexStart=r,this.indexCount=s,this._mainDrawWrapperOverride=null,this._linesIndexCount=0,this._linesIndexBuffer=null,this._lastColliderWorldVertices=null,this._lastColliderTransformMatrix=null,this._wasDispatched=!1,this._renderId=0,this._alphaIndex=0,this._distanceToCamera=0,this._currentMaterial=null,this._mesh=n,this._renderingMesh=a||n,o&&n.subMeshes.push(this),this._engine=this._mesh.getScene().getEngine(),this.resetDrawCache(),this._trianglePlanes=[],this._id=n.subMeshes.length-1,l&&(this.refreshBoundingInfo(),n.computeWorldMatrix(!0))}get IsGlobal(){return 0===this.verticesStart&&this.verticesCount===this._mesh.getTotalVertices()&&0===this.indexStart&&this.indexCount===this._mesh.getTotalIndices()}getBoundingInfo(){return this.IsGlobal||this._mesh.hasThinInstances?this._mesh.getBoundingInfo():this._boundingInfo}setBoundingInfo(e){return this._boundingInfo=e,this}getMesh(){return this._mesh}getRenderingMesh(){return this._renderingMesh}getReplacementMesh(){return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null}getEffectiveMesh(){return(this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null)||this._renderingMesh}getMaterial(e=!0){let t=this._renderingMesh.getMaterialForRenderPass(this._engine.currentRenderPassId)??this._renderingMesh.material;if(!t)return e&&this._mesh.getScene()._hasDefaultMaterial?this._mesh.getScene().defaultMaterial:null;if(this._isMultiMaterial(t)){let e=t.getSubMaterial(this.materialIndex);return this._currentMaterial!==e&&(this._currentMaterial=e,this.resetDrawCache()),e}return t}_isMultiMaterial(e){return void 0!==e.getSubMaterial}refreshBoundingInfo(e=null){let t;if(this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;if(e||(e=this._renderingMesh.getVerticesData(l.VertexBuffer.PositionKind)),!e)return this._boundingInfo=this._mesh.getBoundingInfo(),this;let i=this._renderingMesh.getIndices();if(0===this.indexStart&&this.indexCount===i.length){let e=this._renderingMesh.getBoundingInfo();t={minimum:e.minimum.clone(),maximum:e.maximum.clone()}}else t=m(e,i,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias);return this._boundingInfo?this._boundingInfo.reConstruct(t.minimum,t.maximum):this._boundingInfo=new f(t.minimum,t.maximum),this}_checkCollision(e){return this.getBoundingInfo()._checkCollision(e)}updateBoundingInfo(e){let t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t&&t.update(e),this}isInFrustum(e){let t=this.getBoundingInfo();return!!t&&t.isInFrustum(e,this._mesh.cullingStrategy)}isCompletelyInFrustum(e){let t=this.getBoundingInfo();return!!t&&t.isCompletelyInFrustum(e)}render(e){return this._renderingMesh.render(this,e,this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:void 0),this}_getLinesIndexBuffer(e,t){if(!this._linesIndexBuffer){let i=6*Math.floor(this.indexCount/3),r=this.verticesStart+this.verticesCount>65535?new Uint32Array(i):new Uint16Array(i),s=0;if(0===e.length)for(let e=this.indexStart;e<this.indexStart+this.indexCount;e+=3)r[s++]=e,r[s++]=e+1,r[s++]=e+1,r[s++]=e+2,r[s++]=e+2,r[s++]=e;else for(let t=this.indexStart;t<this.indexStart+this.indexCount;t+=3)r[s++]=e[t],r[s++]=e[t+1],r[s++]=e[t+1],r[s++]=e[t+2],r[s++]=e[t+2],r[s++]=e[t];this._linesIndexBuffer=t.createIndexBuffer(r),this._linesIndexCount=r.length}return this._linesIndexBuffer}canIntersects(e){let t=this.getBoundingInfo();return!!t&&e.intersectsBox(t.boundingBox)}intersects(e,t,i,r,s){let n=this.getMaterial();if(!n)return null;let a=3,l=!1;switch(n.fillMode){case 3:case 5:case 6:case 8:return null;case 7:a=1,l=!0}return 4===n.fillMode?i.length?this._intersectLines(e,t,i,this._mesh.intersectionThreshold,r):this._intersectUnIndexedLines(e,t,i,this._mesh.intersectionThreshold,r):!i.length&&this._mesh._unIndexed?this._intersectUnIndexedTriangles(e,t,i,r,s):this._intersectTriangles(e,t,i,a,l,r,s)}_intersectLines(e,t,i,r,s){let n=null;for(let a=this.indexStart;a<this.indexStart+this.indexCount;a+=2){let l=t[i[a]],h=t[i[a+1]],c=e.intersectionSegment(l,h,r);if(!(c<0)&&(s||!n||c<n.distance)&&((n=new o.IntersectionInfo(null,null,c)).faceId=a/2,s))break}return n}_intersectUnIndexedLines(e,t,i,r,s){let n=null;for(let i=this.verticesStart;i<this.verticesStart+this.verticesCount;i+=2){let a=t[i],l=t[i+1],h=e.intersectionSegment(a,l,r);if(!(h<0)&&(s||!n||h<n.distance)&&((n=new o.IntersectionInfo(null,null,h)).faceId=i/2,s))break}return n}_intersectTriangles(e,t,i,r,s,n,a){let l=null,o=-1;for(let h=this.indexStart;h<this.indexStart+this.indexCount-(3-r);h+=r){o++;let r=i[h],c=i[h+1],u=i[h+2];if(s&&0xffffffff===u){h+=2;continue}let d=t[r],_=t[c],p=t[u];if(!d||!_||!p||a&&!a(d,_,p,e,r,c,u))continue;let E=e.intersectsTriangle(d,_,p);if(E){if(E.distance<0)continue;if((n||!l||E.distance<l.distance)&&((l=E).faceId=o,n))break}}return l}_intersectUnIndexedTriangles(e,t,i,r,s){let n=null;for(let i=this.verticesStart;i<this.verticesStart+this.verticesCount;i+=3){let a=t[i],l=t[i+1],o=t[i+2];if(s&&!s(a,l,o,e,-1,-1,-1))continue;let h=e.intersectsTriangle(a,l,o);if(h){if(h.distance<0)continue;if((r||!n||h.distance<n.distance)&&((n=h).faceId=i/3,r))break}}return n}_rebuild(){this._linesIndexBuffer&&(this._linesIndexBuffer=null)}clone(e,t){let i=new b(this.materialIndex,this.verticesStart,this.verticesCount,this.indexStart,this.indexCount,e,t,!1);if(!this.IsGlobal){let e=this.getBoundingInfo();if(!e)return i;i._boundingInfo=new f(e.minimum,e.maximum)}return i}dispose(e=!1){this._linesIndexBuffer&&(this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer),this._linesIndexBuffer=null);let t=this._mesh.subMeshes.indexOf(this);this._mesh.subMeshes.splice(t,1),this.resetDrawCache(void 0,e)}getClassName(){return"SubMesh"}static CreateFromIndices(e,t,i,r,s,n=!0){let a=Number.MAX_VALUE,l=-Number.MAX_VALUE,o=(s||r).getIndices();for(let e=t;e<t+i;e++){let t=o[e];t<a&&(a=t),t>l&&(l=t)}return new b(e,a,l-a+1,t,i,r,s,n)}}(t=b.prototype).projectToRef??(t.projectToRef=(0,S._MissingSideEffect)("SubMesh","projectToRef")),e.s(["SubMesh",0,b],3717);var I=e.i(33855),P=e.i(13379),R=e.i(65002),C=e.i(80871);class x{constructor(){this.reset()}reset(){this.enabled=!1,this.mask=255,this.funcRef=1,this.funcMask=255,this.func=519,this.opStencilFail=7680,this.opDepthFail=7680,this.opStencilDepthPass=7681,this.backFunc=519,this.backOpStencilFail=7680,this.backOpDepthFail=7680,this.backOpStencilDepthPass=7681}get func(){return this._func}set func(e){this._func=e}get backFunc(){return this._backFunc}set backFunc(e){this._backFunc=e}get funcRef(){return this._funcRef}set funcRef(e){this._funcRef=e}get funcMask(){return this._funcMask}set funcMask(e){this._funcMask=e}get opStencilFail(){return this._opStencilFail}set opStencilFail(e){this._opStencilFail=e}get opDepthFail(){return this._opDepthFail}set opDepthFail(e){this._opDepthFail=e}get opStencilDepthPass(){return this._opStencilDepthPass}set opStencilDepthPass(e){this._opStencilDepthPass=e}get backOpStencilFail(){return this._backOpStencilFail}set backOpStencilFail(e){this._backOpStencilFail=e}get backOpDepthFail(){return this._backOpDepthFail}set backOpDepthFail(e){this._backOpDepthFail=e}get backOpStencilDepthPass(){return this._backOpStencilDepthPass}set backOpStencilDepthPass(e){this._backOpStencilDepthPass=e}get mask(){return this._mask}set mask(e){this._mask=e}get enabled(){return this._enabled}set enabled(e){this._enabled=e}getClassName(){return"MaterialStencilState"}copyTo(e){C.SerializationHelper.Clone(()=>e,this)}serialize(){return C.SerializationHelper.Serialize(this)}parse(e,t,i){C.SerializationHelper.Parse(()=>this,e,t,i)}}(0,i.__decorate)([(0,r.serialize)()],x.prototype,"func",null),(0,i.__decorate)([(0,r.serialize)()],x.prototype,"backFunc",null),(0,i.__decorate)([(0,r.serialize)()],x.prototype,"funcRef",null),(0,i.__decorate)([(0,r.serialize)()],x.prototype,"funcMask",null),(0,i.__decorate)([(0,r.serialize)()],x.prototype,"opStencilFail",null),(0,i.__decorate)([(0,r.serialize)()],x.prototype,"opDepthFail",null),(0,i.__decorate)([(0,r.serialize)()],x.prototype,"opStencilDepthPass",null),(0,i.__decorate)([(0,r.serialize)()],x.prototype,"backOpStencilFail",null),(0,i.__decorate)([(0,r.serialize)()],x.prototype,"backOpDepthFail",null),(0,i.__decorate)([(0,r.serialize)()],x.prototype,"backOpStencilDepthPass",null),(0,i.__decorate)([(0,r.serialize)()],x.prototype,"mask",null),(0,i.__decorate)([(0,r.serialize)()],x.prototype,"enabled",null);var D=e.i(21823),O=e.i(94160);function y(e,t,i){let r=!1,s=!!(e.clipPlane??t.clipPlane),n=!!(e.clipPlane2??t.clipPlane2),a=!!(e.clipPlane3??t.clipPlane3),l=!!(e.clipPlane4??t.clipPlane4),o=!!(e.clipPlane5??t.clipPlane5),h=!!(e.clipPlane6??t.clipPlane6);return i.CLIPPLANE!==s&&(i.CLIPPLANE=s,r=!0),i.CLIPPLANE2!==n&&(i.CLIPPLANE2=n,r=!0),i.CLIPPLANE3!==a&&(i.CLIPPLANE3=a,r=!0),i.CLIPPLANE4!==l&&(i.CLIPPLANE4=l,r=!0),i.CLIPPLANE5!==o&&(i.CLIPPLANE5=o,r=!0),i.CLIPPLANE6!==h&&(i.CLIPPLANE6=h,r=!0),r}function L(e,t,i){if(i){let r=O.FloatingOriginCurrentScene.getScene()?.floatingOriginOffset||c.Vector3.ZeroReadOnly;e.setFloat4(t,i.normal.x,i.normal.y,i.normal.z,i.d+c.Vector3.Dot(i.normal,r))}}e.s(["AddClipPlaneUniforms",0,function(e){-1===e.indexOf("vClipPlane")&&e.push("vClipPlane"),-1===e.indexOf("vClipPlane2")&&e.push("vClipPlane2"),-1===e.indexOf("vClipPlane3")&&e.push("vClipPlane3"),-1===e.indexOf("vClipPlane4")&&e.push("vClipPlane4"),-1===e.indexOf("vClipPlane5")&&e.push("vClipPlane5"),-1===e.indexOf("vClipPlane6")&&e.push("vClipPlane6")},"BindClipPlane",0,function(e,t,i){let r=t.clipPlane??i.clipPlane;L(e,"vClipPlane",r),L(e,"vClipPlane2",r=t.clipPlane2??i.clipPlane2),L(e,"vClipPlane3",r=t.clipPlane3??i.clipPlane3),L(e,"vClipPlane4",r=t.clipPlane4??i.clipPlane4),L(e,"vClipPlane5",r=t.clipPlane5??i.clipPlane5),L(e,"vClipPlane6",r=t.clipPlane6??i.clipPlane6)},"PrepareDefinesForClipPlanes",0,y,"PrepareStringDefinesForClipPlanes",0,function(e,t,i){let r=!!(e.clipPlane??t.clipPlane),s=!!(e.clipPlane2??t.clipPlane2),n=!!(e.clipPlane3??t.clipPlane3),a=!!(e.clipPlane4??t.clipPlane4),l=!!(e.clipPlane5??t.clipPlane5),o=!!(e.clipPlane6??t.clipPlane6);r&&i.push("#define CLIPPLANE"),s&&i.push("#define CLIPPLANE2"),n&&i.push("#define CLIPPLANE3"),a&&i.push("#define CLIPPLANE4"),l&&i.push("#define CLIPPLANE5"),o&&i.push("#define CLIPPLANE6")}],92040);var F=e.i(76535);class N{static get DiffuseTextureEnabled(){return this._DiffuseTextureEnabled}static set DiffuseTextureEnabled(e){this._DiffuseTextureEnabled!==e&&(this._DiffuseTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get BaseWeightTextureEnabled(){return this._BaseWeightTextureEnabled}static set BaseWeightTextureEnabled(e){this._BaseWeightTextureEnabled!==e&&(this._BaseWeightTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get BaseDiffuseRoughnessTextureEnabled(){return this._BaseDiffuseRoughnessTextureEnabled}static set BaseDiffuseRoughnessTextureEnabled(e){this._BaseDiffuseRoughnessTextureEnabled!==e&&(this._BaseDiffuseRoughnessTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get DetailTextureEnabled(){return this._DetailTextureEnabled}static set DetailTextureEnabled(e){this._DetailTextureEnabled!==e&&(this._DetailTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get DecalMapEnabled(){return this._DecalMapEnabled}static set DecalMapEnabled(e){this._DecalMapEnabled!==e&&(this._DecalMapEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get AmbientTextureEnabled(){return this._AmbientTextureEnabled}static set AmbientTextureEnabled(e){this._AmbientTextureEnabled!==e&&(this._AmbientTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get OpacityTextureEnabled(){return this._OpacityTextureEnabled}static set OpacityTextureEnabled(e){this._OpacityTextureEnabled!==e&&(this._OpacityTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get ReflectionTextureEnabled(){return this._ReflectionTextureEnabled}static set ReflectionTextureEnabled(e){this._ReflectionTextureEnabled!==e&&(this._ReflectionTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get EmissiveTextureEnabled(){return this._EmissiveTextureEnabled}static set EmissiveTextureEnabled(e){this._EmissiveTextureEnabled!==e&&(this._EmissiveTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get SpecularTextureEnabled(){return this._SpecularTextureEnabled}static set SpecularTextureEnabled(e){this._SpecularTextureEnabled!==e&&(this._SpecularTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get BumpTextureEnabled(){return this._BumpTextureEnabled}static set BumpTextureEnabled(e){this._BumpTextureEnabled!==e&&(this._BumpTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get LightmapTextureEnabled(){return this._LightmapTextureEnabled}static set LightmapTextureEnabled(e){this._LightmapTextureEnabled!==e&&(this._LightmapTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get RefractionTextureEnabled(){return this._RefractionTextureEnabled}static set RefractionTextureEnabled(e){this._RefractionTextureEnabled!==e&&(this._RefractionTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get ColorGradingTextureEnabled(){return this._ColorGradingTextureEnabled}static set ColorGradingTextureEnabled(e){this._ColorGradingTextureEnabled!==e&&(this._ColorGradingTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get FresnelEnabled(){return this._FresnelEnabled}static set FresnelEnabled(e){this._FresnelEnabled!==e&&(this._FresnelEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(4))}static get ClearCoatTextureEnabled(){return this._ClearCoatTextureEnabled}static set ClearCoatTextureEnabled(e){this._ClearCoatTextureEnabled!==e&&(this._ClearCoatTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get ClearCoatBumpTextureEnabled(){return this._ClearCoatBumpTextureEnabled}static set ClearCoatBumpTextureEnabled(e){this._ClearCoatBumpTextureEnabled!==e&&(this._ClearCoatBumpTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get ClearCoatTintTextureEnabled(){return this._ClearCoatTintTextureEnabled}static set ClearCoatTintTextureEnabled(e){this._ClearCoatTintTextureEnabled!==e&&(this._ClearCoatTintTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get SheenTextureEnabled(){return this._SheenTextureEnabled}static set SheenTextureEnabled(e){this._SheenTextureEnabled!==e&&(this._SheenTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get AnisotropicTextureEnabled(){return this._AnisotropicTextureEnabled}static set AnisotropicTextureEnabled(e){this._AnisotropicTextureEnabled!==e&&(this._AnisotropicTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get ThicknessTextureEnabled(){return this._ThicknessTextureEnabled}static set ThicknessTextureEnabled(e){this._ThicknessTextureEnabled!==e&&(this._ThicknessTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get RefractionIntensityTextureEnabled(){return this._ThicknessTextureEnabled}static set RefractionIntensityTextureEnabled(e){this._RefractionIntensityTextureEnabled!==e&&(this._RefractionIntensityTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get TranslucencyIntensityTextureEnabled(){return this._TranslucencyIntensityTextureEnabled}static set TranslucencyIntensityTextureEnabled(e){this._TranslucencyIntensityTextureEnabled!==e&&(this._TranslucencyIntensityTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get TranslucencyColorTextureEnabled(){return this._TranslucencyColorTextureEnabled}static set TranslucencyColorTextureEnabled(e){this._TranslucencyColorTextureEnabled!==e&&(this._TranslucencyColorTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}static get IridescenceTextureEnabled(){return this._IridescenceTextureEnabled}static set IridescenceTextureEnabled(e){this._IridescenceTextureEnabled!==e&&(this._IridescenceTextureEnabled=e,F.AbstractEngine.MarkAllMaterialsAsDirty(1))}}N._DiffuseTextureEnabled=!0,N._BaseWeightTextureEnabled=!0,N._BaseDiffuseRoughnessTextureEnabled=!0,N._DetailTextureEnabled=!0,N._DecalMapEnabled=!0,N._AmbientTextureEnabled=!0,N._OpacityTextureEnabled=!0,N._ReflectionTextureEnabled=!0,N._EmissiveTextureEnabled=!0,N._SpecularTextureEnabled=!0,N._BumpTextureEnabled=!0,N._LightmapTextureEnabled=!0,N._RefractionTextureEnabled=!0,N._ColorGradingTextureEnabled=!0,N._FresnelEnabled=!0,N._ClearCoatTextureEnabled=!0,N._ClearCoatBumpTextureEnabled=!0,N._ClearCoatTintTextureEnabled=!0,N._SheenTextureEnabled=!0,N._AnisotropicTextureEnabled=!0,N._ThicknessTextureEnabled=!0,N._RefractionIntensityTextureEnabled=!0,N._TranslucencyIntensityTextureEnabled=!0,N._TranslucencyColorTextureEnabled=!0,N._IridescenceTextureEnabled=!0,e.s(["MaterialFlags",0,N],33457);let v={r:0,g:0,b:0},B={NUM_MORPH_INFLUENCERS:0,NORMAL:!1,TANGENT:!1,UV:!1,UV2:!1,COLOR:!1};function k(e,t,i,r=!0){let s=i.NUM_MORPH_INFLUENCERS;if(s>0&&a.EngineStore.LastCreatedEngine){let n=a.EngineStore.LastCreatedEngine.getCaps().maxVertexAttribs,l=t.morphTargetManager;if(l?.isUsingTextureForTargets)return;let o=l&&l.supportsPositions&&r,h=l&&l.supportsNormals&&i.NORMAL,c=l&&l.supportsTangents&&i.TANGENT,u=l&&l.supportsUVs&&i.UV1,d=l&&l.supportsUV2s&&i.UV2,_=l&&l.supportsColors&&i.VERTEXCOLOR;for(let i=0;i<s;i++)o&&e.push("position"+i),h&&e.push("normal"+i),c&&e.push("tangent"+i),u&&e.push("uv_"+i),d&&e.push("uv2_"+i),_&&e.push("color"+i),e.length>n&&P.Logger.Error("Cannot add more vertex attributes for mesh "+t.name)}}function U(e,t=!1){e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3"),t&&(e.push("previousWorld0"),e.push("previousWorld1"),e.push("previousWorld2"),e.push("previousWorld3"))}function H(e,t){t.bindToEffect(e,"Scene")}let V=new WeakMap,W=new WeakSet;e.s(["AreLightsTexturesReady",0,function(e,t,i,r=!1){if(!e.lightsEnabled||r)return!0;let s=t.lightSources,n=Math.min(s.length,i);for(let e=0;e<n;e++)if(!s[e].areLightTexturesReady())return!1;return!0},"BindBonesParameters",0,function(e,t,i){if(t&&e&&(e.computeBonesUsingShaders&&t._bonesComputationForcedToCPU&&(e.computeBonesUsingShaders=!1),e.useBones&&e.computeBonesUsingShaders&&e.skeleton)){let r=e.skeleton;if(r.isUsingTextureForMatrices&&t.getUniformIndex("boneTextureInfo")>-1){let i=r.getTransformMatrixTexture(e);t.setTexture("boneSampler",i),t.setFloat2("boneTextureInfo",r._textureWidth,r._textureHeight)}else{let s=r.getTransformMatrices(e);s&&(t.setMatrices("mBones",s),i&&e.getScene().prePassRenderer&&e.getScene().prePassRenderer.getIndex(2))&&(i.previousBones[e.uniqueId]||(i.previousBones[e.uniqueId]=s.slice()),t.setMatrices("mPreviousBones",i.previousBones[e.uniqueId]),i.previousBones[e.uniqueId].set(s))}}},"BindFogParameters",0,function(e,t,i,r=!1){i&&e.fogEnabled&&(!t||t.applyFog)&&0!==e.fogMode&&(i.setFloat4("vFogInfos",e.fogMode,e.fogStart,e.fogEnd,e.fogDensity),r?(e.fogColor.toLinearSpaceToRef(v,e.getEngine().useExactSrgbConversions),i.setColor3("vFogColor",v)):i.setColor3("vFogColor",e.fogColor))},"BindIBLParameters",0,function(e,t,i,r,s=null,n=!1,a=!1,l=!1,o=!1,h=!1,c=!1,u=0){if(e.texturesEnabled&&s&&N.ReflectionTextureEnabled){if(i.updateMatrix("reflectionMatrix",s.getReflectionTextureMatrix()),i.updateFloat2("vReflectionInfos",s.level*e.iblIntensity,u),l&&s.boundingBoxSize&&(i.updateVector3("vReflectionPosition",s.boundingBoxPosition),i.updateVector3("vReflectionSize",s.boundingBoxSize)),n){let e=s.getSize().width;i.updateFloat2("vReflectionFilteringInfo",e,Math.log2(e))}if(h&&!t.USEIRRADIANCEMAP){let e=s.sphericalPolynomial;if(t.USESPHERICALFROMREFLECTIONMAP&&e)if(t.SPHERICAL_HARMONICS){let t=e.preScaledHarmonics;i.updateVector3("vSphericalL00",t.l00),i.updateVector3("vSphericalL1_1",t.l1_1),i.updateVector3("vSphericalL10",t.l10),i.updateVector3("vSphericalL11",t.l11),i.updateVector3("vSphericalL2_2",t.l2_2),i.updateVector3("vSphericalL2_1",t.l2_1),i.updateVector3("vSphericalL20",t.l20),i.updateVector3("vSphericalL21",t.l21),i.updateVector3("vSphericalL22",t.l22)}else i.updateFloat3("vSphericalX",e.x.x,e.x.y,e.x.z),i.updateFloat3("vSphericalY",e.y.x,e.y.y,e.y.z),i.updateFloat3("vSphericalZ",e.z.x,e.z.y,e.z.z),i.updateFloat3("vSphericalXX_ZZ",e.xx.x-e.zz.x,e.xx.y-e.zz.y,e.xx.z-e.zz.z),i.updateFloat3("vSphericalYY_ZZ",e.yy.x-e.zz.x,e.yy.y-e.zz.y,e.yy.z-e.zz.z),i.updateFloat3("vSphericalZZ",e.zz.x,e.zz.y,e.zz.z),i.updateFloat3("vSphericalXY",e.xy.x,e.xy.y,e.xy.z),i.updateFloat3("vSphericalYZ",e.yz.x,e.yz.y,e.yz.z),i.updateFloat3("vSphericalZX",e.zx.x,e.zx.y,e.zx.z)}else o&&t.USEIRRADIANCEMAP&&t.USE_IRRADIANCE_DOMINANT_DIRECTION&&s.irradianceTexture&&i.updateVector3("vReflectionDominantDirection",s.irradianceTexture._dominantDirection);a&&i.updateFloat3("vReflectionMicrosurfaceInfos",s.getSize().width,s.lodGenerationScale,s.lodGenerationOffset)}c&&i.updateColor3("vReflectionColor",r)},"BindLights",0,function(e,t,i,r,s=4){let n=Math.min(t.lightSources.length,s);for(let s=0;s<n;s++)!function(e,t,i,r,s,n=!0){e._bindLight(t,i,r,s,n)}(t.lightSources[s],s,e,i,"boolean"==typeof r?r:r.SPECULARTERM,t.receiveShadows)},"BindLogDepth",0,function(e,t,i){if(!e||e.LOGARITHMICDEPTH||e.indexOf&&e.indexOf("LOGARITHMICDEPTH")>=0){let e=i.activeCamera;1===e.mode&&P.Logger.Error("Logarithmic depth is not compatible with orthographic cameras!",20),t.setFloat("logarithmicDepthConstant",2/(Math.log(e.maxZ+1)/Math.LN2))}},"BindMorphTargetParameters",0,function(e,t){let i=e.morphTargetManager;e&&i&&t.setFloatArray("morphTargetInfluences",i.influences)},"BindSceneUniformBuffer",0,H,"BindTextureMatrix",0,function(e,t,i){let r=e.getTextureMatrix();t.updateMatrix(i+"Matrix",r)},"HandleFallbacksForShadows",0,function(e,t,i=4,r=0){let s=0;for(let n=0;n<i&&e["LIGHT"+n];n++)n>0&&(s=r+n,t.addFallback(s,"LIGHT"+n)),!e.SHADOWS&&(e["SHADOW"+n]&&t.addFallback(r,"SHADOW"+n),e["SHADOWPCF"+n]&&t.addFallback(r,"SHADOWPCF"+n),e["SHADOWPCSS"+n]&&t.addFallback(r,"SHADOWPCSS"+n),e["SHADOWPOISSON"+n]&&t.addFallback(r,"SHADOWPOISSON"+n),e["SHADOWESM"+n]&&t.addFallback(r,"SHADOWESM"+n),e["SHADOWCLOSEESM"+n]&&t.addFallback(r,"SHADOWCLOSEESM"+n));return s},"PrepareAttributesForBakedVertexAnimation",0,function(e,t,i){i.BAKED_VERTEX_ANIMATION_TEXTURE&&i.INSTANCES&&e.push("bakedVertexAnimationSettingsInstanced")},"PrepareAttributesForBones",0,function(e,t,i,r){i.NUM_BONE_INFLUENCERS>0&&(r.addCPUSkinningFallback(0,t),e.push("matricesIndices"),e.push("matricesWeights"),i.NUM_BONE_INFLUENCERS>4&&(e.push("matricesIndicesExtra"),e.push("matricesWeightsExtra")))},"PrepareAttributesForInstances",0,function(e,t){(t.INSTANCES||t.THIN_INSTANCES)&&U(e,!!t.PREPASS_VELOCITY),t.INSTANCESCOLOR&&e.push("instanceColor")},"PrepareAttributesForMorphTargets",0,k,"PrepareDefinesAndAttributesForMorphTargets",0,function(e,t,i,r,s,n,a,l,o,h){let c=e.numMaxInfluencers||e.numInfluencers;return c<=0?0:(t.push("#define MORPHTARGETS"),e.hasPositions&&t.push("#define MORPHTARGETTEXTURE_HASPOSITIONS"),e.hasNormals&&t.push("#define MORPHTARGETTEXTURE_HASNORMALS"),e.hasTangents&&t.push("#define MORPHTARGETTEXTURE_HASTANGENTS"),e.hasUVs&&t.push("#define MORPHTARGETTEXTURE_HASUVS"),e.hasUV2s&&t.push("#define MORPHTARGETTEXTURE_HASUV2S"),e.hasColors&&t.push("#define MORPHTARGETTEXTURE_HASCOLORS"),e.supportsPositions&&s&&t.push("#define MORPHTARGETS_POSITION"),e.supportsNormals&&n&&t.push("#define MORPHTARGETS_NORMAL"),e.supportsTangents&&a&&t.push("#define MORPHTARGETS_TANGENT"),e.supportsUVs&&l&&t.push("#define MORPHTARGETS_UV"),e.supportsUV2s&&o&&t.push("#define MORPHTARGETS_UV2"),e.supportsColors&&h&&t.push("#define MORPHTARGETS_COLOR"),t.push("#define NUM_MORPH_INFLUENCERS "+c),e.isUsingTextureForTargets&&t.push("#define MORPHTARGETS_TEXTURE"),B.NUM_MORPH_INFLUENCERS=c,B.NORMAL=n,B.TANGENT=a,B.UV=l,B.UV2=o,B.COLOR=h,k(i,r,B,s),c)},"PrepareDefinesForAttributes",0,function(e,t,i,r,s=!1,n=!0,a=!0){let l,o;if(!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs)return!1;t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent("normal"),t._needNormals&&e.isVerticesDataPresent("tangent")&&(t.TANGENT=!0);for(let i=1;i<=6;++i)t["UV"+i]=!!t._needUVs&&e.isVerticesDataPresent(`uv${1===i?"":i}`);if(i){let i=e.useVertexColors&&e.isVerticesDataPresent("color");t.VERTEXCOLOR=i,t.VERTEXALPHA=e.hasVertexAlpha&&i&&n}return e.isVerticesDataPresent("instanceColor")&&(e.hasInstances||e.hasThinInstances)&&(t.INSTANCESCOLOR=!0),r&&function(e,t){if(e.useBones&&e.computeBonesUsingShaders&&e.skeleton){t.NUM_BONE_INFLUENCERS=e.numBoneInfluencers;let i=void 0!==t.BONETEXTURE;if(e.skeleton.isUsingTextureForMatrices&&i)t.BONETEXTURE=!0;else{t.BonesPerMesh=e.skeleton.bones.length+1,t.BONETEXTURE=!i&&void 0;let r=e.getScene(),s=r.prePassRenderer;s&&s.enabled&&(t.BONES_VELOCITY_ENABLED=-1===s.excludedSkinnedMesh.indexOf(e));let n=!0===t.MULTIVIEW,a=2*t.BonesPerMesh+ +!!n;if(V.get(e.skeleton)!==a){V.set(e.skeleton,a);let i=r.getEngine().getCaps().maxVertexUniformVectors;if(i&&!W.has(e.skeleton)){let r=4*t.BonesPerMesh,s=Math.max(i-(n?64:40),0);(r>s||n&&3*r>i)&&(W.add(e.skeleton),P.Logger.Warn(`Skeleton "${e.skeleton.name}": ${e.skeleton.bones.length} bones stored as vertex uniforms use ${r} of ~${s} usable uniform vectors${n?" (multiview)":""} on a device reporting ${i}. This can exceed the GPU vertex-uniform limit and make the mesh silently fail to render. Set skeleton.useTextureToStoreBoneMatrices = true to store bone matrices in a texture.`))}}}}else t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,void 0!==t.BONETEXTURE&&(t.BONETEXTURE=!1)}(e,t),s&&((l=e.morphTargetManager)?(t.MORPHTARGETS_UV=l.supportsUVs&&t.UV1,t.MORPHTARGETS_UV2=l.supportsUV2s&&t.UV2,t.MORPHTARGETS_TANGENT=l.supportsTangents&&t.TANGENT,t.MORPHTARGETS_NORMAL=l.supportsNormals&&t.NORMAL,t.MORPHTARGETS_POSITION=l.supportsPositions,t.MORPHTARGETS_COLOR=l.supportsColors,t.MORPHTARGETTEXTURE_HASUVS=l.hasUVs,t.MORPHTARGETTEXTURE_HASUV2S=l.hasUV2s,t.MORPHTARGETTEXTURE_HASTANGENTS=l.hasTangents,t.MORPHTARGETTEXTURE_HASNORMALS=l.hasNormals,t.MORPHTARGETTEXTURE_HASPOSITIONS=l.hasPositions,t.MORPHTARGETTEXTURE_HASCOLORS=l.hasColors,t.NUM_MORPH_INFLUENCERS=l.numMaxInfluencers||l.numInfluencers,t.MORPHTARGETS=t.NUM_MORPH_INFLUENCERS>0,t.MORPHTARGETS_TEXTURE=l.isUsingTextureForTargets):(t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_UV2=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS_POSITION=!1,t.MORPHTARGETS_COLOR=!1,t.MORPHTARGETTEXTURE_HASUVS=!1,t.MORPHTARGETTEXTURE_HASUV2S=!1,t.MORPHTARGETTEXTURE_HASTANGENTS=!1,t.MORPHTARGETTEXTURE_HASNORMALS=!1,t.MORPHTARGETTEXTURE_HASPOSITIONS=!1,t.MORPHTARGETTEXTURE_HAS_COLORS=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)),a&&(t.BAKED_VERTEX_ANIMATION_TEXTURE=!!(o=e.bakedVertexAnimationManager)&&!!o.isEnabled),!0},"PrepareDefinesForFrameBoundValues",0,function(e,t,i,r,s,n=null,a=!1){let l=function(e,t){let i=!1;if(e.activeCamera){let r=+!!t.CAMERA_ORTHOGRAPHIC,s=+!!t.CAMERA_PERSPECTIVE,n=+(1===e.activeCamera.mode),a=+(0===e.activeCamera.mode);(r^n||s^a)&&(t.CAMERA_ORTHOGRAPHIC=1===n,t.CAMERA_PERSPECTIVE=1===a,i=!0)}return i}(e,r);!1!==n&&(l=y(i,e,r)),!t.getColorWrite()!==r.DEPTHPREPASS&&(r.DEPTHPREPASS=!r.DEPTHPREPASS,l=!0),r.INSTANCES!==s&&(r.INSTANCES=s,l=!0),r.THIN_INSTANCES!==a&&(r.THIN_INSTANCES=a,l=!0),l&&r.markAsUnprocessed()},"PrepareDefinesForIBL",0,function(e,t,i,r=!1,s=8,n=!1){if(t&&N.ReflectionTextureEnabled){if(!t.isReadyOrNotBlocking())return!1;i._needNormals=!0,i.REFLECTION=!0,i.GAMMAREFLECTION=t.gammaSpace,i.RGBDREFLECTION=t.isRGBD,i.LODINREFLECTIONALPHA=t.lodLevelInAlpha,i.LINEARSPECULARREFLECTION=t.linearSpecularLOD,i.USEIRRADIANCEMAP=!1,i.LODBASEDMICROSFURACE=e.getEngine().getCaps().textureLOD;let a=e.getEngine();switch(r&&s>0?(i.NUM_SAMPLES=""+s,a._features.needTypeSuffixInShaderConstants&&(i.NUM_SAMPLES=i.NUM_SAMPLES+"u"),i.REALTIME_FILTERING=!0,e.iblCdfGenerator&&(i.IBL_CDF_FILTERING=!0)):i.REALTIME_FILTERING=!1,i.INVERTCUBICMAP=6===t.coordinatesMode,i.REFLECTIONMAP_3D=t.isCube,i.REFLECTIONMAP_OPPOSITEZ=i.REFLECTIONMAP_3D&&e.useRightHandedSystem?!t.invertZ:t.invertZ,i.REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,t.coordinatesMode){case 0:i.REFLECTIONMAP_EXPLICIT=!0;break;case 2:i.REFLECTIONMAP_PLANAR=!0;break;case 4:i.REFLECTIONMAP_PROJECTION=!0;break;case 5:i.REFLECTIONMAP_SKYBOX=!0;break;case 1:i.REFLECTIONMAP_SPHERICAL=!0;break;case 7:i.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case 8:i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case 9:i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;default:i.REFLECTIONMAP_CUBIC=!0,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!!t.boundingBoxSize}5!==t.coordinatesMode&&(t.irradianceTexture?(i.USEIRRADIANCEMAP=!0,i.USESPHERICALFROMREFLECTIONMAP=!1,i.USESPHERICALINVERTEX=!1,t.irradianceTexture._dominantDirection?i.USE_IRRADIANCE_DOMINANT_DIRECTION=!0:i.USE_IRRADIANCE_DOMINANT_DIRECTION=!1):t.isCube&&(i.USESPHERICALFROMREFLECTIONMAP=!0,i.USEIRRADIANCEMAP=!1,i.USE_IRRADIANCE_DOMINANT_DIRECTION=!1,i.USESPHERICALINVERTEX=n))}else i.REFLECTION=!1,i.REFLECTIONMAP_3D=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_CUBIC=!1,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,i.INVERTCUBICMAP=!1,i.USESPHERICALFROMREFLECTIONMAP=!1,i.USEIRRADIANCEMAP=!1,i.USE_IRRADIANCE_DOMINANT_DIRECTION=!1,i.USESPHERICALINVERTEX=!1,i.REFLECTIONMAP_OPPOSITEZ=!1,i.LODINREFLECTIONALPHA=!1,i.GAMMAREFLECTION=!1,i.RGBDREFLECTION=!1,i.LINEARSPECULARREFLECTION=!1;return!0},"PrepareDefinesForLights",0,function(e,t,i,r,s=4,n=!1){if(!i._areLightsDirty)return i._needNormals;let a=0,l={needNormals:i._needNormals,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(e.lightsEnabled&&!n){for(let n of t.lightSources)if(function(e,t,i,r,s,n,a){switch(a.needNormals=!0,void 0===s["LIGHT"+r]&&(a.needRebuild=!0),s["LIGHT"+r]=!0,s["SPOTLIGHT"+r]=!1,s["HEMILIGHT"+r]=!1,s["POINTLIGHT"+r]=!1,s["DIRLIGHT"+r]=!1,s["AREALIGHT"+r]=!1,s["CLUSTLIGHT"+r]=!1,i.prepareLightSpecificDefines(s,r),s["LIGHT_FALLOFF_PHYSICAL"+r]=!1,s["LIGHT_FALLOFF_GLTF"+r]=!1,s["LIGHT_FALLOFF_STANDARD"+r]=!1,i.falloffType){case D.LightConstants.FALLOFF_GLTF:s["LIGHT_FALLOFF_GLTF"+r]=!0;break;case D.LightConstants.FALLOFF_PHYSICAL:s["LIGHT_FALLOFF_PHYSICAL"+r]=!0;break;case D.LightConstants.FALLOFF_STANDARD:s["LIGHT_FALLOFF_STANDARD"+r]=!0}if(n&&!i.specular.equalsFloats(0,0,0)&&(a.specularEnabled=!0),s["SHADOW"+r]=!1,s["SHADOWCSM"+r]=!1,s["SHADOWCSMDEBUG"+r]=!1,s["SHADOWCSMNUM_CASCADES"+r]=!1,s["SHADOWCSMUSESHADOWMAXZ"+r]=!1,s["SHADOWCSMNOBLEND"+r]=!1,s["SHADOWCSM_RIGHTHANDED"+r]=!1,s["SHADOWPCF"+r]=!1,s["SHADOWPCSS"+r]=!1,s["SHADOWPOISSON"+r]=!1,s["SHADOWESM"+r]=!1,s["SHADOWCLOSEESM"+r]=!1,s["SHADOWCUBE"+r]=!1,s["SHADOWLOWQUALITY"+r]=!1,s["SHADOWMEDIUMQUALITY"+r]=!1,t&&t.receiveShadows&&e.shadowsEnabled&&i.shadowEnabled){let t=i.getShadowGenerator(e.activeCamera)??i.getShadowGenerator();if(t){let e=t.getShadowMap();e&&e.renderList&&e.renderList.length>0&&(a.shadowEnabled=!0,t.prepareDefines(s,r))}}i.lightmapMode!=D.LightConstants.LIGHTMAP_DEFAULT?(a.lightmapMode=!0,s["LIGHTMAPEXCLUDED"+r]=!0,s["LIGHTMAPNOSPECULAR"+r]=i.lightmapMode==D.LightConstants.LIGHTMAP_SHADOWSONLY):(s["LIGHTMAPEXCLUDED"+r]=!1,s["LIGHTMAPNOSPECULAR"+r]=!1)}(e,t,n,a,i,r,l),++a===s)break}i.SPECULARTERM=l.specularEnabled,i.SHADOWS=l.shadowEnabled;let o=Math.max(s,i.MAXLIGHTCOUNT||0);for(let e=a;e<o;e++)void 0!==i["LIGHT"+e]&&(i["LIGHT"+e]=!1,i["HEMILIGHT"+e]=!1,i["POINTLIGHT"+e]=!1,i["DIRLIGHT"+e]=!1,i["SPOTLIGHT"+e]=!1,i["AREALIGHT"+e]=!1,i["CLUSTLIGHT"+e]=!1,i["SHADOW"+e]=!1,i["SHADOWCSM"+e]=!1,i["SHADOWCSMDEBUG"+e]=!1,i["SHADOWCSMNUM_CASCADES"+e]=!1,i["SHADOWCSMUSESHADOWMAXZ"+e]=!1,i["SHADOWCSMNOBLEND"+e]=!1,i["SHADOWCSM_RIGHTHANDED"+e]=!1,i["SHADOWPCF"+e]=!1,i["SHADOWPCSS"+e]=!1,i["SHADOWPOISSON"+e]=!1,i["SHADOWESM"+e]=!1,i["SHADOWCLOSEESM"+e]=!1,i["SHADOWCUBE"+e]=!1,i["SHADOWLOWQUALITY"+e]=!1,i["SHADOWMEDIUMQUALITY"+e]=!1);i.LIGHTCOUNT=a,i.MAXLIGHTCOUNT=s;let h=e.getEngine().getCaps();return void 0===i.SHADOWFLOAT&&(l.needRebuild=!0),i.SHADOWFLOAT=l.shadowEnabled&&(h.textureFloatRender&&h.textureFloatLinearFiltering||h.textureHalfFloatRender&&h.textureHalfFloatLinearFiltering),i.LIGHTMAPEXCLUDED=l.lightmapMode,l.needRebuild&&i.rebuild(),l.needNormals},"PrepareDefinesForMergedUV",0,function(e,t,i){t._needUVs=!0,t[i]=!0,e.optimizeUVAllocation&&e.getTextureMatrix().isIdentityAs3x2()?(t[i+"DIRECTUV"]=e.coordinatesIndex+1,t["MAINUV"+(e.coordinatesIndex+1)]=!0):t[i+"DIRECTUV"]=0},"PrepareDefinesForMisc",0,function(e,t,i,r,s,n,a,l=!1,o=!1,h,c){if(a._areMiscDirty){a.LOGARITHMICDEPTH=i,a.POINTSIZE=r,a.FOG=s&&t.fogEnabled&&e.applyFog&&0!==t.fogMode,a.NONUNIFORMSCALING=e.nonUniformScaling,a.ALPHATEST=n,a.DECAL_AFTER_DETAIL=l,a.USE_VERTEX_PULLING=o,a.RIGHT_HANDED=t.useRightHandedSystem;let u=h?.geometry?.getIndexBuffer(),d=!!h&&h.isUnIndexed;a.VERTEX_PULLING_USE_INDEX_BUFFER=!!u&&!d,a.VERTEX_PULLING_INDEX_BUFFER_32BITS=!!u&&!d&&u.is32Bits,a.VERTEXOUTPUT_INVARIANT=!!c}},"PrepareDefinesForMultiview",0,function(e,t){if(e.activeCamera){let i=t.MULTIVIEW;t.MULTIVIEW=null!==e.activeCamera.outputRenderTarget&&e.activeCamera.outputRenderTarget.getViewCount()>1,t.MULTIVIEW!=i&&t.markAsUnprocessed()}},"PrepareDefinesForOIT",0,function(e,t,i){let r=t.ORDER_INDEPENDENT_TRANSPARENCY,s=t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS;t.ORDER_INDEPENDENT_TRANSPARENCY=e.useOrderIndependentTransparency&&i,t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!e.getEngine().getCaps().textureFloatLinearFiltering,(r!==t.ORDER_INDEPENDENT_TRANSPARENCY||s!==t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS)&&t.markAsUnprocessed()},"PrepareDefinesForPrePass",0,function(e,t,i){let r=t.PREPASS;if(!t._arePrePassDirty)return;let s=[{type:1,define:"PREPASS_POSITION",index:"PREPASS_POSITION_INDEX"},{type:9,define:"PREPASS_LOCAL_POSITION",index:"PREPASS_LOCAL_POSITION_INDEX"},{type:2,define:"PREPASS_VELOCITY",index:"PREPASS_VELOCITY_INDEX"},{type:11,define:"PREPASS_VELOCITY_LINEAR",index:"PREPASS_VELOCITY_LINEAR_INDEX"},{type:3,define:"PREPASS_REFLECTIVITY",index:"PREPASS_REFLECTIVITY_INDEX"},{type:0,define:"PREPASS_IRRADIANCE_LEGACY",index:"PREPASS_IRRADIANCE_LEGACY_INDEX"},{type:7,define:"PREPASS_ALBEDO_SQRT",index:"PREPASS_ALBEDO_SQRT_INDEX"},{type:5,define:"PREPASS_DEPTH",index:"PREPASS_DEPTH_INDEX"},{type:10,define:"PREPASS_SCREENSPACE_DEPTH",index:"PREPASS_SCREENSPACE_DEPTH_INDEX"},{type:6,define:"PREPASS_NORMAL",index:"PREPASS_NORMAL_INDEX"},{type:8,define:"PREPASS_WORLD_NORMAL",index:"PREPASS_WORLD_NORMAL_INDEX"},{type:14,define:"PREPASS_IRRADIANCE",index:"PREPASS_IRRADIANCE_INDEX"}];if(e.prePassRenderer&&e.prePassRenderer.enabled&&i){t.PREPASS=!0,t.SCENE_MRT_COUNT=e.prePassRenderer.mrtCount,t.PREPASS_NORMAL_WORLDSPACE=e.prePassRenderer.generateNormalsInWorldSpace,t.PREPASS_COLOR=!0,t.PREPASS_COLOR_INDEX=0;for(let i=0;i<s.length;i++){let r=e.prePassRenderer.getIndex(s[i].type);-1!==r?(t[s[i].define]=!0,t[s[i].index]=r):t[s[i].define]=!1}}else{t.PREPASS=!1;for(let e=0;e<s.length;e++)t[s[e].define]=!1}t.PREPASS!=r&&(t.markAsUnprocessed(),t.markAsImageProcessingDirty())},"PrepareUniformLayoutForIBL",0,function(e,t=!1,i=!1,r=!1,s=!1,n=!1){e.addUniform("vReflectionInfos",2),e.addUniform("reflectionMatrix",16),t&&e.addUniform("vReflectionMicrosurfaceInfos",3),i&&(e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3)),r&&(e.addUniform("vReflectionFilteringInfo",2),e.addUniform("vReflectionDominantDirection",3)),n&&e.addUniform("vReflectionColor",3),s&&(e.addUniform("vSphericalL00",3),e.addUniform("vSphericalL1_1",3),e.addUniform("vSphericalL10",3),e.addUniform("vSphericalL11",3),e.addUniform("vSphericalL2_2",3),e.addUniform("vSphericalL2_1",3),e.addUniform("vSphericalL20",3),e.addUniform("vSphericalL21",3),e.addUniform("vSphericalL22",3),e.addUniform("vSphericalX",3),e.addUniform("vSphericalY",3),e.addUniform("vSphericalZ",3),e.addUniform("vSphericalXX_ZZ",3),e.addUniform("vSphericalYY_ZZ",3),e.addUniform("vSphericalZZ",3),e.addUniform("vSphericalXY",3),e.addUniform("vSphericalYZ",3),e.addUniform("vSphericalZX",3))},"PrepareUniformsAndSamplersForIBL",0,function(e,t,i){let r=["vReflectionMicrosurfaceInfos","vReflectionDominantDirection","reflectionMatrix","vReflectionInfos","vReflectionPosition","vReflectionSize","vReflectionColor","vReflectionFilteringInfo"];i&&r.push("vSphericalX","vSphericalY","vSphericalZ","vSphericalXX_ZZ","vSphericalYY_ZZ","vSphericalZZ","vSphericalXY","vSphericalYZ","vSphericalZX","vSphericalL00","vSphericalL1_1","vSphericalL10","vSphericalL11","vSphericalL2_2","vSphericalL2_1","vSphericalL20","vSphericalL21","vSphericalL22"),e.push(...r),t.push("reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh","irradianceSampler","icdfSampler")},"PrepareUniformsAndSamplersList",0,function(e,t,i,r=4){let s,n,a=null;e.uniformsNames?(s=e.uniformsNames,n=e.uniformBuffersNames,t=e.samplers,i=e.defines,r=e.maxSimultaneousLights||0,a=e.shaderLanguage??null):(s=e,t||(t=[]));for(let e=0;e<r&&i["LIGHT"+e];e++)!function(e,t,i,r,s=null,n=!1,a=!1,l=!1,o=!1,h=!1){s&&s.push("Light"+e),!n&&(t.push("vLightData"+e,"vLightDiffuse"+e,"vLightSpecular"+e,"vLightDirection"+e,"vLightWidth"+e,"vLightHeight"+e,"vLightFalloff"+e,"vLightGround"+e,"vSliceData"+e,"vSliceRanges"+e,"lightMatrix"+e,"shadowsInfo"+e,"depthValues"+e),i.push("shadowTexture"+e),i.push("depthTexture"+e),t.push("viewFrustumZ"+e,"cascadeBlendFactor"+e,"lightSizeUVCorrection"+e,"depthCorrection"+e,"penumbraDarkness"+e,"frustumLengths"+e),r&&(i.push("projectionLightTexture"+e),t.push("textureProjectionMatrix"+e)),a&&i.push("iesLightTexture"+e),o&&i.push("rectAreaLightEmissionTexture"+e),l&&(i.push("lightDataTexture"+e),h||i.push("tileMaskTexture"+e)))}(e,s,t,i["PROJECTEDLIGHTTEXTURE"+e],n,!1,i["IESLIGHTTEXTURE"+e],i["CLUSTLIGHT"+e],i["RECTAREALIGHTEMISSIONTEXTURE"+e],1===a);i.NUM_MORPH_INFLUENCERS&&(s.push("morphTargetInfluences"),s.push("morphTargetCount")),i.BAKED_VERTEX_ANIMATION_TEXTURE&&(s.push("bakedVertexAnimationSettings"),s.push("bakedVertexAnimationTextureSizeInverted"),s.push("bakedVertexAnimationTime"),t.push("bakedVertexAnimationTexture"))},"PushAttributesForInstances",0,U],97001);var w=e.i(18064);class G{get useVertexPulling(){return this._useVertexPulling}set useVertexPulling(e){this._useVertexPulling!==e&&(this._useVertexPulling=e,this.markAsDirty(G.MiscDirtyFlag))}get _supportGlowLayer(){return!1}set _glowModeEnabled(e){}get shaderLanguage(){return this._shaderLanguage}get canRenderToMRT(){return!1}set alpha(e){if(this._alpha===e)return;let t=this._alpha;this._alpha=e,(1===t||1===e)&&this.markAsDirty(G.MiscDirtyFlag+G.PrePassDirtyFlag)}get alpha(){return this._alpha}set backFaceCulling(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,this.markAsDirty(G.TextureDirtyFlag))}get backFaceCulling(){return this._backFaceCulling}set textureRepetitionMode(e){let t=Math.max(0,Math.min(0|e,4));this._textureRepetitionMode!==t&&(this._textureRepetitionMode=t,this.markAsDirty(G.TextureDirtyFlag))}get textureRepetitionMode(){return this._textureRepetitionMode}set cullBackFaces(e){this._cullBackFaces!==e&&(this._cullBackFaces=e,this.markAsDirty(G.TextureDirtyFlag))}get cullBackFaces(){return this._cullBackFaces}get blockDirtyMechanism(){return this._blockDirtyMechanism}set blockDirtyMechanism(e){this._blockDirtyMechanism!==e&&(this._blockDirtyMechanism=e,e||this.markDirty())}atomicMaterialsUpdate(e){this.blockDirtyMechanism=!0;try{e(this)}finally{this.blockDirtyMechanism=!1}}get hasRenderTargetTextures(){return this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._eventInfo.hasRenderTargetTextures}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get onBindObservable(){return this._onBindObservable||(this._onBindObservable=new n.Observable),this._onBindObservable}set onBind(e){this._onBindObserver&&this.onBindObservable.remove(this._onBindObserver),this._onBindObserver=this.onBindObservable.add(e)}get onUnBindObservable(){return this._onUnBindObservable||(this._onUnBindObservable=new n.Observable),this._onUnBindObservable}get onEffectCreatedObservable(){return this._onEffectCreatedObservable||(this._onEffectCreatedObservable=new n.Observable),this._onEffectCreatedObservable}set alphaMode(e){this._alphaMode[0]!==e&&(this._alphaMode[0]=e,this.markAsDirty(G.TextureDirtyFlag))}get alphaMode(){return this._alphaMode[0]}get alphaModes(){return this._alphaMode}setAlphaMode(e,t=0){this._alphaMode[t]!==e&&(this._alphaMode[t]=e,this.markAsDirty(G.TextureDirtyFlag))}set needDepthPrePass(e){this._needDepthPrePass!==e&&(this._needDepthPrePass=e,this._needDepthPrePass&&(this.checkReadyOnEveryCall=!0))}get needDepthPrePass(){return this._needDepthPrePass}get isPrePassCapable(){return!1}set fogEnabled(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAsDirty(G.MiscDirtyFlag))}get fogEnabled(){return this._fogEnabled}get wireframe(){switch(this._fillMode){case G.WireFrameFillMode:case G.LineListDrawMode:case G.LineLoopDrawMode:case G.LineStripDrawMode:return!0}return this._scene.forceWireframe}set wireframe(e){this.fillMode=e?G.WireFrameFillMode:G.TriangleFillMode}get pointsCloud(){switch(this._fillMode){case G.PointFillMode:case G.PointListDrawMode:return!0}return this._scene.forcePointsCloud}set pointsCloud(e){this.fillMode=e?G.PointFillMode:G.TriangleFillMode}get fillMode(){return this._fillMode}set fillMode(e){this._fillMode!==e&&(this._fillMode=e,this.markAsDirty(G.MiscDirtyFlag))}get useLogarithmicDepth(){return this._useLogarithmicDepth}set useLogarithmicDepth(e){let t=this.getScene().getEngine().getCaps().fragmentDepthSupported;e&&!t&&P.Logger.Warn("Logarithmic depth has been requested for a material on a device that doesn't support it."),this._useLogarithmicDepth=e&&t,this._markAllSubMeshesAsMiscDirty()}get isVertexOutputInvariant(){return this._isVertexOutputInvariant}set isVertexOutputInvariant(e){this._isVertexOutputInvariant!==e&&(this._isVertexOutputInvariant=e,this._markAllSubMeshesAsMiscDirty())}_getDrawWrapper(){return this._drawWrapper}_setDrawWrapper(e){this._drawWrapper=e}constructor(e,t,i,r=!1){this.shadowDepthWrapper=null,this.allowShaderHotSwapping=!0,this._shaderLanguage=0,this._forceGLSL=!1,this._useVertexPulling=!1,this.metadata=null,this.reservedDataStore=null,this.checkReadyOnEveryCall=!1,this.checkReadyOnlyOnce=!1,this.state="",this._alpha=1,this._backFaceCulling=!0,this._textureRepetitionMode=0,this.textureRepetitionHexTilingParams=[1,.6,7,.5],this._cullBackFaces=!0,this._blockDirtyMechanism=!1,this.sideOrientation=null,this.onCompiled=null,this.onError=null,this.getRenderTargetTextures=null,this.doNotSerialize=!1,this._storeEffectOnSubMeshes=!1,this.animations=null,this.onDisposeObservable=new n.Observable,this._onDisposeObserver=null,this._onUnBindObservable=null,this._onBindObserver=null,this._alphaMode=[2],this._needDepthPrePass=!1,this.disableDepthWrite=!1,this.disableColorWrite=!1,this.forceDepthWrite=!1,this.depthFunction=0,this.separateCullingPass=!1,this._fogEnabled=!0,this.pointSize=1,this.zOffset=0,this.zOffsetUnits=0,this.stencil=new x,this._isVertexOutputInvariant=G.ForceVertexOutputInvariant,this._useUBO=!1,this._fillMode=G.TriangleFillMode,this._cachedDepthWriteState=!1,this._cachedColorWriteState=!1,this._cachedDepthFunctionState=0,this._indexInSceneMaterialArray=-1,this.meshMap=null,this._parentContainer=null,this._uniformBufferLayoutBuilt=!1,this._eventInfo={},this._callbackPluginEventGeneric=()=>void 0,this._callbackPluginEventIsReadyForSubMesh=()=>void 0,this._callbackPluginEventPrepareDefines=()=>void 0,this._callbackPluginEventPrepareDefinesBeforeAttributes=()=>void 0,this._callbackPluginEventHardBindForSubMesh=()=>void 0,this._callbackPluginEventBindForSubMesh=()=>void 0,this._callbackPluginEventHasRenderTargetTextures=()=>void 0,this._callbackPluginEventFillRenderTargetTextures=()=>void 0,this._transparencyMode=null,this.name=e;const l=t||a.EngineStore.LastCreatedScene;if(!l)return;this._scene=l,this._dirtyCallbacks={},this._forceGLSL=r,this._dirtyCallbacks[1]=this._markAllSubMeshesAsTexturesDirty.bind(this),this._dirtyCallbacks[2]=this._markAllSubMeshesAsLightsDirty.bind(this),this._dirtyCallbacks[4]=this._markAllSubMeshesAsFresnelDirty.bind(this),this._dirtyCallbacks[8]=this._markAllSubMeshesAsAttributesDirty.bind(this),this._dirtyCallbacks[16]=this._markAllSubMeshesAsMiscDirty.bind(this),this._dirtyCallbacks[32]=this._markAllSubMeshesAsPrePassDirty.bind(this),this._dirtyCallbacks[127]=this._markAllSubMeshesAsAllDirty.bind(this),this.id=e||s.Tools.RandomId(),this.uniqueId=this._scene.getUniqueId(),this._materialContext=this._scene.getEngine().createMaterialContext(),this._drawWrapper=new M.DrawWrapper(this._scene.getEngine(),!1),this._drawWrapper.materialContext=this._materialContext,this._uniformBuffer=new I.UniformBuffer(this._scene.getEngine(),void 0,void 0,e),this._useUBO=this.getScene().getEngine().supportsUniformBuffers,this._createUniformBuffer(),i||this._scene.addMaterial(this),this._scene.useMaterialMeshMap&&(this.meshMap={}),G.OnEventObservable.notifyObservers(this,1)}_createUniformBuffer(){let e=this.getScene().getEngine();this._uniformBuffer?.dispose(),e.isWebGPU&&!this._forceGLSL?(this._uniformBuffer=new I.UniformBuffer(e,void 0,void 0,this.name,!0),this._shaderLanguage=1):this._uniformBuffer=new I.UniformBuffer(this._scene.getEngine(),void 0,void 0,this.name),this._uniformBufferLayoutBuilt=!1}toString(e){return"Name: "+this.name}getClassName(){return"Material"}get _isMaterial(){return!0}get isFrozen(){return this.checkReadyOnlyOnce}freeze(){this.markDirty(),this.checkReadyOnlyOnce=!0}unfreeze(){this.markDirty(),this.checkReadyOnlyOnce=!1}isReady(e,t){return!0}isReadyForSubMesh(e,t,i){let r=t.materialDefines;return!!r&&(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=r,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),this._eventInfo.isReadyForSubMesh)}getEffect(){return this._drawWrapper.effect}getScene(){return this._scene}_getEffectiveOrientation(e){return null!==this.sideOrientation?this.sideOrientation:e.sideOrientation}get transparencyMode(){return this._transparencyMode}set transparencyMode(e){this._transparencyMode!==e&&(this._transparencyMode=e,this._markAllSubMeshesAsTexturesAndMiscDirty())}get _hasTransparencyMode(){return null!=this._transparencyMode}get _transparencyModeIsBlend(){return this._transparencyMode===G.MATERIAL_ALPHABLEND||this._transparencyMode===G.MATERIAL_ALPHATESTANDBLEND}get _transparencyModeIsTest(){return this._transparencyMode===G.MATERIAL_ALPHATEST||this._transparencyMode===G.MATERIAL_ALPHATESTANDBLEND}get _disableAlphaBlending(){return this._transparencyMode===G.MATERIAL_OPAQUE||this._transparencyMode===G.MATERIAL_ALPHATEST}needAlphaBlending(){return this._hasTransparencyMode?this._transparencyModeIsBlend:!this._disableAlphaBlending&&this.alpha<1}needAlphaBlendingForMesh(e){return this._hasTransparencyMode?this._transparencyModeIsBlend:e.visibility<1||!this._disableAlphaBlending&&(e.hasVertexAlpha||this.needAlphaBlending())}needAlphaTesting(){return!!this._hasTransparencyMode&&this._transparencyModeIsTest}needAlphaTestingForMesh(e){return this._hasTransparencyMode?this._transparencyModeIsTest:!this.needAlphaBlendingForMesh(e)&&this.needAlphaTesting()}getAlphaTestTexture(){return null}markDirty(e=!1){for(let t of this.getScene().meshes)if(t.subMeshes){for(let i of t.subMeshes)if(i.getMaterial()===this)for(let t of i._drawWrappers)t&&this._materialContext===t.materialContext&&(t._wasPreviouslyReady=!1,t._wasPreviouslyUsingInstances=null,t._forceRebindOnNextCall=e)}e&&this.markAsDirty(G.AllDirtyFlag)}_preBind(e,t=null){let i=this._scene.getEngine(),r=(null==t?this.sideOrientation:t)===G.ClockWiseSideOrientation,s=e||this._getDrawWrapper();return(0,w.IsWrapper)(s)&&s.materialContext&&(s.materialContext.useVertexPulling=this.useVertexPulling),i.enableEffect(s),i.setState(this.backFaceCulling,this.zOffset,!1,r,this._scene._mirroredCameraPosition?!this.cullBackFaces:this.cullBackFaces,this.stencil,this.zOffsetUnits),r}bind(e,t){}buildUniformLayout(){let e=this._uniformBuffer;this._eventInfo.ubo=e,this._callbackPluginEventGeneric(8,this._eventInfo),e.create(),this._uniformBufferLayoutBuilt=!0}bindForSubMesh(e,t,i){let r=i._drawWrapper;this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),r._forceRebindOnNextCall=!1}bindOnlyWorldMatrix(e){}bindView(e){this._useUBO?this._needToBindSceneUbo=!0:e.setMatrix("view",this.getScene().getViewMatrix())}bindViewProjection(e){this._useUBO?this._needToBindSceneUbo=!0:(e.setMatrix("viewProjection",this.getScene().getTransformMatrix()),e.setMatrix("projection",this.getScene().getProjectionMatrix()),e.setMatrix("inverseProjection",this.getScene().getInverseProjectionMatrix()))}bindEyePosition(e,t){this._useUBO?this._needToBindSceneUbo=!0:this._scene.bindEyePosition(e,t)}_afterBind(e,t=null,i){if(this._scene._cachedMaterial=this,this._needToBindSceneUbo&&t&&(this._needToBindSceneUbo=!1,H(t,this.getScene().getSceneUniformBuffer()),this._scene.finalizeSceneUbo()),e?this._scene._cachedVisibility=e.visibility:this._scene._cachedVisibility=1,this._onBindObservable&&e&&this._onBindObservable.notifyObservers(e),this.disableDepthWrite){let e=this._scene.getEngine();this._cachedDepthWriteState=e.getDepthWrite(),e.setDepthWrite(!1)}if(this.disableColorWrite){let e=this._scene.getEngine();this._cachedColorWriteState=e.getColorWrite(),e.setColorWrite(!1)}if(0!==this.depthFunction){let e=this._scene.getEngine();this._cachedDepthFunctionState=e.getDepthFunction()||0,e.setDepthFunction(this.depthFunction)}}unbind(){this._scene.getSceneUniformBuffer().unbindEffect(),this._onUnBindObservable&&this._onUnBindObservable.notifyObservers(this),0!==this.depthFunction&&this._scene.getEngine().setDepthFunction(this._cachedDepthFunctionState),this.disableDepthWrite&&this._scene.getEngine().setDepthWrite(this._cachedDepthWriteState),this.disableColorWrite&&this._scene.getEngine().setColorWrite(this._cachedColorWriteState)}getAnimatables(){return this._eventInfo.animatables=[],this._callbackPluginEventGeneric(256,this._eventInfo),this._eventInfo.animatables}getActiveTextures(){return this._eventInfo.activeTextures=[],this._callbackPluginEventGeneric(512,this._eventInfo),this._eventInfo.activeTextures}hasTexture(e){return this._eventInfo.hasTexture=!1,this._eventInfo.texture=e,this._callbackPluginEventGeneric(1024,this._eventInfo),this._eventInfo.hasTexture}clone(e){return null}_clonePlugins(e,t){let i={};if(this._serializePlugins(i),G._ParsePlugins(i,e,this._scene,t),this.pluginManager)for(let t of this.pluginManager._plugins){let i=e.pluginManager.getPlugin(t.name);i&&t.copyTo(i)}}getBindedMeshes(){if(!this.meshMap)return this._scene.meshes.filter(e=>e.material===this);{let e=[];for(let t in this.meshMap){let i=this.meshMap[t];i&&e.push(i)}return e}}forceCompilation(e,t,i,r){let s={clipPlane:!1,useInstances:!1,...i},n=this.getScene(),a=this.allowShaderHotSwapping;this.allowShaderHotSwapping=!1;let l=()=>{if(!this._scene||!this._scene.getEngine())return;let i=n.clipPlane;if(s.clipPlane&&(n.clipPlane=new R.Plane(0,0,0,1)),this._storeEffectOnSubMeshes){let i=!0,n=null;if(e.subMeshes){let t=new b(0,0,0,0,0,e,void 0,!1,!1);t.materialDefines&&(t.materialDefines._renderId=-1),this.isReadyForSubMesh(e,t,s.useInstances)||(t.effect&&t.effect.getCompilationError()&&t.effect.allFallbacksProcessed()?n=t.effect.getCompilationError():(i=!1,setTimeout(l,16)))}i&&(this.allowShaderHotSwapping=a,n&&r&&r(n),t&&t(this))}else this.isReady()?(this.allowShaderHotSwapping=a,t&&t(this)):setTimeout(l,16);s.clipPlane&&(n.clipPlane=i)};l()}async forceCompilationAsync(e,t){return await new Promise((i,r)=>{this.forceCompilation(e,()=>{i()},t,e=>{r(e)})})}markAsDirty(e){this.getScene().blockMaterialDirtyMechanism||this._blockDirtyMechanism||(G._DirtyCallbackArray.length=0,e&G.ImageProcessingDirtyFlag&&G._DirtyCallbackArray.push(G._ImageProcessingDirtyCallBack),e&G.TextureDirtyFlag&&G._DirtyCallbackArray.push(G._TextureDirtyCallBack),e&G.LightDirtyFlag&&G._DirtyCallbackArray.push(G._LightsDirtyCallBack),e&G.FresnelDirtyFlag&&G._DirtyCallbackArray.push(G._FresnelDirtyCallBack),e&G.AttributesDirtyFlag&&G._DirtyCallbackArray.push(G._AttributeDirtyCallBack),e&G.MiscDirtyFlag&&G._DirtyCallbackArray.push(G._MiscDirtyCallBack),e&G.PrePassDirtyFlag&&G._DirtyCallbackArray.push(G._PrePassDirtyCallBack),G._DirtyCallbackArray.length&&this._markAllSubMeshesAsDirty(G._RunDirtyCallBacks),this.getScene().resetCachedMaterial())}resetDrawCache(){for(let e of this.getScene().meshes)if(e.subMeshes)for(let t of e.subMeshes)t.getMaterial()===this&&t.resetDrawCache()}_markAllSubMeshesAsDirty(e){let t=this.getScene();if(!t.blockMaterialDirtyMechanism&&!this._blockDirtyMechanism){for(let i of t.meshes)if(i.subMeshes){for(let r of i.subMeshes)if((r.getMaterial()||(t._hasDefaultMaterial?t.defaultMaterial:null))===this)for(let t of r._drawWrappers)t&&t.defines&&t.defines.markAllAsDirty&&this._materialContext===t.materialContext&&e(t.defines)}}}_markScenePrePassDirty(){if(this.getScene().blockMaterialDirtyMechanism||this._blockDirtyMechanism)return;let e=this.getScene().enablePrePassRenderer();e&&e.markAsDirty()}_markAllSubMeshesAsAllDirty(){this._markAllSubMeshesAsDirty(G._AllDirtyCallBack)}_markAllSubMeshesAsImageProcessingDirty(){this._markAllSubMeshesAsDirty(G._ImageProcessingDirtyCallBack)}_markAllSubMeshesAsTexturesDirty(){this._markAllSubMeshesAsDirty(G._TextureDirtyCallBack)}_markAllSubMeshesAsFresnelDirty(){this._markAllSubMeshesAsDirty(G._FresnelDirtyCallBack)}_markAllSubMeshesAsFresnelAndMiscDirty(){this._markAllSubMeshesAsDirty(G._FresnelAndMiscDirtyCallBack)}_markAllSubMeshesAsLightsDirty(){this._markAllSubMeshesAsDirty(G._LightsDirtyCallBack)}_markAllSubMeshesAsAttributesDirty(){this._markAllSubMeshesAsDirty(G._AttributeDirtyCallBack)}_markAllSubMeshesAsMiscDirty(){this._markAllSubMeshesAsDirty(G._MiscDirtyCallBack)}_markAllSubMeshesAsPrePassDirty(){this._markAllSubMeshesAsDirty(G._PrePassDirtyCallBack)}_markAllSubMeshesAsTexturesAndMiscDirty(){this._markAllSubMeshesAsDirty(G._TextureAndMiscDirtyCallBack)}_checkScenePerformancePriority(){if(0!==this._scene.performancePriority){this.checkReadyOnlyOnce=!0;let e=this._scene.onScenePerformancePriorityChangedObservable.addOnce(()=>{this.checkReadyOnlyOnce=!1});this.onDisposeObservable.add(()=>{this._scene.onScenePerformancePriorityChangedObservable.remove(e)})}}setPrePassRenderer(e){return!1}dispose(e,t,i){let r=this.getScene();if(r.stopAnimation(this),r.freeProcessedMaterials(),r.removeMaterial(this),this._eventInfo.forceDisposeTextures=t,this._callbackPluginEventGeneric(2,this._eventInfo),this._parentContainer){let e=this._parentContainer.materials.indexOf(this);e>-1&&this._parentContainer.materials.splice(e,1),this._parentContainer=null}if(!0!==i)if(this.meshMap)for(let e in this.meshMap){let t=this.meshMap[e];this._disposeMeshResources(t)}else for(let e of r.meshes)this._disposeMeshResources(e);this._uniformBuffer.dispose(),this._drawWrapper.effect&&(this._storeEffectOnSubMeshes||this._drawWrapper.effect.dispose(),this._drawWrapper.effect=null),this.metadata=null,this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._onBindObservable&&this._onBindObservable.clear(),this._onUnBindObservable&&this._onUnBindObservable.clear(),this._onEffectCreatedObservable&&this._onEffectCreatedObservable.clear(),this._eventInfo&&(this._eventInfo={})}_disposeMeshResources(e){if(!e)return;let t=e.geometry,i=e._internalAbstractMeshDataInfo._materialForRenderPass;if(this._storeEffectOnSubMeshes){if(e.subMeshes&&i)for(let r of e.subMeshes){let e=r._drawWrappers;for(let s=0;s<e.length;s++){let n=e[s]?.effect;n&&i[s]===this&&(t?._releaseVertexArrayObject(n),r._removeDrawWrapper(s,!0,!0))}}}else t?._releaseVertexArrayObject(this._drawWrapper.effect);e.material!==this||e.sourceMesh||(e.material=null)}serialize(){let e=C.SerializationHelper.Serialize(this);return e.stencil=this.stencil.serialize(),e.uniqueId=this.uniqueId,this._serializePlugins(e),e}_serializePlugins(e){if(e.plugins={},this.pluginManager)for(let t of this.pluginManager._plugins)t.doNotSerialize||(e.plugins[t.getClassName()]=t.serialize())}static ParseAlphaMode(e,t){void 0!==e._alphaMode?t._alphaMode=Array.isArray(e._alphaMode)?e._alphaMode:[e._alphaMode]:void 0!==e.alphaMode?t._alphaMode=Array.isArray(e.alphaMode)?e.alphaMode:[e.alphaMode]:t._alphaMode=[2]}static Parse(e,t,i){if(e.customType){if("BABYLON.PBRMaterial"===e.customType&&e.overloadedAlbedo&&(e.customType="BABYLON.LegacyPBRMaterial",!BABYLON.LegacyPBRMaterial))return P.Logger.Error("Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library."),null}else e.customType="BABYLON.StandardMaterial";let r=s.Tools.Instantiate(e.customType).Parse(e,t,i);return r._loadedUniqueId=e.uniqueId,G.ParseAlphaMode(e,r),r}static _ParsePlugins(e,t,i,r){if(e.plugins)for(let n in e.plugins){let a=e.plugins[n],l=t.pluginManager?.getPlugin(a.name);if(!l){let e=s.Tools.Instantiate("BABYLON."+n);e&&(l=new e(t))}l?.parse(a,i,r)}}}G.TriangleFillMode=0,G.WireFrameFillMode=1,G.PointFillMode=2,G.PointListDrawMode=3,G.LineListDrawMode=4,G.LineLoopDrawMode=5,G.LineStripDrawMode=6,G.TriangleStripDrawMode=7,G.TriangleFanDrawMode=8,G.ClockWiseSideOrientation=0,G.CounterClockWiseSideOrientation=1,G.ImageProcessingDirtyFlag=64,G.TextureDirtyFlag=1,G.LightDirtyFlag=2,G.FresnelDirtyFlag=4,G.AttributesDirtyFlag=8,G.MiscDirtyFlag=16,G.PrePassDirtyFlag=32,G.AllDirtyFlag=127,G.MATERIAL_OPAQUE=0,G.MATERIAL_ALPHATEST=1,G.MATERIAL_ALPHABLEND=2,G.MATERIAL_ALPHATESTANDBLEND=3,G.MATERIAL_NORMALBLENDMETHOD_WHITEOUT=0,G.MATERIAL_NORMALBLENDMETHOD_RNM=1,G.LIGHTFALLOFF_PHYSICAL=0,G.LIGHTFALLOFF_GLTF=1,G.LIGHTFALLOFF_STANDARD=2,G.OnEventObservable=new n.Observable,G.ForceVertexOutputInvariant=!1,G._AllDirtyCallBack=e=>e.markAllAsDirty(),G._ImageProcessingDirtyCallBack=e=>e.markAsImageProcessingDirty(),G._TextureDirtyCallBack=e=>e.markAsTexturesDirty(),G._FresnelDirtyCallBack=e=>e.markAsFresnelDirty(),G._MiscDirtyCallBack=e=>e.markAsMiscDirty(),G._PrePassDirtyCallBack=e=>e.markAsPrePassDirty(),G._LightsDirtyCallBack=e=>e.markAsLightDirty(),G._AttributeDirtyCallBack=e=>e.markAsAttributesDirty(),G._FresnelAndMiscDirtyCallBack=e=>{G._FresnelDirtyCallBack(e),G._MiscDirtyCallBack(e)},G._TextureAndMiscDirtyCallBack=e=>{G._TextureDirtyCallBack(e),G._MiscDirtyCallBack(e)},G._DirtyCallbackArray=[],G._RunDirtyCallBacks=e=>{for(let t of G._DirtyCallbackArray)t(e)},(0,i.__decorate)([(0,r.serialize)()],G.prototype,"id",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"uniqueId",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"name",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"metadata",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"checkReadyOnEveryCall",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"checkReadyOnlyOnce",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"state",void 0),(0,i.__decorate)([(0,r.serialize)("alpha")],G.prototype,"_alpha",void 0),(0,i.__decorate)([(0,r.serialize)("backFaceCulling")],G.prototype,"_backFaceCulling",void 0),(0,i.__decorate)([(0,r.serialize)("textureRepetitionMode")],G.prototype,"_textureRepetitionMode",void 0),(0,i.__decorate)([(0,r.serialize)("textureRepetitionHexTilingParams")],G.prototype,"textureRepetitionHexTilingParams",void 0),(0,i.__decorate)([(0,r.serialize)("cullBackFaces")],G.prototype,"_cullBackFaces",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"sideOrientation",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"_alphaMode",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"_needDepthPrePass",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"disableDepthWrite",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"disableColorWrite",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"forceDepthWrite",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"depthFunction",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"separateCullingPass",void 0),(0,i.__decorate)([(0,r.serialize)("fogEnabled")],G.prototype,"_fogEnabled",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"pointSize",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"zOffset",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"zOffsetUnits",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"pointsCloud",null),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"fillMode",null),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"useLogarithmicDepth",null),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"_isVertexOutputInvariant",void 0),(0,i.__decorate)([(0,r.serialize)()],G.prototype,"transparencyMode",null),Object.getOwnPropertyDescriptor(G.prototype,"pluginManager")||Object.defineProperty(G.prototype,"pluginManager",(0,S._MissingSideEffectProperty)("Material","pluginManager")),e.s(["Material",0,G],23507)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,12423,t=>{"use strict";class e{static GetShadersRepository(t=0){return 0===t?e.ShadersRepository:e.ShadersRepositoryWGSL}static GetShadersStore(t=0){return 0===t?e.ShadersStore:e.ShadersStoreWGSL}static GetIncludesShadersStore(t=0){return 0===t?e.IncludesShadersStore:e.IncludesShadersStoreWGSL}}e.ShadersRepository="src/Shaders/",e.ShadersStore={},e.IncludesShadersStore={},e.ShadersRepositoryWGSL="src/ShadersWGSL/",e.ShadersStoreWGSL={},e.IncludesShadersStoreWGSL={},t.s(["ShaderStore",0,e])},49007,t=>{"use strict";t.s(["IntersectionInfo",0,class{constructor(t,e,i){this.bu=t,this.bv=e,this.distance=i,this.faceId=0,this.subMeshId=0,this._internalSubMeshId=0}}])},21222,t=>{"use strict";var e=t.i(96265);class i{}i.POINTERDOWN=1,i.POINTERUP=2,i.POINTERMOVE=4,i.POINTERWHEEL=8,i.POINTERPICK=16,i.POINTERTAP=32,i.POINTERDOUBLETAP=64;class r{constructor(t,e){this.type=t,this.event=e}}t.s(["PointerEventTypes",0,i,"PointerInfo",0,class extends r{get pickInfo(){return this._pickInfo||this._generatePickInfo(),this._pickInfo}constructor(t,e,i,r=null){super(t,e),this._pickInfo=i,this._inputManager=r}_generatePickInfo(){this._inputManager&&(this._pickInfo=this._inputManager._pickMove(this.event),this._inputManager._setRayOnPointerInfo(this._pickInfo,this.event),this._inputManager=null)}},"PointerInfoPre",0,class extends r{constructor(t,i,r,n){super(t,i),this.ray=null,this.originalPickingInfo=null,this.skipOnPointerObservable=!1,this.localPosition=new e.Vector2(r,n)}}])},36365,t=>{"use strict";class e{}e.KEYDOWN=1,e.KEYUP=2;class i{constructor(t,e){this.type=t,this.event=e}}t.s(["KeyboardEventTypes",0,e,"KeyboardInfo",0,i,"KeyboardInfoPre",0,class extends i{get skipOnPointerObservable(){return this.skipOnKeyboardObservable}set skipOnPointerObservable(t){this.skipOnKeyboardObservable=t}constructor(t,e){super(t,e),this.type=t,this.event=e,this.skipOnKeyboardObservable=!1}}])},76696,t=>{"use strict";var e,i;(i=e||(e={}))[i.PointerMove=0]="PointerMove",i[i.PointerDown=1]="PointerDown",i[i.PointerUp=2]="PointerUp";class r{}r.DOM_DELTA_PIXEL=0,r.DOM_DELTA_LINE=1,r.DOM_DELTA_PAGE=2,t.s(["EventConstants",0,r])},67359,t=>{"use strict";var e=t.i(36395);class i{get min(){return this._min}get max(){return this._max}get average(){return this._average}get lastSecAverage(){return this._lastSecAverage}get current(){return this._current}get total(){return this._totalAccumulated}get count(){return this._totalValueCount}constructor(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}fetchNewFrame(){this._totalValueCount++,this._current=0,this._lastSecValueCount++}addCount(t,e){i.Enabled&&(this._current+=t,e&&this._fetchResult())}beginMonitoring(){i.Enabled&&(this._startMonitoringTime=e.PrecisionDate.Now)}endMonitoring(t=!0){if(!i.Enabled)return;t&&this.fetchNewFrame();let r=e.PrecisionDate.Now;this._current=r-this._startMonitoringTime,t&&this._fetchResult()}endFrame(){this._fetchResult()}_fetchResult(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;let t=e.PrecisionDate.Now;t-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=t,this._lastSecAccumulated=0,this._lastSecValueCount=0)}}i.Enabled=!0,t.s(["PerfCounter",0,i])},44981,t=>{"use strict";var e=t.i(66749),i=t.i(59576),r=t.i(89030),n=t.i(96265),o=t.i(48657),s=t.i(49007),a=t.i(50107),c=t.i(81623),l=t.i(5785);let h={internalPickerForMesh:void 0};class u{constructor(t,e,i=Number.MAX_VALUE,n=r.Epsilon){this.origin=t,this.direction=e,this.length=i,this.epsilon=n}clone(){return new u(this.origin.clone(),this.direction.clone(),this.length)}intersectsBoxMinMax(t,e,i=0){let r,n,o,s,a=u._TmpVector3[0].copyFromFloats(t.x-i,t.y-i,t.z-i),c=u._TmpVector3[1].copyFromFloats(e.x+i,e.y+i,e.z+i),l=0,h=Number.MAX_VALUE;if(1e-7>Math.abs(this.direction.x)){if(this.origin.x<a.x||this.origin.x>c.x)return!1}else if(r=1/this.direction.x,n=(a.x-this.origin.x)*r,(o=(c.x-this.origin.x)*r)==-1/0&&(o=1/0),n>o&&(s=n,n=o,o=s),(l=Math.max(n,l))>(h=Math.min(o,h)))return!1;if(1e-7>Math.abs(this.direction.y)){if(this.origin.y<a.y||this.origin.y>c.y)return!1}else if(r=1/this.direction.y,n=(a.y-this.origin.y)*r,(o=(c.y-this.origin.y)*r)==-1/0&&(o=1/0),n>o&&(s=n,n=o,o=s),(l=Math.max(n,l))>(h=Math.min(o,h)))return!1;if(1e-7>Math.abs(this.direction.z)){if(this.origin.z<a.z||this.origin.z>c.z)return!1}else if(r=1/this.direction.z,n=(a.z-this.origin.z)*r,(o=(c.z-this.origin.z)*r)==-1/0&&(o=1/0),n>o&&(s=n,n=o,o=s),(l=Math.max(n,l))>(h=Math.min(o,h)))return!1;return!0}intersectsBox(t,e=0){return this.intersectsBoxMinMax(t.minimum,t.maximum,e)}intersectsSphere(t,e=0){let i=t.center.x-this.origin.x,r=t.center.y-this.origin.y,n=t.center.z-this.origin.z,o=i*i+r*r+n*n,s=t.radius+e,a=s*s;if(o<=a)return!0;let c=i*this.direction.x+r*this.direction.y+n*this.direction.z;return!(c<0)&&o-c*c<=a}intersectsTriangle(t,e,i){let r=u._TmpVector3[0],o=u._TmpVector3[1],a=u._TmpVector3[2],c=u._TmpVector3[3],l=u._TmpVector3[4];e.subtractToRef(t,r),i.subtractToRef(t,o),n.Vector3.CrossToRef(this.direction,o,a);let h=n.Vector3.Dot(r,a);if(0===h)return null;let f=1/h;this.origin.subtractToRef(t,c);let d=n.Vector3.Dot(c,a)*f;if(d<-this.epsilon||d>1+this.epsilon)return null;n.Vector3.CrossToRef(c,r,l);let m=n.Vector3.Dot(this.direction,l)*f;if(m<-this.epsilon||d+m>1+this.epsilon)return null;let y=n.Vector3.Dot(o,l)*f;return y>this.length||y<0?null:new s.IntersectionInfo(1-d-m,d,y)}intersectsPlane(t){let e,i=n.Vector3.Dot(t.normal,this.direction);if(999999997475243e-21>Math.abs(i))return null;{let r=n.Vector3.Dot(t.normal,this.origin);if((e=(-t.d-r)/i)<0)if(e<-999999997475243e-21)return null;else return 0;return e}}intersectsAxis(t,e=0){switch(t){case"y":{let t=(this.origin.y-e)/this.direction.y;if(t>0)return null;return new n.Vector3(this.origin.x+-(this.direction.x*t),e,this.origin.z+-(this.direction.z*t))}case"x":{let t=(this.origin.x-e)/this.direction.x;if(t>0)return null;return new n.Vector3(e,this.origin.y+-(this.direction.y*t),this.origin.z+-(this.direction.z*t))}case"z":{let t=(this.origin.z-e)/this.direction.z;if(t>0)return null;return new n.Vector3(this.origin.x+-(this.direction.x*t),this.origin.y+-(this.direction.y*t),e)}default:return null}}intersectsMesh(t,e,i,r=!1,o,s=!1){let a=n.TmpVectors.Matrix[0];return t.getWorldMatrix().invertToRef(a),this._tmpRay?u.TransformToRef(this,a,this._tmpRay):this._tmpRay=u.Transform(this,a),t.intersects(this._tmpRay,e,i,r,o,s)}intersectsMeshes(t,e,i){i?i.length=0:i=[];for(let r=0;r<t.length;r++){let n=this.intersectsMesh(t[r],e);n.hit&&i.push(n)}return i.sort(this._comparePickingInfo),i}_comparePickingInfo(t,e){return t.distance<e.distance?-1:+(t.distance>e.distance)}intersectionSegment(t,e,i){let r=this.origin,o=n.TmpVectors.Vector3[0],s=n.TmpVectors.Vector3[1],a=n.TmpVectors.Vector3[2],c=n.TmpVectors.Vector3[3];e.subtractToRef(t,o),this.direction.scaleToRef(u._Rayl,a),r.addToRef(a,s),t.subtractToRef(r,c);let l=n.Vector3.Dot(o,o),h=n.Vector3.Dot(o,a),f=n.Vector3.Dot(a,a),d=n.Vector3.Dot(o,c),m=n.Vector3.Dot(a,c),y=l*f-h*h,g,R=y,p,T=y;y<u._Smallnum?(g=0,R=1,p=m,T=f):(g=h*m-f*d,p=l*m-h*d,g<0?(g=0,p=m,T=f):g>R&&(g=R,p=m+h,T=f)),p<0?(p=0,0>-d?g=0:-d>l?g=R:(g=-d,R=l)):p>T&&(p=T,-d+h<0?g=0:-d+h>l?g=R:(g=-d+h,R=l));let _=Math.abs(g)<u._Smallnum?0:g/R,P=Math.abs(p)<u._Smallnum?0:p/T,x=n.TmpVectors.Vector3[4];a.scaleToRef(P,x);let M=n.TmpVectors.Vector3[5];o.scaleToRef(_,M),M.addInPlace(c);let I=n.TmpVectors.Vector3[6];return(M.subtractToRef(x,I),P>0&&P<=this.length&&I.lengthSquared()<i*i)?M.length():-1}update(t,e,i,r,o,s,a,c=!1){if(c){u._RayDistant||(u._RayDistant=u.Zero()),u._RayDistant.unprojectRayToRef(t,e,i,r,n.Matrix.IdentityReadOnly,s,a);let c=n.TmpVectors.Matrix[0];o.invertToRef(c),u.TransformToRef(u._RayDistant,c,this)}else this.unprojectRayToRef(t,e,i,r,o,s,a);return this}static Zero(){return new u(n.Vector3.Zero(),n.Vector3.Zero())}static CreateNew(t,e,i,r,n,o,s){return u.Zero().update(t,e,i,r,n,o,s)}static CreateNewFromTo(t,e,i=n.Matrix.IdentityReadOnly){let r=new u(new n.Vector3(0,0,0),new n.Vector3(0,0,0));return u.CreateFromToToRef(t,e,r,i)}static CreateFromToToRef(t,e,i,r=n.Matrix.IdentityReadOnly){i.origin.copyFrom(t);let o=e.subtractToRef(t,i.direction);return i.length=Math.sqrt(o.x*o.x+o.y*o.y+o.z*o.z),i.direction.normalize(),u.TransformToRef(i,r,i)}static Transform(t,e){let i=new u(new n.Vector3(0,0,0),new n.Vector3(0,0,0));return u.TransformToRef(t,e,i),i}static TransformToRef(t,e,i){n.Vector3.TransformCoordinatesToRef(t.origin,e,i.origin),n.Vector3.TransformNormalToRef(t.direction,e,i.direction),i.length=t.length,i.epsilon=t.epsilon;let r=i.direction,o=r.length();if(0!==o&&1!==o){let t=1/o;r.x*=t,r.y*=t,r.z*=t,i.length*=o}return i}unprojectRayToRef(t,e,i,r,o,s,a){let l=n.TmpVectors.Matrix[0];o.multiplyToRef(s,l),l.multiplyToRef(a,l),l.invert();let h=c.EngineStore.LastCreatedEngine,u=n.TmpVectors.Vector3[0];u.x=t/i*2-1,u.y=-(e/r*2-1),u.z=h?.useReverseDepthBuffer?1:h?.isNDCHalfZRange?0:-1;let f=n.TmpVectors.Vector3[1].copyFromFloats(u.x,u.y,1-1e-8),d=n.TmpVectors.Vector3[2],m=n.TmpVectors.Vector3[3];n.Vector3.TransformCoordinatesToRef(u,l,d),n.Vector3.TransformCoordinatesToRef(f,l,m),this.origin.copyFrom(d),m.subtractToRef(d,this.direction),this.direction.normalize()}}function f(t,e,i,r,n,o=!1){let s=u.Zero();return d(t,e,i,r,s,n,o),s}function d(t,e,i,r,o,s,a=!1,c=!1){let l=t.getEngine();if(!s&&!(s=t.activeCamera)&&!(s=t.cameraToUseForPointers))return t;let h=s.viewport,u=l.getRenderHeight(),{x:f,y:m,width:y,height:g}=h.toGlobal(l.getRenderWidth(),u),R=1/l.getHardwareScalingLevel();return e=e*R-f,i=i*R-(u-m-g),o.update(e,i,y,g,r||n.Matrix.IdentityReadOnly,a?n.Matrix.IdentityReadOnly:s.getViewMatrix(),s.getProjectionMatrix(),c),t}function m(t,e,i,r){let n=u.Zero();return y(t,e,i,n,r),n}function y(t,e,i,r,o){if(!a.PickingInfo)return t;let s=t.getEngine();if(!o&&!(o=t.activeCamera)&&!(o=t.cameraToUseForPointers))throw Error("Active camera not set");let c=o.viewport,l=s.getRenderHeight(),{x:h,y:u,width:f,height:d}=c.toGlobal(s.getRenderWidth(),l),m=n.Matrix.Identity(),y=1/s.getHardwareScalingLevel();return e=e*y-h,i=i*y-(l-u-d),r.update(e,i,f,d,m,m,o.getProjectionMatrix()),t}function g(t,e,i,r,n,o,s,a){let c=e(r,i.enableDistantPicking);return R(t,i,r,c,n,o,s,a)}function R(t,e,i,r,n,o,s,a){let c=e.intersects(r,n,s,o,i,a);return c&&c.hit&&(n||null==t||!(c.distance>=t.distance))?c:null}function p(t){let e=t.getClassName();if("GreasedLineMesh"===e)return{rawBoundingInfo:null,intersectionThreshold:0};let i=t.rawBoundingInfo;return{rawBoundingInfo:i,intersectionThreshold:i?"InstancedLinesMesh"===e||"LinesMesh"===e?t.intersectionThreshold:0:0}}function T(t,e,i,r,n){let o=t(i,e.enableDistantPicking);return o.intersectsSphere(r.boundingSphere,n)&&o.intersectsBox(r.boundingBox,n)?o:null}function _(t,e,i,r,o,s){let c=null,l=!!(t.activeCameras&&t.activeCameras.length>1&&t.cameraToUseForPointers!==t.activeCamera),u=t.cameraToUseForPointers||t.activeCamera,f=h.internalPickerForMesh||g,d=f===g;for(let a=0;a<t.meshes.length;a++){let h=t.meshes[a];if(i){if(!i(h,-1))continue}else if(!h.isEnabled()||!h.isVisible||!h.isPickable)continue;let m=l&&h.isWorldMatrixCameraDependent(),y=h.computeWorldMatrix(m,u);if(h.hasThinInstances&&h.thinInstanceEnablePicking){let t=f(c,e,h,y,!0,!0,s);if(t){if(o)return t;let{rawBoundingInfo:a,intersectionThreshold:l}=p(h),u=h._thinInstanceDataStorage.matrixData;if(u){let t=n.TmpVectors.Matrix[0],m=n.TmpVectors.Matrix[1],g=Math.min(h.thinInstanceCount,u.length>>4);for(let p=0;p<g;p++){if(i&&!i(h,p))continue;n.Matrix.FromArrayToRef(u,p<<4,t),t.multiplyToRef(y,m);let g=d&&a?T(e,h,m,a,l):null;if(d&&a&&!g)continue;let _=d&&g?R(c,h,m,g,r,o,s,!0):f(c,e,h,m,r,o,s,!0);if(_&&((c=_).thinInstanceIndex=p,r))return c}}}}else{let t=f(c,e,h,y,r,o,s);if(t&&(c=t,r))return c}}return c||new a.PickingInfo}function P(t,e,i,r){if(!a.PickingInfo)return null;let o=[],s=!!(t.activeCameras&&t.activeCameras.length>1&&t.cameraToUseForPointers!==t.activeCamera),c=t.cameraToUseForPointers||t.activeCamera,l=h.internalPickerForMesh||g,u=l===g;for(let a=0;a<t.meshes.length;a++){let h=t.meshes[a];if(i){if(!i(h,-1))continue}else if(!h.isEnabled()||!h.isVisible||!h.isPickable)continue;let f=s&&h.isWorldMatrixCameraDependent(),d=h.computeWorldMatrix(f,c);if(h.hasThinInstances&&h.thinInstanceEnablePicking){if(l(null,e,h,d,!0,!0,r)){let{rawBoundingInfo:t,intersectionThreshold:s}=p(h),a=h._thinInstanceDataStorage.matrixData;if(a){let c=n.TmpVectors.Matrix[0],f=n.TmpVectors.Matrix[1],m=Math.min(h.thinInstanceCount,a.length>>4);for(let y=0;y<m;y++){if(i&&!i(h,y))continue;n.Matrix.FromArrayToRef(a,y<<4,c),c.multiplyToRef(d,f);let m=u&&t?T(e,h,f,t,s):null;if(u&&t&&!m)continue;let g=u&&m?R(null,h,f,m,!1,!1,r,!0):l(null,e,h,f,!1,!1,r,!0);g&&(g.thinInstanceIndex=y,o.push(g))}}}}else{let t=l(null,e,h,d,!1,!1,r);t&&o.push(t)}}return o}function x(t,e,i,r,o,s){if(!a.PickingInfo)return null;let c=_(t,r=>(t._tempPickingRay||(t._tempPickingRay=u.Zero()),d(t,e,i,r,t._tempPickingRay,s||null),t._tempPickingRay),r,o,!0);return c&&(c.ray=f(t,e,i,n.Matrix.Identity(),s||null)),c}function M(t,e,i,r,o,s,a,c=!1){let l=_(t,(r,n)=>(t._tempPickingRay||(t._tempPickingRay=u.Zero()),d(t,e,i,r,t._tempPickingRay,s||null,!1,n),t._tempPickingRay),r,o,!1,a);return l&&(l.ray=f(t,e,i,n.Matrix.Identity(),s||null)),l}function I(t,e,i,r,o){let s=_(t,i=>(t._pickWithRayInverseMatrix||(t._pickWithRayInverseMatrix=n.Matrix.Identity()),i.invertToRef(t._pickWithRayInverseMatrix),t._cachedRayForTransform||(t._cachedRayForTransform=u.Zero()),u.TransformToRef(e,t._pickWithRayInverseMatrix,t._cachedRayForTransform),t._cachedRayForTransform),i,r,!1,o);return s&&(s.ray=e),s}function V(t,e,i,r,n,o){return P(t,r=>f(t,e,i,r,n||null),r,o)}function k(t,e,i,r){return P(t,i=>(t._pickWithRayInverseMatrix||(t._pickWithRayInverseMatrix=n.Matrix.Identity()),i.invertToRef(t._pickWithRayInverseMatrix),t._cachedRayForTransform||(t._cachedRayForTransform=u.Zero()),u.TransformToRef(e,t._pickWithRayInverseMatrix,t._cachedRayForTransform),t._cachedRayForTransform),i,r)}function S(t,e=100,i,r){return C(t,new u(n.Vector3.Zero(),n.Vector3.Zero(),e),e,i,r)}function C(t,e,i=100,r,o){r||(r=t.getWorldMatrix()),e.length=i,o?e.origin.copyFrom(o):e.origin.copyFrom(t.position);let s=n.TmpVectors.Vector3[2];s.set(0,0,t._scene.useRightHandedSystem?-1:1);let a=n.TmpVectors.Vector3[3];return n.Vector3.TransformNormalToRef(s,r,a),n.Vector3.NormalizeToRef(a,e.direction),e}function v(t,e){e&&(e.prototype.getForwardRay=function(t=100,e,i){return C(this,new u(n.Vector3.Zero(),n.Vector3.Zero(),t),t,e,i)},e.prototype.getForwardRayToRef=function(t,e=100,i,r){return C(this,t,e,i,r)}),t&&(l._ImportHelper._IsPickingAvailable=!0,t.prototype.createPickingRay=function(t,e,i,r,n=!1){return f(this,t,e,i,r,n)})}u._TmpVector3=(0,o.BuildArray)(6,n.Vector3.Zero),u._RayDistant=u.Zero(),u._Smallnum=1e-8,u._Rayl=1e9,t.s(["AddRayExtensions",0,v,"CreatePickingRay",0,f,"CreatePickingRayInCameraSpace",0,m,"CreatePickingRayInCameraSpaceToRef",0,y,"CreatePickingRayToRef",0,d,"GetForwardRay",0,S,"GetForwardRayToRef",0,C,"MultiPick",0,V,"MultiPickWithRay",0,k,"Pick",0,M,"PickWithBoundingInfo",0,x,"PickWithRay",0,I,"PickingCustomization",0,h,"Ray",0,u],57180);let b=!1;function w(){b||(b=!0,v(e.Scene,i.Camera),e.Scene.prototype.createPickingRayToRef=function(t,e,i,r,n,o=!1,s=!1){return d(this,t,e,i,r,n,o,s)},e.Scene.prototype.createPickingRayInCameraSpace=function(t,e,i){return m(this,t,e,i)},e.Scene.prototype.createPickingRayInCameraSpaceToRef=function(t,e,i,r){return y(this,t,e,i,r)},e.Scene.prototype.pickWithBoundingInfo=function(t,e,i,r,n){return x(this,t,e,i,r,n)},e.Scene.prototype.pick=function(t,e,i,r,n,o,s=!1){return M(this,t,e,i,r,n,o,s)},e.Scene.prototype.pickWithRay=function(t,e,i,r){return I(this,t,e,i,r)},e.Scene.prototype.multiPick=function(t,e,i,r,n){return V(this,t,e,i,r,n)},e.Scene.prototype.multiPickWithRay=function(t,e,i){return k(this,t,e,i)})}t.s(["RegisterRay",0,w],88181),w(),t.s([],1727),t.i(1727),t.i(88181),t.i(57180),t.s(["AddRayExtensions",0,v,"CreatePickingRay",0,f,"CreatePickingRayInCameraSpace",0,m,"CreatePickingRayInCameraSpaceToRef",0,y,"CreatePickingRayToRef",0,d,"GetForwardRay",0,S,"GetForwardRayToRef",0,C,"MultiPick",0,V,"MultiPickWithRay",0,k,"Pick",0,M,"PickWithBoundingInfo",0,x,"PickWithRay",0,I,"PickingCustomization",0,h,"Ray",0,u,"RegisterRay",0,w],27608),t.i(27608),t.s(["AddRayExtensions",0,v,"CreatePickingRay",0,f,"CreatePickingRayInCameraSpace",0,m,"CreatePickingRayInCameraSpaceToRef",0,y,"CreatePickingRayToRef",0,d,"GetForwardRay",0,S,"GetForwardRayToRef",0,C,"MultiPick",0,V,"MultiPickWithRay",0,k,"Pick",0,M,"PickWithBoundingInfo",0,x,"PickWithRay",0,I,"PickingCustomization",0,h,"Ray",0,u,"RegisterRay",0,w],44981)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,97998,e=>{"use strict";var t,s,r=e.i(96265),i=e.i(40408),o=e.i(35407),a=e.i(21249),n=e.i(1773);function h(e,t,s=null){let l=t.pathArray,u=t.closeArray,c=t.closePath,d=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),f=t.instance,p=t.updatable;if(f){let e=r.TmpVectors.Vector3[0].setAll(Number.MAX_VALUE),s=r.TmpVectors.Vector3[1].setAll(-Number.MAX_VALUE),h=f.getVerticesData(o.VertexBuffer.PositionKind);if((t=>{let r=l[0].length,o=0,a=f._originalBuilderSideOrientation===i.Mesh.DOUBLESIDE?2:1;for(let i=1;i<=a;++i)for(let i=0;i<l.length;++i){let a=l[i],n=a.length;r=r<n?r:n;for(let i=0;i<r;++i){let r=a[i];t[o]=r.x,t[o+1]=r.y,t[o+2]=r.z,e.minimizeInPlaceFromFloats(r.x,r.y,r.z),s.maximizeInPlaceFromFloats(r.x,r.y,r.z),o+=3}if(f._creationDataStorage&&f._creationDataStorage.closePath){let e=a[0];t[o]=e.x,t[o+1]=e.y,t[o+2]=e.z,o+=3}}})(h),f.hasBoundingInfo?f.getBoundingInfo().reConstruct(e,s,f._worldMatrix):f.buildBoundingInfo(e,s,f._worldMatrix),f.updateVerticesData(o.VertexBuffer.PositionKind,h,!1,!1),t.colors){let e=f.getVerticesData(o.VertexBuffer.ColorKind);for(let s=0,r=0;s<t.colors.length;s++,r+=4){let i=t.colors[s];e[r]=i.r,e[r+1]=i.g,e[r+2]=i.b,e[r+3]=i.a}f.updateVerticesData(o.VertexBuffer.ColorKind,e,!1,!1)}if(t.uvs){let e=f.getVerticesData(o.VertexBuffer.UVKind);for(let s=0;s<t.uvs.length;s++)e[2*s]=t.uvs[s].x,e[2*s+1]=n.useOpenGLOrientationForUV?1-t.uvs[s].y:t.uvs[s].y;f.updateVerticesData(o.VertexBuffer.UVKind,e,!1,!1)}if(!f.areNormalsFrozen||f.isFacetDataEnabled){let e=f.getIndices(),t=f.getVerticesData(o.VertexBuffer.NormalKind),s=f.isFacetDataEnabled?f.getFacetDataParameters():null;if(a.VertexData.ComputeNormals(h,e,t,s),f._creationDataStorage&&f._creationDataStorage.closePath){let e,s;for(let r=0;r<l.length;r++)e=3*f._creationDataStorage.idx[r],s=r+1<l.length?(f._creationDataStorage.idx[r+1]-1)*3:t.length-3,t[e]=(t[e]+t[s])*.5,t[e+1]=(t[e+1]+t[s+1])*.5,t[e+2]=(t[e+2]+t[s+2])*.5,t[s]=t[e],t[s+1]=t[e+1],t[s+2]=t[e+2]}f.areNormalsFrozen||f.updateVerticesData(o.VertexBuffer.NormalKind,t,!1,!1)}return f}{let r=new i.Mesh(e,s);r._originalBuilderSideOrientation=d,r._creationDataStorage=new i._CreationDataStorage;let h=function(e){let t,s,r,i,h,l,u,c,d,f,p,x,g,_=e.pathArray,m=e.closeArray||!1,M=e.closePath||!1,y=e.invertUV||!1,V=Math.floor(_[0].length/2),O=e.offset||V;O=O>V?V:Math.floor(O);let A=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,v=e.uvs,T=e.colors,b=[],I=[],D=[],w=[],P=[],F=[],B=[],L=[],E=[],C=[];if(_.length<2){let e=[],t=[];for(r=0;r<_[0].length-O;r++)e.push(_[0][r]),t.push(_[0][r+O]);_=[e,t]}let S=0,z=+!!M,R=+!!m;for(s=0,t=_[0].length;s<_.length+R;s++){for(B[s]=0,P[s]=[0],t=t<(l=(h=s===_.length?_[0]:_[s]).length)?t:l,i=0;i<l;)b.push(h[i].x,h[i].y,h[i].z),i>0&&(u=h[i].subtract(h[i-1]).length()+B[s],P[s].push(u),B[s]=u),i++;M&&(i--,b.push(h[0].x,h[0].y,h[0].z),u=h[i].subtract(h[0]).length()+B[s],P[s].push(u),B[s]=u),E[s]=l+z,C[s]=S,S+=l+z}for(r=0;r<t+z;r++)for(s=0,L[r]=0,F[r]=[0];s<_.length-1+R;s++)c=_[s],d=s===_.length-1?_[0]:_[s+1],r===t?(f=c[0],p=d[0]):(f=c[r],p=d[r]),u=p.subtract(f).length()+L[r],F[r].push(u),L[r]=u;if(v)for(s=0;s<v.length;s++)w.push(v[s].x,n.useOpenGLOrientationForUV?1-v[s].y:v[s].y);else for(s=0;s<_.length+R;s++)for(r=0;r<t+z;r++)x=0!=B[s]?P[s][r]/B[s]:0,g=0!=L[r]?F[r][s]/L[r]:0,y?w.push(g,x):w.push(x,n.useOpenGLOrientationForUV?1-g:g);let U=0,N=E[s=0]-1,W=E[s+1]-1,G=N<W?N:W,k=C[1]-C[0],H=E.length-1;for(;U<=G&&s<H;)I.push(U,U+k,U+1),I.push(U+k+1,U+1,U+k),(U+=1)===G&&(k=C[++s+1]-C[s],N=E[s]-1,W=E[s+1]-1,U=C[s],G=N<W?N+U:W+U);if(a.VertexData.ComputeNormals(b,I,D),M){let e,t;for(s=0;s<_.length;s++){e=3*C[s],t=s+1<_.length?(C[s+1]-1)*3:D.length-3,D[e]=(D[e]+D[t])*.5,D[e+1]=(D[e+1]+D[t+1])*.5,D[e+2]=(D[e+2]+D[t+2])*.5;let r=Math.sqrt(D[e]*D[e]+D[e+1]*D[e+1]+D[e+2]*D[e+2]);D[e]/=r,D[e+1]/=r,D[e+2]/=r,D[t]=D[e],D[t+1]=D[e+1],D[t+2]=D[e+2]}}if(m){let e=3*C[0],s=3*C[_.length];for(r=0;r<t+z;r++){D[e]=(D[e]+D[s])*.5,D[e+1]=(D[e+1]+D[s+1])*.5,D[e+2]=(D[e+2]+D[s+2])*.5;let t=Math.sqrt(D[e]*D[e]+D[e+1]*D[e+1]+D[e+2]*D[e+2]);D[e]/=t,D[e+1]/=t,D[e+2]/=t,D[s]=D[e],D[s+1]=D[e+1],D[s+2]=D[e+2],e+=3,s+=3}}a.VertexData._ComputeSides(A,b,I,D,w,e.frontUVs,e.backUVs);let X=null;if(T){X=new Float32Array(4*T.length);for(let e=0;e<T.length;e++)X[4*e]=T[e].r,X[4*e+1]=T[e].g,X[4*e+2]=T[e].b,X[4*e+3]=T[e].a}let Z=new a.VertexData,K=new Float32Array(b),Y=new Float32Array(D),q=new Float32Array(w);return Z.indices=I,Z.positions=K,Z.normals=Y,Z.uvs=q,X&&Z.set(X,o.VertexBuffer.ColorKind),M&&(Z._idx=C),Z}(t);return c&&(r._creationDataStorage.idx=h._idx),r._creationDataStorage.closePath=c,r._creationDataStorage.closeArray=u,h.applyToMesh(r,p),r}}var l=e.i(70653);function u(e){let t=e.pattern||i.Mesh.NO_FLIP,s=e.tileWidth||e.tileSize||1,r=e.tileHeight||e.tileSize||1,o=e.alignHorizontal||0,n=e.alignVertical||0,h=e.width||e.size||1,l=Math.floor(h/s),u=h-l*s,c=e.height||e.size||1,d=Math.floor(c/r),f=c-d*r,p=s*l/2,x=r*d/2,g=0,_=0,m=0,M=0,y=0,V=0;if(u>0||f>0){switch(m=-p,M=-x,y=p,V=x,o){case i.Mesh.CENTER:u/=2,m-=u,y+=u;break;case i.Mesh.LEFT:y+=u,g=-u/2;break;case i.Mesh.RIGHT:m-=u,g=u/2}switch(n){case i.Mesh.CENTER:f/=2,M-=f,V+=f;break;case i.Mesh.BOTTOM:V+=f,_=-f/2;break;case i.Mesh.TOP:M-=f,_=f/2}}let O=[],A=[],v=[];v[0]=[0,0,1,0,1,1,0,1],v[1]=[0,0,1,0,1,1,0,1],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(v[1]=[1,1,0,1,0,0,1,0]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(v[1]=[1,0,0,0,0,1,1,1]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(v[1]=[0,1,1,1,1,0,0,0]);let T=[],b=[],I=[],D=0;for(let e=0;e<d;e++)for(let o=0;o<l;o++)O.push(-p+o*s+g,-x+e*r+_,0),O.push(-p+(o+1)*s+g,-x+e*r+_,0),O.push(-p+(o+1)*s+g,-x+(e+1)*r+_,0),O.push(-p+o*s+g,-x+(e+1)*r+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(v[(o%2+e%2)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(v[e%2]):T.concat(v[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1),D+=4;if(u>0||f>0){let e,a,h,c,v,w=f>0&&(n===i.Mesh.CENTER||n===i.Mesh.TOP),P=f>0&&(n===i.Mesh.CENTER||n===i.Mesh.BOTTOM),F=u>0&&(o===i.Mesh.CENTER||o===i.Mesh.RIGHT),B=u>0&&(o===i.Mesh.CENTER||o===i.Mesh.LEFT);if(w&&F&&(O.push(m+g,M+_,0),O.push(-p+g,M+_,0),O.push(-p+g,M+f+_,0),O.push(m+g,M+f+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,c=1,v=1,e=[a=1-u/s,h=1-f/r,c,h,c,v,a,v],t===i.Mesh.ROTATE_ROW&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),t===i.Mesh.FLIP_ROW&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),t===i.Mesh.FLIP_N_ROTATE_ROW&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),w&&B&&(O.push(p+g,M+_,0),O.push(y+g,M+_,0),O.push(y+g,M+f+_,0),O.push(p+g,M+f+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,v=1,e=[a=0,h=1-f/r,c=u/s,h,c,v,a,v],(t===i.Mesh.ROTATE_ROW||t===i.Mesh.ROTATE_TILE&&l%2==0)&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_ROW||t===i.Mesh.FLIP_TILE&&l%2==0)&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_TILE&&l%2==0)&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),P&&F&&(O.push(m+g,x+_,0),O.push(-p+g,x+_,0),O.push(-p+g,V+_,0),O.push(m+g,V+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,h=0,c=1,e=[a=1-u/s,h,c,h,c,v=f/r,a,v],(t===i.Mesh.ROTATE_ROW&&d%2==1||t===i.Mesh.ROTATE_TILE&&d%1==0)&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_ROW&&d%2==1||t===i.Mesh.FLIP_TILE&&d%2==0)&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_ROW&&d%2==1||t===i.Mesh.FLIP_N_ROTATE_TILE&&d%2==0)&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),P&&B&&(O.push(p+g,x+_,0),O.push(y+g,x+_,0),O.push(y+g,V+_,0),O.push(p+g,V+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,e=[a=0,h=0,c=u/s,h,c,v=f/r,a,v],(t===i.Mesh.ROTATE_ROW&&d%2==1||t===i.Mesh.ROTATE_TILE&&(d+l)%2==1)&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_ROW&&d%2==1||t===i.Mesh.FLIP_TILE&&(d+l)%2==1)&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_ROW&&d%2==1||t===i.Mesh.FLIP_N_ROTATE_TILE&&(d+l)%2==1)&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),w){let e=[];a=0,h=1-f/r,c=1,v=1,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let r=0;r<l;r++)O.push(-p+r*s+g,M+_,0),O.push(-p+(r+1)*s+g,M+_,0),O.push(-p+(r+1)*s+g,M+f+_,0),O.push(-p+r*s+g,M+f+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(r+1)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[1]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(P){let e=[];a=0,h=0,c=1,v=f/r,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let r=0;r<l;r++)O.push(-p+r*s+g,V-f+_,0),O.push(-p+(r+1)*s+g,V-f+_,0),O.push(-p+(r+1)*s+g,V+_,0),O.push(-p+r*s+g,V+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(r+d)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[d%2]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(F){let e=[];a=1-u/s,h=0,c=1,v=1,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let s=0;s<d;s++)O.push(m+g,-x+s*r+_,0),O.push(m+u+g,-x+s*r+_,0),O.push(m+u+g,-x+(s+1)*r+_,0),O.push(m+g,-x+(s+1)*r+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(s+1)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[s%2]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(B){let e=[];a=0,h=0,c=u/r,v=1,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let s=0;s<d;s++)O.push(y-u+g,-x+s*r+_,0),O.push(y+g,-x+s*r+_,0),O.push(y+g,-x+(s+1)*r+_,0),O.push(y-u+g,-x+(s+1)*r+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(s+l)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[s%2]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}}let w=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE;a.VertexData._ComputeSides(w,O,I,A,T,e.frontUVs,e.backUVs);let P=new a.VertexData;return P.indices=I,P.positions=O,P.normals=A,P.uvs=T,P.colors=w===a.VertexData.DOUBLESIDE?b.concat(b):b,P}function c(e){let t,s=e.faceUV||Array(6),o=e.faceColors,h=e.pattern||i.Mesh.NO_FLIP,c=e.width||e.size||1,d=e.height||e.size||1,f=e.depth||e.size||1,p=e.tileWidth||e.tileSize||1,x=e.tileHeight||e.tileSize||1,g=e.alignHorizontal||0,_=e.alignVertical||0,m=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE;for(let e=0;e<6;e++)void 0===s[e]&&(s[e]=new r.Vector4(0,0,1,1)),o&&void 0===o[e]&&(o[e]=new l.Color4(1,1,1,1));let M=c/2,y=d/2,V=f/2,O=[];for(let e=0;e<2;e++)O[e]=u({pattern:h,tileWidth:p,tileHeight:x,width:c,height:d,alignVertical:_,alignHorizontal:g,sideOrientation:m});for(let e=2;e<4;e++)O[e]=u({pattern:h,tileWidth:p,tileHeight:x,width:f,height:d,alignVertical:_,alignHorizontal:g,sideOrientation:m});let A=_;_===i.Mesh.BOTTOM?A=i.Mesh.TOP:_===i.Mesh.TOP&&(A=i.Mesh.BOTTOM);for(let e=4;e<6;e++)O[e]=u({pattern:h,tileWidth:p,tileHeight:x,width:c,height:f,alignVertical:A,alignHorizontal:g,sideOrientation:m});let v=[],T=[],b=[],I=[],D=[],w=[],P=[],F=[],B=0;for(let e=0;e<6;e++){let i=O[e].positions.length;w[e]=[],P[e]=[];for(let t=0;t<i/3;t++)w[e].push(new r.Vector3(O[e].positions[3*t],O[e].positions[3*t+1],O[e].positions[3*t+2])),P[e].push(new r.Vector3(O[e].normals[3*t],O[e].normals[3*t+1],O[e].normals[3*t+2]));t=O[e].uvs.length,F[e]=[];for(let r=0;r<t;r+=2)F[e][r]=s[e].x+(s[e].z-s[e].x)*O[e].uvs[r],F[e][r+1]=s[e].y+(s[e].w-s[e].y)*O[e].uvs[r+1],n.useOpenGLOrientationForUV&&(F[e][r+1]=1-F[e][r+1]);if(b=b.concat(F[e]),I=I.concat(O[e].indices.map(e=>e+B)),B+=w[e].length,o){let t=o[e];for(let s=0;s<w[e].length;s++)D.push(t.r,t.g,t.b,t.a)}}let L=[{m:r.Matrix.RotationY(Math.PI),t:new r.Vector3(0,0,V),op:1},{m:r.Matrix.Identity(),t:new r.Vector3(0,0,V),op:-1},{m:r.Matrix.RotationY(-Math.PI/2),t:new r.Vector3(M,0,0),op:1},{m:r.Matrix.RotationY(Math.PI/2),t:new r.Vector3(M,0,0),op:-1},{m:r.Matrix.RotationX(Math.PI/2),t:new r.Vector3(0,y,0),op:1},{m:r.Matrix.RotationX(-Math.PI/2),t:new r.Vector3(0,y,0),op:-1}];for(let e=0;e<6;e++){let{m:t,t:s,op:i}=L[e];for(let o of w[e]){let e=r.Vector3.TransformCoordinates(o,t),a=1===i?e.add(s):e.subtract(s);v.push(a.x,a.y,a.z)}for(let s of P[e]){let e=r.Vector3.TransformNormal(s,t);T.push(e.x,e.y,e.z)}}let E=new a.VertexData;return E.indices=I,E.positions=v,E.normals=T,E.uvs=b,o&&(E.colors=m===a.VertexData.DOUBLESIDE?D.concat(D):D),E}a.VertexData.CreateTiledPlane=u,a.VertexData.CreateTiledBox=c;var d=e.i(70247),f=i,p=e.i(13379),x=e.i(12638),g=e.i(71265),_=e.i(24632);class m extends x.AbstractMesh{constructor(e,t){for(const s of(super(e,t.getScene()),this._indexInSourceMeshInstanceArray=-1,this._distanceToCamera=0,t.addInstance(this),this._sourceMesh=t,this._unIndexed=t._unIndexed,this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scaling.copyFrom(t.scaling),t.rotationQuaternion&&(this.rotationQuaternion=t.rotationQuaternion.clone()),this.animations=t.animations.slice(),t.getAnimationRanges()))null!=s&&this.createAnimationRange(s.name,s.from,s.to);if(this.infiniteDistance=t.infiniteDistance,this.setPivotMatrix(t.getPivotMatrix()),t.skeleton||t.morphTargetManager||!t.hasBoundingInfo)this.refreshBoundingInfo(!0,!0);else{const e=t.getBoundingInfo();this.buildBoundingInfo(e.minimum,e.maximum)}this._syncSubMeshes()}getClassName(){return"InstancedMesh"}get lightSources(){return this._sourceMesh._lightSources}_resyncLightSources(){}_resyncLightSource(){}_removeLightSource(){}get receiveShadows(){return this._sourceMesh.receiveShadows}set receiveShadows(e){this._sourceMesh?.receiveShadows!==e&&p.Logger.Warn("Setting receiveShadows on an instanced mesh has no effect")}get material(){return this._sourceMesh.material}set material(e){this._sourceMesh?.material!==e&&p.Logger.Warn("Setting material on an instanced mesh has no effect")}get visibility(){return this._sourceMesh.visibility}set visibility(e){this._sourceMesh?.visibility!==e&&p.Logger.Warn("Setting visibility on an instanced mesh has no effect")}get skeleton(){return this._sourceMesh.skeleton}set skeleton(e){this._sourceMesh?.skeleton!==e&&p.Logger.Warn("Setting skeleton on an instanced mesh has no effect")}get renderingGroupId(){return this._sourceMesh.renderingGroupId}set renderingGroupId(e){this._sourceMesh&&e!==this._sourceMesh.renderingGroupId&&p.Logger.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene")}getTotalVertices(){return this._sourceMesh?this._sourceMesh.getTotalVertices():0}getTotalIndices(){return this._sourceMesh.getTotalIndices()}get sourceMesh(){return this._sourceMesh}get geometry(){return this._sourceMesh._geometry}createInstance(e){return this._sourceMesh.createInstance(e)}isReady(e=!1){return this._sourceMesh.isReady(e,!0)}getVerticesData(e,t,s){return this._sourceMesh.getVerticesData(e,t,s)}copyVerticesData(e,t){this._sourceMesh.copyVerticesData(e,t)}getVertexBuffer(e,t){return this._sourceMesh.getVertexBuffer(e,t)}setVerticesData(e,t,s,r){return this.sourceMesh&&this.sourceMesh.setVerticesData(e,t,s,r),this.sourceMesh}updateVerticesData(e,t,s,r){return this.sourceMesh&&this.sourceMesh.updateVerticesData(e,t,s,r),this.sourceMesh}setIndices(e,t=null){return this.sourceMesh&&this.sourceMesh.setIndices(e,t),this.sourceMesh}isVerticesDataPresent(e){return this._sourceMesh.isVerticesDataPresent(e)}getIndices(){return this._sourceMesh.getIndices()}get _positions(){return this._sourceMesh._positions}refreshBoundingInfo(e=!1,t=!1){if(this.hasBoundingInfo&&this.getBoundingInfo().isLocked)return this;let s=this._sourceMesh.geometry?this._sourceMesh.geometry.boundingBias:null;return this._refreshBoundingInfo(this._sourceMesh._getData("object"==typeof e?e:{applySkeleton:e,applyMorph:t},null,o.VertexBuffer.PositionKind),s),this}_preActivate(){return this._currentLOD&&this._currentLOD._preActivate(),this}_activate(e,t){if(super._activate(e,t),this._sourceMesh.subMeshes||p.Logger.Warn("Instances should only be created for meshes with geometry."),this._currentLOD){if(this._currentLOD._getWorldMatrixDeterminant()>=0!=this._getWorldMatrixDeterminant()>=0)return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0,!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,e),t){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0,!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0,!0}return!1}_postActivate(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)}getWorldMatrix(){if(this._currentLOD&&this._currentLOD!==this._sourceMesh&&this._currentLOD.billboardMode!==_.TransformNode.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){this._billboardWorldMatrix||(this._billboardWorldMatrix=new r.Matrix);let e=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,r.TmpVectors.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),this._billboardWorldMatrix.copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(r.TmpVectors.Vector3[7]),this._currentLOD._masterMesh=e,this._billboardWorldMatrix}return super.getWorldMatrix()}get isAnInstance(){return!0}getLOD(e){if(!e)return this;let t=this.sourceMesh.getLODLevels();if(t&&0!==t.length){let t=this.getBoundingInfo();this._currentLOD=this.sourceMesh.getLOD(e,t.boundingSphere)}else this._currentLOD=this.sourceMesh;return this._currentLOD}_preActivateForIntermediateRendering(e){return this.sourceMesh._preActivateForIntermediateRendering(e)}_syncSubMeshes(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(let e=0;e<this._sourceMesh.subMeshes.length;e++)this._sourceMesh.subMeshes[e].clone(this,this._sourceMesh);return this}_generatePointsArray(){return this._sourceMesh._generatePointsArray()}_updateBoundingInfo(){return this.hasBoundingInfo?this.getBoundingInfo().update(this.worldMatrixFromCache):this.buildBoundingInfo(this.absolutePosition,this.absolutePosition,this.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache),this}clone(e,t=null,s,r){let i=(r||this._sourceMesh).createInstance(e);if(g.DeepCopier.DeepCopy(this,i,["name","subMeshes","uniqueId","parent","lightSources","receiveShadows","material","visibility","skeleton","sourceMesh","isAnInstance","facetNb","isFacetDataEnabled","isBlocked","useBones","hasInstances","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances","hasBoundingInfo","geometry"],[]),t&&(i.parent=t),!s)for(let e=0;e<this.getScene().meshes.length;e++){let t=this.getScene().meshes[e];t.parent===this&&t.clone(t.name,i)}return i.computeWorldMatrix(!0),this.onClonedObservable.notifyObservers(i),i}dispose(e,t=!1){this._sourceMesh.removeInstance(this),super.dispose(e,t)}_serializeAsParent(e){super._serializeAsParent(e),e.parentId=this._sourceMesh.uniqueId,e.parentInstanceIndex=this._indexInSourceMeshInstanceArray}instantiateHierarchy(e=null,t,s){let r=this.clone("Clone of "+(this.name||this.id),e||this.parent,!0,t&&t.newSourcedMesh);for(let e of(r&&s&&s(this,r),this.getChildTransformNodes(!0)))e.instantiateHierarchy(r,t,s);return r}}var M=e.i(23507),y=e.i(80871),V=e.i(66749);e.i(58720);var O=e.i(31278);e.i(65295);var A=e.i(22369),v=e.i(81623),T=e.i(92040),b=e.i(97001),I=e.i(12033);let D={effect:null,subMesh:null};class w extends A.PushMaterial{constructor(e,t,s,i={},o=!0){super(e,t,o),this._textures={},this._internalTextures={},this._textureArrays={},this._externalTextures={},this._floats={},this._ints={},this._uints={},this._floatsArrays={},this._colors3={},this._colors3Arrays={},this._colors4={},this._colors4Arrays={},this._vectors2={},this._vectors3={},this._vectors4={},this._quaternions={},this._quaternionsArrays={},this._matrices={},this._matrixArrays={},this._matrices3x3={},this._matrices2x2={},this._vectors2Arrays={},this._vectors3Arrays={},this._vectors4Arrays={},this._uniformBuffers={},this._textureSamplers={},this._storageBuffers={},this._cachedWorldViewMatrix=new r.Matrix,this._cachedWorldViewProjectionMatrix=new r.Matrix,this._multiview=!1,this._vertexPullingMetadata=null,this._materialHelperNeedsPreviousMatrices=!1,this._shaderPath=s,this._options={needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],externalTextures:[],samplerObjects:[],storageBuffers:[],defines:[],useClipPlane:!1,...i}}get shaderPath(){return this._shaderPath}set shaderPath(e){this._shaderPath=e}get options(){return this._options}get isMultiview(){return this._multiview}getClassName(){return"ShaderMaterial"}needAlphaBlending(){return this.alpha<1||this._options.needAlphaBlending}needAlphaTesting(){return this._options.needAlphaTesting}_checkUniform(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)}setTexture(e,t){return -1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this}setInternalTexture(e,t){return -1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._internalTextures[e]=t,this}removeTexture(e){delete this._textures[e]}setTextureArray(e,t){return -1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._checkUniform(e),this._textureArrays[e]=t,this}setExternalTexture(e,t){return -1===this._options.externalTextures.indexOf(e)&&this._options.externalTextures.push(e),this._externalTextures[e]=t,this}setFloat(e,t){return this._checkUniform(e),this._floats[e]=t,this}setInt(e,t){return this._checkUniform(e),this._ints[e]=t,this}setUInt(e,t){return this._checkUniform(e),this._uints[e]=t,this}setFloats(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this}setColor3(e,t){return this._checkUniform(e),this._colors3[e]=t,this}setColor3Array(e,t){return this._checkUniform(e),this._colors3Arrays[e]=t.reduce((e,t)=>(e.push(t.r,t.g,t.b),e),[]),this}setColor4(e,t){return this._checkUniform(e),this._colors4[e]=t,this}setColor4Array(e,t){return this._checkUniform(e),this._colors4Arrays[e]=t.reduce((e,t)=>(e.push(t.r,t.g,t.b,t.a),e),[]),this}setVector2(e,t){return this._checkUniform(e),this._vectors2[e]=t,this}setVector3(e,t){return this._checkUniform(e),this._vectors3[e]=t,this}setVector4(e,t){return this._checkUniform(e),this._vectors4[e]=t,this}setQuaternion(e,t){return this._checkUniform(e),this._quaternions[e]=t,this}setQuaternionArray(e,t){return this._checkUniform(e),this._quaternionsArrays[e]=t.reduce((e,t)=>(t.toArray(e,e.length),e),[]),this}setMatrix(e,t){return this._checkUniform(e),this._matrices[e]=t,this}setMatrices(e,t){this._checkUniform(e);let s=new Float32Array(16*t.length);for(let e=0;e<t.length;e++)t[e].copyToArray(s,16*e);return this._matrixArrays[e]=s,this}setMatrix3x3(e,t){return this._checkUniform(e),this._matrices3x3[e]=t,this}setMatrix2x2(e,t){return this._checkUniform(e),this._matrices2x2[e]=t,this}setArray2(e,t){return this._checkUniform(e),this._vectors2Arrays[e]=t,this}setArray3(e,t){return this._checkUniform(e),this._vectors3Arrays[e]=t,this}setArray4(e,t){return this._checkUniform(e),this._vectors4Arrays[e]=t,this}setUniformBuffer(e,t){return -1===this._options.uniformBuffers.indexOf(e)&&this._options.uniformBuffers.push(e),this._uniformBuffers[e]=t,this}setTextureSampler(e,t){return -1===this._options.samplerObjects.indexOf(e)&&this._options.samplerObjects.push(e),this._textureSamplers[e]=t,this}setStorageBuffer(e,t){return -1===this._options.storageBuffers.indexOf(e)&&this._options.storageBuffers.push(e),this._storageBuffers[e]=t,this}setDefine(e,t){let s=e.trimEnd()+" ",r=this.options.defines.findIndex(t=>t===e||t.startsWith(s));return r>=0&&this.options.defines.splice(r,1),("boolean"!=typeof t||t)&&this.options.defines.push(s+t),this}isReadyForSubMesh(e,t,s){return this.isReady(e,s,t)}isReady(e,t,s){let r=s&&this._storeEffectOnSubMeshes;if(this.isFrozen){let e=r?s._drawWrapper:this._drawWrapper;if(e.effect&&e._wasPreviouslyReady&&e._wasPreviouslyUsingInstances===t)return!0}let i=this.getScene(),a=i.getEngine(),n=[],h=[],l=null,u=this._shaderPath,c=this._options.uniforms,d=this._options.uniformBuffers,f=this._options.samplers;a.getCaps().multiview&&i.activeCamera&&i.activeCamera.outputRenderTarget&&i.activeCamera.outputRenderTarget.getViewCount()>1&&(this._multiview=!0,n.push("#define MULTIVIEW"),-1!==c.indexOf("viewProjection")&&-1===c.indexOf("viewProjectionR")&&c.push("viewProjectionR"));for(let e=0;e<this._options.defines.length;e++){let t=0===this._options.defines[e].indexOf("#define")?this._options.defines[e]:`#define ${this._options.defines[e]}`;n.push(t)}for(let e=0;e<this._options.attributes.length;e++)h.push(this._options.attributes[e]);if(e&&e.isVerticesDataPresent(o.VertexBuffer.ColorKind)&&(-1===h.indexOf(o.VertexBuffer.ColorKind)&&h.push(o.VertexBuffer.ColorKind),n.push("#define VERTEXCOLOR")),t&&(n.push("#define INSTANCES"),(0,b.PushAttributesForInstances)(h,this._materialHelperNeedsPreviousMatrices),e?.hasThinInstances&&(n.push("#define THIN_INSTANCES"),e&&e.isVerticesDataPresent(o.VertexBuffer.ColorInstanceKind)&&(h.push(o.VertexBuffer.ColorInstanceKind),n.push("#define INSTANCESCOLOR")))),e&&e.useBones&&e.computeBonesUsingShaders&&e.skeleton){h.push(o.VertexBuffer.MatricesIndicesKind),h.push(o.VertexBuffer.MatricesWeightsKind),e.numBoneInfluencers>4&&(h.push(o.VertexBuffer.MatricesIndicesExtraKind),h.push(o.VertexBuffer.MatricesWeightsExtraKind));let t=e.skeleton;n.push("#define NUM_BONE_INFLUENCERS "+e.numBoneInfluencers),(l=new O.EffectFallbacks).addCPUSkinningFallback(0,e),t.isUsingTextureForMatrices?(n.push("#define BONETEXTURE"),-1===c.indexOf("boneTextureInfo")&&c.push("boneTextureInfo"),-1===this._options.samplers.indexOf("boneSampler")&&this._options.samplers.push("boneSampler")):(n.push("#define BonesPerMesh "+(t.bones.length+1)),-1===c.indexOf("mBones")&&c.push("mBones"))}else n.push("#define NUM_BONE_INFLUENCERS 0");let p=0,x=e?e.morphTargetManager:null;if(x){let t=-1!==n.indexOf("#define UV1"),s=-1!==n.indexOf("#define UV2"),r=-1!==n.indexOf("#define TANGENT"),i=-1!==n.indexOf("#define NORMAL"),o=-1!==n.indexOf("#define VERTEXCOLOR");p=(0,b.PrepareDefinesAndAttributesForMorphTargets)(x,n,h,e,!0,i,r,t,s,o),x.isUsingTextureForTargets&&(-1===c.indexOf("morphTargetTextureIndices")&&c.push("morphTargetTextureIndices"),-1===this._options.samplers.indexOf("morphTargets")&&this._options.samplers.push("morphTargets")),p>0&&((c=c.slice()).push("morphTargetInfluences"),c.push("morphTargetCount"),c.push("morphTargetTextureInfo"),c.push("morphTargetTextureIndices"))}else n.push("#define NUM_MORPH_INFLUENCERS 0");if(e){let s=e.bakedVertexAnimationManager;s&&s.isEnabled&&(n.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),-1===c.indexOf("bakedVertexAnimationSettings")&&c.push("bakedVertexAnimationSettings"),-1===c.indexOf("bakedVertexAnimationTextureSizeInverted")&&c.push("bakedVertexAnimationTextureSizeInverted"),-1===c.indexOf("bakedVertexAnimationTime")&&c.push("bakedVertexAnimationTime"),-1===this._options.samplers.indexOf("bakedVertexAnimationTexture")&&this._options.samplers.push("bakedVertexAnimationTexture"),t&&h.push("bakedVertexAnimationSettingsInstanced"))}for(let e in this._textures)if(!this._textures[e].isReady())return!1;for(let e in this._internalTextures)if(!this._internalTextures[e].isReady)return!1;e&&this.needAlphaTestingForMesh(e)&&n.push("#define ALPHATEST"),!1!==this._options.useClipPlane&&((0,T.AddClipPlaneUniforms)(c),(0,T.PrepareStringDefinesForClipPlanes)(this,i,n)),i.fogEnabled&&e?.applyFog&&i.fogMode!==V.Scene.FOGMODE_NONE&&(n.push("#define FOG"),-1===c.indexOf("view")&&c.push("view"),-1===c.indexOf("vFogInfos")&&c.push("vFogInfos"),-1===c.indexOf("vFogColor")&&c.push("vFogColor")),this._useLogarithmicDepth&&(n.push("#define LOGARITHMICDEPTH"),-1===c.indexOf("logarithmicDepthConstant")&&c.push("logarithmicDepthConstant"));let g=s?s.getRenderingMesh():e;if(g&&this.useVertexPulling){let e=g.geometry;e&&(this._vertexPullingMetadata=(0,I.PrepareVertexPullingUniforms)(e),this._vertexPullingMetadata&&this._vertexPullingMetadata.forEach((e,t)=>{c.push(`vp_${t}_info`)})),n.push("#define USE_VERTEX_PULLING");let t=g.geometry?.getIndexBuffer();t&&!g.isUnIndexed&&(n.push("#define VERTEX_PULLING_USE_INDEX_BUFFER"),t.is32Bits&&n.push("#define VERTEX_PULLING_INDEX_BUFFER_32BITS"))}this.customShaderNameResolve&&(c=c.slice(),d=d.slice(),f=f.slice(),u=this.customShaderNameResolve(this.name,c,d,f,n,h));let _=r?s._getDrawWrapper(void 0,!0):this._drawWrapper,m=_?.effect??null,M=_?.defines??null,y=n.join("\n"),A=m;return M!==y&&(A=a.createEffect(u,{attributes:h,uniformsNames:c,uniformBuffersNames:d,samplers:f,defines:y,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousMorphTargets:p},shaderLanguage:this._options.shaderLanguage,extraInitializationsAsync:this._options.extraInitializationsAsync},a),r?s.setEffect(A,y,this._materialContext):_&&_.setEffect(A,y),this._onEffectCreatedObservable&&(D.effect=A,D.subMesh=s??e?.subMeshes[0]??null,this._onEffectCreatedObservable.notifyObservers(D))),_._wasPreviouslyUsingInstances=!!t,!!A?.isReady()&&(m!==A&&i.resetCachedMaterial(),_._wasPreviouslyReady=!0,!0)}bindOnlyWorldMatrix(e,t){let s=t??this.getEffect();if(!s)return;let r=this._options.uniforms;-1!==r.indexOf("world")&&s.setMatrix("world",e);let i=this.getScene();-1!==r.indexOf("worldView")&&(e.multiplyToRef(i.getViewMatrix(),this._cachedWorldViewMatrix),s.setMatrix("worldView",this._cachedWorldViewMatrix)),-1!==r.indexOf("worldViewProjection")&&(e.multiplyToRef(i.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),s.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)),-1!==r.indexOf("view")&&s.setMatrix("view",i.getViewMatrix())}bindForSubMesh(e,t,s){this.bind(e,t,s._drawWrapperOverride?.effect,s)}bind(e,t,s,r){let i=r&&this._storeEffectOnSubMeshes,o=s??(i?r.effect:this.getEffect());if(!o)return;let a=this.getScene();this._activeEffect=o,this.bindOnlyWorldMatrix(e,s);let n=this._options.uniformBuffers,h=!1;if(o&&n&&n.length>0&&a.getEngine().supportsUniformBuffers)for(let s=0;s<n.length;++s)switch(n[s]){case"Mesh":t&&(t.getMeshUniformBuffer().bindToEffect(o,"Mesh"),t.transferToEffect(e));break;case"Scene":(0,b.BindSceneUniformBuffer)(o,a.getSceneUniformBuffer()),a.finalizeSceneUbo(),h=!0}let l=t&&i?this._mustRebind(a,o,r,t.visibility):a.getCachedMaterial()!==this;if(o&&l){let e;for(e in h||-1===this._options.uniforms.indexOf("view")||o.setMatrix("view",a.getViewMatrix()),h||-1===this._options.uniforms.indexOf("projection")||o.setMatrix("projection",a.getProjectionMatrix()),!h&&-1!==this._options.uniforms.indexOf("viewProjection")&&(o.setMatrix("viewProjection",a.getTransformMatrix()),this._multiview&&o.setMatrix("viewProjectionR",a._transformMatrixR)),a.activeCamera&&-1!==this._options.uniforms.indexOf("cameraPosition")&&o.setVector3("cameraPosition",a.activeCamera.globalPosition),(0,b.BindBonesParameters)(t,o),(0,T.BindClipPlane)(o,this,a),this._vertexPullingMetadata&&(0,I.BindVertexPullingUniforms)(o,this._vertexPullingMetadata),this._useLogarithmicDepth&&(0,b.BindLogDepth)(i?r.materialDefines:o.defines,o,a),t&&(0,b.BindFogParameters)(a,t,o),this._textures)o.setTexture(e,this._textures[e]);for(e in this._internalTextures)o._bindTexture(e,this._internalTextures[e]);for(e in this._textureArrays)o.setTextureArray(e,this._textureArrays[e]);for(e in this._ints)o.setInt(e,this._ints[e]);for(e in this._uints)o.setUInt(e,this._uints[e]);for(e in this._floats)o.setFloat(e,this._floats[e]);for(e in this._floatsArrays)o.setArray(e,this._floatsArrays[e]);for(e in this._colors3)o.setColor3(e,this._colors3[e]);for(e in this._colors3Arrays)o.setArray3(e,this._colors3Arrays[e]);for(e in this._colors4){let t=this._colors4[e];o.setFloat4(e,t.r,t.g,t.b,t.a)}for(e in this._colors4Arrays)o.setArray4(e,this._colors4Arrays[e]);for(e in this._vectors2)o.setVector2(e,this._vectors2[e]);for(e in this._vectors3)o.setVector3(e,this._vectors3[e]);for(e in this._vectors4)o.setVector4(e,this._vectors4[e]);for(e in this._quaternions)o.setQuaternion(e,this._quaternions[e]);for(e in this._matrices)o.setMatrix(e,this._matrices[e]);for(e in this._matrixArrays)o.setMatrices(e,this._matrixArrays[e]);for(e in this._matrices3x3)o.setMatrix3x3(e,this._matrices3x3[e]);for(e in this._matrices2x2)o.setMatrix2x2(e,this._matrices2x2[e]);for(e in this._vectors2Arrays)o.setArray2(e,this._vectors2Arrays[e]);for(e in this._vectors3Arrays)o.setArray3(e,this._vectors3Arrays[e]);for(e in this._vectors4Arrays)o.setArray4(e,this._vectors4Arrays[e]);for(e in this._quaternionsArrays)o.setArray4(e,this._quaternionsArrays[e]);for(e in this._uniformBuffers){let t=this._uniformBuffers[e].getBuffer();t&&o.bindUniformBuffer(t,e)}let s=a.getEngine(),n=s.setExternalTexture;if(n)for(e in this._externalTextures)n.call(s,e,this._externalTextures[e]);let l=s.setTextureSampler;if(l)for(e in this._textureSamplers)l.call(s,e,this._textureSamplers[e]);let u=s.setStorageBuffer;if(u)for(e in this._storageBuffers)u.call(s,e,this._storageBuffers[e])}if(o&&t&&(l||!this.isFrozen)){(0,b.BindMorphTargetParameters)(t,o),t.morphTargetManager&&t.morphTargetManager.isUsingTextureForTargets&&t.morphTargetManager._bind(o);let e=t.bakedVertexAnimationManager;if(e&&e.isEnabled){let e=i?r._drawWrapper:this._drawWrapper;t.bakedVertexAnimationManager?.bind(o,!!e._wasPreviouslyUsingInstances)}}this._afterBind(t,o,r)}getActiveTextures(){let e=super.getActiveTextures();for(let t in this._textures)e.push(this._textures[t]);for(let t in this._textureArrays){let s=this._textureArrays[t];for(let t=0;t<s.length;t++)e.push(s[t])}return e}hasTexture(e){if(super.hasTexture(e))return!0;for(let t in this._textures)if(this._textures[t]===e)return!0;let t=e.getInternalTexture();for(let e in this._internalTextures)if(this._internalTextures[e]===t)return!0;for(let t in this._textureArrays){let s=this._textureArrays[t];for(let t=0;t<s.length;t++)if(s[t]===e)return!0}return!1}clone(e){let t=y.SerializationHelper.Clone(()=>new w(e,this.getScene(),this._shaderPath,this._options,this._storeEffectOnSubMeshes),this);for(let s of(t.name=e,t.id=e,"object"==typeof t._shaderPath&&(t._shaderPath={...t._shaderPath}),this._options={...this._options},Object.keys(this._options))){let e=this._options[s];Array.isArray(e)&&(this._options[s]=e.slice(0))}for(let e in this.stencil.copyTo(t.stencil),this._textures)t.setTexture(e,this._textures[e]);for(let e in this._internalTextures)t.setInternalTexture(e,this._internalTextures[e]);for(let e in this._textureArrays)t.setTextureArray(e,this._textureArrays[e]);for(let e in this._externalTextures)t.setExternalTexture(e,this._externalTextures[e]);for(let e in this._ints)t.setInt(e,this._ints[e]);for(let e in this._uints)t.setUInt(e,this._uints[e]);for(let e in this._floats)t.setFloat(e,this._floats[e]);for(let e in this._floatsArrays)t.setFloats(e,this._floatsArrays[e]);for(let e in this._colors3)t.setColor3(e,this._colors3[e]);for(let e in this._colors3Arrays)t._colors3Arrays[e]=this._colors3Arrays[e];for(let e in this._colors4)t.setColor4(e,this._colors4[e]);for(let e in this._colors4Arrays)t._colors4Arrays[e]=this._colors4Arrays[e];for(let e in this._vectors2)t.setVector2(e,this._vectors2[e]);for(let e in this._vectors3)t.setVector3(e,this._vectors3[e]);for(let e in this._vectors4)t.setVector4(e,this._vectors4[e]);for(let e in this._quaternions)t.setQuaternion(e,this._quaternions[e]);for(let e in this._quaternionsArrays)t._quaternionsArrays[e]=this._quaternionsArrays[e];for(let e in this._matrices)t.setMatrix(e,this._matrices[e]);for(let e in this._matrixArrays)t._matrixArrays[e]=this._matrixArrays[e].slice();for(let e in this._matrices3x3)t.setMatrix3x3(e,this._matrices3x3[e]);for(let e in this._matrices2x2)t.setMatrix2x2(e,this._matrices2x2[e]);for(let e in this._vectors2Arrays)t.setArray2(e,this._vectors2Arrays[e]);for(let e in this._vectors3Arrays)t.setArray3(e,this._vectors3Arrays[e]);for(let e in this._vectors4Arrays)t.setArray4(e,this._vectors4Arrays[e]);for(let e in this._uniformBuffers)t.setUniformBuffer(e,this._uniformBuffers[e]);for(let e in this._textureSamplers)t.setTextureSampler(e,this._textureSamplers[e]);for(let e in this._storageBuffers)t.setStorageBuffer(e,this._storageBuffers[e]);return t}dispose(e,t,s){if(t){let e;for(e in this._textures)this._textures[e].dispose();for(e in this._internalTextures)this._internalTextures[e].dispose();for(e in this._textureArrays){let t=this._textureArrays[e];for(let e=0;e<t.length;e++)t[e].dispose()}}this._textures={},this._internalTextures={},super.dispose(e,t,s)}serialize(){let e,t=y.SerializationHelper.Serialize(this);for(e in t.customType="BABYLON.ShaderMaterial",t.uniqueId=this.uniqueId,t.options=this._options,t.shaderPath=this._shaderPath,t.storeEffectOnSubMeshes=this._storeEffectOnSubMeshes,t.stencil=this.stencil.serialize(),t.textures={},this._textures)t.textures[e]=this._textures[e].serialize();for(e in t.textureArrays={},this._textureArrays){t.textureArrays[e]=[];let s=this._textureArrays[e];for(let r=0;r<s.length;r++)t.textureArrays[e].push(s[r].serialize())}for(e in t.ints={},this._ints)t.ints[e]=this._ints[e];for(e in t.uints={},this._uints)t.uints[e]=this._uints[e];for(e in t.floats={},this._floats)t.floats[e]=this._floats[e];for(e in t.floatsArrays={},this._floatsArrays)t.floatsArrays[e]=this._floatsArrays[e];for(e in t.colors3={},this._colors3){let s=this._colors3[e];t.colors3[e]=[s.r,s.g,s.b]}for(e in t.colors3Arrays={},this._colors3Arrays)t.colors3Arrays[e]=this._colors3Arrays[e];for(e in t.colors4={},this._colors4){let s=this._colors4[e];t.colors4[e]=[s.r,s.g,s.b,s.a]}for(e in t.colors4Arrays={},this._colors4Arrays)t.colors4Arrays[e]=this._colors4Arrays[e];for(e in t.vectors2={},this._vectors2){let s=this._vectors2[e];t.vectors2[e]=[s.x,s.y]}for(e in t.vectors3={},this._vectors3){let s=this._vectors3[e];t.vectors3[e]=[s.x,s.y,s.z]}for(e in t.vectors4={},this._vectors4){let s=this._vectors4[e];t.vectors4[e]=[s.x,s.y,s.z,s.w]}for(e in t.quaternions={},this._quaternions)t.quaternions[e]=this._quaternions[e].asArray();for(e in t.matrices={},this._matrices)t.matrices[e]=this._matrices[e].asArray();for(e in t.matrixArray={},this._matrixArrays)t.matrixArray[e]=this._matrixArrays[e];for(e in t.matrices3x3={},this._matrices3x3)t.matrices3x3[e]=this._matrices3x3[e];for(e in t.matrices2x2={},this._matrices2x2)t.matrices2x2[e]=this._matrices2x2[e];for(e in t.vectors2Arrays={},this._vectors2Arrays)t.vectors2Arrays[e]=this._vectors2Arrays[e];for(e in t.vectors3Arrays={},this._vectors3Arrays)t.vectors3Arrays[e]=this._vectors3Arrays[e];for(e in t.vectors4Arrays={},this._vectors4Arrays)t.vectors4Arrays[e]=this._vectors4Arrays[e];for(e in t.quaternionsArrays={},this._quaternionsArrays)t.quaternionsArrays[e]=this._quaternionsArrays[e];return t}}w.SnippetUrl="https://snippet.babylonjs.com";var P=e.i(75405);class F extends f.Mesh{_isShaderMaterial(e){return!!e&&"ShaderMaterial"===e.getClassName()}constructor(t,s=null,r=null,i=null,a,n,h,u){super(t,s,r,i,a),this.useVertexColor=n,this.useVertexAlpha=h,this.color=new l.Color3(1,1,1),this.alpha=1,this._shaderLanguage=0,this._ownsMaterial=!1,i&&(this.color=i.color.clone(),this.alpha=i.alpha,this.useVertexColor=i.useVertexColor,this.useVertexAlpha=i.useVertexAlpha),this.intersectionThreshold=.1;const c={attributes:[o.VertexBuffer.PositionKind],uniforms:["world","viewProjection"],needAlphaBlending:!0,defines:[],useClipPlane:null,shaderLanguage:0};if(this.useVertexAlpha?c.defines.push("#define VERTEXALPHA"):c.needAlphaBlending=!1,this.useVertexColor?(c.defines.push("#define VERTEXCOLOR"),c.attributes.push(o.VertexBuffer.ColorKind)):(c.uniforms.push("color"),this._color4=new l.Color4),u)this.material=u;else{this.getScene().getEngine().isWebGPU&&!F.ForceGLSL&&(this._shaderLanguage=1),c.shaderLanguage=this._shaderLanguage,c.extraInitializationsAsync=async()=>{1===this._shaderLanguage?await Promise.all([e.A(20169),e.A(57284)]):await Promise.all([e.A(76121),e.A(83228)])};const t=new w("colorShader",this.getScene(),"color",c,!1);t.doNotSerialize=!0,this._ownsMaterial=!0,this._setInternalMaterial(t)}}getClassName(){return"LinesMesh"}get material(){return this._internalAbstractMeshDataInfo._material}set material(e){let t=this.material;if(t===e)return;let s=t&&this._ownsMaterial;this._ownsMaterial=!1,this._setInternalMaterial(e),s&&t?.dispose()}_setInternalMaterial(e){this._setMaterial(e),this.material&&(this.material.fillMode=M.Material.LineListDrawMode,this.material.disableLighting=!0)}get checkCollisions(){return!1}set checkCollisions(e){}_bind(e,t){if(!this._geometry)return this;let s=this.isUnIndexed?null:this._geometry.getIndexBuffer();if(!this._userInstancedBuffersStorage||this.hasThinInstances?this._geometry._bind(t,s):this._geometry._bind(t,s,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects),!this.useVertexColor&&this._isShaderMaterial(this.material)){let{r:e,g:t,b:s}=this.color;this._color4.set(e,t,s,this.alpha),this.material.setColor4("color",this._color4)}return this}_draw(e,t,s){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;let r=this.getScene().getEngine();return this._unIndexed?r.drawArraysType(M.Material.LineListDrawMode,e.verticesStart,e.verticesCount,s):r.drawElementsType(M.Material.LineListDrawMode,e.indexStart,e.indexCount,s),this}dispose(e,t=!1,s){!s&&(this._ownsMaterial?this.material?.dispose(!1,!1,!0):t&&this.material?.dispose(!1,!1,!0)),super.dispose(e)}clone(e,t=null,s){return t&&void 0===t._addToSceneRootNodes?(t.source=this,new F(e,this.getScene(),t.parent,t.source,t.doNotCloneChildren)):new F(e,this.getScene(),t,this,s)}createInstance(e){let t=new B(e,this);if(this.instancedBuffers)for(let e in t.instancedBuffers={},this.instancedBuffers)t.instancedBuffers[e]=this.instancedBuffers[e];return t}serialize(e){super.serialize(e),e.color=this.color.asArray(),e.alpha=this.alpha}static Parse(e,t){let s=new F(e.name,t);return s.color=l.Color3.FromArray(e.color),s.alpha=e.alpha,s}}F.ForceGLSL=!1;class B extends m{constructor(e,t){super(e,t),this.intersectionThreshold=t.intersectionThreshold}getClassName(){return"InstancedLinesMesh"}}function L(e,t,s=null){let r=t.instance,i=t.lines,n=t.colors;if(r){let e,t,s=r.getVerticesData(o.VertexBuffer.PositionKind);n&&(e=r.getVerticesData(o.VertexBuffer.ColorKind));let a=0,h=0;for(let r=0;r<i.length;r++){let o=i[r];for(let i=0;i<o.length;i++)s[a]=o[i].x,s[a+1]=o[i].y,s[a+2]=o[i].z,n&&e&&(t=n[r],e[h]=t[i].r,e[h+1]=t[i].g,e[h+2]=t[i].b,e[h+3]=t[i].a,h+=4),a+=3}return r.updateVerticesData(o.VertexBuffer.PositionKind,s,!1,!1),n&&e&&r.updateVerticesData(o.VertexBuffer.ColorKind,e,!1,!1),r.refreshBoundingInfo(),r}let h=new F(e,s,null,void 0,void 0,!!n,t.useVertexAlpha,t.material);return(function(e){let t=[],s=[],r=e.lines,i=e.colors,o=[],n=0;for(let e=0;e<r.length;e++){let a=r[e];for(let r=0;r<a.length;r++){let{x:h,y:l,z:u}=a[r];if(s.push(h,l,u),i){let{r:t,g:s,b:a,a:n}=i[e][r];o.push(t,s,a,n)}r>0&&(t.push(n-1),t.push(n)),n++}}let h=new a.VertexData;return h.indices=t,h.positions=s,i&&(h.colors=o),h})(t).applyToMesh(h,t.updatable),h}(t=F.prototype).enableEdgesRendering??(t.enableEdgesRendering=(0,P._MissingSideEffect)("LinesMesh","enableEdgesRendering")),(s=B.prototype).enableEdgesRendering??(s.enableEdgesRendering=(0,P._MissingSideEffect)("InstancedLinesMesh","enableEdgesRendering"));var E=r,C=e.i(75991),S=e.i(89030);class z extends E.Vector2{constructor(e,t){super(e.x,e.y),this.index=t}}class R{constructor(){this.elements=[]}add(e){let t=[];for(let s of e){let e=new z(s,this.elements.length);t.push(e),this.elements.push(e)}return t}computeBounds(){let e=new E.Vector2(this.elements[0].x,this.elements[0].y),t=new E.Vector2(this.elements[0].x,this.elements[0].y);for(let s of this.elements)s.x<e.x?e.x=s.x:s.x>t.x&&(t.x=s.x),s.y<e.y?e.y=s.y:s.y>t.y&&(t.y=s.y);return{min:e,max:t,width:t.x-e.x,height:t.y-e.y}}}class U{_addToepoint(e){for(let t of e)this._epoints.push(t.x,t.y)}constructor(e,t,s,r=earcut){let i;this._points=new R,this._outlinepoints=new R,this._holes=[],this._epoints=[],this._eholes=[],this.bjsEarcut=r,this._name=e,this._scene=s||v.EngineStore.LastCreatedScene,i=t instanceof C.Path2?t.getPoints():t,this._addToepoint(i),this._points.add(i),this._outlinepoints.add(i),void 0===this.bjsEarcut&&p.Logger.Warn("Earcut was not found, the polygon will not be built.")}addHole(e){this._points.add(e);let t=new R;return t.add(e),this._holes.push(t),this._eholes.push(this._epoints.length/2),this._addToepoint(e),this}build(e=!1,t=0,s=2){let r=new i.Mesh(this._name,this._scene),a=this.buildVertexData(t,s);return r.setVerticesData(o.VertexBuffer.PositionKind,a.positions,e),r.setVerticesData(o.VertexBuffer.NormalKind,a.normals,e),r.setVerticesData(o.VertexBuffer.UVKind,a.uvs,e),r.setIndices(a.indices),r}buildVertexData(e=0,t=2){let s=new a.VertexData,r=[],i=[],o=[],n=this._points.computeBounds();for(let e of this._points.elements)r.push(0,1,0),i.push(e.x,0,e.y),o.push((e.x-n.min.x)/n.width,(e.y-n.min.y)/n.height);let h=[],l=this.bjsEarcut(this._epoints,this._eholes,2);for(let e=0;e<l.length;e++)h.push(l[e]);if(e>0){let s=i.length/3;for(let t of this._points.elements)r.push(0,-1,0),i.push(t.x,-e,t.y),o.push(1-(t.x-n.min.x)/n.width,1-(t.y-n.min.y)/n.height);let a=h.length;for(let e=0;e<a;e+=3){let t=h[e+0],r=h[e+1],i=h[e+2];h.push(i+s),h.push(r+s),h.push(t+s)}for(let s of(this._addSide(i,r,o,h,n,this._outlinepoints,e,!1,t),this._holes))this._addSide(i,r,o,h,n,s,e,!0,t)}return s.indices=h,s.positions=i,s.normals=r,s.uvs=o,s}_addSide(e,t,s,r,i,o,a,n,h){let l=e.length/3,u=0;for(let c=0;c<o.elements.length;c++){let d,f=o.elements[c],p=o.elements[(c+1)%o.elements.length];e.push(f.x,0,f.y),e.push(f.x,-a,f.y),e.push(p.x,0,p.y),e.push(p.x,-a,p.y);let x=o.elements[(c+o.elements.length-1)%o.elements.length],g=o.elements[(c+2)%o.elements.length],_=new E.Vector3(-(p.y-f.y),0,p.x-f.x),m=new E.Vector3(-(f.y-x.y),0,f.x-x.x),M=new E.Vector3(-(g.y-p.y),0,g.x-p.x);n||(_=_.scale(-1),m=m.scale(-1),M=M.scale(-1));let y=_.normalizeToNew(),V=m.normalizeToNew(),O=E.Vector3.Dot(V,y);V=O>h?O<S.Epsilon-1?new E.Vector3(f.x,0,f.y).subtract(new E.Vector3(p.x,0,p.y)).normalize():m.add(_).normalize():y;let A=E.Vector3.Dot(M,_);d=A>h?A<S.Epsilon-1?new E.Vector3(p.x,0,p.y).subtract(new E.Vector3(f.x,0,f.y)).normalize():M.add(_).normalize():y,s.push(u/i.width,0),s.push(u/i.width,1),u+=_.length(),s.push(u/i.width,0),s.push(u/i.width,1),t.push(V.x,V.y,V.z),t.push(V.x,V.y,V.z),t.push(d.x,d.y,d.z),t.push(d.x,d.y,d.z),n?(r.push(l),r.push(l+2),r.push(l+1),r.push(l+1),r.push(l+2),r.push(l+3)):(r.push(l),r.push(l+1),r.push(l+2),r.push(l+1),r.push(l+3),r.push(l+2)),l+=4}}}function N(e,t,s=null,h=earcut){let u;t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation);let c=t.shape,d=t.holes||[],f=t.depth||0,p=t.smoothingThreshold||2,x=[];for(let e=0;e<c.length;e++)x[e]=new r.Vector2(c[e].x,c[e].z);x[0].equalsWithEpsilon(x[x.length-1],1e-8)&&x.pop();let g=new U(e,x,s||v.EngineStore.LastCreatedScene,h);for(let e=0;e<d.length;e++){u=[];for(let t=0;t<d[e].length;t++)u.push(new r.Vector2(d[e][t].x,d[e][t].z));g.addHole(u)}let _=g.build(!1,f,p);return _._originalBuilderSideOrientation=t.sideOrientation,(function(e,t,s,i,h,u,c){let d,f,p,x,g=s||[,,,],_=[],m=c||!1;for(let e=0;e<3;e++)void 0===g[e]&&(g[e]=new r.Vector4(0,0,1,1)),i&&void 0===i[e]&&(i[e]=new l.Color4(1,1,1,1));let M=e.getVerticesData(o.VertexBuffer.PositionKind),y=e.getVerticesData(o.VertexBuffer.NormalKind),V=e.getVerticesData(o.VertexBuffer.UVKind),O=e.getIndices(),A=M.length/9,v=0,T=[0];if(m)for(let e=A;e<M.length/3;e+=4)T.push(v+=Math.sqrt((f=M[3*(e+2)]-M[3*e])*f+(p=M[3*(e+2)+2]-M[3*e+2])*p));let b=0;for(let e=0;e<y.length;e+=3).001>Math.abs(y[e+1])&&(b=1),.001>Math.abs(y[e+1]-1)&&(b=0),.001>Math.abs(y[e+1]+1)&&(b=2),x=e/3,1===b?((d=x-A)%4<1.5?m?V[2*x]=g[b].x+(g[b].z-g[b].x)*T[Math.floor(d/4)]/v:V[2*x]=g[b].x:m?V[2*x]=g[b].x+(g[b].z-g[b].x)*T[Math.floor(d/4)+1]/v:V[2*x]=g[b].z,d%2==0?V[2*x+1]=n.useOpenGLOrientationForUV?1-g[b].w:g[b].w:V[2*x+1]=n.useOpenGLOrientationForUV?1-g[b].y:g[b].y):(V[2*x]=(1-V[2*x])*g[b].x+V[2*x]*g[b].z,V[2*x+1]=(1-V[2*x+1])*g[b].y+V[2*x+1]*g[b].w,n.useOpenGLOrientationForUV&&(V[2*x+1]=1-V[2*x+1])),i&&_.push(i[b].r,i[b].g,i[b].b,i[b].a);a.VertexData._ComputeSides(t,M,O,y,V,h,u);let I=new a.VertexData;return I.indices=O,I.positions=M,I.normals=y,I.uvs=V,i&&(I.colors=t===a.VertexData.DOUBLESIDE?_.concat(_):_),I})(_,t.sideOrientation,t.faceUV,t.faceColors,t.frontUVs,t.backUVs,t.wrap).applyToMesh(_,t.updatable),_}function W(e,t,s=null,r=earcut){return N(e,t,s,r)}function G(e,t,s,o,a,n,l,u,c,d,f,p,x,g,_,m,M,y,V,O,A){let v,T=(e,t,s,o,a,n,h,l,u,c,d)=>{let f=s.getTangents(),p=s.getNormals(),x=s.getBinormals(),g=s.getDistances();if(d){for(let e=0;e<f.length;e++)if(0==f[e].x&&0==f[e].y&&0==f[e].z&&f[e].copyFrom(f[e-1]),0==p[e].x&&0==p[e].y&&0==p[e].z&&p[e].copyFrom(p[e-1]),0==x[e].x&&0==x[e].y&&0==x[e].z&&x[e].copyFrom(x[e-1]),e>0){let t=f[e-1];0>r.Vector3.Dot(t,f[e])&&f[e].scaleInPlace(-1),t=p[e-1],0>r.Vector3.Dot(t,p[e])&&p[e].scaleInPlace(-1),t=x[e-1],0>r.Vector3.Dot(t,x[e])&&x[e].scaleInPlace(-1)}}let _=0,m=c&&l?l:()=>null!==n?n:0,M=c&&h?h:()=>null!==a?a:r.Vector3.OneReadOnly,y=2*(u!==i.Mesh.NO_CAP&&u!==i.Mesh.CAP_END),V=r.TmpVectors.Matrix[0];for(let s=0;s<t.length;s++){let i=[],a=m(s,g[s]),n=M(s,g[s]);r.Matrix.RotationAxisToRef(f[s],_,V);for(let o=0;o<e.length;o++){let a=f[s].scale(e[o].z).add(p[s].scale(e[o].x)).add(x[s].scale(e[o].y)),h=r.Vector3.Zero();r.Vector3.TransformCoordinatesToRef(a,V,h),h.multiplyInPlace(n).addInPlace(t[s]),i[o]=h}o[y]=i,_+=a,y++}let O=A||(e=>{let t,s=[],i=r.Vector3.Zero();for(t=0;t<e.length;t++)i.addInPlace(e[t]);for(i.scaleInPlace(1/e.length),t=0;t<e.length;t++)s.push(i);return s});switch(u){case i.Mesh.NO_CAP:break;case i.Mesh.CAP_START:o[0]=O(o[2]),o[1]=o[2];break;case i.Mesh.CAP_END:o[y]=o[y-1],o[y+1]=O(o[y-1]);break;case i.Mesh.CAP_ALL:o[0]=O(o[2]),o[1]=o[2],o[y]=o[y-1],o[y+1]=O(o[y-1])}return o},b=null!==o?new r.Vector3(o,o,o):null;if(_){let e=_._creationDataStorage;return V?e.path3D.update(s,V):e.path3D.update(s),_=h("",{pathArray:v=T(t,s,e.path3D,e.pathArray,b,a,n,l,e.cap,f,O),closeArray:!1,closePath:!1,offset:0,updatable:!1,sideOrientation:0,instance:_},p||void 0)}let I=V?new C.Path3D(s,V):new C.Path3D(s),D=h(e,{pathArray:v=T(t,s,I,[],b,a,n,l,d=d<0||d>3?0:d,f,O),closeArray:u,closePath:c,updatable:x,sideOrientation:g,invertUV:m,frontUVs:M||void 0,backUVs:y||void 0},p);return D._creationDataStorage.pathArray=v,D._creationDataStorage.path3D=I,D._creationDataStorage.cap=d,D}var k=i;class H extends k.Mesh{constructor(e,t){super(e,t),this.generateOctree=!1}getClassName(){return"GroundMesh"}get subdivisions(){return Math.min(this._subdivisionsX,this._subdivisionsY)}get subdivisionsX(){return this._subdivisionsX}get subdivisionsY(){return this._subdivisionsY}optimize(e,t=32){this._subdivisionsX=e,this._subdivisionsY=e,this.subdivide(e),(0,P._IsSideEffectImplemented)(this.createOrUpdateSubmeshesOctree)&&this.createOrUpdateSubmeshesOctree(t)}getHeightAtCoordinates(e,t){let s=this.getWorldMatrix(),i=r.TmpVectors.Matrix[5];s.invertToRef(i);let o=r.TmpVectors.Vector3[8];if(r.Vector3.TransformCoordinatesFromFloatsToRef(e,0,t,i,o),e=o.x,t=o.z,e<this._minX||e>=this._maxX||t<=this._minZ||t>this._maxZ)return this.position.y;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());let a=this._getFacetAt(e,t),n=-(a.x*e+a.z*t+a.w)/a.y;return r.Vector3.TransformCoordinatesFromFloatsToRef(0,n,0,s,o),o.y}getNormalAtCoordinates(e,t){let s=new r.Vector3(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,s),s}getNormalAtCoordinatesToRef(e,t,s){let i=this.getWorldMatrix(),o=r.TmpVectors.Matrix[5];i.invertToRef(o);let a=r.TmpVectors.Vector3[8];if(r.Vector3.TransformCoordinatesFromFloatsToRef(e,0,t,o,a),e=a.x,t=a.z,e<this._minX||e>this._maxX||t<this._minZ||t>this._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());let n=this._getFacetAt(e,t);return r.Vector3.TransformNormalFromFloatsToRef(n.x,n.y,n.z,i,s),this}updateCoordinateHeights(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this}_getFacetAt(e,t){let s=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),r=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY),i=this._heightQuads[r*this._subdivisionsX+s];return t<i.slope.x*e+i.slope.y?i.facet1:i.facet2}_initHeightQuads(){let e=this._subdivisionsX,t=this._subdivisionsY;this._heightQuads=[];for(let s=0;s<t;s++)for(let t=0;t<e;t++){let i={slope:r.Vector2.Zero(),facet1:new r.Vector4(0,0,0,0),facet2:new r.Vector4(0,0,0,0)};this._heightQuads[s*e+t]=i}return this}_computeHeightQuads(){let e,t,s,i,a,n,h,l=this.getVerticesData(o.VertexBuffer.PositionKind);if(!l)return this;let u=r.TmpVectors.Vector3[3],c=r.TmpVectors.Vector3[2],d=r.TmpVectors.Vector3[1],f=r.TmpVectors.Vector3[0],p=r.TmpVectors.Vector3[4],x=r.TmpVectors.Vector3[5],g=r.TmpVectors.Vector3[6],_=r.TmpVectors.Vector3[7],m=r.TmpVectors.Vector3[8],M=this._subdivisionsX,y=this._subdivisionsY;for(let o=0;o<y;o++)for(let y=0;y<M;y++){e=3*y,t=o*(M+1)*3,s=(o+1)*(M+1)*3,u.x=l[t+e],u.y=l[t+e+1],u.z=l[t+e+2],c.x=l[t+e+3],c.y=l[t+e+4],c.z=l[t+e+5],d.x=l[s+e],d.y=l[s+e+1],d.z=l[s+e+2],f.x=l[s+e+3],f.y=l[s+e+4],f.z=l[s+e+5],i=(f.z-u.z)/(f.x-u.x),a=u.z-i*u.x,c.subtractToRef(u,p),d.subtractToRef(u,x),f.subtractToRef(u,g),r.Vector3.CrossToRef(g,x,_),r.Vector3.CrossToRef(p,g,m),_.normalize(),m.normalize(),n=-(_.x*u.x+_.y*u.y+_.z*u.z),h=-(m.x*c.x+m.y*c.y+m.z*c.z);let V=this._heightQuads[o*M+y];V.slope.copyFromFloats(i,a),V.facet1.copyFromFloats(_.x,_.y,_.z,n),V.facet2.copyFromFloats(m.x,m.y,m.z,h)}return this}serialize(e){super.serialize(e),e.subdivisionsX=this._subdivisionsX,e.subdivisionsY=this._subdivisionsY,e.minX=this._minX,e.maxX=this._maxX,e.minZ=this._minZ,e.maxZ=this._maxZ,e.width=this._width,e.height=this._height}static Parse(e,t){let s=new H(e.name,t);return s._subdivisionsX=e.subdivisionsX||1,s._subdivisionsY=e.subdivisionsY||1,s._minX=e.minX,s._maxX=e.maxX,s._minZ=e.minZ,s._maxZ=e.maxZ,s._width=e.width,s._height=e.height,s}}var X=e.i(65740);function Z(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s,i,o,h,u,c,d,f=[];f[0]={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]]},f[1]={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]]},f[2]={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]]},f[3]={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]]},f[4]={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]]},f[5]={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]]},f[6]={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]]},f[7]={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]]},f[8]={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]]},f[9]={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]]},f[10]={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]]},f[11]={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]]},f[12]={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]]},f[13]={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]]},f[14]={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]]};let p=e.type&&(e.type<0||e.type>=f.length)?0:e.type||0,x=e.size,g=e.sizeX||x||1,_=e.sizeY||x||1,m=e.sizeZ||x||1,M=e.custom||f[p],y=M.face.length,V=e.faceUV||Array(y),O=e.faceColors,A=void 0===e.flat||e.flat,v=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,T=[],b=[],I=[],D=[],w=[],P=0,F=0,B=[];if(A)for(s=0;s<y;s++)O&&void 0===O[s]&&(O[s]=new l.Color4(1,1,1,1)),V&&void 0===V[s]&&(V[s]=new r.Vector4(0,0,1,1));if(A)for(s=0;s<y;s++){let e=M.face[s].length;for(t=0,u=.5*Math.tan((h=2*Math.PI/e)/2),c=.5;t<e;t++)T.push(M.vertex[M.face[s][t]][0]*g,M.vertex[M.face[s][t]][1]*_,M.vertex[M.face[s][t]][2]*m),B.push(P),P++,i=V[s].x+(V[s].z-V[s].x)*(.5+u),o=V[s].y+(V[s].w-V[s].y)*(c-.5),D.push(i,n.useOpenGLOrientationForUV?1-o:o),d=u*Math.cos(h)-c*Math.sin(h),c=u*Math.sin(h)+c*Math.cos(h),u=d,O&&w.push(O[s].r,O[s].g,O[s].b,O[s].a);for(t=0;t<e-2;t++)b.push(B[0+F],B[t+2+F],B[t+1+F]);F+=e}else{for(t=0;t<M.vertex.length;t++)T.push(M.vertex[t][0]*g,M.vertex[t][1]*_,M.vertex[t][2]*m),D.push(0,+!!n.useOpenGLOrientationForUV);for(s=0;s<y;s++)for(t=0;t<M.face[s].length-2;t++)b.push(M.face[s][0],M.face[s][t+2],M.face[s][t+1])}a.VertexData.ComputeNormals(T,b,I),a.VertexData._ComputeSides(v,T,b,I,D,e.frontUVs,e.backUVs);let L=new a.VertexData;return L.positions=T,L.indices=b,L.normals=I,L.uvs=D,O&&A&&(L.colors=w),L})(t).applyToMesh(o,t.updatable),o}var K=e.i(46703);let Y=new r.Vector3(1,0,0),q=new r.Vector3(-1,0,0),j=new r.Vector3(0,1,0),Q=new r.Vector3(0,-1,0),$=new r.Vector3(0,0,1),J=new r.Vector3(0,0,-1);class ee{constructor(e=r.Vector3.Zero(),t=r.Vector3.Up(),s=r.Vector2.Zero(),i=0,o=0,a=null,n=null,h=null,l=null){this.position=e,this.normal=t,this.uv=s,this.vertexIdx=i,this.vertexIdxForBones=o,this.localPositionOverride=a,this.localNormalOverride=n,this.matrixIndicesOverride=h,this.matrixWeightsOverride=l}clone(){return new ee(this.position.clone(),this.normal.clone(),this.uv.clone(),this.vertexIdx,this.vertexIdxForBones,this.localPositionOverride?.slice(),this.localNormalOverride?.slice(),this.matrixIndicesOverride?.slice(),this.matrixWeightsOverride?.slice())}}class et{constructor(e=0,t=0){this.x=e,this.y=t,e!==Math.floor(e)&&(e=Math.floor(e),p.Logger.Warn("x is not an integer, floor(x) used")),t!==Math.floor(t)&&(t=Math.floor(t),p.Logger.Warn("y is not an integer, floor(y) used"))}clone(){return new et(this.x,this.y)}rotate60About(e){let t=this.x;return this.x=e.x+e.y-this.y,this.y=t+this.y-e.x,this}rotateNeg60About(e){let t=this.x;return this.x=t+this.y-e.y,this.y=e.x+e.y-t,this}rotate120(e,t){e!==Math.floor(e)&&(e=Math.floor(e),p.Logger.Warn("m not an integer only floor(m) used")),t!==Math.floor(t)&&(t=Math.floor(t),p.Logger.Warn("n not an integer only floor(n) used"));let s=this.x;return this.x=e-s-this.y,this.y=t+s,this}rotateNeg120(e,t){e!==Math.floor(e)&&(e=Math.floor(e),p.Logger.Warn("m is not an integer, floor(m) used")),t!==Math.floor(t)&&(t=Math.floor(t),p.Logger.Warn("n is not an integer, floor(n) used"));let s=this.x;return this.x=this.y-t,this.y=e+t-s-this.y,this}toCartesianOrigin(e,t){let s=r.Vector3.Zero();return s.x=e.x+2*this.x*t+this.y*t,s.y=e.y+Math.sqrt(3)*this.y*t,s}static Zero(){return new et(0,0)}}class es{constructor(){this.cartesian=[],this.vertices=[],this.max=[],this.min=[],this.closestTo=[],this.innerFacets=[],this.isoVecsABOB=[],this.isoVecsOBOA=[],this.isoVecsBAOA=[],this.vertexTypes=[],this.IDATA=new er("icosahedron","Regular",[[0,S.PHI,-1],[-S.PHI,1,0],[-1,0,-S.PHI],[1,0,-S.PHI],[S.PHI,1,0],[0,S.PHI,1],[-1,0,S.PHI],[-S.PHI,-1,0],[0,-S.PHI,-1],[S.PHI,-1,0],[1,0,S.PHI],[0,-S.PHI,1]],[[0,2,1],[0,3,2],[0,4,3],[0,5,4],[0,1,5],[7,6,1],[8,7,2],[9,8,3],[10,9,4],[6,10,5],[2,7,1],[3,8,2],[4,9,3],[5,10,4],[1,6,5],[11,6,7],[11,7,8],[11,8,9],[11,9,10],[11,10,6]])}setIndices(){let e,t,s,r,i,o,a,n,h=12,l={},u=this.m,c=this.n,d=u;0!==c&&(d=(0,K.HighestCommonFactor)(u,c));let f=u/d,p=c/d,x=et.Zero(),g=new et(u,c),_=new et(-c,u+c),m=et.Zero(),M=et.Zero(),y=et.Zero(),V=[],O=[],A=this.vertByDist,v=(e,t,s,r)=>{o=e+"|"+s,a=t+"|"+r,o in l||a in l?o in l&&!(a in l)?l[a]=l[o]:a in l&&!(o in l)&&(l[o]=l[a]):(l[o]=h,l[a]=h,h++),A[s][0]>2?O[l[o]]=[-A[s][0],A[s][1],l[o]]:O[l[o]]=[V[A[s][0]],A[s][1],l[o]]};this.IDATA.edgematch=[[1,"B"],[2,"B"],[3,"B"],[4,"B"],[0,"B"],[10,"O",14,"A"],[11,"O",10,"A"],[12,"O",11,"A"],[13,"O",12,"A"],[14,"O",13,"A"],[0,"O"],[1,"O"],[2,"O"],[3,"O"],[4,"O"],[19,"B",5,"A"],[15,"B",6,"A"],[16,"B",7,"A"],[17,"B",8,"A"],[18,"B",9,"A"]];for(let a=0;a<20;a++){if(s=(V=this.IDATA.face[a])[2],r=V[1],i=V[0],(o=a+"|"+(n=x.x+"|"+x.y))in l||(l[o]=s,O[s]=[V[A[n][0]],A[n][1]]),(o=a+"|"+(n=g.x+"|"+g.y))in l||(l[o]=r,O[r]=[V[A[n][0]],A[n][1]]),(o=a+"|"+(n=_.x+"|"+_.y))in l||(l[o]=i,O[i]=[V[A[n][0]],A[n][1]]),e=this.IDATA.edgematch[a][0],"B"===(t=this.IDATA.edgematch[a][1]))for(let t=1;t<d;t++)M.x=u-t*(f+p),M.y=c+t*f,y.x=-t*p,y.y=t*(f+p),v(a,e,n=M.x+"|"+M.y,y.x+"|"+y.y);if("O"===t)for(let t=1;t<d;t++)y.x=-t*p,y.y=t*(f+p),m.x=t*f,m.y=t*p,v(a,e,n=y.x+"|"+y.y,m.x+"|"+m.y);if(e=this.IDATA.edgematch[a][2],(t=this.IDATA.edgematch[a][3])&&"A"===t)for(let t=1;t<d;t++)m.x=t*f,m.y=t*p,M.x=u-(d-t)*(f+p),M.y=c+(d-t)*f,v(a,e,n=m.x+"|"+m.y,M.x+"|"+M.y);for(let e=0;e<this.vertices.length;e++)(o=a+"|"+(n=this.vertices[e].x+"|"+this.vertices[e].y))in l||(l[o]=h++,A[n][0]>2?O[l[o]]=[-A[n][0],A[n][1],l[o]]:O[l[o]]=[V[A[n][0]],A[n][1],l[o]])}this.closestTo=O,this.vecToidx=l}calcCoeffs(){let e=this.m,t=this.n,s=Math.sqrt(3)/3,r=e*e+t*t+e*t;this.coau=(e+t)/r,this.cobu=-t/r,this.coav=-s*(e-t)/r,this.cobv=s*(2*e+t)/r}createInnerFacets(){let e=this.m,t=this.n;for(let s=0;s<t+e+1;s++)for(let e=this.min[s];e<this.max[s]+1;e++)e<this.max[s]&&e<this.max[s+1]+1&&this.innerFacets.push(["|"+e+"|"+s,"|"+e+"|"+(s+1),"|"+(e+1)+"|"+s]),s>0&&e<this.max[s-1]&&e+1<this.max[s]+1&&this.innerFacets.push(["|"+e+"|"+s,"|"+(e+1)+"|"+s,"|"+(e+1)+"|"+(s-1)])}edgeVecsABOB(){let e=this.m,t=this.n,s=new et(-t,e+t);for(let r=1;r<e+t;r++){let e=new et(this.min[r],r),t=new et(this.min[r-1],r-1),i=new et(this.min[r+1],r+1),o=e.clone(),a=t.clone(),n=i.clone();o.rotate60About(s),a.rotate60About(s),n.rotate60About(s);let h=new et(this.max[o.y],o.y),l=new et(this.max[o.y-1],o.y-1),u=new et(this.max[o.y-1]-1,o.y-1);(o.x!==h.x||o.y!==h.y)&&(o.x!==l.x?(this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([e,l,u]),this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([e,u,h])):o.y===n.y?(this.vertexTypes.push([1,1,0]),this.isoVecsABOB.push([e,t,l]),this.vertexTypes.push([1,0,1]),this.isoVecsABOB.push([e,l,i])):(this.vertexTypes.push([1,1,0]),this.isoVecsABOB.push([e,t,l]),this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([e,l,h])))}}mapABOBtoOBOA(){let e=new et(0,0);for(let t=0;t<this.isoVecsABOB.length;t++){let s=[];for(let r=0;r<3;r++)e.x=this.isoVecsABOB[t][r].x,e.y=this.isoVecsABOB[t][r].y,0===this.vertexTypes[t][r]&&e.rotateNeg120(this.m,this.n),s.push(e.clone());this.isoVecsOBOA.push(s)}}mapABOBtoBAOA(){let e=new et(0,0);for(let t=0;t<this.isoVecsABOB.length;t++){let s=[];for(let r=0;r<3;r++)e.x=this.isoVecsABOB[t][r].x,e.y=this.isoVecsABOB[t][r].y,1===this.vertexTypes[t][r]&&e.rotate120(this.m,this.n),s.push(e.clone());this.isoVecsBAOA.push(s)}}MapToFace(e,t){let s,i,o=this.IDATA.face[e],a=o[2],n=o[1],h=o[0],l=r.Vector3.FromArray(this.IDATA.vertex[a]),u=r.Vector3.FromArray(this.IDATA.vertex[n]),c=r.Vector3.FromArray(this.IDATA.vertex[h]),d=u.subtract(l),f=c.subtract(l),p=d.scale(this.coau).add(f.scale(this.cobu)),x=d.scale(this.coav).add(f.scale(this.cobv)),g=[];for(let r=0;r<this.cartesian.length;r++)i=p.scale(this.cartesian[r].x).add(x.scale(this.cartesian[r].y)).add(l),g[r]=[i.x,i.y,i.z],s=e+"|"+this.vertices[r].x+"|"+this.vertices[r].y,t.vertex[this.vecToidx[s]]=[i.x,i.y,i.z]}build(e,t){let s,r,i=[],o=et.Zero(),a=new et(e,t),n=new et(-t,e+t);i.push(o,a,n);for(let s=t;s<e+1;s++)for(let t=0;t<e+1-s;t++)i.push(new et(t,s));if(t>0){let s=(0,K.HighestCommonFactor)(e,t),r=e/s,o=t/s;for(let a=1;a<s;a++)i.push(new et(a*r,a*o)),i.push(new et(-a*o,a*(r+o))),i.push(new et(e-a*(r+o),t+a*r));let a=e/t;for(let s=1;s<t;s++)for(let r=0;r<s*a;r++)i.push(new et(r,s)),i.push(new et(r,s).rotate120(e,t)),i.push(new et(r,s).rotateNeg120(e,t))}i.sort((e,t)=>e.x-t.x),i.sort((e,t)=>e.y-t.y);let h=Array(e+t+1),l=Array(e+t+1);for(let e=0;e<h.length;e++)h[e]=1/0,l[e]=-1/0;let u=i.length;for(let e=0;e<u;e++)r=i[e].x,h[s=i[e].y]=Math.min(r,h[s]),l[s]=Math.max(r,l[s]);let c=(s,r)=>{let i=s.clone();return("A"===r&&i.rotateNeg120(e,t),"B"===r&&i.rotate120(e,t),i.x<0)?i.y:i.x+i.y},d=[],f=[],p=[],x=[],g={},_=[],m=-1,M=-1;for(let e=0;e<u;e++)d[e]=i[e].toCartesianOrigin(new et(0,0),.5),f[e]=c(i[e],"O"),p[e]=c(i[e],"A"),x[e]=c(i[e],"B"),f[e]===p[e]&&p[e]===x[e]?(m=3,M=f[e]):f[e]===p[e]?(m=4,M=f[e]):p[e]===x[e]?(m=5,M=p[e]):x[e]===f[e]&&(m=6,M=f[e]),f[e]<p[e]&&f[e]<x[e]&&(m=2,M=f[e]),p[e]<f[e]&&p[e]<x[e]&&(m=1,M=p[e]),x[e]<p[e]&&x[e]<f[e]&&(m=0,M=x[e]),_.push([m,M,i[e].x,i[e].y]);_.sort((e,t)=>e[2]-t[2]),_.sort((e,t)=>e[3]-t[3]),_.sort((e,t)=>e[1]-t[1]),_.sort((e,t)=>e[0]-t[0]);for(let e=0;e<_.length;e++)g[_[e][2]+"|"+_[e][3]]=[_[e][0],_[e][1],e];return this.m=e,this.n=t,this.vertices=i,this.vertByDist=g,this.cartesian=d,this.min=h,this.max=l,this}}class er{constructor(e,t,s,r){this.name=e,this.category=t,this.vertex=s,this.face=r}}class ei extends er{innerToData(e,t){for(let s=0;s<t.innerFacets.length;s++)this.face.push(t.innerFacets[s].map(s=>t.vecToidx[e+s]))}mapABOBtoDATA(e,t){let s=t.IDATA.edgematch[e][0];for(let r=0;r<t.isoVecsABOB.length;r++){let i=[];for(let o=0;o<3;o++)0===t.vertexTypes[r][o]?i.push(e+"|"+t.isoVecsABOB[r][o].x+"|"+t.isoVecsABOB[r][o].y):i.push(s+"|"+t.isoVecsABOB[r][o].x+"|"+t.isoVecsABOB[r][o].y);this.face.push([t.vecToidx[i[0]],t.vecToidx[i[1]],t.vecToidx[i[2]]])}}mapOBOAtoDATA(e,t){let s=t.IDATA.edgematch[e][0];for(let r=0;r<t.isoVecsOBOA.length;r++){let i=[];for(let o=0;o<3;o++)1===t.vertexTypes[r][o]?i.push(e+"|"+t.isoVecsOBOA[r][o].x+"|"+t.isoVecsOBOA[r][o].y):i.push(s+"|"+t.isoVecsOBOA[r][o].x+"|"+t.isoVecsOBOA[r][o].y);this.face.push([t.vecToidx[i[0]],t.vecToidx[i[1]],t.vecToidx[i[2]]])}}mapBAOAtoDATA(e,t){let s=t.IDATA.edgematch[e][2];for(let r=0;r<t.isoVecsBAOA.length;r++){let i=[];for(let o=0;o<3;o++)1===t.vertexTypes[r][o]?i.push(e+"|"+t.isoVecsBAOA[r][o].x+"|"+t.isoVecsBAOA[r][o].y):i.push(s+"|"+t.isoVecsBAOA[r][o].x+"|"+t.isoVecsBAOA[r][o].y);this.face.push([t.vecToidx[i[0]],t.vecToidx[i[1]],t.vecToidx[i[2]]])}}orderData(e){let t=[];for(let e=0;e<13;e++)t[e]=[];let s=e.closestTo;for(let e=0;e<s.length;e++)s[e][0]>-1?s[e][1]>0&&t[s[e][0]].push([e,s[e][1]]):t[12].push([e,s[e][0]]);let r=[];for(let e=0;e<12;e++)r[e]=e;let i=12;for(let e=0;e<12;e++){t[e].sort((e,t)=>e[1]-t[1]);for(let s=0;s<t[e].length;s++)r[t[e][s][0]]=i++}for(let e=0;e<t[12].length;e++)r[t[12][e][0]]=i++;for(let e=0;e<this.vertex.length;e++)this.vertex[e].push(r[e]);this.vertex.sort((e,t)=>e[3]-t[3]);for(let e=0;e<this.vertex.length;e++)this.vertex[e].pop();for(let e=0;e<this.face.length;e++)for(let t=0;t<this.face[e].length;t++)this.face[e][t]=r[this.face[e][t]];this.sharedNodes=t[12].length,this.poleNodes=this.vertex.length-this.sharedNodes}setOrder(e,t){let s=[],r=[],i=t.pop();r.push(i);let o=this.face[i].indexOf(e);o=(o+2)%3;let a=this.face[i][o];s.push(a);let n=0;for(;t.length>0;)i=t[n],this.face[i].indexOf(a)>-1?(o=(this.face[i].indexOf(a)+1)%3,a=this.face[i][o],s.push(a),r.push(i),t.splice(n,1),n=0):n++;return this.adjacentFaces.push(s),r}toGoldbergPolyhedronData(){let e,t,s,r,i,o=new er("GeoDual","Goldberg",[],[]);o.name="GD dual";let a=this.vertex.length,n=Array(a);for(let e=0;e<a;e++)n[e]=[];for(let e=0;e<this.face.length;e++)for(let t=0;t<3;t++)n[this.face[e][t]].push(e);this.adjacentFaces=[];for(let a=0;a<n.length;a++)for(let h of(o.face[a]=this.setOrder(a,n[a].concat([])),n[a])){e=0,t=0,s=0,r=this.face[h];for(let o=0;o<3;o++)e+=(i=this.vertex[r[o]])[0],t+=i[1],s+=i[2];o.vertex[h]=[e/3,t/3,s/3]}return o}static BuildGeodesicData(e){let t=new ei("Geodesic-m-n","Geodesic",[[0,S.PHI,-1],[-S.PHI,1,0],[-1,0,-S.PHI],[1,0,-S.PHI],[S.PHI,1,0],[0,S.PHI,1],[-1,0,S.PHI],[-S.PHI,-1,0],[0,-S.PHI,-1],[S.PHI,-1,0],[1,0,S.PHI],[0,-S.PHI,1]],[]);e.setIndices(),e.calcCoeffs(),e.createInnerFacets(),e.edgeVecsABOB(),e.mapABOBtoOBOA(),e.mapABOBtoBAOA();for(let s=0;s<e.IDATA.face.length;s++)e.MapToFace(s,t),t.innerToData(s,e),"B"===e.IDATA.edgematch[s][1]&&t.mapABOBtoDATA(s,e),"O"===e.IDATA.edgematch[s][1]&&t.mapOBOAtoDATA(s,e),"A"===e.IDATA.edgematch[s][3]&&t.mapBAOAtoDATA(s,e);return t.orderData(e),t.vertex=t.vertex.map(function(e){let t=e[0],s=e[1],r=e[2],i=Math.sqrt(t*t+s*s+r*r);return e[0]*=1/i,e[1]*=1/i,e[2]*=1/i,e}),t}}var eo=i;class ea extends eo.Mesh{constructor(){super(...arguments),this.goldbergData={faceColors:[],faceCenters:[],faceZaxis:[],faceXaxis:[],faceYaxis:[],nbSharedFaces:0,nbUnsharedFaces:0,nbFaces:0,nbFacesAtPole:0,adjacentFaces:[]}}relatedGoldbergFace(e,t){return void 0===t?(e>this.goldbergData.nbUnsharedFaces-1&&(p.Logger.Warn("Maximum number of unshared faces used"),e=this.goldbergData.nbUnsharedFaces-1),this.goldbergData.nbUnsharedFaces+e):(e>11&&(p.Logger.Warn("Last pole used"),e=11),t>this.goldbergData.nbFacesAtPole-1&&(p.Logger.Warn("Maximum number of faces at a pole used"),t=this.goldbergData.nbFacesAtPole-1),12+e*this.goldbergData.nbFacesAtPole+t)}_changeGoldbergFaceColors(e){for(let t=0;t<e.length;t++){let s=e[t][0],r=e[t][1],i=e[t][2];for(let e=s;e<r+1;e++)this.goldbergData.faceColors[e]=i}let t=[];for(let e=0;e<12;e++)for(let s=0;s<5;s++)t.push(this.goldbergData.faceColors[e].r,this.goldbergData.faceColors[e].g,this.goldbergData.faceColors[e].b,this.goldbergData.faceColors[e].a);for(let e=12;e<this.goldbergData.faceColors.length;e++)for(let s=0;s<6;s++)t.push(this.goldbergData.faceColors[e].r,this.goldbergData.faceColors[e].g,this.goldbergData.faceColors[e].b,this.goldbergData.faceColors[e].a);return t}setGoldbergFaceColors(e){let t=this._changeGoldbergFaceColors(e);this.setVerticesData(o.VertexBuffer.ColorKind,t)}updateGoldbergFaceColors(e){let t=this._changeGoldbergFaceColors(e);this.updateVerticesData(o.VertexBuffer.ColorKind,t)}_changeGoldbergFaceUVs(e){let t=this.getVerticesData(o.VertexBuffer.UVKind);for(let s=0;s<e.length;s++){let r,i,o=e[s][0],a=e[s][1],n=e[s][2],h=e[s][3],l=e[s][4],u=[],c=[];for(let e=0;e<5;e++)r=n.x+h*Math.cos(l+e*Math.PI/2.5),i=n.y+h*Math.sin(l+e*Math.PI/2.5),r<0&&(r=0),r>1&&(r=1),u.push(r,i);for(let e=0;e<6;e++)r=n.x+h*Math.cos(l+e*Math.PI/3),i=n.y+h*Math.sin(l+e*Math.PI/3),r<0&&(r=0),r>1&&(r=1),c.push(r,i);for(let e=o;e<Math.min(12,a+1);e++)for(let s=0;s<5;s++)t[10*e+2*s]=u[2*s],t[10*e+2*s+1]=u[2*s+1];for(let e=Math.max(12,o);e<a+1;e++)for(let s=0;s<6;s++)t[12*e-24+2*s]=c[2*s],t[12*e-23+2*s]=c[2*s+1]}return t}setGoldbergFaceUVs(e){let t=this._changeGoldbergFaceUVs(e);this.setVerticesData(o.VertexBuffer.UVKind,t)}updateGoldbergFaceUVs(e){let t=this._changeGoldbergFaceUVs(e);this.updateVerticesData(o.VertexBuffer.UVKind,t)}placeOnGoldbergFaceAt(e,t,s){e.rotation=r.Vector3.RotationFromAxis(this.goldbergData.faceXaxis[t],this.goldbergData.faceYaxis[t],this.goldbergData.faceZaxis[t]),e.position=this.goldbergData.faceCenters[t].add(this.goldbergData.faceXaxis[t].scale(s.x)).add(this.goldbergData.faceYaxis[t].scale(s.y)).add(this.goldbergData.faceZaxis[t].scale(s.z))}serialize(e){super.serialize(e),e.type="GoldbergMesh";let t={};if(t.adjacentFaces=this.goldbergData.adjacentFaces,t.nbSharedFaces=this.goldbergData.nbSharedFaces,t.nbUnsharedFaces=this.goldbergData.nbUnsharedFaces,t.nbFaces=this.goldbergData.nbFaces,t.nbFacesAtPole=this.goldbergData.nbFacesAtPole,this.goldbergData.faceColors)for(let e of(t.faceColors=[],this.goldbergData.faceColors))t.faceColors.push(e.asArray());if(this.goldbergData.faceCenters)for(let e of(t.faceCenters=[],this.goldbergData.faceCenters))t.faceCenters.push(e.asArray());if(this.goldbergData.faceZaxis)for(let e of(t.faceZaxis=[],this.goldbergData.faceZaxis))t.faceZaxis.push(e.asArray());if(this.goldbergData.faceYaxis)for(let e of(t.faceYaxis=[],this.goldbergData.faceYaxis))t.faceYaxis.push(e.asArray());if(this.goldbergData.faceXaxis)for(let e of(t.faceXaxis=[],this.goldbergData.faceXaxis))t.faceXaxis.push(e.asArray());e.goldbergData=t}static Parse(e,t){let s=e.goldbergData;s.faceColors=s.faceColors.map(e=>l.Color4.FromArray(e)),s.faceCenters=s.faceCenters.map(e=>r.Vector3.FromArray(e)),s.faceZaxis=s.faceZaxis.map(e=>r.Vector3.FromArray(e)),s.faceXaxis=s.faceXaxis.map(e=>r.Vector3.FromArray(e)),s.faceYaxis=s.faceYaxis.map(e=>r.Vector3.FromArray(e));let i=new ea(e.name,t);return i.goldbergData=s,i}}class en{constructor(e){this._paths=[],this._tempPaths=[],this._holes=[],this._resolution=e}moveTo(e,t){this._currentPath=new C.Path2(e,t),this._tempPaths.push(this._currentPath)}lineTo(e,t){this._currentPath.addLineTo(e,t)}quadraticCurveTo(e,t,s,r){this._currentPath.addQuadraticCurveTo(e,t,s,r,this._resolution)}bezierCurveTo(e,t,s,r,i,o){this._currentPath.addBezierCurveTo(e,t,s,r,i,o,this._resolution)}extractHoles(){for(let e of this._tempPaths)e.area()>0?this._holes.push(e):this._paths.push(e);if(!this._paths.length&&this._holes.length){let e=this._holes;this._holes=this._paths,this._paths=e}this._tempPaths.length=0}get paths(){return this._paths}get holes(){return this._holes}}e.s(["MeshBuilder",0,{CreateBox:function(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],s=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],i=[],o=e.width||e.size||1,h=e.height||e.size||1,u=e.depth||e.size||1,c=e.wrap||!1,d=void 0===e.topBaseAt?1:e.topBaseAt,f=void 0===e.bottomBaseAt?0:e.bottomBaseAt;d=(d+4)%4,f=(f+4)%4;let p=[2,0,3,1][d],x=[2,0,1,3][f],g=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1];if(c){t=[2,3,0,2,0,1,4,5,6,4,6,7,9,10,11,9,11,8,12,14,15,12,13,14],g=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1];let e=[[1,1,1],[-1,1,1],[-1,1,-1],[1,1,-1]],s=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]],r=[17,18,19,16],i=[22,23,20,21];for(;p>0;)e.unshift(e.pop()),r.unshift(r.pop()),p--;for(;x>0;)s.unshift(s.pop()),i.unshift(i.pop()),x--;e=e.flat(),s=s.flat(),g=g.concat(e).concat(s),t.push(r[0],r[2],r[3],r[0],r[1],r[2]),t.push(i[0],i[2],i[3],i[0],i[1],i[2])}let _=[o/2,h/2,u/2],m=g.reduce((e,t,s)=>e.concat(t*_[s%3]),[]),M=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,y=e.faceUV||Array(6),V=e.faceColors,O=[];for(let e=0;e<6;e++)void 0===y[e]&&(y[e]=new r.Vector4(0,0,1,1)),V&&void 0===V[e]&&(V[e]=new l.Color4(1,1,1,1));for(let e=0;e<6;e++)if(i.push(y[e].z,n.useOpenGLOrientationForUV?1-y[e].w:y[e].w),i.push(y[e].x,n.useOpenGLOrientationForUV?1-y[e].w:y[e].w),i.push(y[e].x,n.useOpenGLOrientationForUV?1-y[e].y:y[e].y),i.push(y[e].z,n.useOpenGLOrientationForUV?1-y[e].y:y[e].y),V)for(let t=0;t<4;t++)O.push(V[e].r,V[e].g,V[e].b,V[e].a);a.VertexData._ComputeSides(M,m,t,s,i,e.frontUVs,e.backUVs);let A=new a.VertexData;return A.indices=t,A.positions=m,A.normals=s,A.uvs=i,V&&(A.colors=M===a.VertexData.DOUBLESIDE?O.concat(O):O),A})(t).applyToMesh(o,t.updatable),o},CreateTiledBox:function(e,t,s=null){let r=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,c(t).applyToMesh(r,t.updatable),r},CreateSphere:function(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=0|(e.segments||32),s=e.diameterX||e.diameter||1,i=e.diameterY||e.diameter||1,o=e.diameterZ||e.diameter||1,h=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,l=e.slice&&e.slice<=0?1:e.slice||1,u=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,c=!!e.dedupTopBottomIndices,d=new r.Vector3(s/2,i/2,o/2),f=2+t,p=2*f,x=[],g=[],_=[],m=[];for(let e=0;e<=f;e++){let t=e/f,s=t*Math.PI*l;for(let e=0;e<=p;e++){let i=e/p,o=i*Math.PI*2*h,a=r.Matrix.RotationZ(-s),l=r.Matrix.RotationY(o),u=r.Vector3.TransformCoordinates(r.Vector3.Up(),a),c=r.Vector3.TransformCoordinates(u,l),f=c.multiply(d),x=c.divide(d).normalize();g.push(f.x,f.y,f.z),_.push(x.x,x.y,x.z),m.push(i,n.useOpenGLOrientationForUV?1-t:t)}if(e>0){let t=g.length/3;for(let s=t-2*(p+1);s+p+2<t;s++)c?(e>1&&(x.push(s),x.push(s+1),x.push(s+p+1)),(e<f||l<1)&&(x.push(s+p+1),x.push(s+1),x.push(s+p+2))):(x.push(s),x.push(s+1),x.push(s+p+1),x.push(s+p+1),x.push(s+1),x.push(s+p+2))}}a.VertexData._ComputeSides(u,g,x,_,m,e.frontUVs,e.backUVs);let M=new a.VertexData;return M.indices=x,M.positions=g,M.normals=_,M.uvs=m,M})(t).applyToMesh(o,t.updatable),o},CreateDisc:function(e,t={},s=null){let r=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=[],s=[],r=[],i=[],o=e.radius||.5,h=e.tessellation||64,l=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,u=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE;t.push(0,0,0),i.push(.5,.5);let c=2*Math.PI*l,d=1===l?c/h:c/(h-1),f=0;for(let e=0;e<h;e++){let e=Math.cos(f),s=Math.sin(f),r=(e+1)/2,a=(1-s)/2;t.push(o*e,o*s,0),i.push(r,n.useOpenGLOrientationForUV?1-a:a),f+=d}1===l&&(t.push(t[3],t[4],t[5]),i.push(i[2],n.useOpenGLOrientationForUV?1-i[3]:i[3]));let p=t.length/3;for(let e=1;e<p-1;e++)s.push(e+1,0,e);a.VertexData.ComputeNormals(t,s,r),a.VertexData._ComputeSides(u,t,s,r,i,e.frontUVs,e.backUVs);let x=new a.VertexData;return x.indices=s,x.positions=t,x.normals=r,x.uvs=i,x})(t).applyToMesh(r,t.updatable),r},CreateIcoSphere:function(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s=e.sideOrientation||a.VertexData.DEFAULTSIDE,i=e.radius||1,o=void 0===e.flat||e.flat,h=0|(e.subdivisions||4),l=e.radiusX||i,u=e.radiusY||i,c=e.radiusZ||i,d=(1+Math.sqrt(5))/2,f=[-1,d,-0,1,d,0,-1,-d,0,1,-d,0,0,-1,-d,0,1,-d,0,-1,d,0,1,d,d,0,1,d,0,-1,-d,0,1,-d,0,-1],p=[0,11,5,0,5,1,0,1,7,0,7,10,12,22,23,1,5,20,5,11,4,23,22,13,22,18,6,7,1,8,14,21,4,14,4,2,16,13,6,15,6,19,3,8,9,4,21,5,13,17,23,6,13,22,19,6,18,9,8,1],x=[0,1,2,3,4,5,6,7,8,9,10,11,0,2,3,3,3,4,7,8,9,9,10,11],g=[5,1,3,1,6,4,0,0,5,3,4,2,2,2,4,0,2,0,1,1,6,0,6,2,0,4,3,3,4,4,3,1,4,2,4,4,0,2,1,1,2,2,3,3,1,3,2,4],_=138/1024,m=239/1024,M=60/1024,y=26/1024,V=-40/1024,O=20/1024,A=[0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0],v=[],T=[],b=[],I=[],D=0,w=[,,,],P=[,,,];for(t=0;t<3;t++)w[t]=r.Vector3.Zero(),P[t]=r.Vector2.Zero();for(let e=0;e<20;e++){for(t=0;t<3;t++){let s=p[3*e+t];w[t].copyFromFloats(f[3*x[s]],f[3*x[s]+1],f[3*x[s]+2]),w[t].normalize(),P[t].copyFromFloats(g[2*s]*_+M+A[e]*V,g[2*s+1]*m+y+A[e]*O)}let s=(e,t,s,i)=>{let a,d=r.Vector3.Lerp(w[0],w[2],t/h),f=r.Vector3.Lerp(w[1],w[2],t/h),p=h===t?w[2]:r.Vector3.Lerp(d,f,e/(h-t));if(p.normalize(),o){let e=r.Vector3.Lerp(w[0],w[2],i/h),t=r.Vector3.Lerp(w[1],w[2],i/h);a=r.Vector3.Lerp(e,t,s/(h-i))}else a=new r.Vector3(p.x,p.y,p.z);a.x/=l,a.y/=u,a.z/=c,a.normalize();let x=r.Vector2.Lerp(P[0],P[2],t/h),g=r.Vector2.Lerp(P[1],P[2],t/h),_=h===t?P[2]:r.Vector2.Lerp(x,g,e/(h-t));T.push(p.x*l,p.y*u,p.z*c),b.push(a.x,a.y,a.z),I.push(_.x,n.useOpenGLOrientationForUV?1-_.y:_.y),v.push(D),D++};for(let e=0;e<h;e++)for(let t=0;t+e<h;t++)s(t,e,t+1/3,e+1/3),s(t+1,e,t+1/3,e+1/3),s(t,e+1,t+1/3,e+1/3),t+e+1<h&&(s(t+1,e,t+2/3,e+2/3),s(t+1,e+1,t+2/3,e+2/3),s(t,e+1,t+2/3,e+2/3))}a.VertexData._ComputeSides(s,T,v,b,I,e.frontUVs,e.backUVs);let F=new a.VertexData;return F.indices=v,F.positions=T,F.normals=b,F.uvs=I,F})(t).applyToMesh(o,t.updatable),o},CreateRibbon:h,CreateCylinder:function(e,t={},s){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s,o,h,u,c,f,p,x,g=e.height||2,_=0===e.diameterTop?0:e.diameterTop||e.diameter||1,m=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1;_=_||1e-5,m=m||1e-5;let M=0|(e.tessellation||24),y=0|(e.subdivisions||1),V=!!e.hasRings,O=!!e.enclose,A=0===e.cap?0:e.cap||i.Mesh.CAP_ALL,v=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,T=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,b=e.faceUV||[,,,],I=e.faceColors,D=2+(1+(1!==v&&O?2:0))*(V?y:1);for(t=0;t<D;t++)I&&void 0===I[t]&&(I[t]=new l.Color4(1,1,1,1));for(t=0;t<D;t++)b&&void 0===b[t]&&(b[t]=new r.Vector4(0,0,1,1));let w=[],P=[],F=[],B=[],L=[],E=2*Math.PI*v/M,C=(m-_)/2/g,S=r.Vector3.Zero(),z=r.Vector3.Zero(),R=r.Vector3.Zero(),U=r.Vector3.Zero(),N=r.Vector3.Zero(),W=d.Axis.Y,G=1,k=0;for(u=0;u<=y;u++)for(f=0,h=((o=u/y)*(_-m)+m)/2,p=V&&0!==u&&u!==y?2:1;f<p;f++){for(V&&(G+=f),O&&(G+=2*f),c=0;c<=M;c++)S.x=Math.cos(-(s=c*E))*h,S.y=-g/2+o*g,S.z=Math.sin(-s)*h,0===_&&u===y?(z.x=F[F.length-(M+1)*3],z.y=F[F.length-(M+1)*3+1],z.z=F[F.length-(M+1)*3+2]):(z.x=S.x,z.z=S.z,z.y=Math.sqrt(z.x*z.x+z.z*z.z)*C,z.normalize()),0===c&&(R.copyFrom(S),U.copyFrom(z)),P.push(S.x,S.y,S.z),F.push(z.x,z.y,z.z),x=V?k!==G?b[G].y:b[G].w:b[G].y+(b[G].w-b[G].y)*o,B.push(b[G].x+(b[G].z-b[G].x)*c/M,n.useOpenGLOrientationForUV?1-x:x),I&&L.push(I[G].r,I[G].g,I[G].b,I[G].a);1!==v&&O&&(P.push(S.x,S.y,S.z),P.push(0,S.y,0),P.push(0,S.y,0),P.push(R.x,R.y,R.z),r.Vector3.CrossToRef(W,z,N),N.normalize(),F.push(N.x,N.y,N.z,N.x,N.y,N.z),r.Vector3.CrossToRef(U,W,N),N.normalize(),F.push(N.x,N.y,N.z,N.x,N.y,N.z),x=V?k!==G?b[G+1].y:b[G+1].w:b[G+1].y+(b[G+1].w-b[G+1].y)*o,B.push(b[G+1].x,n.useOpenGLOrientationForUV?1-x:x),B.push(b[G+1].z,n.useOpenGLOrientationForUV?1-x:x),x=V?k!==G?b[G+2].y:b[G+2].w:b[G+2].y+(b[G+2].w-b[G+2].y)*o,B.push(b[G+2].x,n.useOpenGLOrientationForUV?1-x:x),B.push(b[G+2].z,n.useOpenGLOrientationForUV?1-x:x),I&&(L.push(I[G+1].r,I[G+1].g,I[G+1].b,I[G+1].a),L.push(I[G+1].r,I[G+1].g,I[G+1].b,I[G+1].a),L.push(I[G+2].r,I[G+2].g,I[G+2].b,I[G+2].a),L.push(I[G+2].r,I[G+2].g,I[G+2].b,I[G+2].a))),k!==G&&(k=G)}let H=1!==v&&O?M+4:M;for(G=0,u=0;G<y;G++){let e=0,t=0,s=0,r=0;for(c=0;c<M;c++)e=u*(H+1)+c,t=(u+1)*(H+1)+c,s=u*(H+1)+(c+1),r=(u+1)*(H+1)+(c+1),w.push(e,t,s),w.push(r,s,t);1!==v&&O&&(w.push(e+2,t+2,s+2),w.push(r+2,s+2,t+2),w.push(e+4,t+4,s+4),w.push(r+4,s+4,t+4)),u=V?u+2:u+1}let X=e=>{let t,s,i,o=e?_/2:m/2;if(0===o)return;let a=e?b[D-1]:b[0],h=null;I&&(h=e?I[D-1]:I[0]);let l=P.length/3,u=e?g/2:-g/2,c=new r.Vector3(0,u,0);P.push(c.x,c.y,c.z),F.push(0,e?1:-1,0);let d=a.y+(a.w-a.y)*.5;B.push(a.x+(a.z-a.x)*.5,n.useOpenGLOrientationForUV?1-d:d),h&&L.push(h.r,h.g,h.b,h.a);let f=new r.Vector2(.5,.5);for(i=0;i<=M;i++){let l=Math.cos(-(t=2*Math.PI*i*v/M)),c=Math.sin(-t);s=new r.Vector3(l*o,u,c*o);let d=new r.Vector2(l*f.x+.5,c*f.y+.5);P.push(s.x,s.y,s.z),F.push(0,e?1:-1,0);let p=a.y+(a.w-a.y)*d.y;B.push(a.x+(a.z-a.x)*d.x,n.useOpenGLOrientationForUV?1-p:p),h&&L.push(h.r,h.g,h.b,h.a)}for(i=0;i<M;i++)e?(w.push(l),w.push(l+(i+2)),w.push(l+(i+1))):(w.push(l),w.push(l+(i+1)),w.push(l+(i+2)))};(A===i.Mesh.CAP_START||A===i.Mesh.CAP_ALL)&&X(!1),(A===i.Mesh.CAP_END||A===i.Mesh.CAP_ALL)&&X(!0),a.VertexData._ComputeSides(T,P,w,F,B,e.frontUVs,e.backUVs);let Z=new a.VertexData;return Z.indices=w,Z.positions=P,Z.normals=F,Z.uvs=B,I&&(Z.colors=L),Z})(t).applyToMesh(o,t.updatable),o},CreateTorus:function(e,t={},s){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=[],s=[],i=[],o=[],h=e.diameter||1,l=e.thickness||.5,u=0|(e.tessellation||16),c=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,d=u+1;for(let e=0;e<=u;e++){let a=e/u,c=e*Math.PI*2/u-Math.PI/2,f=r.Matrix.Translation(h/2,0,0).multiply(r.Matrix.RotationY(c));for(let h=0;h<=u;h++){let c=1-h/u,p=h*Math.PI*2/u+Math.PI,x=Math.cos(p),g=Math.sin(p),_=new r.Vector3(x,g,0),m=_.scale(l/2),M=new r.Vector2(a,c);m=r.Vector3.TransformCoordinates(m,f),_=r.Vector3.TransformNormal(_,f),s.push(m.x,m.y,m.z),i.push(_.x,_.y,_.z),o.push(M.x,n.useOpenGLOrientationForUV?1-M.y:M.y);let y=(e+1)%d,V=(h+1)%d;t.push(e*d+h),t.push(e*d+V),t.push(y*d+h),t.push(e*d+V),t.push(y*d+V),t.push(y*d+h)}}a.VertexData._ComputeSides(c,s,t,i,o,e.frontUVs,e.backUVs);let f=new a.VertexData;return f.indices=t,f.positions=s,f.normals=i,f.uvs=o,f})(t).applyToMesh(o,t.updatable),o},CreateTorusKnot:function(e,t={},s){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s,i=[],o=[],h=[],l=[],u=e.radius||2,c=e.tube||.5,d=e.radialSegments||32,f=e.tubularSegments||32,p=e.p||2,x=e.q||3,g=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,_=e=>{let t=Math.cos(e),s=Math.sin(e),i=x/p*e,o=Math.cos(i),a=u*Math.sin(i)*.5;return new r.Vector3(u*(2+o)*.5*t,u*(2+o)*s*.5,a)};for(t=0;t<=d;t++){let e=t%d/d*2*p*Math.PI,i=_(e),a=_(e+.01),h=a.subtract(i),u=a.add(i),x=r.Vector3.Cross(h,u);for(u=r.Vector3.Cross(x,h),x.normalize(),u.normalize(),s=0;s<f;s++){let e=s%f/f*2*Math.PI,r=-c*Math.cos(e),a=c*Math.sin(e);o.push(i.x+r*u.x+a*x.x),o.push(i.y+r*u.y+a*x.y),o.push(i.z+r*u.z+a*x.z),l.push(t/d),l.push(n.useOpenGLOrientationForUV?1-s/f:s/f)}}for(t=0;t<d;t++)for(s=0;s<f;s++){let e=(s+1)%f,r=t*f+s,o=(t+1)*f+s,a=(t+1)*f+e,n=t*f+e;i.push(n),i.push(o),i.push(r),i.push(n),i.push(a),i.push(o)}a.VertexData.ComputeNormals(o,i,h),a.VertexData._ComputeSides(g,o,i,h,l,e.frontUVs,e.backUVs);let m=new a.VertexData;return m.indices=i,m.positions=o,m.normals=h,m.uvs=l,m})(t).applyToMesh(o,t.updatable),o},CreateLineSystem:L,CreateLines:function(e,t,s=null){let r=t.colors?[t.colors]:null;return L(e,{lines:[t.points],updatable:t.updatable,instance:t.instance,colors:r,useVertexAlpha:t.useVertexAlpha,material:t.material},s)},CreateDashedLines:function(e,t,s=null){let o=t.points,n=t.instance,h=t.gapSize||1,l=t.dashSize||3;if(n)return(t.dashNb||t.dashSize||t.gapSize||t.useVertexAlpha||t.material)&&p.Logger.Warn("You have used an option other than points with the instance option. Please be aware that these other options will be ignored."),n.updateMeshPositions(e=>{let t,s,i,a,h=r.Vector3.Zero(),l=e.length/6,u=0,c=0;for(i=0;i<o.length-1;i++)o[i+1].subtractToRef(o[i],h),u+=h.length();let d=u/l,f=n._creationDataStorage.dashSize,p=f*d/(f+n._creationDataStorage.gapSize);for(i=0;i<o.length-1;i++)for(o[i+1].subtractToRef(o[i],h),t=Math.floor(h.length()/d),h.normalize(),a=0;a<t&&c<e.length;)s=d*a,e[c]=o[i].x+s*h.x,e[c+1]=o[i].y+s*h.y,e[c+2]=o[i].z+s*h.z,e[c+3]=o[i].x+(s+p)*h.x,e[c+4]=o[i].y+(s+p)*h.y,e[c+5]=o[i].z+(s+p)*h.z,c+=6,a++;for(;c<e.length;)e[c]=o[i].x,e[c+1]=o[i].y,e[c+2]=o[i].z,c+=3},!1),n;let u=new F(e,s,null,void 0,void 0,void 0,t.useVertexAlpha,t.material);return(function(e){let t,s,i,o=e.dashSize||3,n=e.gapSize||1,h=e.dashNb||200,l=e.points,u=[],c=[],d=r.Vector3.Zero(),f=0,p=0;for(i=0;i<l.length-1;i++)l[i+1].subtractToRef(l[i],d),f+=d.length();let x=f/h,g=o*x/(o+n);for(i=0;i<l.length-1;i++){l[i+1].subtractToRef(l[i],d),t=Math.floor(d.length()/x),d.normalize();for(let e=0;e<t;e++)s=x*e,u.push(l[i].x+s*d.x,l[i].y+s*d.y,l[i].z+s*d.z),u.push(l[i].x+(s+g)*d.x,l[i].y+(s+g)*d.y,l[i].z+(s+g)*d.z),c.push(p,p+1),p+=2}let _=new a.VertexData;return _.positions=u,_.indices=c,_})(t).applyToMesh(u,t.updatable),u._creationDataStorage=new i._CreationDataStorage,u._creationDataStorage.dashSize=l,u._creationDataStorage.gapSize=h,u},ExtrudeShape:function(e,t,s=null){let r=t.path,o=t.shape,a=t.scale||1,n=t.rotation||0,h=0===t.cap?0:t.cap||i.Mesh.NO_CAP,l=t.updatable,u=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),c=t.instance||null,d=t.invertUV||!1,f=t.closeShape||!1,p=t.closePath||!1,x=t.capFunction||null;return G(e,o,r,a,n,null,null,p,f,h,!1,s,!!l,u,c,d,t.frontUVs||null,t.backUVs||null,t.firstNormal||null,!!t.adjustFrame,x)},ExtrudeShapeCustom:function(e,t,s=null){let o=t.path,a=t.shape,n=r.Vector3.Zero(),h=t.rotationFunction||(()=>0),l=t.closePath||t.ribbonCloseArray||!1,u=t.closeShape||t.ribbonClosePath||!1,c=0===t.cap?0:t.cap||i.Mesh.NO_CAP,d=t.updatable,f=t.firstNormal||null,p=t.adjustFrame||!1,x=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),g=t.instance,_=t.invertUV||!1,m=t.capFunction||null;return G(e,a,o,null,null,t.scaleVectorFunction??((e,s)=>{let r=t.scaleFunction?.(e,s)??1;return n.copyFromFloats(r,r,r)}),h,l,u,c,!0,s,!!d,x,g||null,_,t.frontUVs||null,t.backUVs||null,f,p,m||null)},CreateLathe:function(e,t,s=null){let o,a,n,l,u=t.arc?t.arc<=0||t.arc>1?1:t.arc:1,c=void 0===t.closed||t.closed,d=t.shape,f=t.radius||1,p=t.tessellation||64,x=t.clip||0,g=t.updatable,_=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),m=t.cap||i.Mesh.NO_CAP,M=2*Math.PI,y=[],V=t.invertUV||!1,O=M/p*u;for(o=0;o<=p-x;o++){for(l=[],(m==i.Mesh.CAP_START||m==i.Mesh.CAP_ALL)&&(l.push(new r.Vector3(0,d[0].y,0)),l.push(new r.Vector3(Math.cos(o*O)*d[0].x*f,d[0].y,Math.sin(o*O)*d[0].x*f))),a=0;a<d.length;a++)n=new r.Vector3(Math.cos(o*O)*d[a].x*f,d[a].y,Math.sin(o*O)*d[a].x*f),l.push(n);(m==i.Mesh.CAP_END||m==i.Mesh.CAP_ALL)&&(l.push(new r.Vector3(Math.cos(o*O)*d[d.length-1].x*f,d[d.length-1].y,Math.sin(o*O)*d[d.length-1].x*f)),l.push(new r.Vector3(0,d[d.length-1].y,0))),y.push(l)}return h(e,{pathArray:y,closeArray:c,sideOrientation:_,updatable:g,invertUV:V,frontUVs:t.frontUVs,backUVs:t.backUVs},s)},CreateTiledPlane:function(e,t,s=null){let r=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,u(t).applyToMesh(r,t.updatable),r},CreatePlane:function(e,t={},s=null){let r,o,h,l,u,c,d,f,p,x,g=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),g._originalBuilderSideOrientation=t.sideOrientation,(r=[],o=[],h=[],l=[],u=void 0!==t.width?t.width:void 0!==t.size?t.size:1,c=void 0!==t.height?t.height:void 0!==t.size?t.size:1,d=0===t.sideOrientation?0:t.sideOrientation||a.VertexData.DEFAULTSIDE,f=u/2,p=c/2,o.push(-f,-p,0),h.push(0,0,-1),l.push(0,+!!n.useOpenGLOrientationForUV),o.push(f,-p,0),h.push(0,0,-1),l.push(1,+!!n.useOpenGLOrientationForUV),o.push(f,p,0),h.push(0,0,-1),l.push(1,+!n.useOpenGLOrientationForUV),o.push(-f,p,0),h.push(0,0,-1),l.push(0,+!n.useOpenGLOrientationForUV),r.push(0),r.push(1),r.push(2),r.push(0),r.push(2),r.push(3),a.VertexData._ComputeSides(d,o,r,h,l,t.frontUVs,t.backUVs),(x=new a.VertexData).indices=r,x.positions=o,x.normals=h,x.uvs=l,x).applyToMesh(g,t.updatable),t.sourcePlane&&(g.translate(t.sourcePlane.normal,-t.sourcePlane.d),g.setDirection(t.sourcePlane.normal.scale(-1))),g},CreateGround:function(e,t={},s){let i=new H(e,s);return i._setReady(!1),i._subdivisionsX=t.subdivisionsX||t.subdivisions||1,i._subdivisionsY=t.subdivisionsY||t.subdivisions||1,i._width=t.width||1,i._height=t.height||1,i._maxX=i._width/2,i._maxZ=i._height/2,i._minX=-i._maxX,i._minZ=-i._maxZ,(function(e){let t,s,i=[],o=[],h=[],l=[],u=e.width||e.size||1,c=e.height||e.size||1,d=0|(e.subdivisionsX||e.subdivisions||1),f=0|(e.subdivisionsY||e.subdivisions||1);for(t=0;t<=f;t++)for(s=0;s<=d;s++){let e=new r.Vector3(s*u/d-u/2,0,(f-t)*c/f-c/2),i=new r.Vector3(0,1,0);o.push(e.x,e.y,e.z),h.push(i.x,i.y,i.z),l.push(s/d,n.useOpenGLOrientationForUV?t/f:1-t/f)}for(t=0;t<f;t++)for(s=0;s<d;s++)i.push(s+1+(t+1)*(d+1)),i.push(s+1+t*(d+1)),i.push(s+t*(d+1)),i.push(s+(t+1)*(d+1)),i.push(s+1+(t+1)*(d+1)),i.push(s+t*(d+1));let p=new a.VertexData;return p.indices=i,p.positions=o,p.normals=h,p.uvs=l,p})(t).applyToMesh(i,t.updatable),i._setReady(!0),i},CreateTiledGround:function(e,t,s=null){let o=new i.Mesh(e,s);return(function(e){let t,s,i,o,n=void 0!==e.xmin&&null!==e.xmin?e.xmin:-1,h=void 0!==e.zmin&&null!==e.zmin?e.zmin:-1,l=void 0!==e.xmax&&null!==e.xmax?e.xmax:1,u=void 0!==e.zmax&&null!==e.zmax?e.zmax:1,c=e.subdivisions||{w:1,h:1},d=e.precision||{w:1,h:1},f=[],p=[],x=[],g=[];c.h=c.h<1?1:c.h,c.w=c.w<1?1:c.w,d.w=d.w<1?1:d.w,d.h=d.h<1?1:d.h;let _={w:(l-n)/c.w,h:(u-h)/c.h};for(i=0;i<c.h;i++)for(o=0;o<c.w;o++)!function(e,i,o,a){let n=p.length/3,h=d.w+1;for(t=0;t<d.h;t++)for(s=0;s<d.w;s++){let e=[n+s+t*h,n+(s+1)+t*h,n+(s+1)+(t+1)*h,n+s+(t+1)*h];f.push(e[1]),f.push(e[2]),f.push(e[3]),f.push(e[0]),f.push(e[1]),f.push(e[3])}let l=r.Vector3.Zero(),u=new r.Vector3(0,1,0);for(t=0;t<=d.h;t++)for(s=0,l.z=t*(a-i)/d.h+i;s<=d.w;s++)l.x=s*(o-e)/d.w+e,l.y=0,p.push(l.x,l.y,l.z),x.push(u.x,u.y,u.z),g.push(s/d.w,t/d.h)}(n+o*_.w,h+i*_.h,n+(o+1)*_.w,h+(i+1)*_.h);let m=new a.VertexData;return m.indices=f,m.positions=p,m.normals=x,m.uvs=g,m})(t).applyToMesh(o,t.updatable),o},CreateGroundFromHeightMap:function(e,t,s={},i=null){let o,n=s.width||10,h=s.height||10,u=s.subdivisions||1,c=s.minHeight||0,d=s.maxHeight||1,f=s.colorFilter||new l.Color3(.3,.59,.11),p=s.alphaFilter||0,x=s.updatable,g=s.onReady,_=new H(e,i=i||v.EngineStore.LastCreatedScene);_._subdivisionsX=u,_._subdivisionsY=u,_._width=n,_._height=h,_._maxX=_._width/2,_._maxZ=_._height/2,_._minX=-_._maxX,_._minZ=-_._maxZ,_._setReady(!1),s.passHeightBufferInCallback&&(o=new Float32Array((u+1)*(u+1)));let m=(e,t,s)=>{(function(e){let t,s,i=[],o=[],n=[],h=[],u=e.colorFilter||new l.Color3(.3,.59,.11),c=e.alphaFilter||0,d=!1;if(e.minHeight>e.maxHeight){d=!0;let t=e.maxHeight;e.maxHeight=e.minHeight,e.minHeight=t}for(t=0;t<=e.subdivisions;t++)for(s=0;s<=e.subdivisions;s++){let i=new r.Vector3(s*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-t)*e.height/e.subdivisions-e.height/2),a=(((i.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(i.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth)*4,l=e.buffer[a]/255,f=e.buffer[a+1]/255,p=e.buffer[a+2]/255,x=e.buffer[a+3]/255;d&&(l=1-l,f=1-f,p=1-p);let g=l*u.r+f*u.g+p*u.b;x>=c?i.y=e.minHeight+(e.maxHeight-e.minHeight)*g:i.y=e.minHeight-S.Epsilon,e.heightBuffer&&(e.heightBuffer[t*(e.subdivisions+1)+s]=i.y),o.push(i.x,i.y,i.z),n.push(0,0,0),h.push(s/e.subdivisions,1-t/e.subdivisions)}for(t=0;t<e.subdivisions;t++)for(s=0;s<e.subdivisions;s++){let r=s+1+(t+1)*(e.subdivisions+1),a=s+1+t*(e.subdivisions+1),n=s+t*(e.subdivisions+1),h=s+(t+1)*(e.subdivisions+1),l=o[3*r+1]>=e.minHeight,u=o[3*a+1]>=e.minHeight,c=o[3*n+1]>=e.minHeight;l&&u&&c&&(i.push(r),i.push(a),i.push(n)),o[3*h+1]>=e.minHeight&&l&&c&&(i.push(h),i.push(r),i.push(n))}a.VertexData.ComputeNormals(o,i,n);let f=new a.VertexData;return f.indices=i,f.positions=o,f.normals=n,f.uvs=h,f})({width:n,height:h,subdivisions:u,minHeight:c,maxHeight:d,colorFilter:f,buffer:e,bufferWidth:t,bufferHeight:s,alphaFilter:p,heightBuffer:o}).applyToMesh(_,x),g&&g(_,o),_._setReady(!0)};return"string"==typeof t?(i.addPendingData(_),X.Tools.LoadImage(t,e=>{let t=e.width,s=e.height;i.isDisposed||m(i?.getEngine().resizeImageBitmap(e,t,s),t,s),i.removePendingData(_)},(e,t)=>{i.removePendingData(_),s.onError&&s.onError(e,t)},i.offlineProvider)):m(t.data,t.width,t.height),_},CreatePolygon:N,ExtrudePolygon:W,CreateTube:function(e,t,s=null){let o,a,n=t.path,l=t.instance,u=1;void 0!==t.radius?u=t.radius:l&&(u=l._creationDataStorage.radius);let c=t.tessellation||64,d=t.radiusFunction||null,f=t.cap||i.Mesh.NO_CAP,p=t.invertUV||!1,x=t.updatable,g=i.Mesh._GetDefaultSideOrientation(t.sideOrientation);t.arc=t.arc&&(t.arc<=0||t.arc>1)?1:t.arc||1;let _=(e,t,s,o,a,n,h,l)=>{let u,c,d,f,p=t.getTangents(),x=t.getNormals(),g=t.getDistances(),_=2*Math.PI/a*l,m=n||(()=>o),M=r.TmpVectors.Matrix[0],y=2*(h!==i.Mesh.NO_CAP&&h!==i.Mesh.CAP_END);for(let t=0;t<e.length;t++){c=m(t,g[t]),u=[],d=x[t];for(let s=0;s<a;s++)r.Matrix.RotationAxisToRef(p[t],_*s,M),f=u[s]?u[s]:r.Vector3.Zero(),r.Vector3.TransformCoordinatesToRef(d,M,f),f.scaleInPlace(c).addInPlace(e[t]),u[s]=f;s[y]=u,y++}let V=(t,s)=>{let r=[];for(let i=0;i<t;i++)r.push(e[s]);return r};switch(h){case i.Mesh.NO_CAP:break;case i.Mesh.CAP_START:s[0]=V(a,0),s[1]=s[2].slice(0);break;case i.Mesh.CAP_END:s[y]=s[y-1].slice(0),s[y+1]=V(a,e.length-1);break;case i.Mesh.CAP_ALL:s[0]=V(a,0),s[1]=s[2].slice(0),s[y]=s[y-1].slice(0),s[y+1]=V(a,e.length-1)}return s};if(l){let e=l._creationDataStorage,s=t.arc||e.arc;return o=e.path3D.update(n),l=h("",{pathArray:a=_(n,o,e.pathArray,u,e.tessellation,d,e.cap,s),instance:l}),e.path3D=o,e.pathArray=a,e.arc=s,e.radius=u,l}o=new C.Path3D(n);let m=h(e,{pathArray:a=_(n,o,[],u,c,d,f=f<0||f>3?0:f,t.arc),closePath:!0,closeArray:!1,updatable:x,sideOrientation:g,invertUV:p,frontUVs:t.frontUVs,backUVs:t.backUVs},s);return m._creationDataStorage.pathArray=a,m._creationDataStorage.path3D=o,m._creationDataStorage.tessellation=c,m._creationDataStorage.cap=f,m._creationDataStorage.arc=t.arc,m._creationDataStorage.radius=u,m},CreatePolyhedron:Z,CreateGeodesic:function(e,t,s=null){let r=t.m||1;r!==Math.floor(r)&&(r=Math.floor(r),p.Logger.Warn("m not an integer only floor(m) used"));let i=t.n||0;if(i!==Math.floor(i)&&(i=Math.floor(i),p.Logger.Warn("n not an integer only floor(n) used")),i>r){let e=i;i=r,r=e,p.Logger.Warn("n > m therefore m and n swapped")}let o=new es;return o.build(r,i),Z(e,{custom:ei.BuildGeodesicData(o),size:t.size,sizeX:t.sizeX,sizeY:t.sizeY,sizeZ:t.sizeZ,faceUV:t.faceUV,faceColors:t.faceColors,flat:t.flat,updatable:t.updatable,sideOrientation:t.sideOrientation,frontUVs:t.frontUVs,backUVs:t.backUVs},s)},CreateGoldberg:function(e,t,s=null){let o=t.size,h=t.sizeX||o||1,u=t.sizeY||o||1,c=t.sizeZ||o||1,d=t.m||1;d!==Math.floor(d)&&(d=Math.floor(d),p.Logger.Warn("m not an integer only floor(m) used"));let f=t.n||0;if(f!==Math.floor(f)&&(f=Math.floor(f),p.Logger.Warn("n not an integer only floor(n) used")),f>d){let e=f;f=d,d=e,p.Logger.Warn("n > m therefore m and n swapped")}let x=new es;x.build(d,f);let g=ei.BuildGeodesicData(x),_=g.toGoldbergPolyhedronData(),m=new ea(e,s);t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),m._originalBuilderSideOrientation=t.sideOrientation,(function(e,t){let s=e.size,i=e.sizeX||s||1,o=e.sizeY||s||1,h=e.sizeZ||s||1,l=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,u=[],c=[],d=[],f=[],p=1/0,x=-1/0,g=1/0,_=-1/0;for(let e=0;e<t.vertex.length;e++)p=Math.min(p,t.vertex[e][0]*i),x=Math.max(x,t.vertex[e][0]*i),g=Math.min(g,t.vertex[e][1]*o),_=Math.max(_,t.vertex[e][1]*o);let m=0;for(let e=0;e<t.face.length;e++){let s=t.face[e],a=r.Vector3.FromArray(t.vertex[s[0]]),l=r.Vector3.FromArray(t.vertex[s[2]]),M=r.Vector3.FromArray(t.vertex[s[1]]),y=l.subtract(a),V=M.subtract(a),O=r.Vector3.Cross(V,y).normalize();for(let e=0;e<s.length;e++){d.push(O.x,O.y,O.z);let r=t.vertex[s[e]];u.push(r[0]*i,r[1]*o,r[2]*h);let a=(r[1]*o-g)/(_-g);f.push((r[0]*i-p)/(x-p),n.useOpenGLOrientationForUV?1-a:a)}for(let e=0;e<s.length-2;e++)c.push(m,m+e+2,m+e+1);m+=s.length}a.VertexData._ComputeSides(l,u,c,d,f);let M=new a.VertexData;return M.positions=u,M.indices=c,M.normals=d,M.uvs=f,M})(t,_).applyToMesh(m,t.updatable),m.goldbergData.nbSharedFaces=g.sharedNodes,m.goldbergData.nbUnsharedFaces=g.poleNodes,m.goldbergData.adjacentFaces=g.adjacentFaces,m.goldbergData.nbFaces=m.goldbergData.nbSharedFaces+m.goldbergData.nbUnsharedFaces,m.goldbergData.nbFacesAtPole=(m.goldbergData.nbUnsharedFaces-12)/12;for(let e=0;e<g.vertex.length;e++)m.goldbergData.faceCenters.push(r.Vector3.FromArray(g.vertex[e])),m.goldbergData.faceCenters[e].x*=h,m.goldbergData.faceCenters[e].y*=u,m.goldbergData.faceCenters[e].z*=c,m.goldbergData.faceColors.push(new l.Color4(1,1,1,1));for(let e=0;e<_.face.length;e++){let t=_.face[e],s=r.Vector3.FromArray(_.vertex[t[0]]),i=r.Vector3.FromArray(_.vertex[t[2]]),o=r.Vector3.FromArray(_.vertex[t[1]]),a=i.subtract(s),n=o.subtract(s),h=r.Vector3.Cross(n,a).normalize(),l=r.Vector3.Cross(n,h).normalize();m.goldbergData.faceXaxis.push(n.normalize()),m.goldbergData.faceYaxis.push(h),m.goldbergData.faceZaxis.push(l)}return m},CreateDecal:function(e,t,s){let h=!!t.skeleton,l=!!t.morphTargetManager?.numTargets,u=s.localMode||h,c=t.getIndices(),d=h||l?t.getPositionData(!0,!0):t.getVerticesData(o.VertexBuffer.PositionKind),f=h||l?t.getNormalsData(!0,!0):t.getVerticesData(o.VertexBuffer.NormalKind),p=u?h?t.getVerticesData(o.VertexBuffer.PositionKind):d:null,x=u?h?t.getVerticesData(o.VertexBuffer.NormalKind):f:null,g=t.getVerticesData(o.VertexBuffer.UVKind),_=h?t.getVerticesData(o.VertexBuffer.MatricesIndicesKind):null,m=h?t.getVerticesData(o.VertexBuffer.MatricesWeightsKind):null,M=h?t.getVerticesData(o.VertexBuffer.MatricesIndicesExtraKind):null,y=h?t.getVerticesData(o.VertexBuffer.MatricesWeightsExtraKind):null,V=s.position||r.Vector3.Zero(),O=s.normal||r.Vector3.Up(),A=s.size||r.Vector3.One(),v=s.angle||0;if(!O){let e=new r.Vector3(0,0,1),s=t.getScene().activeCamera,i=r.Vector3.TransformCoordinates(e,s.getWorldMatrix());O=s.globalPosition.subtract(i)}let T=-Math.atan2(O.z,O.x)-Math.PI/2,b=Math.sqrt(O.x*O.x+O.z*O.z),I=Math.atan2(O.y,b),D=new a.VertexData;D.indices=[],D.positions=[],D.normals=[],D.uvs=[],D.matricesIndices=h?[]:null,D.matricesWeights=h?[]:null,D.matricesIndicesExtra=M?[]:null,D.matricesWeightsExtra=y?[]:null;let w=0,P=(e,t)=>{let i=new ee;if(!c||!d||!f)return i;let o=c[e];if(i.vertexIdx=3*o,i.vertexIdxForBones=4*o,i.position=new r.Vector3(d[3*o],d[3*o+1],d[3*o+2]),r.Vector3.TransformCoordinatesToRef(i.position,t,i.position),i.normal=new r.Vector3(f[3*o],f[3*o+1],f[3*o+2]),r.Vector3.TransformNormalToRef(i.normal,t,i.normal),s.captureUVS&&g){let e=g[2*o+1];i.uv=new r.Vector2(g[2*o],n.useOpenGLOrientationForUV?1-e:e)}return i},F=[0,0,0,0],B=(e,t)=>{if(0===e.length)return e;let s=.5*Math.abs(r.Vector3.Dot(A,t)),i=(e,t,s,r)=>{for(let i=0;i<r;++i)if(e[s+i]===t)return s+i;return -1},o=(e,o)=>{let a=r.Vector3.GetClipFactor(e.position,o.position,t,s),n=F,h=F;if(_&&m){let t=e.matrixIndicesOverride?0:e.vertexIdxForBones,s=e.matrixIndicesOverride??_,r=e.matrixWeightsOverride??m,l=o.matrixIndicesOverride?0:o.vertexIdxForBones,u=o.matrixIndicesOverride??_,c=o.matrixWeightsOverride??m;n=[0,0,0,0],h=[0,0,0,0];let d=0;for(let e=0;e<4;++e)if(r[t+e]>0){let o=i(u,s[t+e],l,4);n[d]=s[t+e],h[d]=(0,K.Lerp)(r[t+e],o>=0?c[o]:0,a),d++}for(let e=0;e<4&&d<4;++e){let r=u[l+e];-1===i(s,r,t,4)&&(n[d]=r,h[d]=(0,K.Lerp)(0,c[l+e],a),d++)}let f=h[0]+h[1]+h[2]+h[3];h[0]/=f,h[1]/=f,h[2]/=f,h[3]/=f}let l=e.localPositionOverride?e.localPositionOverride[0]:p?.[e.vertexIdx]??0,u=e.localPositionOverride?e.localPositionOverride[1]:p?.[e.vertexIdx+1]??0,c=e.localPositionOverride?e.localPositionOverride[2]:p?.[e.vertexIdx+2]??0,d=o.localPositionOverride?o.localPositionOverride[0]:p?.[o.vertexIdx]??0,f=o.localPositionOverride?o.localPositionOverride[1]:p?.[o.vertexIdx+1]??0,g=o.localPositionOverride?o.localPositionOverride[2]:p?.[o.vertexIdx+2]??0,M=e.localNormalOverride?e.localNormalOverride[0]:x?.[e.vertexIdx]??0,y=e.localNormalOverride?e.localNormalOverride[1]:x?.[e.vertexIdx+1]??0,V=e.localNormalOverride?e.localNormalOverride[2]:x?.[e.vertexIdx+2]??0,O=o.localNormalOverride?o.localNormalOverride[0]:x?.[o.vertexIdx]??0,A=o.localNormalOverride?o.localNormalOverride[1]:x?.[o.vertexIdx+1]??0,v=o.localNormalOverride?o.localNormalOverride[2]:x?.[o.vertexIdx+2]??0,T=M+(O-M)*a,b=y+(A-y)*a,I=V+(v-V)*a,D=Math.sqrt(T*T+b*b+I*I);return new ee(r.Vector3.Lerp(e.position,o.position,a),r.Vector3.Lerp(e.normal,o.normal,a).normalize(),r.Vector2.Lerp(e.uv,o.uv,a),-1,-1,p?[l+(d-l)*a,u+(f-u)*a,c+(g-c)*a]:null,x?[T/D,b/D,I/D]:null,n,h)},a=null;e.length>3&&(a=[]);for(let i=0;i<e.length;i+=3){let n=null,h=null,l=null,u=null,c=r.Vector3.Dot(e[i].position,t)-s,d=r.Vector3.Dot(e[i+1].position,t)-s,f=r.Vector3.Dot(e[i+2].position,t)-s,p=c>0,x=d>0,g=f>0;switch(+!!p+ +!!x+ +!!g){case 0:e.length>3?(a.push(e[i]),a.push(e[i+1]),a.push(e[i+2])):a=e;break;case 1:if(a=a??[],p&&(n=e[i+1],h=e[i+2],l=o(e[i],n),u=o(e[i],h)),x){n=e[i],h=e[i+2],l=o(e[i+1],n),u=o(e[i+1],h),a.push(l),a.push(h.clone()),a.push(n.clone()),a.push(h.clone()),a.push(l.clone()),a.push(u);break}g&&(n=e[i],h=e[i+1],l=o(e[i+2],n),u=o(e[i+2],h)),n&&h&&l&&u&&(a.push(n.clone()),a.push(h.clone()),a.push(l),a.push(u),a.push(l.clone()),a.push(h.clone()));break;case 2:a=a??[],p||(h=o(n=e[i].clone(),e[i+1]),l=o(n,e[i+2]),a.push(n),a.push(h),a.push(l)),x||(h=o(n=e[i+1].clone(),e[i+2]),l=o(n,e[i]),a.push(n),a.push(h),a.push(l)),g||(h=o(n=e[i+2].clone(),e[i]),l=o(n,e[i+1]),a.push(n),a.push(h),a.push(l))}}return a},L=t instanceof i.Mesh?t:null,E=L?._thinInstanceDataStorage.matrixData,C=L?.thinInstanceCount||1,S=r.TmpVectors.Matrix[0];S.copyFrom(r.Matrix.IdentityReadOnly);for(let e=0;e<C;++e){if(L?.hasThinInstances&&E){let t=16*e;S.setRowFromFloats(0,E[t+0],E[t+1],E[t+2],E[t+3]),S.setRowFromFloats(1,E[t+4],E[t+5],E[t+6],E[t+7]),S.setRowFromFloats(2,E[t+8],E[t+9],E[t+10],E[t+11]),S.setRowFromFloats(3,E[t+12],E[t+13],E[t+14],E[t+15])}let i=r.Matrix.RotationYawPitchRoll(T,I,v).multiply(r.Matrix.Translation(V.x,V.y,V.z)),o=r.Matrix.Invert(i),a=t.getWorldMatrix(),h=S.multiply(a).multiply(o),l=[,,,];for(let e=0;e<c.length;e+=3){let t=l;if((t[0]=P(e,h),t[1]=P(e+1,h),t[2]=P(e+2,h),!(s.cullBackFaces&&0>=-t[0].normal.z&&0>=-t[1].normal.z&&0>=-t[2].normal.z)&&(t=B(t,Y))&&(t=B(t,q))&&(t=B(t,j))&&(t=B(t,Q))&&(t=B(t,$)))&&(t=B(t,J)))for(let e=0;e<t.length;e++){let r=t[e];if(D.indices.push(w),u?(r.localPositionOverride?(D.positions[3*w]=r.localPositionOverride[0],D.positions[3*w+1]=r.localPositionOverride[1],D.positions[3*w+2]=r.localPositionOverride[2]):p&&(D.positions[3*w]=p[r.vertexIdx],D.positions[3*w+1]=p[r.vertexIdx+1],D.positions[3*w+2]=p[r.vertexIdx+2]),r.localNormalOverride?(D.normals[3*w]=r.localNormalOverride[0],D.normals[3*w+1]=r.localNormalOverride[1],D.normals[3*w+2]=r.localNormalOverride[2]):x&&(D.normals[3*w]=x[r.vertexIdx],D.normals[3*w+1]=x[r.vertexIdx+1],D.normals[3*w+2]=x[r.vertexIdx+2])):(r.position.toArray(D.positions,3*w),r.normal.toArray(D.normals,3*w)),D.matricesIndices&&D.matricesWeights&&(r.matrixIndicesOverride?(D.matricesIndices[4*w]=r.matrixIndicesOverride[0],D.matricesIndices[4*w+1]=r.matrixIndicesOverride[1],D.matricesIndices[4*w+2]=r.matrixIndicesOverride[2],D.matricesIndices[4*w+3]=r.matrixIndicesOverride[3]):(_&&(D.matricesIndices[4*w]=_[r.vertexIdxForBones],D.matricesIndices[4*w+1]=_[r.vertexIdxForBones+1],D.matricesIndices[4*w+2]=_[r.vertexIdxForBones+2],D.matricesIndices[4*w+3]=_[r.vertexIdxForBones+3]),M&&D.matricesIndicesExtra&&(D.matricesIndicesExtra[4*w]=M[r.vertexIdxForBones],D.matricesIndicesExtra[4*w+1]=M[r.vertexIdxForBones+1],D.matricesIndicesExtra[4*w+2]=M[r.vertexIdxForBones+2],D.matricesIndicesExtra[4*w+3]=M[r.vertexIdxForBones+3])),r.matrixWeightsOverride?(D.matricesWeights[4*w]=r.matrixWeightsOverride[0],D.matricesWeights[4*w+1]=r.matrixWeightsOverride[1],D.matricesWeights[4*w+2]=r.matrixWeightsOverride[2],D.matricesWeights[4*w+3]=r.matrixWeightsOverride[3]):(m&&(D.matricesWeights[4*w]=m[r.vertexIdxForBones],D.matricesWeights[4*w+1]=m[r.vertexIdxForBones+1],D.matricesWeights[4*w+2]=m[r.vertexIdxForBones+2],D.matricesWeights[4*w+3]=m[r.vertexIdxForBones+3]),y&&D.matricesWeightsExtra&&(D.matricesWeightsExtra[4*w]=y[r.vertexIdxForBones],D.matricesWeightsExtra[4*w+1]=y[r.vertexIdxForBones+1],D.matricesWeightsExtra[4*w+2]=y[r.vertexIdxForBones+2],D.matricesWeightsExtra[4*w+3]=y[r.vertexIdxForBones+3]))),s.captureUVS)r.uv.toArray(D.uvs,2*w);else{D.uvs.push(.5+r.position.x/A.x);let e=.5+r.position.y/A.y;D.uvs.push(n.useOpenGLOrientationForUV?1-e:e)}w++}}}0===D.indices.length&&(D.indices=null),0===D.positions.length&&(D.positions=null),0===D.normals.length&&(D.normals=null),0===D.uvs.length&&(D.uvs=null),D.matricesIndices?.length===0&&(D.matricesIndices=null),D.matricesWeights?.length===0&&(D.matricesWeights=null),D.matricesIndicesExtra?.length===0&&(D.matricesIndicesExtra=null),D.matricesWeightsExtra?.length===0&&(D.matricesWeightsExtra=null);let z=new i.Mesh(e,t.getScene());return D.applyToMesh(z),u?(z.skeleton=t.skeleton,z.parent=t):(z.position=V.clone(),z.rotation=new r.Vector3(I,T,v)),z.computeWorldMatrix(!0),z.refreshBoundingInfo(!0,!0),z},CreateCapsule:function(e,t={orientation:r.Vector3.Up(),subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6,updatable:!1},s=null){let o=new i.Mesh(e,s);return(function(e={subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6}){let t,s,i=0|Math.max(e.subdivisions?e.subdivisions:2,1),o=0|Math.max(e.tessellation?e.tessellation:16,3),h=Math.max(e.height?e.height:1,0),l=Math.max(e.radius?e.radius:.25,0),u=0|Math.max(e.capSubdivisions?e.capSubdivisions:6,1),c=Math.max(e.radiusTop?e.radiusTop:l,0),d=Math.max(e.radiusBottom?e.radiusBottom:l,0),f=2*Math.PI,p=Math.max(e.topCapSubdivisions?e.topCapSubdivisions:u,1),x=Math.max(e.bottomCapSubdivisions?e.bottomCapSubdivisions:u,1),g=Math.acos((d-c)/h),_=[],m=[],M=[],y=[],V=0,O=[],A=.5*(h-(c+d)),v=.5*Math.PI,T=r.Vector3.Zero(),b=r.Vector3.Zero(),I=Math.cos(g),D=Math.sin(g),w=new r.Vector2(c*D,A+c*I).subtract(new r.Vector2(d*D,-A+d*I)).length(),P=c*g+w+d*(v-g),F=0;for(s=0;s<=p;s++){let e=[],r=v-s/p*g;F+=c*g/p;let i=Math.cos(r),a=Math.sin(r),h=i*c;for(t=0;t<=o;t++){let s=t/o,r=s*f+0,l=Math.sin(r),u=Math.cos(r);b.x=h*l,b.y=A+a*c,b.z=h*u,m.push(b.x,b.y,b.z),T.set(i*l,a,i*u),M.push(T.x,T.y,T.z),y.push(s,n.useOpenGLOrientationForUV?F/P:1-F/P),e.push(V),V++}O.push(e)}let B=h-c-d+I*c-I*d,L=D*(d-c)/B;for(s=1;s<=i;s++){let e=[];F+=w/i;let r=D*(s*(d-c)/i+c);for(t=0;t<=o;t++){let a=t/o,h=a*f+0,l=Math.sin(h),u=Math.cos(h);b.x=r*l,b.y=A+I*c-s*B/i,b.z=r*u,m.push(b.x,b.y,b.z),T.set(l,L,u).normalize(),M.push(T.x,T.y,T.z),y.push(a,n.useOpenGLOrientationForUV?F/P:1-F/P),e.push(V),V++}O.push(e)}for(s=1;s<=x;s++){let e=[],r=v-g-s/x*(Math.PI-g);F+=d*g/x;let i=Math.cos(r),a=Math.sin(r),h=i*d;for(t=0;t<=o;t++){let s=t/o,r=s*f+0,l=Math.sin(r),u=Math.cos(r);b.x=h*l,b.y=-A+a*d,b.z=h*u,m.push(b.x,b.y,b.z),T.set(i*l,a,i*u),M.push(T.x,T.y,T.z),y.push(s,n.useOpenGLOrientationForUV?F/P:1-F/P),e.push(V),V++}O.push(e)}for(t=0;t<o;t++)for(s=0;s<p+i+x;s++){let e=O[s][t],r=O[s+1][t],i=O[s+1][t+1],o=O[s][t+1];_.push(e),_.push(r),_.push(o),_.push(r),_.push(i),_.push(o)}if(_=_.reverse(),e.orientation&&!e.orientation.equals(r.Vector3.Up())){let t=new r.Matrix;e.orientation.clone().scale(.5*Math.PI).cross(r.Vector3.Up()).toQuaternion().toRotationMatrix(t);let s=r.Vector3.Zero();for(let e=0;e<m.length;e+=3)s.set(m[e],m[e+1],m[e+2]),r.Vector3.TransformCoordinatesToRef(s.clone(),t,s),m[e]=s.x,m[e+1]=s.y,m[e+2]=s.z}let E=new a.VertexData;return E.positions=m,E.normals=M,E.uvs=y,E.indices=_,E})(t).applyToMesh(o,t.updatable),o},CreateText:function(e,t,s,o={size:50,resolution:8,depth:1},a=null,n=earcut){let h=function(e,t,s,r){let i=Array.from(e),o=t/r.resolution,a=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*o,n=[],h=0,l=0;for(let e=0;e<i.length;e++){let t=i[e];if("\n"===t)h=0,l-=a;else{let e=function(e,t,s,r,i,o){let a=o.glyphs[e]||o.glyphs["?"];if(!a)return null;let n=new en(i);if(a.o){let e=a.o.split(" ");for(let i=0,o=e.length;i<o;)switch(e[i++]){case"m":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r;n.moveTo(o,a);break}case"l":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r;n.lineTo(o,a);break}case"q":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r,h=parseInt(e[i++])*t+s,l=parseInt(e[i++])*t+r;n.quadraticCurveTo(h,l,o,a);break}case"b":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r,h=parseInt(e[i++])*t+s,l=parseInt(e[i++])*t+r,u=parseInt(e[i++])*t+s,c=parseInt(e[i++])*t+r;n.bezierCurveTo(h,l,u,c,o,a)}}}return n.extractHoles(),{offsetX:a.ha*t,shapePath:n}}(t,o,h,l,s,r);e&&(h+=e.offsetX,n.push(e.shapePath))}}return n}(t,o.size||50,o.resolution||8,s),l=[],u=0;for(let t of h){if(!t.paths.length)continue;let s=t.holes.slice();for(let h of t.paths){let t=[],c=[];for(let e of h.getPoints())c.push(new r.Vector3(e.x,0,e.y));for(let e of s.slice()){let i=e.getPoints(),o=!1;for(let e of i)if(h.isPointInside(e)){o=!0;break}if(!o)continue;let a=[];for(let e of i)a.push(new r.Vector3(e.x,0,e.y));t.push(a),s.splice(s.indexOf(e),1)}if(!t.length&&s.length)for(let e of s){let s=e.getPoints(),i=[];for(let e of s)i.push(new r.Vector3(e.x,0,e.y));t.push(i)}let d=W(e,{shape:c,holes:t.length?t:void 0,depth:o.depth||1,faceUV:o.faceUV||o.perLetterFaceUV?.(u),faceColors:o.faceColors||o.perLetterFaceColors?.(u),sideOrientation:i.Mesh._GetDefaultSideOrientation(o.sideOrientation||i.Mesh.DOUBLESIDE)},a,n);l.push(d),u++}}let c=i.Mesh.MergeMeshes(l,!0,!0);if(c){let t=c.getBoundingInfo().boundingBox;c.position.x+=-(t.minimumWorld.x+t.maximumWorld.x)/2,c.position.y+=-(t.minimumWorld.y+t.maximumWorld.y)/2,c.position.z+=-(t.minimumWorld.z+t.maximumWorld.z)/2+t.extendSize.z,c.name=e;let s=new _.TransformNode("pivot",a);s.rotation.x=-Math.PI/2,c.parent=s,c.bakeCurrentTransformIntoVertices(),c.parent=null,s.dispose()}return c}}],97998)}]);
|