@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.
Files changed (240) hide show
  1. package/out/404.html +1 -1
  2. package/out/__next.__PAGE__.txt +4 -4
  3. package/out/__next._full.txt +11 -11
  4. package/out/__next._head.txt +4 -4
  5. package/out/__next._index.txt +4 -4
  6. package/out/__next._tree.txt +2 -2
  7. package/out/_next/static/chunks/002cjeoit6-up.js +1 -0
  8. package/out/_next/static/chunks/02n1uiltexy3w.js +1 -0
  9. package/out/_next/static/chunks/03ab2khhe8-x5.js +1 -0
  10. package/out/_next/static/chunks/04_yytpc2paxy.js +1 -0
  11. package/out/_next/static/chunks/06qot1qvlsqaz.js +1 -0
  12. package/out/_next/static/chunks/07eeopuufsqp-.js +1501 -0
  13. package/out/_next/static/chunks/08a5xek662n8n.js +1 -0
  14. package/out/_next/static/chunks/08wuc9--s8zn_.js +1 -0
  15. package/out/_next/static/chunks/0927l-ygd5c8d.js +1 -0
  16. package/out/_next/static/chunks/09510356f0lad.js +1 -0
  17. package/out/_next/static/chunks/0_eu72k69lxj7.js +1 -0
  18. package/out/_next/static/chunks/0beajlqy8p8b5.js +1 -0
  19. package/out/_next/static/chunks/0c83pe1mpx456.js +1 -0
  20. package/out/_next/static/chunks/0echnagbkyx79.js +1198 -0
  21. package/out/_next/static/chunks/0eh1ml86u8dh7.js +1 -0
  22. package/out/_next/static/chunks/0fh-9h9ylxskr.js +674 -0
  23. package/out/_next/static/chunks/0fzmc1up21g1i.js +1 -0
  24. package/out/_next/static/chunks/0g_v2zswo4l6f.js +1 -0
  25. package/out/_next/static/chunks/0grlb9lo8e502.js +1 -0
  26. package/out/_next/static/chunks/0h22pg-0xrxnm.js +1 -0
  27. package/out/_next/static/chunks/0j6p1pmc14t96.js +1 -0
  28. package/out/_next/static/chunks/0j_6dx-sttgsy.js +1 -0
  29. package/out/_next/static/chunks/0j__xaq_8_di1.js +1 -0
  30. package/out/_next/static/chunks/0kfd-cvj5fvtz.js +1 -0
  31. package/out/_next/static/chunks/0o_mp98xzqfyf.js +1 -0
  32. package/out/_next/static/chunks/0otsec99kdkt7.js +213 -0
  33. package/out/_next/static/chunks/0ql-s-tsmel_u.js +151 -0
  34. package/out/_next/static/chunks/0r47gs_e93cka.js +1 -0
  35. package/out/_next/static/chunks/0sqys6o2pbe1q.js +1328 -0
  36. package/out/_next/static/chunks/0titqrn1qmcsv.js +1 -0
  37. package/out/_next/static/chunks/0tnlbw78tgaxp.js +4 -0
  38. package/out/_next/static/chunks/0tw4dyl-cp-hd.js +1 -0
  39. package/out/_next/static/chunks/0vbce-8omgurc.js +1 -0
  40. package/out/_next/static/chunks/0vfsg5byzep_0.js +1 -0
  41. package/out/_next/static/chunks/{0gv7mblzv3dl3.js → 0w8_1yjvol1f0.js} +20 -20
  42. package/out/_next/static/chunks/0xh144a5fz58h.js +1 -0
  43. package/out/_next/static/chunks/0xjltg_pph0c8.js +1 -0
  44. package/out/_next/static/chunks/0yeqgh0dnas8d.js +1 -0
  45. package/out/_next/static/chunks/101-7e_7up7rk.js +1 -0
  46. package/out/_next/static/chunks/128e51hj_04r0.js +1 -0
  47. package/out/_next/static/chunks/{10fnxpln_5xfd.js → 12kv810lohbsx.js} +2 -2
  48. package/out/_next/static/chunks/137xbvd4nd41j.js +3 -0
  49. package/out/_next/static/chunks/14bws-suyy5zu.js +1 -0
  50. package/out/_next/static/chunks/14ggsmqwej_tt.js +1656 -0
  51. package/out/_next/static/chunks/17genz6pkmty_.js +1 -0
  52. package/out/_next/static/chunks/17xd8hnazzr0g.js +1454 -0
  53. package/out/_next/static/chunks/18dczy9ylt2s_.js +1 -0
  54. package/out/_next/static/chunks/18xs_kvsaolb0.js +1 -0
  55. package/out/_next/static/chunks/19016f8-ry0z6.js +1 -0
  56. package/out/_next/static/chunks/1_6oejyxj39li.js +1 -0
  57. package/out/_next/static/chunks/1_aon8nz9p1fr.js +1 -0
  58. package/out/_next/static/chunks/1_qzlkuxukhpq.js +779 -0
  59. package/out/_next/static/chunks/1akaj5rhgitn3.js +1 -0
  60. package/out/_next/static/chunks/1bvl1ws7b_3gn.js +1 -0
  61. package/out/_next/static/chunks/1cdbk6kxyr1c9.js +1 -0
  62. package/out/_next/static/chunks/1fbjkk55uu4_g.js +1 -0
  63. package/out/_next/static/chunks/1furcfsgrw_3g.js +1 -0
  64. package/out/_next/static/chunks/1g0-f1g3gn_rs.js +1 -0
  65. package/out/_next/static/chunks/1g7emwu85bifo.js +557 -0
  66. package/out/_next/static/chunks/{37vzwr3ciejf1.js → 1gs-5722l4u59.js} +1 -1
  67. package/out/_next/static/chunks/1gt4kh0_xmigy.js +1 -0
  68. package/out/_next/static/chunks/1h8xzuuhhglu9.js +1 -0
  69. package/out/_next/static/chunks/1hatz-jlztrn0.js +1 -0
  70. package/out/_next/static/chunks/1iioifo7i0t0_.js +1 -0
  71. package/out/_next/static/chunks/{0impkpmxx3ttp.js → 1iiz7jqgj20z0.js} +1 -1
  72. package/out/_next/static/chunks/1kujmd5n0j9nk.js +1 -0
  73. package/out/_next/static/chunks/{2kazjq29jeamx.js → 1ltux4lwz7muf.js} +160 -372
  74. package/out/_next/static/chunks/1m_buecgcq67j.js +740 -0
  75. package/out/_next/static/chunks/1n9sy0yt5d2vq.js +1 -0
  76. package/out/_next/static/chunks/1p1gz6dseck--.js +1 -0
  77. package/out/_next/static/chunks/1p1xtsfwvpuqo.js +1 -0
  78. package/out/_next/static/chunks/1p8f6okk2ewbz.js +1 -0
  79. package/out/_next/static/chunks/1qg_etglhvp9h.js +740 -0
  80. package/out/_next/static/chunks/1th_t5ujeqlkf.js +1 -0
  81. package/out/_next/static/chunks/1thr-mdzbu96v.js +1 -0
  82. package/out/_next/static/chunks/1tta1a064979p.js +1 -0
  83. package/out/_next/static/chunks/1u_riwm0nfww7.js +1 -0
  84. package/out/_next/static/chunks/1ua15kzid0_8p.js +2560 -0
  85. package/out/_next/static/chunks/1uu-rt_8p1edp.js +2712 -0
  86. package/out/_next/static/chunks/1uu93wuxigx4k.js +1 -0
  87. package/out/_next/static/chunks/{1flb8adpj6_2o.js → 1xpwp4m1tqugp.js} +1 -1
  88. package/out/_next/static/chunks/1ynju1jqfrcv0.js +1 -0
  89. package/out/_next/static/chunks/1zfojlgb15okk.js +1 -0
  90. package/out/_next/static/chunks/1zj8x5wbgnzz-.js +1 -0
  91. package/out/_next/static/chunks/1zl6t15gh34nn.js +1 -0
  92. package/out/_next/static/chunks/{1thjncpj7u6pq.js → 223vrr_4sfhsj.js} +1 -1
  93. package/out/_next/static/chunks/22cr2b04btguf.js +1 -0
  94. package/out/_next/static/chunks/242xhzxxetctz.js +1 -0
  95. package/out/_next/static/chunks/24essz5mmvx-6.js +1 -0
  96. package/out/_next/static/chunks/256k1jw1m--l7.js +146 -0
  97. package/out/_next/static/chunks/259obyrpxcv6r.js +1 -0
  98. package/out/_next/static/chunks/26v9yqicofqba.js +1 -0
  99. package/out/_next/static/chunks/290d93hmm_e8b.js +1 -0
  100. package/out/_next/static/chunks/2_2fk7iddrs43.js +1 -0
  101. package/out/_next/static/chunks/{00k_j_r7bv_eb.js → 2bjlls8-qe05r.js} +9 -9
  102. package/out/_next/static/chunks/2ckd7f1wbfod-.js +1 -0
  103. package/out/_next/static/chunks/{163fa70v4mgxj.js → 2d6hru4qo23tt.js} +1 -1
  104. package/out/_next/static/chunks/2ejvntxtvf5o9.js +1 -0
  105. package/out/_next/static/chunks/2f7_3tzf7xhps.js +1 -0
  106. package/out/_next/static/chunks/2gxd_o1g89_bv.js +1 -0
  107. package/out/_next/static/chunks/2hd2txb4-m9k1.js +1 -0
  108. package/out/_next/static/chunks/2hpxou_cnp4f_.js +1 -0
  109. package/out/_next/static/chunks/2izioctrfc0s5.js +1 -0
  110. package/out/_next/static/chunks/2jhnk4h4n0udv.js +1 -0
  111. package/out/_next/static/chunks/2jpkhkk9zi8-f.js +1 -0
  112. package/out/_next/static/chunks/2kpet_l1kq2sx.js +1 -0
  113. package/out/_next/static/chunks/2mdbvf1b5h00_.css +3 -0
  114. package/out/_next/static/chunks/2nck5w4c7leb7.js +1 -0
  115. package/out/_next/static/chunks/2our10fwtj87e.js +1 -0
  116. package/out/_next/static/chunks/2qq3uzsbiicw3.js +1194 -0
  117. package/out/_next/static/chunks/2qqqpu0ahfdda.js +1 -0
  118. package/out/_next/static/chunks/2u-f7mmxvk8wj.js +1 -0
  119. package/out/_next/static/chunks/2ue1wo4ryk87z.js +1 -0
  120. package/out/_next/static/chunks/2uk-vwlxe9-xr.js +1 -0
  121. package/out/_next/static/chunks/2ur5-lxdvv1jm.js +1 -0
  122. package/out/_next/static/chunks/2veqsohwfhfqc.js +1 -0
  123. package/out/_next/static/chunks/2vqlv9wnewhu9.js +1 -0
  124. package/out/_next/static/chunks/{1zvc1tv--w8nn.js → 2wzshintp5lf8.js} +1 -1
  125. package/out/_next/static/chunks/2x-00glogc485.js +1 -0
  126. package/out/_next/static/chunks/2yfxy0f5fqs4o.js +1 -0
  127. package/out/_next/static/chunks/2z88mt3ixktu3.js +1 -0
  128. package/out/_next/static/chunks/2z_jn9ud28fk7.js +1 -0
  129. package/out/_next/static/chunks/3-eswqjobiqk1.js +1 -0
  130. package/out/_next/static/chunks/30-tbi7pys6fp.js +4 -0
  131. package/out/_next/static/chunks/30c-nsedy_ce0.js +1 -0
  132. package/out/_next/static/chunks/31u5lbu1vxznh.js +1 -0
  133. package/out/_next/static/chunks/{2feca0xcipcyt.js → 32ahba5ezp467.js} +156 -156
  134. package/out/_next/static/chunks/337hn35kts7ud.js +1 -0
  135. package/out/_next/static/chunks/33dgpebv-tf73.js +1 -0
  136. package/out/_next/static/chunks/36jkdhq6kb-cf.js +1 -0
  137. package/out/_next/static/chunks/37epa8fz59vba.js +1166 -0
  138. package/out/_next/static/chunks/3833xfnz0a-ub.js +1 -0
  139. package/out/_next/static/chunks/38awrh_qxn22k.js +1 -0
  140. package/out/_next/static/chunks/{0wrm9jr-9bw0e.js → 38x3c1ra5slhe.js} +383 -913
  141. package/out/_next/static/chunks/39idqlqlcp5b9.js +1 -0
  142. package/out/_next/static/chunks/{2a3spdq-m8drh.js → 3_gku1pwluoo0.js} +1 -1
  143. package/out/_next/static/chunks/3_mu-4rdjajna.js +1450 -0
  144. package/out/_next/static/chunks/3coacc4-g-g5c.js +1 -0
  145. package/out/_next/static/chunks/3e00fzdfkclzq.js +1 -0
  146. package/out/_next/static/chunks/3e8fmlq0k5wkg.js +1 -0
  147. package/out/_next/static/chunks/3e9tzyrt4_98z.js +1 -0
  148. package/out/_next/static/chunks/3edelqkq92pil.js +1 -0
  149. package/out/_next/static/chunks/3figbil1t4ssj.js +593 -0
  150. package/out/_next/static/chunks/3gimb3z_mteou.js +1 -0
  151. package/out/_next/static/chunks/{2p2vv6cc9i-3q.js → 3idaz_s77e-j_.js} +9 -9
  152. package/out/_next/static/chunks/3j-4wuhs5weba.js +1 -0
  153. package/out/_next/static/chunks/3jjfnwvybayy7.js +1 -0
  154. package/out/_next/static/chunks/3jwm5dfk_78gc.js +1 -0
  155. package/out/_next/static/chunks/3k9d4ylc3li2t.js +1352 -0
  156. package/out/_next/static/chunks/3l3_0ack3gy4k.js +1 -0
  157. package/out/_next/static/chunks/3lwhs5ja7tun3.js +1 -0
  158. package/out/_next/static/chunks/3m6nmp2dca6un.js +1342 -0
  159. package/out/_next/static/chunks/3mbnfpufs2-7e.js +7 -0
  160. package/out/_next/static/chunks/3mcd08gmt038z.js +1 -0
  161. package/out/_next/static/chunks/3mt5th7b1i_u9.js +1 -0
  162. package/out/_next/static/chunks/3ne77mjdz2y7o.js +1 -0
  163. package/out/_next/static/chunks/3puhrqtujktyv.js +1 -0
  164. package/out/_next/static/chunks/3rdifucupcgkg.js +1 -0
  165. package/out/_next/static/chunks/3riekaxl3uxfb.js +1195 -0
  166. package/out/_next/static/chunks/3sdoskq_buttj.js +1 -0
  167. package/out/_next/static/chunks/3tg-ma9tv9xu4.js +1 -0
  168. package/out/_next/static/chunks/3tm-pqpmq_ppw.js +1 -0
  169. package/out/_next/static/chunks/3w9go565cjhq3.js +1636 -0
  170. package/out/_next/static/chunks/3wi9gzq2mtr_q.js +8 -0
  171. package/out/_next/static/chunks/3xagd_2_9zft2.js +1 -0
  172. package/out/_next/static/chunks/3xsq_anpad-fb.js +1 -0
  173. package/out/_next/static/chunks/3ycv2qq7vpbua.js +1 -0
  174. package/out/_next/static/chunks/3z84au-mitjjw.js +1 -0
  175. package/out/_next/static/chunks/4030dhur2h70-.js +1 -0
  176. package/out/_next/static/chunks/40ffffml4h_3r.js +4 -0
  177. package/out/_next/static/chunks/{3-shckrcpvbxu.js → 41wt50z9tx9cx.js} +108 -711
  178. package/out/_next/static/chunks/431slrqh0wa0g.js +1 -0
  179. package/out/_next/static/chunks/43s_lbd1i2krj.js +1 -0
  180. package/out/_next/static/chunks/{0-2y-_oomza2l.js → 44nxswtahaq4w.js} +18 -18
  181. package/out/_next/static/chunks/45bwefvdpztfs.js +1 -0
  182. package/out/_next/static/chunks/{turbopack-0sgd6pfbe1fy6.js → turbopack-19105pdhzxp1x.js} +1 -1
  183. package/out/_not-found/__next._full.txt +9 -9
  184. package/out/_not-found/__next._head.txt +4 -4
  185. package/out/_not-found/__next._index.txt +4 -4
  186. package/out/_not-found/__next._not-found.__PAGE__.txt +2 -2
  187. package/out/_not-found/__next._not-found.txt +3 -3
  188. package/out/_not-found/__next._tree.txt +2 -2
  189. package/out/_not-found.html +1 -1
  190. package/out/_not-found.txt +9 -9
  191. package/out/index.html +1 -1
  192. package/out/index.txt +11 -11
  193. package/package.json +5 -4
  194. package/out/_next/static/chunks/068j6934u8j16.js +0 -1
  195. package/out/_next/static/chunks/09e4adtr6w0xe.js +0 -1
  196. package/out/_next/static/chunks/0_rf76jneiwal.js +0 -176
  197. package/out/_next/static/chunks/0aznt7717miff.js +0 -1
  198. package/out/_next/static/chunks/0cu-q5q3a7uf3.js +0 -1
  199. package/out/_next/static/chunks/0fskcfh9vbhtv.js +0 -1
  200. package/out/_next/static/chunks/0gg-ii7i6d_p6.js +0 -1
  201. package/out/_next/static/chunks/0tx1j_ghpz7rc.css +0 -3
  202. package/out/_next/static/chunks/0ufbyo1x3qkmo.js +0 -1
  203. package/out/_next/static/chunks/0wwcfw8i3j_zx.js +0 -1
  204. package/out/_next/static/chunks/0wwkrsvxwi57d.js +0 -1
  205. package/out/_next/static/chunks/0ys9-ozuluawt.js +0 -1
  206. package/out/_next/static/chunks/1-61zh4waha61.js +0 -1
  207. package/out/_next/static/chunks/10r_824wzt8hj.js +0 -1
  208. package/out/_next/static/chunks/123xxske5c9na.js +0 -1
  209. package/out/_next/static/chunks/13isnf0--pmx1.js +0 -1
  210. package/out/_next/static/chunks/157d9euci08yu.js +0 -1
  211. package/out/_next/static/chunks/18u58lorfahxi.js +0 -4
  212. package/out/_next/static/chunks/1_aahautsz2v_.js +0 -1
  213. package/out/_next/static/chunks/1o1d0p-v1z8ty.js +0 -1
  214. package/out/_next/static/chunks/1vdjn0pkoyypn.js +0 -1
  215. package/out/_next/static/chunks/1yehxf-fmeicg.js +0 -1
  216. package/out/_next/static/chunks/1zx2q-r32thv1.js +0 -4
  217. package/out/_next/static/chunks/2-sjjedfr0kfq.js +0 -1
  218. package/out/_next/static/chunks/25b9x-li-tvk2.js +0 -1
  219. package/out/_next/static/chunks/2aelw3far6rii.js +0 -1
  220. package/out/_next/static/chunks/2aor7m-wbis85.js +0 -1
  221. package/out/_next/static/chunks/2clzipqap01hp.js +0 -1
  222. package/out/_next/static/chunks/2fh-_9b6tqhvb.js +0 -1
  223. package/out/_next/static/chunks/2g5gecypj0rqe.js +0 -1
  224. package/out/_next/static/chunks/2szdcpl41-kzv.js +0 -1
  225. package/out/_next/static/chunks/2u6shh3oeycm-.js +0 -1
  226. package/out/_next/static/chunks/2unhhuv0arlcv.js +0 -1
  227. package/out/_next/static/chunks/2z5eqx5do5std.js +0 -1
  228. package/out/_next/static/chunks/310uz81hnnzsu.js +0 -1
  229. package/out/_next/static/chunks/3aqbf_wkg2sih.js +0 -3
  230. package/out/_next/static/chunks/3i3gbhccmhu7j.js +0 -210
  231. package/out/_next/static/chunks/3mqy-84_ul3t2.js +0 -1
  232. package/out/_next/static/chunks/3nz-dh9d7cehk.js +0 -1
  233. package/out/_next/static/chunks/3pufs8g4ui943.js +0 -1
  234. package/out/_next/static/chunks/3t06schbtqonl.js +0 -1
  235. package/out/_next/static/chunks/3v3-7fio3nw_t.js +0 -1
  236. package/out/_next/static/chunks/3v5ha25nxo43j.js +0 -1
  237. package/out/_next/static/chunks/3zskk1hxu3-_o.js +0 -1
  238. /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_buildManifest.js +0 -0
  239. /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_clientMiddlewareManifest.js +0 -0
  240. /package/out/_next/static/{vHD3x58R_2B6QWAhZXCg7 → M9ZSIaKJeBgkjz1qktYio}/_ssgManifest.js +0 -0
@@ -1,742 +1,213 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,40042,e=>{"use strict";var i=e.i(12423);let t="decalFragmentDeclaration",o=`#ifdef DECAL
2
- uniform vec4 vDecalInfos;
3
- #endif
4
- `;i.ShaderStore.IncludesShadersStore[t]||(i.ShaderStore.IncludesShadersStore[t]=o);let r="defaultFragmentDeclaration",a=`uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;uniform vec4 vSpecularColor;uniform vec3 vEmissiveColor;uniform vec3 vAmbientColor;uniform float visibility;
5
- #ifdef DIFFUSE
6
- uniform vec2 vDiffuseInfos;
7
- #endif
8
- #ifdef AMBIENT
9
- uniform vec2 vAmbientInfos;
10
- #endif
11
- #ifdef OPACITY
12
- uniform vec2 vOpacityInfos;
13
- #endif
14
- #ifdef EMISSIVE
15
- uniform vec2 vEmissiveInfos;
16
- #endif
17
- #ifdef LIGHTMAP
18
- uniform vec2 vLightmapInfos;
19
- #endif
20
- #ifdef BUMP
21
- uniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;
22
- #endif
23
- #ifdef ALPHATEST
24
- uniform float alphaCutOff;
25
- #endif
26
- #if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION) || defined(PREPASS)
27
- uniform mat4 view;
28
- #endif
29
- #ifdef REFRACTION
30
- uniform vec4 vRefractionInfos;
31
- #ifndef REFRACTIONMAP_3D
32
- uniform mat4 refractionMatrix;
33
- #endif
34
- #ifdef REFRACTIONFRESNEL
35
- uniform vec4 refractionLeftColor;uniform vec4 refractionRightColor;
36
- #endif
37
- #if defined(USE_LOCAL_REFRACTIONMAP_CUBIC) && defined(REFRACTIONMAP_3D)
38
- uniform vec3 vRefractionPosition;uniform vec3 vRefractionSize;
39
- #endif
40
- #endif
41
- #if defined(SPECULAR) && defined(SPECULARTERM)
42
- uniform vec2 vSpecularInfos;
43
- #endif
44
- #ifdef DIFFUSEFRESNEL
45
- uniform vec4 diffuseLeftColor;uniform vec4 diffuseRightColor;
46
- #endif
47
- #ifdef OPACITYFRESNEL
48
- uniform vec4 opacityParts;
49
- #endif
50
- #ifdef EMISSIVEFRESNEL
51
- uniform vec4 emissiveLeftColor;uniform vec4 emissiveRightColor;
52
- #endif
53
- #if defined(REFLECTION) || (defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED))
54
- uniform vec2 vReflectionInfos;
55
- #if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)
56
- uniform mat4 reflectionMatrix;
57
- #endif
58
- #ifndef REFLECTIONMAP_SKYBOX
59
- #if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)
60
- uniform vec3 vReflectionPosition;uniform vec3 vReflectionSize;
61
- #endif
62
- #endif
63
- #ifdef REFLECTIONFRESNEL
64
- uniform vec4 reflectionLeftColor;uniform vec4 reflectionRightColor;
65
- #endif
66
- #endif
67
- #ifdef DETAIL
68
- uniform vec4 vDetailInfos;
69
- #endif
70
- #include<decalFragmentDeclaration>
71
- #if TEXTURE_REPETITION_MODE>0
72
- uniform vec4 vTextureRepetitionHexTilingParams;
73
- #endif
74
- #define ADDITIONAL_FRAGMENT_DECLARATION
75
- `;i.ShaderStore.IncludesShadersStore[r]||(i.ShaderStore.IncludesShadersStore[r]=a);var n=e.i(85668),l=e.i(6232),f=e.i(44661);let s="prePassDeclaration",d=`#ifdef PREPASS
76
- #extension GL_EXT_draw_buffers : require
77
- layout(location=0) out highp vec4 glFragData[{X}];highp vec4 gl_FragColor;
78
- #ifdef PREPASS_LOCAL_POSITION
79
- varying highp vec3 vPosition;
80
- #endif
81
- #ifdef PREPASS_DEPTH
82
- varying highp vec3 vViewPos;
83
- #endif
84
- #ifdef PREPASS_NORMALIZED_VIEW_DEPTH
85
- varying highp float vNormViewDepth;
86
- #endif
87
- #if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)
88
- varying highp vec4 vCurrentPosition;varying highp vec4 vPreviousPosition;
89
- #endif
90
- #endif
91
- `;i.ShaderStore.IncludesShadersStore[s]||(i.ShaderStore.IncludesShadersStore[s]=d);let c="oitDeclaration",v=`#ifdef ORDER_INDEPENDENT_TRANSPARENCY
92
- #extension GL_EXT_draw_buffers : require
93
- layout(location=0) out vec2 depth;
94
- layout(location=1) out vec4 frontColor;layout(location=2) out vec4 backColor;
95
- #define MAX_DEPTH 99999.0
96
- highp vec4 gl_FragColor;uniform sampler2D oitDepthSampler;uniform sampler2D oitFrontColorSampler;
97
- #endif
98
- `;i.ShaderStore.IncludesShadersStore[c]||(i.ShaderStore.IncludesShadersStore[c]=v);var h=e.i(92692),u=e.i(65296);let p="lightFragmentDeclaration",m=`#ifdef LIGHT{X}
99
- uniform vec4 vLightData{X};uniform vec4 vLightDiffuse{X};
100
- #ifdef SPECULARTERM
101
- uniform vec4 vLightSpecular{X};
102
- #else
103
- vec4 vLightSpecular{X}=vec4(0.);
104
- #endif
105
- #ifdef SHADOW{X}
106
- #ifdef SHADOWCSM{X}
107
- uniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];uniform float cascadeBlendFactor{X};varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};
108
- #if defined(SHADOWPCSS{X})
109
- uniform highp sampler2DArrayShadow shadowTexture{X};uniform highp sampler2DArray depthTexture{X};uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float penumbraDarkness{X};
110
- #elif defined(SHADOWPCF{X})
111
- uniform highp sampler2DArrayShadow shadowTexture{X};
112
- #else
113
- uniform highp sampler2DArray shadowTexture{X};
114
- #endif
115
- #ifdef SHADOWCSMDEBUG{X}
116
- const vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]
117
- (
118
- vec3 ( 1.5,0.0,0.0 ),
119
- vec3 ( 0.0,1.5,0.0 ),
120
- vec3 ( 0.0,0.0,5.5 ),
121
- vec3 ( 1.5,0.0,5.5 ),
122
- vec3 ( 1.5,1.5,0.0 ),
123
- vec3 ( 1.0,1.0,1.0 ),
124
- vec3 ( 0.0,1.0,5.5 ),
125
- vec3 ( 0.5,3.5,0.75 )
126
- );vec3 shadowDebug{X};
127
- #endif
128
- #ifdef SHADOWCSMUSESHADOWMAXZ{X}
129
- int index{X}=-1;
130
- #else
131
- int index{X}=SHADOWCSMNUM_CASCADES{X}-1;
132
- #endif
133
- float diff{X}=0.;
134
- #elif defined(SHADOWCUBE{X})
135
- uniform samplerCube shadowTexture{X};
136
- #else
137
- varying vec4 vPositionFromLight{X};varying float vDepthMetric{X};
138
- #if defined(SHADOWPCSS{X})
139
- uniform highp sampler2DShadow shadowTexture{X};uniform highp sampler2D depthTexture{X};
140
- #elif defined(SHADOWPCF{X})
141
- uniform highp sampler2DShadow shadowTexture{X};
142
- #else
143
- uniform sampler2D shadowTexture{X};
144
- #endif
145
- uniform mat4 lightMatrix{X};
146
- #endif
147
- uniform vec4 shadowsInfo{X};uniform vec2 depthValues{X};
148
- #endif
149
- #ifdef SPOTLIGHT{X}
150
- uniform vec4 vLightDirection{X};uniform vec4 vLightFalloff{X};
151
- #elif defined(POINTLIGHT{X})
152
- uniform vec4 vLightFalloff{X};
153
- #elif defined(HEMILIGHT{X})
154
- uniform vec3 vLightGround{X};
155
- #endif
156
- #ifdef AREALIGHT{X}
157
- uniform vec4 vLightWidth{X};uniform vec4 vLightHeight{X};
158
- #ifdef RECTAREALIGHTEMISSIONTEXTURE{X}
159
- uniform sampler2D rectAreaLightEmissionTexture{X};
160
- #endif
161
- #endif
162
- #ifdef IESLIGHTTEXTURE{X}
163
- uniform sampler2D iesLightTexture{X};
164
- #endif
165
- #ifdef PROJECTEDLIGHTTEXTURE{X}
166
- uniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightTexture{X};
167
- #endif
168
- #ifdef CLUSTLIGHT{X}
169
- uniform vec2 vSliceData{X};uniform vec2 vSliceRanges{X}[CLUSTLIGHT_SLICES];uniform sampler2D lightDataTexture{X};uniform highp sampler2D tileMaskTexture{X};
170
- #endif
171
- #endif
172
- `;i.ShaderStore.IncludesShadersStore[p]||(i.ShaderStore.IncludesShadersStore[p]=m);let S="lightUboDeclaration",g=`#ifdef LIGHT{X}
173
- uniform Light{X}
174
- {vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular;
175
- #ifdef SPOTLIGHT{X}
176
- vec4 vLightDirection;vec4 vLightFalloff;
177
- #elif defined(POINTLIGHT{X})
178
- vec4 vLightFalloff;
179
- #elif defined(HEMILIGHT{X})
180
- vec3 vLightGround;
181
- #elif defined(CLUSTLIGHT{X})
182
- vec2 vSliceData;vec2 vSliceRanges[CLUSTLIGHT_SLICES];
183
- #endif
184
- #if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
185
- vec4 vLightWidth;vec4 vLightHeight;
186
- #endif
187
- vec4 shadowsInfo;vec2 depthValues;} light{X};
188
- #ifdef IESLIGHTTEXTURE{X}
189
- uniform sampler2D iesLightTexture{X};
190
- #endif
191
- #ifdef RECTAREALIGHTEMISSIONTEXTURE{X}
192
- uniform sampler2D rectAreaLightEmissionTexture{X};
193
- #endif
194
- #ifdef PROJECTEDLIGHTTEXTURE{X}
195
- uniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightTexture{X};
196
- #endif
197
- #ifdef CLUSTLIGHT{X}
198
- uniform sampler2D lightDataTexture{X};uniform highp sampler2D tileMaskTexture{X};
199
- #endif
200
- #ifdef SHADOW{X}
201
- #ifdef SHADOWCSM{X}
202
- uniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];uniform float cascadeBlendFactor{X};varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};
203
- #if defined(SHADOWPCSS{X})
204
- uniform highp sampler2DArrayShadow shadowTexture{X};uniform highp sampler2DArray depthTexture{X};uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float penumbraDarkness{X};
205
- #elif defined(SHADOWPCF{X})
206
- uniform highp sampler2DArrayShadow shadowTexture{X};
207
- #else
208
- uniform highp sampler2DArray shadowTexture{X};
209
- #endif
210
- #ifdef SHADOWCSMDEBUG{X}
211
- const vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]
212
- (
213
- vec3 ( 1.5,0.0,0.0 ),
214
- vec3 ( 0.0,1.5,0.0 ),
215
- vec3 ( 0.0,0.0,5.5 ),
216
- vec3 ( 1.5,0.0,5.5 ),
217
- vec3 ( 1.5,1.5,0.0 ),
218
- vec3 ( 1.0,1.0,1.0 ),
219
- vec3 ( 0.0,1.0,5.5 ),
220
- vec3 ( 0.5,3.5,0.75 )
221
- );vec3 shadowDebug{X};
222
- #endif
223
- #ifdef SHADOWCSMUSESHADOWMAXZ{X}
224
- int index{X}=-1;
225
- #else
226
- int index{X}=SHADOWCSMNUM_CASCADES{X}-1;
227
- #endif
228
- float diff{X}=0.;
229
- #elif defined(SHADOWCUBE{X})
230
- uniform samplerCube shadowTexture{X};
231
- #else
232
- varying vec4 vPositionFromLight{X};varying float vDepthMetric{X};
233
- #if defined(SHADOWPCSS{X})
234
- uniform highp sampler2DShadow shadowTexture{X};uniform highp sampler2D depthTexture{X};
235
- #elif defined(SHADOWPCF{X})
236
- uniform highp sampler2DShadow shadowTexture{X};
237
- #else
238
- uniform sampler2D shadowTexture{X};
239
- #endif
240
- uniform mat4 lightMatrix{X};
241
- #endif
242
- #endif
243
- #endif
244
- `;i.ShaderStore.IncludesShadersStore[S]||(i.ShaderStore.IncludesShadersStore[S]=g);let E="ltcHelperFunctions",C=`vec2 LTCUv( const in vec3 N,const in vec3 V,const in float roughness ) {const float LUTSIZE=64.0;const float LUTSCALE=( LUTSIZE-1.0 )/LUTSIZE;const float LUTBIAS=0.5/LUTSIZE;float dotNV=saturate( dot( N,V ) );vec2 uv=vec2( roughness,sqrt( 1.0-dotNV ) );uv=uv*LUTSCALE+LUTBIAS;return uv;}
245
- float LTCClippedSphereFormFactor( const in vec3 f ) {float l=length( f );return max( ( l*l+f.z )/( l+1.0 ),0.0 );}
246
- vec3 LTCEdgeVectorFormFactor( const in vec3 v1,const in vec3 v2 ) {float x=dot( v1,v2 );float y=abs( x );float a=0.8543985+( 0.4965155+0.0145206*y )*y;float b=3.4175940+( 4.1616724+y )*y;float v=a/b;float thetaSintheta=0.0;if( x>0.0 )
247
- {thetaSintheta=v;}
248
- else
249
- {thetaSintheta=0.5*inversesqrt( max( 1.0-x*x,1e-7 ) )-v;}
250
- return cross( v1,v2 )*thetaSintheta;}
251
- vec3 LTCEvaluate( const in vec3 N,const in vec3 V,const in vec3 P,const in mat3 mInv,const in vec3 rectCoords[ 4 ] ) {vec3 v1=rectCoords[ 1 ]-rectCoords[ 0 ];vec3 v2=rectCoords[ 3 ]-rectCoords[ 0 ];vec3 lightNormal=cross( v1,v2 );if( dot( lightNormal,P-rectCoords[ 0 ] )<0.0 ) return vec3( 0.0 );vec3 T1,T2;T1=normalize( V-N*dot( V,N ) );T2=- cross( N,T1 );
252
- mat3 mat=mInv*transposeMat3( mat3( T1,T2,N ) );vec3 coords[ 4 ];coords[ 0 ]=mat*( rectCoords[ 0 ]-P );coords[ 1 ]=mat*( rectCoords[ 1 ]-P );coords[ 2 ]=mat*( rectCoords[ 2 ]-P );coords[ 3 ]=mat*( rectCoords[ 3 ]-P );coords[ 0 ]=normalize( coords[ 0 ] );coords[ 1 ]=normalize( coords[ 1 ] );coords[ 2 ]=normalize( coords[ 2 ] );coords[ 3 ]=normalize( coords[ 3 ] );vec3 vectorFormFactor=vec3( 0.0 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 0 ],coords[ 1 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 1 ],coords[ 2 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 2 ],coords[ 3 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 3 ],coords[ 0 ] );float result=LTCClippedSphereFormFactor( vectorFormFactor );return vec3( result );}
253
- vec3 FetchDiffuseFilteredTexture(sampler2D texLightFiltered,vec3 p1_,vec3 p2_,vec3 p3_,vec3 p4_)
254
- {vec3 V1=p2_-p1_;vec3 V2=p4_-p1_;vec3 planeOrtho=(cross(V1,V2));float planeAreaSquared=dot(planeOrtho,planeOrtho);float planeDistxPlaneArea=dot(planeOrtho,p1_);vec3 P=planeDistxPlaneArea*planeOrtho/planeAreaSquared-p1_;float dot_V1_V2=dot(V1,V2);float inv_dot_V1_V1=1.0/dot(V1,V1);vec3 V2_=V2-V1*dot_V1_V2*inv_dot_V1_V1;vec2 Puv;Puv.y=dot(V2_,P)/dot(V2_,V2_);Puv.x=dot(V1,P)*inv_dot_V1_V1-dot_V1_V2*inv_dot_V1_V1*Puv.y ;float d=abs(planeDistxPlaneArea)/pow(planeAreaSquared,0.75);float sampleLOD=log(2048.0*d)/log(3.0);vec2 sampleUV=vec2(0.125,0.125)+(vec2(0.75)*Puv);sampleUV.x=1.0-sampleUV.x;return texture2DLodEXT(texLightFiltered,sampleUV,sampleLOD).rgb;}
255
- vec3 LTCEvaluateWithEmission( const in vec3 N,const in vec3 V,const in vec3 P,const in mat3 mInv,const in vec3 rectCoords[ 4 ],const in sampler2D texFilteredMap ) {vec3 v1=rectCoords[ 1 ]-rectCoords[ 0 ];vec3 v2=rectCoords[ 3 ]-rectCoords[ 0 ];vec3 lightNormal=cross( v1,v2 );if( dot( lightNormal,P-rectCoords[ 0 ] )<0.0 ) return vec3( 0.0 );vec3 T1,T2;T1=normalize( V-N*dot( V,N ) );T2=- cross( N,T1 );
256
- mat3 mat=mInv*transposeMat3( mat3( T1,T2,N ) );vec3 coords[ 4 ];coords[ 0 ]=mat*( rectCoords[ 0 ]-P );coords[ 1 ]=mat*( rectCoords[ 1 ]-P );coords[ 2 ]=mat*( rectCoords[ 2 ]-P );coords[ 3 ]=mat*( rectCoords[ 3 ]-P );vec3 textureLight=FetchDiffuseFilteredTexture(texFilteredMap,coords[0],coords[1],coords[2],coords[3]);coords[ 0 ]=normalize( coords[ 0 ] );coords[ 1 ]=normalize( coords[ 1 ] );coords[ 2 ]=normalize( coords[ 2 ] );coords[ 3 ]=normalize( coords[ 3 ] );vec3 vectorFormFactor=vec3( 0.0 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 0 ],coords[ 1 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 1 ],coords[ 2 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 2 ],coords[ 3 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 3 ],coords[ 0 ] );float result=LTCClippedSphereFormFactor( vectorFormFactor );return vec3( result )*textureLight;}
257
- struct areaLightData
258
- {vec3 Diffuse;vec3 Specular;vec4 Fresnel;};
259
- #define inline
260
- areaLightData computeAreaLightSpecularDiffuseFresnel(const in sampler2D ltc1,const in sampler2D ltc2,const in vec3 viewDir,const in vec3 normal,const in vec3 position,const in vec3 lightPos,const in vec3 halfWidth,const in vec3 halfHeight,const in float roughness)
261
- {areaLightData result;vec3 rectCoords[ 4 ];rectCoords[ 0 ]=lightPos+halfWidth-halfHeight;
262
- rectCoords[ 1 ]=lightPos-halfWidth-halfHeight;rectCoords[ 2 ]=lightPos-halfWidth+halfHeight;rectCoords[ 3 ]=lightPos+halfWidth+halfHeight;
263
- #ifdef SPECULARTERM
264
- vec2 uv=LTCUv( normal,viewDir,roughness );vec4 t1=texture2D( ltc1,uv );vec4 t2=texture2D( ltc2,uv );mat3 mInv=mat3(
265
- vec3( t1.x,0,t1.y ),
266
- vec3( 0,1, 0 ),
267
- vec3( t1.z,0,t1.w )
268
- );result.Specular=LTCEvaluate( normal,viewDir,position,mInv,rectCoords );result.Fresnel=t2;
269
- #endif
270
- result.Diffuse=LTCEvaluate( normal,viewDir,position,mat3( 1.0 ),rectCoords );return result;}
271
- #define inline
272
- areaLightData computeAreaLightSpecularDiffuseFresnelWithEmission(const in sampler2D ltc1,const in sampler2D ltc2,const in sampler2D texFilteredMap,const in vec3 viewDir,const in vec3 normal,const in vec3 position,const in vec3 lightPos,const in vec3 halfWidth,const in vec3 halfHeight,const in float roughness)
273
- {areaLightData result;vec3 rectCoords[ 4 ];rectCoords[ 0 ]=lightPos+halfWidth-halfHeight;
274
- rectCoords[ 1 ]=lightPos-halfWidth-halfHeight;rectCoords[ 2 ]=lightPos-halfWidth+halfHeight;rectCoords[ 3 ]=lightPos+halfWidth+halfHeight;
275
- #ifdef SPECULARTERM
276
- vec2 uv=LTCUv( normal,viewDir,roughness );vec4 t1=texture2D( ltc1,uv );vec4 t2=texture2D( ltc2,uv );mat3 mInv=mat3(
277
- vec3( t1.x,0,t1.y ),
278
- vec3( 0,1, 0 ),
279
- vec3( t1.z,0,t1.w )
280
- );result.Specular=LTCEvaluateWithEmission( normal,viewDir,position,mInv,rectCoords,texFilteredMap );result.Fresnel=t2;
281
- #endif
282
- result.Diffuse=LTCEvaluateWithEmission( normal,viewDir,position,mat3( 1.0 ),rectCoords,texFilteredMap );return result;}`;i.ShaderStore.IncludesShadersStore[E]||(i.ShaderStore.IncludesShadersStore[E]=C);let D="clusteredLightingFunctions",T=`struct ClusteredLight {vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular;vec4 vLightDirection;vec4 vLightFalloff;};
283
- #define inline
284
- ClusteredLight getClusteredLight(sampler2D lightDataTexture,int index) {return ClusteredLight(
285
- texelFetch(lightDataTexture,ivec2(0,index),0),
286
- texelFetch(lightDataTexture,ivec2(1,index),0),
287
- texelFetch(lightDataTexture,ivec2(2,index),0),
288
- texelFetch(lightDataTexture,ivec2(3,index),0),
289
- texelFetch(lightDataTexture,ivec2(4,index),0)
290
- );}
291
- int getClusteredSliceIndex(vec2 sliceData,float viewDepth) {return int(log(viewDepth)*sliceData.x+sliceData.y);}
292
- `;i.ShaderStore.IncludesShadersStore[D]||(i.ShaderStore.IncludesShadersStore[D]=T);let L="lightsFragmentFunctions",I=`struct lightingInfo
293
- {vec3 diffuse;
294
- #ifdef SPECULARTERM
295
- vec3 specular;
296
- #endif
297
- #ifdef NDOTL
298
- float ndl;
299
- #endif
300
- };lightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {lightingInfo result;vec3 lightVectorW;float attenuation=1.0;if (lightData.w==0.)
301
- {vec3 direction=lightData.xyz-vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}
302
- else
303
- {lightVectorW=normalize(-lightData.xyz);}
304
- float ndl=max(0.,dot(vNormal,lightVectorW));
305
- #ifdef NDOTL
306
- result.ndl=ndl;
307
- #endif
308
- result.diffuse=ndl*diffuseColor*attenuation;
309
- #ifdef SPECULARTERM
310
- vec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
311
- #endif
312
- return result;}
313
- float getAttenuation(float cosAngle,float exponent) {return max(0.,pow(cosAngle,exponent));}
314
- float getIESAttenuation(float cosAngle,sampler2D iesLightSampler) {float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}
315
- lightingInfo basicSpotLighting(vec3 viewDirectionW,vec3 lightVectorW,vec3 vNormal,float attenuation,vec3 diffuseColor,vec3 specularColor,float glossiness) {lightingInfo result;
316
- float ndl=max(0.,dot(vNormal,lightVectorW));
317
- #ifdef NDOTL
318
- result.ndl=ndl;
319
- #endif
320
- result.diffuse=ndl*diffuseColor*attenuation;
321
- #ifdef SPECULARTERM
322
- vec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
323
- #endif
324
- return result;}
325
- lightingInfo computeIESSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness,sampler2D iesLightSampler) {
326
- vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float dotProduct=dot(lightDirection.xyz,-lightVectorW);float cosAngle=max(0.,dotProduct);if (cosAngle>=lightDirection.w)
327
- {
328
- attenuation*=getIESAttenuation(dotProduct,iesLightSampler);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
329
- lightingInfo result;result.diffuse=vec3(0.);
330
- #ifdef SPECULARTERM
331
- result.specular=vec3(0.);
332
- #endif
333
- #ifdef NDOTL
334
- result.ndl=0.;
335
- #endif
336
- return result;}
337
- lightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)
338
- {
339
- attenuation*=getAttenuation(cosAngle,lightData.w);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
340
- lightingInfo result;result.diffuse=vec3(0.);
341
- #ifdef SPECULARTERM
342
- result.specular=vec3(0.);
343
- #endif
344
- #ifdef NDOTL
345
- result.ndl=0.;
346
- #endif
347
- return result;}
348
- lightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {lightingInfo result;float ndl=dot(vNormal,lightData.xyz)*0.5+0.5;
349
- #ifdef NDOTL
350
- result.ndl=ndl;
351
- #endif
352
- result.diffuse=mix(groundColor,diffuseColor,ndl);
353
- #ifdef SPECULARTERM
354
- vec3 angleW=normalize(viewDirectionW+lightData.xyz);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;
355
- #endif
356
- return result;}
357
- #define inline
358
- vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix,vec3 posW){vec4 strq=textureProjectionMatrix*vec4(posW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return textureColor;}
359
- #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
360
- #include<ltcHelperFunctions>
361
- uniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler;
362
- #define inline
363
- lightingInfo computeAreaLighting(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec3 lightPosition,vec3 halfWidth,vec3 halfHeight,vec3 diffuseColor,vec3 specularColor,float roughness)
364
- {lightingInfo result;areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
365
- #ifdef SPECULARTERM
366
- vec3 fresnel=( specularColor*data.Fresnel.x+( vec3( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
367
- #endif
368
- result.diffuse+=diffuseColor*data.Diffuse;return result;}
369
- lightingInfo computeAreaLightingWithTexture(sampler2D ltc1,sampler2D ltc2,sampler2D emissionTexture,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec3 lightPosition,vec3 halfWidth,vec3 halfHeight,vec3 diffuseColor,vec3 specularColor,float roughness)
370
- {lightingInfo result;areaLightData data=computeAreaLightSpecularDiffuseFresnelWithEmission(ltc1,ltc2,emissionTexture,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
371
- #ifdef SPECULARTERM
372
- vec3 fresnel=( specularColor*data.Fresnel.x+( vec3( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
373
- #endif
374
- result.diffuse+=diffuseColor*data.Diffuse;return result;}
375
- #endif
376
- #if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
377
- #include<clusteredLightingFunctions>
378
- #define inline
379
- lightingInfo computeClusteredLighting(
380
- sampler2D lightDataTexture,
381
- sampler2D tileMaskTexture,
382
- vec3 viewDirectionW,
383
- vec3 vNormal,
384
- vec4 lightData,
385
- ivec2 sliceRange,
386
- float glossiness
387
- ) {lightingInfo result;ivec2 tilePosition=ivec2(gl_FragCoord.xy*lightData.xy);int maskHeight=int(lightData.z);tilePosition.y=min(tilePosition.y,maskHeight-1);ivec2 batchRange=sliceRange/CLUSTLIGHT_BATCH;int batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tilePosition.y+=maskHeight*batchRange.x;for (int i=batchRange.x; i<=batchRange.y; i+=1) {uint mask=uint(texelFetch(tileMaskTexture,tilePosition,0).r);tilePosition.y+=maskHeight;int maskOffset=max(sliceRange.x-batchOffset,0);int maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while (mask != 0u) {uint bit=mask & -mask;mask ^= bit;int position=onlyBitPosition(bit);ClusteredLight light=getClusteredLight(lightDataTexture,batchOffset+maskOffset+position);lightingInfo info;if (light.vLightDirection.w<0.0) {info=computeLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);} else {info=computeSpotLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDirection,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);}
388
- result.diffuse+=info.diffuse;
389
- #ifdef SPECULARTERM
390
- result.specular+=info.specular;
391
- #endif
392
- }
393
- batchOffset+=CLUSTLIGHT_BATCH;}
394
- return result;}
395
- #endif
396
- `;i.ShaderStore.IncludesShadersStore[L]||(i.ShaderStore.IncludesShadersStore[L]=I);let w="shadowsFragmentFunctions",x=`#ifdef SHADOWS
397
- #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
398
- #define TEXTUREFUNC(s,c,l) texture2DLodEXT(s,c,l)
399
- #else
400
- #define TEXTUREFUNC(s,c,b) texture2D(s,c,b)
401
- #endif
402
- #ifndef SHADOWFLOAT
403
- float unpack(vec4 color)
404
- {const vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);}
405
- #endif
406
- float computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)
407
- {float mask=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));return mix(value,1.0,mask);}
408
- #define inline
409
- float computeShadowCube(vec3 worldPos,vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)
410
- {vec3 directionToLight=worldPos-lightPosition;float depth=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;
411
- #ifndef SHADOWFLOAT
412
- float shadow=unpack(textureCube(shadowSampler,directionToLight));
413
- #else
414
- float shadow=textureCube(shadowSampler,directionToLight).x;
415
- #endif
416
- return depth>shadow ? darkness : 1.0;}
417
- #define inline
418
- float computeShadowWithPoissonSamplingCube(vec3 worldPos,vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)
419
- {vec3 directionToLight=worldPos-lightPosition;float depth=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;float visibility=1.;vec3 poissonDisk[4];poissonDisk[0]=vec3(-1.0,1.0,-1.0);poissonDisk[1]=vec3(1.0,-1.0,-1.0);poissonDisk[2]=vec3(-1.0,-1.0,-1.0);poissonDisk[3]=vec3(1.0,-1.0,1.0);
420
- #ifndef SHADOWFLOAT
421
- if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))<depth) visibility-=0.25;if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<depth) visibility-=0.25;if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<depth) visibility-=0.25;if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<depth) visibility-=0.25;
422
- #else
423
- if (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<depth) visibility-=0.25;if (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<depth) visibility-=0.25;if (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<depth) visibility-=0.25;if (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<depth) visibility-=0.25;
424
- #endif
425
- return min(1.0,visibility+darkness);}
426
- #define inline
427
- float computeShadowWithESMCube(vec3 worldPos,vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)
428
- {vec3 directionToLight=worldPos-lightPosition;float depth=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);float shadowPixelDepth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;
429
- #ifndef SHADOWFLOAT
430
- float shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));
431
- #else
432
- float shadowMapSample=textureCube(shadowSampler,directionToLight).x;
433
- #endif
434
- float esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return esm;}
435
- #define inline
436
- float computeShadowWithCloseESMCube(vec3 worldPos,vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)
437
- {vec3 directionToLight=worldPos-lightPosition;float depth=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);float shadowPixelDepth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;
438
- #ifndef SHADOWFLOAT
439
- float shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,65296,e=>{"use strict";var i=e.i(12423);let o="helperFunctions",t=`const float PI=3.1415926535897932384626433832795;const float TWO_PI=6.283185307179586;const float HALF_PI=1.5707963267948966;const float RECIPROCAL_PI=0.3183098861837907;const float RECIPROCAL_PI2=0.15915494309189535;const float RECIPROCAL_PI4=0.07957747154594767;const float HALF_MIN=5.96046448e-08;
2
+ const float LinearEncodePowerApprox=2.2;const float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;const vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);const float Epsilon=0.0000001;
3
+ #define saturate(x) clamp(x,0.0,1.0)
4
+ #define absEps(x) abs(x)+Epsilon
5
+ #define maxEps(x) max(x,Epsilon)
6
+ #define saturateEps(x) clamp(x,Epsilon,1.0)
7
+ mat3 transposeMat3(mat3 inMatrix) {vec3 i0=inMatrix[0];vec3 i1=inMatrix[1];vec3 i2=inMatrix[2];mat3 outMatrix=mat3(
8
+ vec3(i0.x,i1.x,i2.x),
9
+ vec3(i0.y,i1.y,i2.y),
10
+ vec3(i0.z,i1.z,i2.z)
11
+ );return outMatrix;}
12
+ mat3 inverseMat3(mat3 inMatrix) {float a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];float a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];float a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),
13
+ b11,(a22*a00-a02*a20),(-a12*a00+a02*a10),
14
+ b21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;}
15
+ #if USE_EXACT_SRGB_CONVERSIONS
16
+ vec3 toLinearSpaceExact(vec3 color)
17
+ {vec3 nearZeroSection=0.0773993808*color;vec3 remainingSection=pow(0.947867299*(color+vec3(0.055)),vec3(2.4));
18
+ #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
19
+ return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.04045)));
440
20
  #else
441
- float shadowMapSample=textureCube(shadowSampler,directionToLight).x;
21
+ return
22
+ vec3(
23
+ color.r<=0.04045 ? nearZeroSection.r : remainingSection.r,
24
+ color.g<=0.04045 ? nearZeroSection.g : remainingSection.g,
25
+ color.b<=0.04045 ? nearZeroSection.b : remainingSection.b);
442
26
  #endif
443
- float esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return esm;}
27
+ }
28
+ vec3 toGammaSpaceExact(vec3 color)
29
+ {vec3 nearZeroSection=12.92*color;vec3 remainingSection=1.055*pow(color,vec3(0.41666))-vec3(0.055);
444
30
  #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
445
- #define inline
446
- float computeShadowCSM(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray shadowSampler,float darkness,float frustumEdgeFalloff)
447
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);vec3 uvLayer=vec3(uv.x,uv.y,layer);float shadowPixelDepth=clamp(depthMetric,0.,1.0);
448
- #ifndef SHADOWFLOAT
449
- float shadow=unpack(texture2D(shadowSampler,uvLayer));
31
+ return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.0031308)));
450
32
  #else
451
- float shadow=texture2D(shadowSampler,uvLayer).x;
33
+ return
34
+ vec3(
35
+ color.r<=0.0031308 ? nearZeroSection.r : remainingSection.r,
36
+ color.g<=0.0031308 ? nearZeroSection.g : remainingSection.g,
37
+ color.b<=0.0031308 ? nearZeroSection.b : remainingSection.b);
452
38
  #endif
453
- return shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;}
454
- #endif
455
- #define inline
456
- float computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)
457
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
458
- {return 1.0;}
459
- else
460
- {float shadowPixelDepth=clamp(depthMetric,0.,1.0);
461
- #ifndef SHADOWFLOAT
462
- float shadow=unpack(TEXTUREFUNC(shadowSampler,uv,0.));
463
- #else
464
- float shadow=TEXTUREFUNC(shadowSampler,uv,0.).x;
39
+ }
465
40
  #endif
466
- return shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;}}
467
- #define inline
468
- float computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)
469
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
470
- {return 1.0;}
471
- else
472
- {float shadowPixelDepth=clamp(depthMetric,0.,1.0);float visibility=1.;vec2 poissonDisk[4];poissonDisk[0]=vec2(-0.94201624,-0.39906216);poissonDisk[1]=vec2(0.94558609,-0.76890725);poissonDisk[2]=vec2(-0.094184101,-0.92938870);poissonDisk[3]=vec2(0.34495938,0.29387760);
473
- #ifndef SHADOWFLOAT
474
- if (unpack(TEXTUREFUNC(shadowSampler,uv+poissonDisk[0]*mapSize,0.))<shadowPixelDepth) visibility-=0.25;if (unpack(TEXTUREFUNC(shadowSampler,uv+poissonDisk[1]*mapSize,0.))<shadowPixelDepth) visibility-=0.25;if (unpack(TEXTUREFUNC(shadowSampler,uv+poissonDisk[2]*mapSize,0.))<shadowPixelDepth) visibility-=0.25;if (unpack(TEXTUREFUNC(shadowSampler,uv+poissonDisk[3]*mapSize,0.))<shadowPixelDepth) visibility-=0.25;
41
+ float toLinearSpace(float color)
42
+ {
43
+ #if USE_EXACT_SRGB_CONVERSIONS
44
+ float nearZeroSection=0.0773993808*color;float remainingSection=pow(0.947867299*(color+0.055),2.4);return color<=0.04045 ? nearZeroSection : remainingSection;
475
45
  #else
476
- if (TEXTUREFUNC(shadowSampler,uv+poissonDisk[0]*mapSize,0.).x<shadowPixelDepth) visibility-=0.25;if (TEXTUREFUNC(shadowSampler,uv+poissonDisk[1]*mapSize,0.).x<shadowPixelDepth) visibility-=0.25;if (TEXTUREFUNC(shadowSampler,uv+poissonDisk[2]*mapSize,0.).x<shadowPixelDepth) visibility-=0.25;if (TEXTUREFUNC(shadowSampler,uv+poissonDisk[3]*mapSize,0.).x<shadowPixelDepth) visibility-=0.25;
46
+ return pow(color,LinearEncodePowerApprox);
477
47
  #endif
478
- return computeFallOff(min(1.0,visibility+darkness),clipSpace.xy,frustumEdgeFalloff);}}
479
- #define inline
480
- float computeShadowWithESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)
481
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
482
- {return 1.0;}
483
- else
484
- {float shadowPixelDepth=clamp(depthMetric,0.,1.0);
485
- #ifndef SHADOWFLOAT
486
- float shadowMapSample=unpack(TEXTUREFUNC(shadowSampler,uv,0.));
48
+ }
49
+ vec3 toLinearSpace(vec3 color)
50
+ {
51
+ #if USE_EXACT_SRGB_CONVERSIONS
52
+ return toLinearSpaceExact(color);
487
53
  #else
488
- float shadowMapSample=TEXTUREFUNC(shadowSampler,uv,0.).x;
54
+ return pow(color,vec3(LinearEncodePowerApprox));
489
55
  #endif
490
- float esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}
491
- #define inline
492
- float computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)
493
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)
494
- {return 1.0;}
495
- else
496
- {float shadowPixelDepth=clamp(depthMetric,0.,1.0);
497
- #ifndef SHADOWFLOAT
498
- float shadowMapSample=unpack(TEXTUREFUNC(shadowSampler,uv,0.));
56
+ }
57
+ vec4 toLinearSpace(vec4 color)
58
+ {
59
+ #if USE_EXACT_SRGB_CONVERSIONS
60
+ return vec4(toLinearSpaceExact(color.rgb),color.a);
499
61
  #else
500
- float shadowMapSample=TEXTUREFUNC(shadowSampler,uv,0.).x;
62
+ return vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);
501
63
  #endif
502
- float esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}
503
- #ifdef IS_NDC_HALF_ZRANGE
504
- #define ZINCLIP clipSpace.z
64
+ }
65
+ float toGammaSpace(float color)
66
+ {
67
+ #if USE_EXACT_SRGB_CONVERSIONS
68
+ float nearZeroSection=12.92*color;float remainingSection=1.055*pow(color,0.41666)-0.055;return color<=0.0031308 ? nearZeroSection : remainingSection;
505
69
  #else
506
- #define ZINCLIP uvDepth.z
70
+ return pow(color,GammaEncodePowerApprox);
507
71
  #endif
508
- #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
509
- #define SMALLEST_ABOVE_ZERO 1.1754943508e-38
510
- #define GREATEST_LESS_THAN_ONE 0.99999994
511
- #define DISABLE_UNIFORMITY_ANALYSIS
512
- #define inline
513
- float computeShadowWithCSMPCF1(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,float darkness,float frustumEdgeFalloff)
514
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));
515
- #ifdef USE_REVERSE_DEPTHBUFFER
516
- uvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.);
72
+ }
73
+ vec3 toGammaSpace(vec3 color)
74
+ {
75
+ #if USE_EXACT_SRGB_CONVERSIONS
76
+ return toGammaSpaceExact(color);
517
77
  #else
518
- uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);
78
+ return pow(color,vec3(GammaEncodePowerApprox));
519
79
  #endif
520
- vec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);float shadow=texture2D(shadowSampler,uvDepthLayer);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}
521
- #define inline
522
- float computeShadowWithCSMPCF3(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)
523
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));
524
- #ifdef USE_REVERSE_DEPTHBUFFER
525
- uvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.);
526
- #else
527
- uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);
528
- #endif
529
- vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;
530
- uv+=0.5;
531
- vec2 st=fract(uv);
532
- vec2 base_uv=floor(uv)-0.5;
533
- base_uv*=shadowMapSizeAndInverse.y;
534
- vec2 uvw0=3.-2.*st;vec2 uvw1=1.+2.*st;vec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;vec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));shadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));shadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));shadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}
535
- #define inline
536
- float computeShadowWithCSMPCF5(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)
537
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));
538
- #ifdef USE_REVERSE_DEPTHBUFFER
539
- uvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.);
540
- #else
541
- uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);
542
- #endif
543
- vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;
544
- uv+=0.5;
545
- vec2 st=fract(uv);
546
- vec2 base_uv=floor(uv)-0.5;
547
- base_uv*=shadowMapSizeAndInverse.y;
548
- vec2 uvw0=4.-3.*st;vec2 uvw1=vec2(7.);vec2 uvw2=1.+3.*st;vec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;vec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));shadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));shadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[0]),layer,uvDepth.z));shadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));shadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));shadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[1]),layer,uvDepth.z));shadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[2]),layer,uvDepth.z));shadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[2]),layer,uvDepth.z));shadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[2]),layer,uvDepth.z));shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}
549
- #define inline
550
- float computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)
551
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {float shadow=TEXTUREFUNC(shadowSampler,uvDepth,0.);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}
552
- #define inline
553
- float computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)
554
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;
555
- uv+=0.5;
556
- vec2 st=fract(uv);
557
- vec2 base_uv=floor(uv)-0.5;
558
- base_uv*=shadowMapSizeAndInverse.y;
559
- vec2 uvw0=3.-2.*st;vec2 uvw1=1.+2.*st;vec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;vec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z),0.);shadow+=uvw1.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z),0.);shadow+=uvw0.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z),0.);shadow+=uvw1.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z),0.);shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}
560
- #define inline
561
- float computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)
562
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;
563
- uv+=0.5;
564
- vec2 st=fract(uv);
565
- vec2 base_uv=floor(uv)-0.5;
566
- base_uv*=shadowMapSizeAndInverse.y;
567
- vec2 uvw0=4.-3.*st;vec2 uvw1=vec2(7.);vec2 uvw2=1.+3.*st;vec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;vec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z),0.);shadow+=uvw1.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z),0.);shadow+=uvw2.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z),0.);shadow+=uvw0.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z),0.);shadow+=uvw1.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z),0.);shadow+=uvw2.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z),0.);shadow+=uvw0.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z),0.);shadow+=uvw1.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z),0.);shadow+=uvw2.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z),0.);shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}
568
- const vec3 PoissonSamplers32[64]=vec3[64](
569
- vec3(0.06407013,0.05409927,0.),
570
- vec3(0.7366577,0.5789394,0.),
571
- vec3(-0.6270542,-0.5320278,0.),
572
- vec3(-0.4096107,0.8411095,0.),
573
- vec3(0.6849564,-0.4990818,0.),
574
- vec3(-0.874181,-0.04579735,0.),
575
- vec3(0.9989998,0.0009880066,0.),
576
- vec3(-0.004920578,-0.9151649,0.),
577
- vec3(0.1805763,0.9747483,0.),
578
- vec3(-0.2138451,0.2635818,0.),
579
- vec3(0.109845,0.3884785,0.),
580
- vec3(0.06876755,-0.3581074,0.),
581
- vec3(0.374073,-0.7661266,0.),
582
- vec3(0.3079132,-0.1216763,0.),
583
- vec3(-0.3794335,-0.8271583,0.),
584
- vec3(-0.203878,-0.07715034,0.),
585
- vec3(0.5912697,0.1469799,0.),
586
- vec3(-0.88069,0.3031784,0.),
587
- vec3(0.5040108,0.8283722,0.),
588
- vec3(-0.5844124,0.5494877,0.),
589
- vec3(0.6017799,-0.1726654,0.),
590
- vec3(-0.5554981,0.1559997,0.),
591
- vec3(-0.3016369,-0.3900928,0.),
592
- vec3(-0.5550632,-0.1723762,0.),
593
- vec3(0.925029,0.2995041,0.),
594
- vec3(-0.2473137,0.5538505,0.),
595
- vec3(0.9183037,-0.2862392,0.),
596
- vec3(0.2469421,0.6718712,0.),
597
- vec3(0.3916397,-0.4328209,0.),
598
- vec3(-0.03576927,-0.6220032,0.),
599
- vec3(-0.04661255,0.7995201,0.),
600
- vec3(0.4402924,0.3640312,0.),
601
- vec3(0.),
602
- vec3(0.),
603
- vec3(0.),
604
- vec3(0.),
605
- vec3(0.),
606
- vec3(0.),
607
- vec3(0.),
608
- vec3(0.),
609
- vec3(0.),
610
- vec3(0.),
611
- vec3(0.),
612
- vec3(0.),
613
- vec3(0.),
614
- vec3(0.),
615
- vec3(0.),
616
- vec3(0.),
617
- vec3(0.),
618
- vec3(0.),
619
- vec3(0.),
620
- vec3(0.),
621
- vec3(0.),
622
- vec3(0.),
623
- vec3(0.),
624
- vec3(0.),
625
- vec3(0.),
626
- vec3(0.),
627
- vec3(0.),
628
- vec3(0.),
629
- vec3(0.),
630
- vec3(0.),
631
- vec3(0.),
632
- vec3(0.)
633
- );const vec3 PoissonSamplers64[64]=vec3[64](
634
- vec3(-0.613392,0.617481,0.),
635
- vec3(0.170019,-0.040254,0.),
636
- vec3(-0.299417,0.791925,0.),
637
- vec3(0.645680,0.493210,0.),
638
- vec3(-0.651784,0.717887,0.),
639
- vec3(0.421003,0.027070,0.),
640
- vec3(-0.817194,-0.271096,0.),
641
- vec3(-0.705374,-0.668203,0.),
642
- vec3(0.977050,-0.108615,0.),
643
- vec3(0.063326,0.142369,0.),
644
- vec3(0.203528,0.214331,0.),
645
- vec3(-0.667531,0.326090,0.),
646
- vec3(-0.098422,-0.295755,0.),
647
- vec3(-0.885922,0.215369,0.),
648
- vec3(0.566637,0.605213,0.),
649
- vec3(0.039766,-0.396100,0.),
650
- vec3(0.751946,0.453352,0.),
651
- vec3(0.078707,-0.715323,0.),
652
- vec3(-0.075838,-0.529344,0.),
653
- vec3(0.724479,-0.580798,0.),
654
- vec3(0.222999,-0.215125,0.),
655
- vec3(-0.467574,-0.405438,0.),
656
- vec3(-0.248268,-0.814753,0.),
657
- vec3(0.354411,-0.887570,0.),
658
- vec3(0.175817,0.382366,0.),
659
- vec3(0.487472,-0.063082,0.),
660
- vec3(-0.084078,0.898312,0.),
661
- vec3(0.488876,-0.783441,0.),
662
- vec3(0.470016,0.217933,0.),
663
- vec3(-0.696890,-0.549791,0.),
664
- vec3(-0.149693,0.605762,0.),
665
- vec3(0.034211,0.979980,0.),
666
- vec3(0.503098,-0.308878,0.),
667
- vec3(-0.016205,-0.872921,0.),
668
- vec3(0.385784,-0.393902,0.),
669
- vec3(-0.146886,-0.859249,0.),
670
- vec3(0.643361,0.164098,0.),
671
- vec3(0.634388,-0.049471,0.),
672
- vec3(-0.688894,0.007843,0.),
673
- vec3(0.464034,-0.188818,0.),
674
- vec3(-0.440840,0.137486,0.),
675
- vec3(0.364483,0.511704,0.),
676
- vec3(0.034028,0.325968,0.),
677
- vec3(0.099094,-0.308023,0.),
678
- vec3(0.693960,-0.366253,0.),
679
- vec3(0.678884,-0.204688,0.),
680
- vec3(0.001801,0.780328,0.),
681
- vec3(0.145177,-0.898984,0.),
682
- vec3(0.062655,-0.611866,0.),
683
- vec3(0.315226,-0.604297,0.),
684
- vec3(-0.780145,0.486251,0.),
685
- vec3(-0.371868,0.882138,0.),
686
- vec3(0.200476,0.494430,0.),
687
- vec3(-0.494552,-0.711051,0.),
688
- vec3(0.612476,0.705252,0.),
689
- vec3(-0.578845,-0.768792,0.),
690
- vec3(-0.772454,-0.090976,0.),
691
- vec3(0.504440,0.372295,0.),
692
- vec3(0.155736,0.065157,0.),
693
- vec3(0.391522,0.849605,0.),
694
- vec3(-0.620106,-0.328104,0.),
695
- vec3(0.789239,-0.419965,0.),
696
- vec3(-0.545396,0.538133,0.),
697
- vec3(-0.178564,-0.596057,0.)
698
- );
699
- #define inline
700
- float computeShadowWithCSMPCSS(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)
701
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));
702
- #ifdef USE_REVERSE_DEPTHBUFFER
703
- uvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.);
80
+ }
81
+ vec4 toGammaSpace(vec4 color)
82
+ {
83
+ #if USE_EXACT_SRGB_CONVERSIONS
84
+ return vec4(toGammaSpaceExact(color.rgb),color.a);
704
85
  #else
705
- uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);
706
- #endif
707
- vec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);float blockerDepth=0.0;float sumBlockerDepth=0.0;float numBlocker=0.0;for (int i=0; i<searchTapCount; i ++) {blockerDepth=texture2D(depthSampler,vec3(uvDepth.xy+(lightSizeUV*lightSizeUVCorrection*shadowMapSizeInverse*PoissonSamplers32[i].xy),layer)).r;if (blockerDepth<depthMetric) {sumBlockerDepth+=blockerDepth;numBlocker++;}}
708
- float avgBlockerDepth=sumBlockerDepth/numBlocker;float AAOffset=shadowMapSizeInverse*10.;float penumbraRatio=((depthMetric-avgBlockerDepth)*depthCorrection+AAOffset);vec4 filterRadius=vec4(penumbraRatio*lightSizeUV*lightSizeUVCorrection*shadowMapSizeInverse,0.,0.);float random=getRand(vPositionFromLight.xy);float rotationAngle=random*3.1415926;vec2 rotationVector=vec2(cos(rotationAngle),sin(rotationAngle));float shadow=0.;for (int i=0; i<pcfTapCount; i++) {vec4 offset=vec4(poissonSamplers[i],0.);offset=vec4(offset.x*rotationVector.x-offset.y*rotationVector.y,offset.y*rotationVector.x+offset.x*rotationVector.y,0.,0.);shadow+=texture2D(shadowSampler,uvDepthLayer+offset*filterRadius);}
709
- shadow/=float(pcfTapCount);shadow=mix(shadow,1.,min((depthMetric-avgBlockerDepth)*depthCorrection*penumbraDarkness,1.));shadow=mix(darkness,1.,shadow);if (numBlocker<1.0) {return 1.0;}
710
- else
711
- {return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}
712
- #define inline
713
- float computeShadowWithPCSS(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,highp sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers)
714
- {vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {float blockerDepth=0.0;float sumBlockerDepth=0.0;float numBlocker=0.0;for (int i=0; i<searchTapCount; i ++) {blockerDepth=TEXTUREFUNC(depthSampler,uvDepth.xy+(lightSizeUV*shadowMapSizeInverse*PoissonSamplers32[i].xy),0.).r;if (blockerDepth<depthMetric) {sumBlockerDepth+=blockerDepth;numBlocker++;}}
715
- if (numBlocker<1.0) {return 1.0;}
716
- else
717
- {float avgBlockerDepth=sumBlockerDepth/numBlocker;float AAOffset=shadowMapSizeInverse*10.;float penumbraRatio=((depthMetric-avgBlockerDepth)+AAOffset);float filterRadius=penumbraRatio*lightSizeUV*shadowMapSizeInverse;float random=getRand(vPositionFromLight.xy);float rotationAngle=random*3.1415926;vec2 rotationVector=vec2(cos(rotationAngle),sin(rotationAngle));float shadow=0.;for (int i=0; i<pcfTapCount; i++) {vec3 offset=poissonSamplers[i];offset=vec3(offset.x*rotationVector.x-offset.y*rotationVector.y,offset.y*rotationVector.x+offset.x*rotationVector.y,0.);shadow+=TEXTUREFUNC(shadowSampler,uvDepth+offset*filterRadius,0.);}
718
- shadow/=float(pcfTapCount);shadow=mix(shadow,1.,depthMetric-avgBlockerDepth);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}}
719
- #define inline
720
- float computeShadowWithPCSS16(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,highp sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)
721
- {return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32);}
722
- #define inline
723
- float computeShadowWithPCSS32(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,highp sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)
724
- {return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32);}
725
- #define inline
726
- float computeShadowWithPCSS64(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,highp sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)
727
- {return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64);}
728
- #define inline
729
- float computeShadowWithCSMPCSS16(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)
730
- {return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}
731
- #define inline
732
- float computeShadowWithCSMPCSS32(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)
733
- {return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}
734
- #define inline
735
- float computeShadowWithCSMPCSS64(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)
736
- {return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64,lightSizeUVCorrection,depthCorrection,penumbraDarkness);}
737
- #endif
86
+ return vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);
738
87
  #endif
739
- `;i.ShaderStore.IncludesShadersStore[w]||(i.ShaderStore.IncludesShadersStore[w]=x);let A="samplerFragmentDeclaration",P=`#ifdef _DEFINENAME_
88
+ }
89
+ float square(float value)
90
+ {return value*value;}
91
+ vec3 square(vec3 value)
92
+ {return value*value;}
93
+ float pow5(float value) {float sq=value*value;return sq*sq*value;}
94
+ vec3 double_refract(vec3 I,vec3 N,float eta) {vec3 Tfront=refract(I,N,1.0/eta);vec3 Nback=normalize(reflect(N,Tfront));return refract(Tfront,-Nback,eta);}
95
+ float getLuminanceUnclamped(vec3 color)
96
+ {return dot(color,LuminanceEncodeApprox);}
97
+ float getLuminance(vec3 color)
98
+ {return saturate(getLuminanceUnclamped(color));}
99
+ float getRand(vec2 seed) {return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);}
100
+ float dither(vec2 seed,float varianceAmount) {float rand=getRand(seed);float normVariance=varianceAmount/255.0;float dither=mix(-normVariance,normVariance,rand);return dither;}
101
+ const float rgbdMaxRange=255.;vec4 toRGBD(vec3 color) {float maxRGB=maxEps(max(color.r,max(color.g,color.b)));float D =max(rgbdMaxRange/maxRGB,1.);D =saturate(floor(D)/255.);vec3 rgb=color.rgb*D;rgb=toGammaSpace(rgb);return vec4(saturate(rgb),D);}
102
+ vec3 fromRGBD(vec4 rgbd) {rgbd.rgb=toLinearSpace(rgbd.rgb);return rgbd.rgb/rgbd.a;}
103
+ vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {vec3 invOrigVec=vec3(1.)/origVec;vec3 halfSize=cubeSize*0.5;vec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;vec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;vec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);float distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);vec3 intersectPositionWS=vertexPos+origVec*distance;return intersectPositionWS-cubePos;}
104
+ vec3 equirectangularToCubemapDirection(vec2 uv) {float longitude=uv.x*TWO_PI-PI;float latitude=HALF_PI-uv.y*PI;vec3 direction;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;}
105
+ float sqrtClamped(float value) {return sqrt(max(value,0.));}
106
+ float avg(vec3 value) {return dot(value,vec3(0.333333333));}
107
+ #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
108
+ uint extractBits(uint value,int offset,int width) {return (value>>offset) & ((1u<<width)-1u);}
109
+ int onlyBitPosition(uint value) {return (floatBitsToInt(float(value))>>23)-0x7f;}
110
+ vec3 singleScatterToMultiScatterAlbedo(vec3 rho_ss) {vec3 s=sqrt(max(vec3(1.0)-rho_ss,vec3(0.0)));return (vec3(1.0)-s)*(vec3(1.0)-vec3(0.139)*s)/(vec3(1.0)+vec3(1.17)*s);}
111
+ vec3 multiScatterToSingleScatterAlbedo(vec3 rho_ms) {vec3 s=4.09712+4.20863*rho_ms-sqrt(9.59217+41.6808*rho_ms+17.7126*rho_ms*rho_ms);return 1.0-s*s;}
112
+ vec3 multiScatterToSingleScatterAlbedo(vec3 rho_ms,float aniso) {vec3 s=4.09712+4.20863*rho_ms-sqrt(9.59217+41.6808*rho_ms+17.7126*rho_ms*rho_ms);return (1.0-s*s)/maxEps(1.0-aniso*s*s);}
113
+ float min3(vec3 v) {return min(v.x,min(v.y,v.z));}
114
+ float max3(vec3 v) {return max(v.x,max(v.y,v.z));}
115
+ float uint2float(uint i) {return uintBitsToFloat(0x3F800000u | (i>>9u))-1.0;}
116
+ vec2 plasticSequence(const uint rstate) {return vec2(uint2float(rstate*3242174889u),
117
+ uint2float(rstate*2447445414u));}
118
+ #endif
119
+ `;i.ShaderStore.IncludesShadersStore[o]||(i.ShaderStore.IncludesShadersStore[o]=t),e.s(["helperFunctions",0,{name:o,shader:t}])},85668,e=>{"use strict";var i=e.i(12423);let o="sceneUboDeclaration",t=`layout(std140,column_major) uniform;uniform Scene {mat4 viewProjection;
120
+ #ifdef MULTIVIEW
121
+ mat4 viewProjectionR;
122
+ #endif
123
+ mat4 view;mat4 projection;vec4 vEyePosition;mat4 inverseProjection;};
124
+ `;i.ShaderStore.IncludesShadersStore[o]||(i.ShaderStore.IncludesShadersStore[o]=t),e.s(["sceneUboDeclaration",0,{name:o,shader:t}])},6232,92692,97226,e=>{"use strict";var i=e.i(12423);let o="meshUboDeclaration",t=`#ifdef WEBGL2
125
+ uniform mat4 world;uniform float visibility;
126
+ #else
127
+ layout(std140,column_major) uniform;uniform Mesh
128
+ {mat4 world;float visibility;};
129
+ #endif
130
+ #define WORLD_UBO
131
+ `;i.ShaderStore.IncludesShadersStore[o]||(i.ShaderStore.IncludesShadersStore[o]=t),e.s(["meshUboDeclaration",0,{name:o,shader:t}],6232);let r="mainUVVaryingDeclaration",a=`#ifdef MAINUV{X}
132
+ varying vec2 vMainUV{X};
133
+ #endif
134
+ `;i.ShaderStore.IncludesShadersStore[r]||(i.ShaderStore.IncludesShadersStore[r]=a),e.s(["mainUVVaryingDeclaration",0,{name:r,shader:a}],92692);let n="logDepthDeclaration",f=`#ifdef LOGARITHMICDEPTH
135
+ uniform float logarithmicDepthConstant;varying float vFragmentDepth;
136
+ #endif
137
+ `;i.ShaderStore.IncludesShadersStore[n]||(i.ShaderStore.IncludesShadersStore[n]=f),e.s(["logDepthDeclaration",0,{name:n,shader:f}],97226)},29981,69838,e=>{"use strict";var i=e.i(12423);let o="clipPlaneFragmentDeclaration",t=`#ifdef CLIPPLANE
138
+ varying float fClipDistance;
139
+ #endif
140
+ #ifdef CLIPPLANE2
141
+ varying float fClipDistance2;
142
+ #endif
143
+ #ifdef CLIPPLANE3
144
+ varying float fClipDistance3;
145
+ #endif
146
+ #ifdef CLIPPLANE4
147
+ varying float fClipDistance4;
148
+ #endif
149
+ #ifdef CLIPPLANE5
150
+ varying float fClipDistance5;
151
+ #endif
152
+ #ifdef CLIPPLANE6
153
+ varying float fClipDistance6;
154
+ #endif
155
+ `;i.ShaderStore.IncludesShadersStore[o]||(i.ShaderStore.IncludesShadersStore[o]=t),e.s(["clipPlaneFragmentDeclaration",0,{name:o,shader:t}],29981);let r="clipPlaneFragment",a=`#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)
156
+ if (false) {}
157
+ #endif
158
+ #ifdef CLIPPLANE
159
+ else if (fClipDistance>0.0)
160
+ {discard;}
161
+ #endif
162
+ #ifdef CLIPPLANE2
163
+ else if (fClipDistance2>0.0)
164
+ {discard;}
165
+ #endif
166
+ #ifdef CLIPPLANE3
167
+ else if (fClipDistance3>0.0)
168
+ {discard;}
169
+ #endif
170
+ #ifdef CLIPPLANE4
171
+ else if (fClipDistance4>0.0)
172
+ {discard;}
173
+ #endif
174
+ #ifdef CLIPPLANE5
175
+ else if (fClipDistance5>0.0)
176
+ {discard;}
177
+ #endif
178
+ #ifdef CLIPPLANE6
179
+ else if (fClipDistance6>0.0)
180
+ {discard;}
181
+ #endif
182
+ `;i.ShaderStore.IncludesShadersStore[r]||(i.ShaderStore.IncludesShadersStore[r]=a),e.s(["clipPlaneFragment",0,{name:r,shader:a}],69838)},56770,40671,e=>{"use strict";var i=e.i(12423);let o="fogFragmentDeclaration",t=`#ifdef FOG
183
+ #define FOGMODE_NONE 0.
184
+ #define FOGMODE_EXP 1.
185
+ #define FOGMODE_EXP2 2.
186
+ #define FOGMODE_LINEAR 3.
187
+ #define E 2.71828
188
+ uniform vec4 vFogInfos;uniform vec3 vFogColor;varying vec3 vFogDistance;float CalcFogFactor()
189
+ {float fogCoeff=1.0;float fogStart=vFogInfos.y;float fogEnd=vFogInfos.z;float fogDensity=vFogInfos.w;float fogDistance=length(vFogDistance);if (FOGMODE_LINEAR==vFogInfos.x)
190
+ {fogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);}
191
+ else if (FOGMODE_EXP==vFogInfos.x)
192
+ {fogCoeff=1.0/pow(E,fogDistance*fogDensity);}
193
+ else if (FOGMODE_EXP2==vFogInfos.x)
194
+ {fogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);}
195
+ return clamp(fogCoeff,0.0,1.0);}
196
+ #endif
197
+ `;i.ShaderStore.IncludesShadersStore[o]||(i.ShaderStore.IncludesShadersStore[o]=t),e.s(["fogFragmentDeclaration",0,{name:o,shader:t}],56770);let r="fogFragment",a=`#ifdef FOG
198
+ float fog=CalcFogFactor();
199
+ #ifdef PBR
200
+ fog=toLinearSpace(fog);
201
+ #endif
202
+ color.rgb=mix(vFogColor,color.rgb,fog);
203
+ #endif
204
+ `;i.ShaderStore.IncludesShadersStore[r]||(i.ShaderStore.IncludesShadersStore[r]=a),e.s(["fogFragment",0,{name:r,shader:a}],40671)},44661,e=>{"use strict";var i=e.i(12423);e.i(85668),e.i(6232);let o="defaultUboDeclaration",t=`layout(std140,column_major) uniform;uniform Material
205
+ {vec4 diffuseLeftColor;vec4 diffuseRightColor;vec4 opacityParts;vec4 reflectionLeftColor;vec4 reflectionRightColor;vec4 refractionLeftColor;vec4 refractionRightColor;vec4 emissiveLeftColor;vec4 emissiveRightColor;vec2 vDiffuseInfos;vec2 vAmbientInfos;vec2 vOpacityInfos;vec2 vEmissiveInfos;vec2 vLightmapInfos;vec2 vSpecularInfos;vec3 vBumpInfos;mat4 diffuseMatrix;mat4 ambientMatrix;mat4 opacityMatrix;mat4 emissiveMatrix;mat4 lightmapMatrix;mat4 specularMatrix;mat4 bumpMatrix;vec2 vTangentSpaceParams;float pointSize;float alphaCutOff;mat4 refractionMatrix;vec4 vRefractionInfos;vec3 vRefractionPosition;vec3 vRefractionSize;vec4 vSpecularColor;vec3 vEmissiveColor;vec4 vDiffuseColor;vec3 vAmbientColor;vec4 cameraInfo;vec4 vTextureRepetitionHexTilingParams;vec2 vReflectionInfos;mat4 reflectionMatrix;vec3 vReflectionPosition;vec3 vReflectionSize;
206
+ #define ADDITIONAL_UBO_DECLARATION
207
+ };
208
+ #include<sceneUboDeclaration>
209
+ #include<meshUboDeclaration>
210
+ `;i.ShaderStore.IncludesShadersStore[o]||(i.ShaderStore.IncludesShadersStore[o]=t),e.s(["defaultUboDeclaration",0,{name:o,shader:t}])},80825,9275,e=>{"use strict";var i=e.i(12423);let o="samplerFragmentDeclaration",t=`#ifdef _DEFINENAME_
740
211
  #if _DEFINENAME_DIRECTUV==1
741
212
  #define v_VARYINGNAME_UV vMainUV1
742
213
  #elif _DEFINENAME_DIRECTUV==2
@@ -754,11 +225,7 @@ varying vec2 v_VARYINGNAME_UV;
754
225
  #endif
755
226
  uniform sampler2D _SAMPLERNAME_Sampler;
756
227
  #endif
757
- `;i.ShaderStore.IncludesShadersStore[A]||(i.ShaderStore.IncludesShadersStore[A]=P);let R="fresnelFunction",X=`#ifdef FRESNEL
758
- float computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)
759
- {float fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);}
760
- #endif
761
- `;i.ShaderStore.IncludesShadersStore[R]||(i.ShaderStore.IncludesShadersStore[R]=X);let F="reflectionFunction",N=`vec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)
228
+ `;i.ShaderStore.IncludesShadersStore[o]||(i.ShaderStore.IncludesShadersStore[o]=t),e.s(["samplerFragmentDeclaration",0,{name:o,shader:t}],80825);let r="reflectionFunction",a=`vec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)
762
229
  {float lon=atan(direction.z,direction.x);float lat=acos(direction.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(s,t,0); }
763
230
  vec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)
764
231
  {float lon=atan(direction.z,direction.x);float lat=acos(direction.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(1.0-s,t,0); }
@@ -820,162 +287,7 @@ return vec3(0,0,0);
820
287
  #endif
821
288
  }
822
289
  #endif
823
- `;i.ShaderStore.IncludesShadersStore[F]||(i.ShaderStore.IncludesShadersStore[F]=N);let M="imageProcessingDeclaration",_=`#ifdef EXPOSURE
824
- uniform float exposureLinear;
825
- #endif
826
- #ifdef CONTRAST
827
- uniform float contrast;
828
- #endif
829
- #if defined(VIGNETTE) || defined(DITHER)
830
- uniform vec2 vInverseScreenSize;
831
- #endif
832
- #ifdef VIGNETTE
833
- uniform vec4 vignetteSettings1;uniform vec4 vignetteSettings2;
834
- #endif
835
- #ifdef COLORCURVES
836
- uniform vec4 vCameraColorCurveNegative;uniform vec4 vCameraColorCurveNeutral;uniform vec4 vCameraColorCurvePositive;
837
- #endif
838
- #ifdef COLORGRADING
839
- #ifdef COLORGRADING3D
840
- uniform highp sampler3D txColorTransform;
841
- #else
842
- uniform sampler2D txColorTransform;
843
- #endif
844
- uniform vec4 colorTransformSettings;
845
- #endif
846
- #ifdef DITHER
847
- uniform float ditherIntensity;
848
- #endif
849
- `;i.ShaderStore.IncludesShadersStore[M]||(i.ShaderStore.IncludesShadersStore[M]=_);let O="imageProcessingFunctions",y=`#if defined(COLORGRADING) && !defined(COLORGRADING3D)
850
- /**
851
- * Polyfill for SAMPLE_TEXTURE_3D,which is unsupported in WebGL.
852
- * sampler3dSetting.x=textureOffset (0.5/textureSize).
853
- * sampler3dSetting.y=textureSize.
854
- */
855
- #define inline
856
- vec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)
857
- {float sliceSize=2.0*sampler3dSetting.x;
858
- #ifdef SAMPLER3DGREENDEPTH
859
- float sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;
860
- #else
861
- float sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;
862
- #endif
863
- float sliceInteger=floor(sliceContinuous);float sliceFraction=sliceContinuous-sliceInteger;
864
- #ifdef SAMPLER3DGREENDEPTH
865
- vec2 sliceUV=color.rb;
866
- #else
867
- vec2 sliceUV=color.rg;
868
- #endif
869
- sliceUV.x*=sliceSize;sliceUV.x+=sliceInteger*sliceSize;sliceUV=saturate(sliceUV);vec4 slice0Color=texture2D(colorTransform,sliceUV);sliceUV.x+=sliceSize;sliceUV=saturate(sliceUV);vec4 slice1Color=texture2D(colorTransform,sliceUV);vec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);
870
- #ifdef SAMPLER3DBGRMAP
871
- color.rgb=result.rgb;
872
- #else
873
- color.rgb=result.bgr;
874
- #endif
875
- return color;}
876
- #endif
877
- #if TONEMAPPING==3
878
- const float PBRNeutralStartCompression=0.8-0.04;const float PBRNeutralDesaturation=0.15;vec3 PBRNeutralToneMapping( vec3 color ) {float x=min(color.r,min(color.g,color.b));float offset=x<0.08 ? x-6.25*x*x : 0.04;color-=offset;float peak=max(color.r,max(color.g,color.b));if (peak<PBRNeutralStartCompression) return color;float d=1.-PBRNeutralStartCompression;float newPeak=1.-d*d/(peak+d-PBRNeutralStartCompression);color*=newPeak/peak;float g=1.-1./(PBRNeutralDesaturation*(peak-newPeak)+1.);return mix(color,newPeak*vec3(1,1,1),g);}
879
- #endif
880
- #if TONEMAPPING==2
881
- const mat3 ACESInputMat=mat3(
882
- vec3(0.59719,0.07600,0.02840),
883
- vec3(0.35458,0.90834,0.13383),
884
- vec3(0.04823,0.01566,0.83777)
885
- );const mat3 ACESOutputMat=mat3(
886
- vec3( 1.60475,-0.10208,-0.00327),
887
- vec3(-0.53108, 1.10813,-0.07276),
888
- vec3(-0.07367,-0.00605, 1.07602)
889
- );vec3 RRTAndODTFit(vec3 v)
890
- {vec3 a=v*(v+0.0245786)-0.000090537;vec3 b=v*(0.983729*v+0.4329510)+0.238081;return a/b;}
891
- vec3 ACESFitted(vec3 color)
892
- {color=ACESInputMat*color;color=RRTAndODTFit(color);color=ACESOutputMat*color;color=saturate(color);return color;}
893
- #endif
894
- #define CUSTOM_IMAGEPROCESSINGFUNCTIONS_DEFINITIONS
895
- vec4 applyImageProcessing(vec4 result) {
896
- #define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATSTART
897
- #ifdef EXPOSURE
898
- result.rgb*=exposureLinear;
899
- #endif
900
- #ifdef VIGNETTE
901
- vec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;viewportXY=viewportXY*2.0-1.0;vec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);float vignetteTerm=dot(vignetteXY1,vignetteXY1);float vignette=pow(vignetteTerm,vignetteSettings2.w);vec3 vignetteColor=vignetteSettings2.rgb;
902
- #ifdef VIGNETTEBLENDMODEMULTIPLY
903
- vec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);result.rgb*=vignetteColorMultiplier;
904
- #endif
905
- #ifdef VIGNETTEBLENDMODEOPAQUE
906
- result.rgb=mix(vignetteColor,result.rgb,vignette);
907
- #endif
908
- #endif
909
- #if TONEMAPPING==3
910
- result.rgb=PBRNeutralToneMapping(result.rgb);
911
- #elif TONEMAPPING==2
912
- result.rgb=ACESFitted(result.rgb);
913
- #elif TONEMAPPING==1
914
- const float tonemappingCalibration=1.590579;result.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);
915
- #endif
916
- result.rgb=toGammaSpace(result.rgb);result.rgb=saturate(result.rgb);
917
- #ifdef CONTRAST
918
- vec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);if (contrast<1.0) {result.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);} else {result.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);}
919
- result.rgb=max(result.rgb,0.);
920
- #endif
921
- #ifdef COLORGRADING
922
- vec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;
923
- #ifdef COLORGRADING3D
924
- vec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;
925
- #else
926
- vec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;
927
- #endif
928
- result.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);
929
- #endif
930
- #ifdef COLORCURVES
931
- float luma=getLuminance(result.rgb);vec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));vec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;result.rgb*=colorCurve.rgb;result.rgb=mix(vec3(luma),result.rgb,colorCurve.a);
932
- #endif
933
- #ifdef DITHER
934
- float rand=getRand(gl_FragCoord.xy*vInverseScreenSize);float dither=mix(-ditherIntensity,ditherIntensity,rand);result.rgb=saturate(result.rgb+vec3(dither));
935
- #endif
936
- #define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATEND
937
- return result;}`;i.ShaderStore.IncludesShadersStore[O]||(i.ShaderStore.IncludesShadersStore[O]=y);let b="textureRepetitionFunctions",U=`#if TEXTURE_REPETITION_MODE>0
938
- vec4 _texRepHash4(vec2 p) {return fract(sin(vec4(
939
- 1.0+dot(p,vec2(37.0,17.0)),
940
- 2.0+dot(p,vec2(11.0,47.0)),
941
- 3.0+dot(p,vec2(41.0,29.0)),
942
- 4.0+dot(p,vec2(23.0,31.0))
943
- ))*103.0);}
944
- #endif
945
- #if TEXTURE_REPETITION_MODE==1
946
- vec4 _texRepSample(sampler2D samp,vec2 uv) {float k=texture2D(samp,0.005*uv).x;float index=k*8.0;float f=fract(index);float i=floor(index+0.5);float ib=floor(index);f=min(f,1.0-f)*2.0;vec2 offa=sin(vec2(3.0,7.0)*i);vec2 offb=sin(vec2(3.0,7.0)*ib);vec2 dx=dFdx(uv);vec2 dy=dFdy(uv);vec4 cola=textureGrad(samp,uv+0.3*offa,dx,dy);vec4 colb=textureGrad(samp,uv+0.3*offb,dx,dy);float colSum=cola.x+cola.y+cola.z-colb.x-colb.y-colb.z;return mix(cola,colb,smoothstep(0.2,0.8,f-0.1*colSum));}
947
- #elif TEXTURE_REPETITION_MODE==2
948
- #ifndef TEXTURE_REPETITION_M_PI
949
- #define TEXTURE_REPETITION_M_PI 3.14159265358979
950
- #endif
951
- vec2 _texRepHexHash(vec2 p) {vec2 r=mat2(127.1,269.5,311.7,183.3)*p;return fract(sin(r)*43758.5453);}
952
- void _texRepTriangleGrid(
953
- out float w1,out float w2,out float w3,
954
- out ivec2 vertex1,out ivec2 vertex2,out ivec2 vertex3,
955
- vec2 st
956
- ) {st*=2.0*sqrt(3.0);mat2 gridToSkewedGrid=mat2(1.0,0.0,-0.57735027,1.15470054);vec2 skewedCoord=gridToSkewedGrid*st;ivec2 baseId=ivec2(floor(skewedCoord));vec3 temp=vec3(fract(skewedCoord),0.0);temp.z=1.0-temp.x-temp.y;float s=step(0.0,-temp.z);float s2=2.0*s-1.0;w1=-temp.z*s2;w2=s-temp.y*s2;w3=s-temp.x*s2;vertex1=baseId+ivec2(int(s),int(s));vertex2=baseId+ivec2(int(s),int(1.0-s));vertex3=baseId+ivec2(int(1.0-s),int(s));}
957
- vec2 _texRepMakeCenST(ivec2 Vertex) {mat2 invSkewMat=mat2(1.0,0.0,0.5,1.0/1.15470054);return (invSkewMat*vec2(Vertex))/(2.0*sqrt(3.0));}
958
- mat2 _texRepLoadRot2x2(ivec2 idx,float rotStr) {float angle=float(abs(idx.x*idx.y)+abs(idx.x+idx.y))+TEXTURE_REPETITION_M_PI;angle=mod(angle,2.0*TEXTURE_REPETITION_M_PI);if (angle<0.0) angle+=2.0*TEXTURE_REPETITION_M_PI;if (angle>TEXTURE_REPETITION_M_PI) angle-=TEXTURE_REPETITION_M_PI;angle*=rotStr;float cs=cos(angle);float si=sin(angle);return mat2(cs,si,-si,cs);}
959
- vec3 _texRepGain3(vec3 x,float r) {float k=log(1.0-r)/log(0.5);vec3 s=2.0*step(0.5,x);vec3 m=2.0*(1.0-s);vec3 res=0.5*s+0.25*m*pow(max(vec3(0.0),s+x*m),vec3(k));return res/(res.x+res.y+res.z);}
960
- vec4 _texRepSample(sampler2D samp,vec2 uv) {float rotStrength=vTextureRepetitionHexTilingParams.x;float fallOffContrast=vTextureRepetitionHexTilingParams.y;float expVal=vTextureRepetitionHexTilingParams.z;float r=vTextureRepetitionHexTilingParams.w;vec2 dSTdx=dFdx(uv);vec2 dSTdy=dFdy(uv);float w1,w2,w3;ivec2 vertex1,vertex2,vertex3;_texRepTriangleGrid(w1,w2,w3,vertex1,vertex2,vertex3,uv);mat2 rot1=_texRepLoadRot2x2(vertex1,rotStrength);mat2 rot2=_texRepLoadRot2x2(vertex2,rotStrength);mat2 rot3=_texRepLoadRot2x2(vertex3,rotStrength);vec2 cen1=_texRepMakeCenST(vertex1);vec2 cen2=_texRepMakeCenST(vertex2);vec2 cen3=_texRepMakeCenST(vertex3);vec2 st1=(uv-cen1)*rot1+cen1+_texRepHexHash(vec2(vertex1));vec2 st2=(uv-cen2)*rot2+cen2+_texRepHexHash(vec2(vertex2));vec2 st3=(uv-cen3)*rot3+cen3+_texRepHexHash(vec2(vertex3));vec4 c1=textureGrad(samp,st1,dSTdx*rot1,dSTdy*rot1);vec4 c2=textureGrad(samp,st2,dSTdx*rot2,dSTdy*rot2);vec4 c3=textureGrad(samp,st3,dSTdx*rot3,dSTdy*rot3);vec3 Lw=vec3(0.299,0.587,0.114);vec3 Dw=vec3(dot(c1.rgb,Lw),dot(c2.rgb,Lw),dot(c3.rgb,Lw));Dw=mix(vec3(1.0),Dw,fallOffContrast);vec3 W=Dw*pow(vec3(w1,w2,w3),vec3(expVal));W/=(W.x+W.y+W.z);if (r != 0.5) {W=_texRepGain3(W,r);}
961
- return W.x*c1+W.y*c2+W.z*c3;}
962
- #elif TEXTURE_REPETITION_MODE==3
963
- vec4 _texRepSample(sampler2D samp,vec2 uv) {vec2 iuv=floor(uv);vec2 fuv=fract(uv);vec4 ofa=_texRepHash4(iuv+vec2(0.0,0.0));vec4 ofb=_texRepHash4(iuv+vec2(1.0,0.0));vec4 ofc=_texRepHash4(iuv+vec2(0.0,1.0));vec4 ofd=_texRepHash4(iuv+vec2(1.0,1.0));vec2 dx=dFdx(uv);vec2 dy=dFdy(uv);ofa.zw=sign(ofa.zw-0.5);ofb.zw=sign(ofb.zw-0.5);ofc.zw=sign(ofc.zw-0.5);ofd.zw=sign(ofd.zw-0.5);vec2 uva=uv*ofa.zw+ofa.xy; vec2 ddxa=dx*ofa.zw; vec2 ddya=dy*ofa.zw;vec2 uvb=uv*ofb.zw+ofb.xy; vec2 ddxb=dx*ofb.zw; vec2 ddyb=dy*ofb.zw;vec2 uvc=uv*ofc.zw+ofc.xy; vec2 ddxc=dx*ofc.zw; vec2 ddyc=dy*ofc.zw;vec2 uvd=uv*ofd.zw+ofd.xy; vec2 ddxd=dx*ofd.zw; vec2 ddyd=dy*ofd.zw;vec2 b=smoothstep(0.25,0.75,fuv);return mix(
964
- mix(textureGrad(samp,uva,ddxa,ddya),textureGrad(samp,uvb,ddxb,ddyb),b.x),
965
- mix(textureGrad(samp,uvc,ddxc,ddyc),textureGrad(samp,uvd,ddxd,ddyd),b.x),
966
- b.y
967
- );}
968
- #elif TEXTURE_REPETITION_MODE==4
969
- vec4 _texRepSample(sampler2D samp,vec2 uv) {vec2 p=floor(uv);vec2 f=fract(uv);vec2 dx=dFdx(uv);vec2 dy=dFdy(uv);vec4 va=vec4(0.0);float wt=0.0;float w2=0.0;for (int j=-1; j<=1; j++) {for (int i=-1; i<=1; i++) {vec2 g=vec2(float(i),float(j));vec4 o=_texRepHash4(p+g);vec2 r=g-f+o.xy;float d=dot(r,r);float w=exp(-5.0*d);vec4 c=textureGrad(samp,uv+o.zw,dx,dy);va+=w*c;wt+=w;w2+=w*w;}}
970
- float mean=0.3;vec4 res=mean+(va-wt*mean)/sqrt(w2);return mix(va/wt,res,0.4);}
971
- #endif
972
- #if TEXTURE_REPETITION_MODE>0
973
- #define TEXRD(s,uv) _texRepSample(s,uv)
974
- #else
975
- #define TEXRD(s,uv) texture2D(s,uv)
976
- #endif
977
- #define TEXRD_DEFINED
978
- `;i.ShaderStore.IncludesShadersStore[b]||(i.ShaderStore.IncludesShadersStore[b]=U);let W="bumpFragmentMainFunctions",H=`#ifndef TEXRD_DEFINED
290
+ `;i.ShaderStore.IncludesShadersStore[r]||(i.ShaderStore.IncludesShadersStore[r]=a),e.s(["reflectionFunction",0,{name:r,shader:a}],9275)},63539,80713,149,e=>{"use strict";var i=e.i(12423);let o="bumpFragmentMainFunctions",t=`#ifndef TEXRD_DEFINED
979
291
  #define TEXRD(s,uv) texture2D(s,uv)
980
292
  #define TEXRD_DEFINED
981
293
  #endif
@@ -1040,7 +352,7 @@ vec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)
1040
352
  mat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)
1041
353
  {vec3 dp1=dFdx(p);vec3 dp2=dFdy(p);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;float det=max(dot(tangent,tangent),dot(bitangent,bitangent));float invmax=det==0.0 ? 0.0 : inversesqrt(det);return mat3(tangent*invmax,bitangent*invmax,normal);}
1042
354
  #endif
1043
- `;i.ShaderStore.IncludesShadersStore[W]||(i.ShaderStore.IncludesShadersStore[W]=H);let z="bumpFragmentFunctions",V=`#if defined(BUMP)
355
+ `;i.ShaderStore.IncludesShadersStore[o]||(i.ShaderStore.IncludesShadersStore[o]=t),e.s(["bumpFragmentMainFunctions",0,{name:o,shader:t}],63539),e.i(80825);let r="bumpFragmentFunctions",a=`#if defined(BUMP)
1044
356
  #include<samplerFragmentDeclaration>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump)
1045
357
  #endif
1046
358
  #if defined(DETAIL)
@@ -1070,7 +382,7 @@ return -texCoordOffset;
1070
382
  #endif
1071
383
  }
1072
384
  #endif
1073
- `;i.ShaderStore.IncludesShadersStore[z]||(i.ShaderStore.IncludesShadersStore[z]=V);var G=e.i(29981),B=e.i(97226),k=e.i(56770),Y=e.i(69838);let Z="bumpFragment",q=`vec2 uvOffset=vec2(0.0,0.0);
385
+ `;i.ShaderStore.IncludesShadersStore[r]||(i.ShaderStore.IncludesShadersStore[r]=a),e.s(["bumpFragmentFunctions",0,{name:r,shader:a}],80713);let n="bumpFragment",f=`vec2 uvOffset=vec2(0.0,0.0);
1074
386
  #if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)
1075
387
  #ifdef NORMALXYSCALE
1076
388
  float normalScale=1.0;
@@ -1122,7 +434,17 @@ normalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);
1122
434
  #elif defined(DETAIL)
1123
435
  detailNormal.xy*=vDetailInfos.z;normalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);
1124
436
  #endif
1125
- `;i.ShaderStore.IncludesShadersStore[Z]||(i.ShaderStore.IncludesShadersStore[Z]=q);let j="decalFragment",Q=`#ifdef DECAL
437
+ `;i.ShaderStore.IncludesShadersStore[n]||(i.ShaderStore.IncludesShadersStore[n]=f),e.s(["bumpFragment",0,{name:n,shader:f}],149)},31463,e=>{"use strict";var i=e.i(12423);let o="clusteredLightingFunctions",t=`struct ClusteredLight {vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular;vec4 vLightDirection;vec4 vLightFalloff;};
438
+ #define inline
439
+ ClusteredLight getClusteredLight(sampler2D lightDataTexture,int index) {return ClusteredLight(
440
+ texelFetch(lightDataTexture,ivec2(0,index),0),
441
+ texelFetch(lightDataTexture,ivec2(1,index),0),
442
+ texelFetch(lightDataTexture,ivec2(2,index),0),
443
+ texelFetch(lightDataTexture,ivec2(3,index),0),
444
+ texelFetch(lightDataTexture,ivec2(4,index),0)
445
+ );}
446
+ int getClusteredSliceIndex(vec2 sliceData,float viewDepth) {return int(log(viewDepth)*sliceData.x+sliceData.y);}
447
+ `;i.ShaderStore.IncludesShadersStore[o]||(i.ShaderStore.IncludesShadersStore[o]=t),e.s(["clusteredLightingFunctions",0,{name:o,shader:t}])},6967,e=>{"use strict";var i=e.i(12423);let o="decalFragment",t=`#ifdef DECAL
1126
448
  #ifdef GAMMADECAL
1127
449
  decalColor.rgb=toLinearSpace(decalColor.rgb);
1128
450
  #endif
@@ -1131,10 +453,7 @@ decalColor.a*=decalColor.a;
1131
453
  #endif
1132
454
  surfaceAlbedo.rgb=mix(surfaceAlbedo.rgb,decalColor.rgb,decalColor.a);
1133
455
  #endif
1134
- `;i.ShaderStore.IncludesShadersStore[j]||(i.ShaderStore.IncludesShadersStore[j]=Q);let J="depthPrePass",K=`#ifdef DEPTHPREPASS
1135
- gl_FragColor=vec4(0.,0.,0.,1.0);return;
1136
- #endif
1137
- `;i.ShaderStore.IncludesShadersStore[J]||(i.ShaderStore.IncludesShadersStore[J]=K);let $="lightFragment",ee=`#ifdef LIGHT{X}
456
+ `;i.ShaderStore.IncludesShadersStore[o]||(i.ShaderStore.IncludesShadersStore[o]=t),e.s(["decalFragment",0,{name:o,shader:t}])},73717,e=>{"use strict";var i=e.i(12423);let o="lightFragment",t=`#ifdef LIGHT{X}
1138
457
  #if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})
1139
458
  #else
1140
459
  vec4 diffuse{X}=light{X}.vLightDiffuse;
@@ -1512,35 +831,186 @@ sheenBase+=info.sheen.rgb*shadow;
1512
831
  #endif
1513
832
  #endif
1514
833
  #endif
1515
- `;i.ShaderStore.IncludesShadersStore[$]||(i.ShaderStore.IncludesShadersStore[$]=ee);let ei="logDepthFragment",et=`#ifdef LOGARITHMICDEPTH
1516
- gl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;
834
+ `;i.ShaderStore.IncludesShadersStore[o]||(i.ShaderStore.IncludesShadersStore[o]=t),e.s(["lightFragment",0,{name:o,shader:t}])},40042,e=>{"use strict";var i=e.i(12423),o=e.i(1935);let t="defaultFragmentDeclaration",r=`uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;uniform vec4 vSpecularColor;uniform vec3 vEmissiveColor;uniform vec3 vAmbientColor;uniform float visibility;
835
+ #ifdef DIFFUSE
836
+ uniform vec2 vDiffuseInfos;
1517
837
  #endif
1518
- `;i.ShaderStore.IncludesShadersStore[ei]||(i.ShaderStore.IncludesShadersStore[ei]=et);var eo=e.i(40671);let er="oitFragment",ea=`#ifdef ORDER_INDEPENDENT_TRANSPARENCY
1519
- float fragDepth=gl_FragCoord.z;
1520
- #ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS
1521
- uint halfFloat=packHalf2x16(vec2(fragDepth));vec2 full=unpackHalf2x16(halfFloat);fragDepth=full.x;
838
+ #ifdef AMBIENT
839
+ uniform vec2 vAmbientInfos;
1522
840
  #endif
1523
- ivec2 fragCoord=ivec2(gl_FragCoord.xy);vec2 lastDepth=texelFetch(oitDepthSampler,fragCoord,0).rg;vec4 lastFrontColor=texelFetch(oitFrontColorSampler,fragCoord,0);depth.rg=vec2(-MAX_DEPTH);frontColor=lastFrontColor;backColor=vec4(0.0);
1524
- #ifdef USE_REVERSE_DEPTHBUFFER
1525
- float furthestDepth=-lastDepth.x;float nearestDepth=lastDepth.y;
1526
- #else
1527
- float nearestDepth=-lastDepth.x;float furthestDepth=lastDepth.y;
841
+ #ifdef OPACITY
842
+ uniform vec2 vOpacityInfos;
1528
843
  #endif
1529
- float alphaMultiplier=1.0-lastFrontColor.a;
1530
- #ifdef USE_REVERSE_DEPTHBUFFER
1531
- if (fragDepth>nearestDepth || fragDepth<furthestDepth) {
1532
- #else
1533
- if (fragDepth<nearestDepth || fragDepth>furthestDepth) {
844
+ #ifdef EMISSIVE
845
+ uniform vec2 vEmissiveInfos;
1534
846
  #endif
1535
- return;}
1536
- #ifdef USE_REVERSE_DEPTHBUFFER
1537
- if (fragDepth<nearestDepth && fragDepth>furthestDepth) {
1538
- #else
1539
- if (fragDepth>nearestDepth && fragDepth<furthestDepth) {
847
+ #ifdef LIGHTMAP
848
+ uniform vec2 vLightmapInfos;
849
+ #endif
850
+ #ifdef BUMP
851
+ uniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;
852
+ #endif
853
+ #ifdef ALPHATEST
854
+ uniform float alphaCutOff;
855
+ #endif
856
+ #if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION) || defined(PREPASS)
857
+ uniform mat4 view;
858
+ #endif
859
+ #ifdef REFRACTION
860
+ uniform vec4 vRefractionInfos;
861
+ #ifndef REFRACTIONMAP_3D
862
+ uniform mat4 refractionMatrix;
863
+ #endif
864
+ #ifdef REFRACTIONFRESNEL
865
+ uniform vec4 refractionLeftColor;uniform vec4 refractionRightColor;
866
+ #endif
867
+ #if defined(USE_LOCAL_REFRACTIONMAP_CUBIC) && defined(REFRACTIONMAP_3D)
868
+ uniform vec3 vRefractionPosition;uniform vec3 vRefractionSize;
869
+ #endif
870
+ #endif
871
+ #if defined(SPECULAR) && defined(SPECULARTERM)
872
+ uniform vec2 vSpecularInfos;
873
+ #endif
874
+ #ifdef DIFFUSEFRESNEL
875
+ uniform vec4 diffuseLeftColor;uniform vec4 diffuseRightColor;
876
+ #endif
877
+ #ifdef OPACITYFRESNEL
878
+ uniform vec4 opacityParts;
879
+ #endif
880
+ #ifdef EMISSIVEFRESNEL
881
+ uniform vec4 emissiveLeftColor;uniform vec4 emissiveRightColor;
882
+ #endif
883
+ #if defined(REFLECTION) || (defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED))
884
+ uniform vec2 vReflectionInfos;
885
+ #if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)
886
+ uniform mat4 reflectionMatrix;
887
+ #endif
888
+ #ifndef REFLECTIONMAP_SKYBOX
889
+ #if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)
890
+ uniform vec3 vReflectionPosition;uniform vec3 vReflectionSize;
891
+ #endif
892
+ #endif
893
+ #ifdef REFLECTIONFRESNEL
894
+ uniform vec4 reflectionLeftColor;uniform vec4 reflectionRightColor;
895
+ #endif
896
+ #endif
897
+ #ifdef DETAIL
898
+ uniform vec4 vDetailInfos;
899
+ #endif
900
+ #include<decalFragmentDeclaration>
901
+ #if TEXTURE_REPETITION_MODE>0
902
+ uniform vec4 vTextureRepetitionHexTilingParams;
903
+ #endif
904
+ #define ADDITIONAL_FRAGMENT_DECLARATION
905
+ `;i.ShaderStore.IncludesShadersStore[t]||(i.ShaderStore.IncludesShadersStore[t]=r);var a=e.i(85668),n=e.i(6232),f=e.i(44661),l=e.i(55587),s=e.i(52195),d=e.i(92692),c=e.i(65296),u=e.i(2097),g=e.i(98351),h=e.i(41932),v=e.i(31463);let m="lightsFragmentFunctions",S=`struct lightingInfo
906
+ {vec3 diffuse;
907
+ #ifdef SPECULARTERM
908
+ vec3 specular;
909
+ #endif
910
+ #ifdef NDOTL
911
+ float ndl;
912
+ #endif
913
+ };lightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {lightingInfo result;vec3 lightVectorW;float attenuation=1.0;if (lightData.w==0.)
914
+ {vec3 direction=lightData.xyz-vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}
915
+ else
916
+ {lightVectorW=normalize(-lightData.xyz);}
917
+ float ndl=max(0.,dot(vNormal,lightVectorW));
918
+ #ifdef NDOTL
919
+ result.ndl=ndl;
920
+ #endif
921
+ result.diffuse=ndl*diffuseColor*attenuation;
922
+ #ifdef SPECULARTERM
923
+ vec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
924
+ #endif
925
+ return result;}
926
+ float getAttenuation(float cosAngle,float exponent) {return max(0.,pow(cosAngle,exponent));}
927
+ float getIESAttenuation(float cosAngle,sampler2D iesLightSampler) {float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}
928
+ lightingInfo basicSpotLighting(vec3 viewDirectionW,vec3 lightVectorW,vec3 vNormal,float attenuation,vec3 diffuseColor,vec3 specularColor,float glossiness) {lightingInfo result;
929
+ float ndl=max(0.,dot(vNormal,lightVectorW));
930
+ #ifdef NDOTL
931
+ result.ndl=ndl;
932
+ #endif
933
+ result.diffuse=ndl*diffuseColor*attenuation;
934
+ #ifdef SPECULARTERM
935
+ vec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
936
+ #endif
937
+ return result;}
938
+ lightingInfo computeIESSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness,sampler2D iesLightSampler) {
939
+ vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float dotProduct=dot(lightDirection.xyz,-lightVectorW);float cosAngle=max(0.,dotProduct);if (cosAngle>=lightDirection.w)
940
+ {
941
+ attenuation*=getIESAttenuation(dotProduct,iesLightSampler);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
942
+ lightingInfo result;result.diffuse=vec3(0.);
943
+ #ifdef SPECULARTERM
944
+ result.specular=vec3(0.);
945
+ #endif
946
+ #ifdef NDOTL
947
+ result.ndl=0.;
948
+ #endif
949
+ return result;}
950
+ lightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)
951
+ {
952
+ attenuation*=getAttenuation(cosAngle,lightData.w);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
953
+ lightingInfo result;result.diffuse=vec3(0.);
954
+ #ifdef SPECULARTERM
955
+ result.specular=vec3(0.);
956
+ #endif
957
+ #ifdef NDOTL
958
+ result.ndl=0.;
959
+ #endif
960
+ return result;}
961
+ lightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {lightingInfo result;float ndl=dot(vNormal,lightData.xyz)*0.5+0.5;
962
+ #ifdef NDOTL
963
+ result.ndl=ndl;
964
+ #endif
965
+ result.diffuse=mix(groundColor,diffuseColor,ndl);
966
+ #ifdef SPECULARTERM
967
+ vec3 angleW=normalize(viewDirectionW+lightData.xyz);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;
968
+ #endif
969
+ return result;}
970
+ #define inline
971
+ vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix,vec3 posW){vec4 strq=textureProjectionMatrix*vec4(posW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return textureColor;}
972
+ #if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
973
+ #include<ltcHelperFunctions>
974
+ uniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler;
975
+ #define inline
976
+ lightingInfo computeAreaLighting(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec3 lightPosition,vec3 halfWidth,vec3 halfHeight,vec3 diffuseColor,vec3 specularColor,float roughness)
977
+ {lightingInfo result;areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
978
+ #ifdef SPECULARTERM
979
+ vec3 fresnel=( specularColor*data.Fresnel.x+( vec3( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
980
+ #endif
981
+ result.diffuse+=diffuseColor*data.Diffuse;return result;}
982
+ lightingInfo computeAreaLightingWithTexture(sampler2D ltc1,sampler2D ltc2,sampler2D emissionTexture,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec3 lightPosition,vec3 halfWidth,vec3 halfHeight,vec3 diffuseColor,vec3 specularColor,float roughness)
983
+ {lightingInfo result;areaLightData data=computeAreaLightSpecularDiffuseFresnelWithEmission(ltc1,ltc2,emissionTexture,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
984
+ #ifdef SPECULARTERM
985
+ vec3 fresnel=( specularColor*data.Fresnel.x+( vec3( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
986
+ #endif
987
+ result.diffuse+=diffuseColor*data.Diffuse;return result;}
988
+ #endif
989
+ #if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
990
+ #include<clusteredLightingFunctions>
991
+ #define inline
992
+ lightingInfo computeClusteredLighting(
993
+ sampler2D lightDataTexture,
994
+ sampler2D tileMaskTexture,
995
+ vec3 viewDirectionW,
996
+ vec3 vNormal,
997
+ vec4 lightData,
998
+ ivec2 sliceRange,
999
+ float glossiness
1000
+ ) {lightingInfo result;ivec2 tilePosition=ivec2(gl_FragCoord.xy*lightData.xy);int maskHeight=int(lightData.z);tilePosition.y=min(tilePosition.y,maskHeight-1);ivec2 batchRange=sliceRange/CLUSTLIGHT_BATCH;int batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tilePosition.y+=maskHeight*batchRange.x;for (int i=batchRange.x; i<=batchRange.y; i+=1) {uint mask=uint(texelFetch(tileMaskTexture,tilePosition,0).r);tilePosition.y+=maskHeight;int maskOffset=max(sliceRange.x-batchOffset,0);int maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while (mask != 0u) {uint bit=mask & -mask;mask ^= bit;int position=onlyBitPosition(bit);ClusteredLight light=getClusteredLight(lightDataTexture,batchOffset+maskOffset+position);lightingInfo info;if (light.vLightDirection.w<0.0) {info=computeLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);} else {info=computeSpotLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDirection,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);}
1001
+ result.diffuse+=info.diffuse;
1002
+ #ifdef SPECULARTERM
1003
+ result.specular+=info.specular;
1004
+ #endif
1005
+ }
1006
+ batchOffset+=CLUSTLIGHT_BATCH;}
1007
+ return result;}
1540
1008
  #endif
1541
- depth.rg=vec2(-fragDepth,fragDepth);return;}
1009
+ `;i.ShaderStore.IncludesShadersStore[m]||(i.ShaderStore.IncludesShadersStore[m]=S);var E=e.i(40234),p=e.i(80825);let I="fresnelFunction",C=`#ifdef FRESNEL
1010
+ float computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)
1011
+ {float fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);}
1542
1012
  #endif
1543
- `;i.ShaderStore.IncludesShadersStore[er]||(i.ShaderStore.IncludesShadersStore[er]=ea);let en="defaultPixelShader",el=`#define CUSTOM_FRAGMENT_EXTENSION
1013
+ `;i.ShaderStore.IncludesShadersStore[I]||(i.ShaderStore.IncludesShadersStore[I]=C);var L=e.i(9275),A=e.i(53843),D=e.i(54994),T=e.i(71209),P=e.i(63539),R=e.i(80713),X=e.i(29981),N=e.i(97226),x=e.i(56770),O=e.i(69838),F=e.i(149),w=e.i(6967),M=e.i(76286),_=e.i(73717),b=e.i(68695),U=e.i(40671),W=e.i(19310);let y="defaultPixelShader",G=`#define CUSTOM_FRAGMENT_EXTENSION
1544
1014
  #include<__decl__defaultFragment>
1545
1015
  #if defined(BUMP) || !defined(NORMAL)
1546
1016
  #extension GL_OES_standard_derivatives : enable
@@ -1890,4 +1360,4 @@ if (fragDepth==nearestDepth) {frontColor.rgb+=color.rgb*color.a*alphaMultiplier;
1890
1360
  #endif
1891
1361
  #define CUSTOM_FRAGMENT_MAIN_END
1892
1362
  }
1893
- `;for(let e of(i.ShaderStore.ShadersStore[en]||(i.ShaderStore.ShadersStore[en]=el),[{name:t,shader:o},{name:r,shader:a},n.sceneUboDeclaration,l.meshUboDeclaration,f.defaultUboDeclaration,{name:s,shader:d},{name:c,shader:v},h.mainUVVaryingDeclaration,u.helperFunctions,{name:p,shader:m},{name:S,shader:g},{name:E,shader:C},{name:D,shader:T},{name:L,shader:I},{name:w,shader:x},{name:A,shader:P},{name:R,shader:X},{name:F,shader:N},{name:M,shader:_},{name:O,shader:y},{name:b,shader:U},{name:W,shader:H},{name:z,shader:V},G.clipPlaneFragmentDeclaration,B.logDepthDeclaration,k.fogFragmentDeclaration,Y.clipPlaneFragment,{name:Z,shader:q},{name:j,shader:Q},{name:J,shader:K},{name:$,shader:ee},{name:ei,shader:et},eo.fogFragment,{name:er,shader:ea}]))i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);e.s(["defaultPixelShader",0,{name:en,shader:el}],40042)}]);
1363
+ `;for(let e of(i.ShaderStore.ShadersStore[y]||(i.ShaderStore.ShadersStore[y]=G),[o.decalFragmentDeclaration,{name:t,shader:r},a.sceneUboDeclaration,n.meshUboDeclaration,f.defaultUboDeclaration,l.prePassDeclaration,s.oitDeclaration,d.mainUVVaryingDeclaration,c.helperFunctions,u.lightFragmentDeclaration,g.lightUboDeclaration,h.ltcHelperFunctions,v.clusteredLightingFunctions,{name:m,shader:S},E.shadowsFragmentFunctions,p.samplerFragmentDeclaration,{name:I,shader:C},L.reflectionFunction,A.imageProcessingDeclaration,D.imageProcessingFunctions,T.textureRepetitionFunctions,P.bumpFragmentMainFunctions,R.bumpFragmentFunctions,X.clipPlaneFragmentDeclaration,N.logDepthDeclaration,x.fogFragmentDeclaration,O.clipPlaneFragment,F.bumpFragment,w.decalFragment,M.depthPrePass,_.lightFragment,b.logDepthFragment,U.fogFragment,W.oitFragment]))i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);e.s(["defaultPixelShader",0,{name:y,shader:G}],40042)}]);