pptx-react-viewer 3.17.0 → 3.18.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 (225) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +33 -31
  3. package/dist/{AiChatPanel-4LKH44IE.mjs → AiChatPanel-DDZC6IRK.mjs} +4 -4
  4. package/dist/AiChatPanel-DDZC6IRK.mjs.br +0 -0
  5. package/dist/AiChatPanel-DDZC6IRK.mjs.gz +0 -0
  6. package/dist/{AiChatPanel-VWVGQ5DD.js → AiChatPanel-T2QSCUQR.js} +25 -25
  7. package/dist/AiChatPanel-T2QSCUQR.js.br +0 -0
  8. package/dist/AiChatPanel-T2QSCUQR.js.gz +0 -0
  9. package/dist/{Area3DChartScene-D7GSJGPQ.js → Area3DChartScene-WEU2MP3B.js} +2 -2
  10. package/dist/Area3DChartScene-WEU2MP3B.js.br +0 -0
  11. package/dist/Area3DChartScene-WEU2MP3B.js.gz +0 -0
  12. package/dist/{Area3DChartScene-X5SM67PZ.mjs → Area3DChartScene-WTKQDHC7.mjs} +1 -1
  13. package/dist/Area3DChartScene-WTKQDHC7.mjs.br +0 -0
  14. package/dist/Area3DChartScene-WTKQDHC7.mjs.gz +0 -0
  15. package/dist/{Bar3DChartScene-M72WQW5Y.js → Bar3DChartScene-25G6TG53.js} +2 -2
  16. package/dist/Bar3DChartScene-25G6TG53.js.br +0 -0
  17. package/dist/Bar3DChartScene-25G6TG53.js.gz +0 -0
  18. package/dist/{Bar3DChartScene-HWIFFGI3.mjs → Bar3DChartScene-A5ICLHXS.mjs} +1 -1
  19. package/dist/{Bar3DChartScene-HWIFFGI3.mjs.br → Bar3DChartScene-A5ICLHXS.mjs.br} +0 -0
  20. package/dist/Bar3DChartScene-A5ICLHXS.mjs.gz +0 -0
  21. package/dist/{GLTFLoader-374ZNTXW.mjs → GLTFLoader-IWJFC4XI.mjs} +54 -16
  22. package/dist/GLTFLoader-IWJFC4XI.mjs.br +0 -0
  23. package/dist/GLTFLoader-IWJFC4XI.mjs.gz +0 -0
  24. package/dist/{GLTFLoader-Q7BHCGAW.js → GLTFLoader-KY7AYPMX.js} +178 -140
  25. package/dist/GLTFLoader-KY7AYPMX.js.br +0 -0
  26. package/dist/GLTFLoader-KY7AYPMX.js.gz +0 -0
  27. package/dist/{Line3DChartScene-7MPZWVF3.mjs → Line3DChartScene-ARCDLHXQ.mjs} +1 -1
  28. package/dist/Line3DChartScene-ARCDLHXQ.mjs.br +0 -0
  29. package/dist/Line3DChartScene-ARCDLHXQ.mjs.gz +0 -0
  30. package/dist/{Line3DChartScene-YOZEEQZ3.js → Line3DChartScene-WRZ52Z2Z.js} +2 -2
  31. package/dist/Line3DChartScene-WRZ52Z2Z.js.br +0 -0
  32. package/dist/Line3DChartScene-WRZ52Z2Z.js.gz +0 -0
  33. package/dist/{Model3DScene-5IJSNGDZ.js → Model3DScene-JGUG5NPX.js} +2 -2
  34. package/dist/Model3DScene-JGUG5NPX.js.br +0 -0
  35. package/dist/Model3DScene-JGUG5NPX.js.gz +0 -0
  36. package/dist/{Model3DScene-57LVY5QW.mjs → Model3DScene-PBKBL2YU.mjs} +1 -1
  37. package/dist/Model3DScene-PBKBL2YU.mjs.br +0 -0
  38. package/dist/Model3DScene-PBKBL2YU.mjs.gz +0 -0
  39. package/dist/OrbitControls-2XOMWUVE.mjs +3 -0
  40. package/dist/OrbitControls-2XOMWUVE.mjs.br +0 -0
  41. package/dist/OrbitControls-2XOMWUVE.mjs.gz +0 -0
  42. package/dist/OrbitControls-CGYUF3BY.js +12 -0
  43. package/dist/OrbitControls-CGYUF3BY.js.br +0 -0
  44. package/dist/OrbitControls-CGYUF3BY.js.gz +0 -0
  45. package/dist/{PieChart3DScene-UBI6X66Q.js → PieChart3DScene-S25DNSRS.js} +2 -2
  46. package/dist/PieChart3DScene-S25DNSRS.js.br +0 -0
  47. package/dist/PieChart3DScene-S25DNSRS.js.gz +0 -0
  48. package/dist/{PieChart3DScene-WD5B6NP3.mjs → PieChart3DScene-ZNKXS62H.mjs} +1 -1
  49. package/dist/{PieChart3DScene-WD5B6NP3.mjs.br → PieChart3DScene-ZNKXS62H.mjs.br} +0 -0
  50. package/dist/PieChart3DScene-ZNKXS62H.mjs.gz +0 -0
  51. package/dist/{SmartArt3DScene-ODKCGJBO.mjs → SmartArt3DScene-QZGIABOK.mjs} +2 -2
  52. package/dist/SmartArt3DScene-QZGIABOK.mjs.br +0 -0
  53. package/dist/SmartArt3DScene-QZGIABOK.mjs.gz +0 -0
  54. package/dist/{SmartArt3DScene-BK7QN3WT.js → SmartArt3DScene-T236GYUT.js} +33 -33
  55. package/dist/SmartArt3DScene-T236GYUT.js.br +0 -0
  56. package/dist/SmartArt3DScene-T236GYUT.js.gz +0 -0
  57. package/dist/{SurfaceChart3DScene-JZGU6BBD.mjs → SurfaceChart3DScene-EBT7RPCX.mjs} +1 -1
  58. package/dist/SurfaceChart3DScene-EBT7RPCX.mjs.br +0 -0
  59. package/dist/SurfaceChart3DScene-EBT7RPCX.mjs.gz +0 -0
  60. package/dist/{SurfaceChart3DScene-JGNPYQ32.js → SurfaceChart3DScene-LXBC3HMV.js} +2 -2
  61. package/dist/SurfaceChart3DScene-LXBC3HMV.js.br +0 -0
  62. package/dist/SurfaceChart3DScene-LXBC3HMV.js.gz +0 -0
  63. package/dist/{chunk-KVXB22D3.js → chunk-2LTTSFLD.js} +5 -5
  64. package/dist/chunk-2LTTSFLD.js.br +0 -0
  65. package/dist/chunk-2LTTSFLD.js.gz +0 -0
  66. package/dist/{chunk-23PW4Y4R.mjs → chunk-2OCTGK4L.mjs} +6 -110
  67. package/dist/chunk-2OCTGK4L.mjs.br +0 -0
  68. package/dist/chunk-2OCTGK4L.mjs.gz +0 -0
  69. package/dist/{chunk-EDMJYVCS.mjs → chunk-3KKPRPVE.mjs} +128 -143
  70. package/dist/chunk-3KKPRPVE.mjs.br +0 -0
  71. package/dist/chunk-3KKPRPVE.mjs.gz +0 -0
  72. package/dist/{chunk-B4QYQLZU.js → chunk-3N6AC4HA.js} +1122 -693
  73. package/dist/chunk-3N6AC4HA.js.br +0 -0
  74. package/dist/chunk-3N6AC4HA.js.gz +0 -0
  75. package/dist/{chunk-7YOA4HNP.mjs → chunk-5S3A6HL3.mjs} +121 -42
  76. package/dist/chunk-5S3A6HL3.mjs.br +0 -0
  77. package/dist/chunk-5S3A6HL3.mjs.gz +0 -0
  78. package/dist/{chunk-72LYFUGL.js → chunk-6R2EUDJQ.js} +1412 -1427
  79. package/dist/chunk-6R2EUDJQ.js.br +0 -0
  80. package/dist/chunk-6R2EUDJQ.js.gz +0 -0
  81. package/dist/{chunk-XBMKFZVP.mjs → chunk-7TAWW5QQ.mjs} +1120 -694
  82. package/dist/chunk-7TAWW5QQ.mjs.br +0 -0
  83. package/dist/chunk-7TAWW5QQ.mjs.gz +0 -0
  84. package/dist/{chunk-3AJ54EAB.js → chunk-BRJN3ZMG.js} +11 -1
  85. package/dist/chunk-BRJN3ZMG.js.br +0 -0
  86. package/dist/{chunk-3AJ54EAB.js.gz → chunk-BRJN3ZMG.js.gz} +0 -0
  87. package/dist/{chunk-QTGCOL5H.mjs → chunk-GNRVDNCV.mjs} +1707 -435
  88. package/dist/chunk-GNRVDNCV.mjs.br +0 -0
  89. package/dist/chunk-GNRVDNCV.mjs.gz +0 -0
  90. package/dist/{chunk-6C2WYLZY.js → chunk-IXS7DALE.js} +45 -39
  91. package/dist/chunk-IXS7DALE.js.br +0 -0
  92. package/dist/chunk-IXS7DALE.js.gz +0 -0
  93. package/dist/{chunk-NJ3WCYYG.js → chunk-LJ46KXUV.js} +179 -283
  94. package/dist/chunk-LJ46KXUV.js.br +0 -0
  95. package/dist/chunk-LJ46KXUV.js.gz +0 -0
  96. package/dist/{chunk-HMX3MQR7.mjs → chunk-MQUTXOET.mjs} +11 -2
  97. package/dist/chunk-MQUTXOET.mjs.br +0 -0
  98. package/dist/{chunk-HMX3MQR7.mjs.gz → chunk-MQUTXOET.mjs.gz} +0 -0
  99. package/dist/{chunk-3CBDTD46.mjs → chunk-MV2GCDBR.mjs} +8 -2
  100. package/dist/chunk-MV2GCDBR.mjs.br +0 -0
  101. package/dist/chunk-MV2GCDBR.mjs.gz +0 -0
  102. package/dist/{chunk-4SPZ5IZN.js → chunk-V32F4I45.js} +1713 -439
  103. package/dist/chunk-V32F4I45.js.br +0 -0
  104. package/dist/chunk-V32F4I45.js.gz +0 -0
  105. package/dist/{chunk-3UGVURWU.js → chunk-WGBXO4LM.js} +576 -497
  106. package/dist/chunk-WGBXO4LM.js.br +0 -0
  107. package/dist/chunk-WGBXO4LM.js.gz +0 -0
  108. package/dist/{chunk-7YJBRPCT.mjs → chunk-WRO37U2O.mjs} +1 -1
  109. package/dist/chunk-WRO37U2O.mjs.br +0 -0
  110. package/dist/chunk-WRO37U2O.mjs.gz +0 -0
  111. package/dist/i18n.js +4 -4
  112. package/dist/i18n.js.br +0 -0
  113. package/dist/i18n.js.gz +0 -0
  114. package/dist/i18n.mjs +1 -1
  115. package/dist/i18n.mjs.br +0 -0
  116. package/dist/i18n.mjs.gz +0 -0
  117. package/dist/index.d.ts +2 -0
  118. package/dist/index.js +47 -47
  119. package/dist/index.js.br +0 -0
  120. package/dist/index.js.gz +0 -0
  121. package/dist/index.mjs +6 -6
  122. package/dist/index.mjs.br +0 -0
  123. package/dist/index.mjs.gz +0 -0
  124. package/dist/internals.d.ts +18 -0
  125. package/dist/internals.d.ts.map +1 -1
  126. package/dist/internals.js +79 -79
  127. package/dist/internals.js.br +0 -0
  128. package/dist/internals.js.gz +0 -0
  129. package/dist/internals.mjs +4 -4
  130. package/dist/internals.mjs.br +0 -0
  131. package/dist/internals.mjs.gz +0 -0
  132. package/dist/pptx-viewer.css +1 -1
  133. package/dist/pptx-viewer.css.br +0 -0
  134. package/dist/pptx-viewer.css.gz +0 -0
  135. package/dist/three.module-LGUV2LI6.mjs +2 -0
  136. package/dist/three.module-LGUV2LI6.mjs.br +0 -0
  137. package/dist/three.module-LGUV2LI6.mjs.gz +0 -0
  138. package/dist/{three.module-GNNNRIMK.js → three.module-YZ4M24WM.js} +454 -442
  139. package/dist/three.module-YZ4M24WM.js.br +0 -0
  140. package/dist/three.module-YZ4M24WM.js.gz +0 -0
  141. package/dist/{useViewerBuildingBlocks-DkUGmlkP.d.ts → useViewerBuildingBlocks-4Tj6P8Fm.d.ts} +3 -1
  142. package/dist/useViewerBuildingBlocks-4Tj6P8Fm.d.ts.map +1 -0
  143. package/dist/viewer/index.js +27 -27
  144. package/dist/viewer/index.js.br +0 -0
  145. package/dist/viewer/index.js.gz +0 -0
  146. package/dist/viewer/index.mjs +6 -6
  147. package/dist/viewer/index.mjs.br +0 -0
  148. package/dist/viewer/index.mjs.gz +0 -0
  149. package/package.json +3 -3
  150. package/dist/AiChatPanel-4LKH44IE.mjs.br +0 -0
  151. package/dist/AiChatPanel-4LKH44IE.mjs.gz +0 -0
  152. package/dist/AiChatPanel-VWVGQ5DD.js.br +0 -0
  153. package/dist/AiChatPanel-VWVGQ5DD.js.gz +0 -0
  154. package/dist/Area3DChartScene-D7GSJGPQ.js.br +0 -0
  155. package/dist/Area3DChartScene-D7GSJGPQ.js.gz +0 -0
  156. package/dist/Area3DChartScene-X5SM67PZ.mjs.br +0 -0
  157. package/dist/Area3DChartScene-X5SM67PZ.mjs.gz +0 -0
  158. package/dist/Bar3DChartScene-HWIFFGI3.mjs.gz +0 -0
  159. package/dist/Bar3DChartScene-M72WQW5Y.js.br +0 -0
  160. package/dist/Bar3DChartScene-M72WQW5Y.js.gz +0 -0
  161. package/dist/GLTFLoader-374ZNTXW.mjs.br +0 -0
  162. package/dist/GLTFLoader-374ZNTXW.mjs.gz +0 -0
  163. package/dist/GLTFLoader-Q7BHCGAW.js.br +0 -0
  164. package/dist/GLTFLoader-Q7BHCGAW.js.gz +0 -0
  165. package/dist/Line3DChartScene-7MPZWVF3.mjs.br +0 -0
  166. package/dist/Line3DChartScene-7MPZWVF3.mjs.gz +0 -0
  167. package/dist/Line3DChartScene-YOZEEQZ3.js.br +0 -0
  168. package/dist/Line3DChartScene-YOZEEQZ3.js.gz +0 -0
  169. package/dist/Model3DScene-57LVY5QW.mjs.br +0 -0
  170. package/dist/Model3DScene-57LVY5QW.mjs.gz +0 -0
  171. package/dist/Model3DScene-5IJSNGDZ.js.br +0 -0
  172. package/dist/Model3DScene-5IJSNGDZ.js.gz +0 -0
  173. package/dist/OrbitControls-SMYCPLXO.js +0 -12
  174. package/dist/OrbitControls-SMYCPLXO.js.br +0 -3
  175. package/dist/OrbitControls-SMYCPLXO.js.gz +0 -0
  176. package/dist/OrbitControls-ZTGHPI5G.mjs +0 -3
  177. package/dist/OrbitControls-ZTGHPI5G.mjs.br +0 -0
  178. package/dist/OrbitControls-ZTGHPI5G.mjs.gz +0 -0
  179. package/dist/PieChart3DScene-UBI6X66Q.js.br +0 -0
  180. package/dist/PieChart3DScene-UBI6X66Q.js.gz +0 -0
  181. package/dist/PieChart3DScene-WD5B6NP3.mjs.gz +0 -0
  182. package/dist/SmartArt3DScene-BK7QN3WT.js.br +0 -0
  183. package/dist/SmartArt3DScene-BK7QN3WT.js.gz +0 -0
  184. package/dist/SmartArt3DScene-ODKCGJBO.mjs.br +0 -0
  185. package/dist/SmartArt3DScene-ODKCGJBO.mjs.gz +0 -0
  186. package/dist/SurfaceChart3DScene-JGNPYQ32.js.br +0 -0
  187. package/dist/SurfaceChart3DScene-JGNPYQ32.js.gz +0 -0
  188. package/dist/SurfaceChart3DScene-JZGU6BBD.mjs.br +0 -0
  189. package/dist/SurfaceChart3DScene-JZGU6BBD.mjs.gz +0 -0
  190. package/dist/chunk-23PW4Y4R.mjs.br +0 -0
  191. package/dist/chunk-23PW4Y4R.mjs.gz +0 -0
  192. package/dist/chunk-3AJ54EAB.js.br +0 -0
  193. package/dist/chunk-3CBDTD46.mjs.br +0 -0
  194. package/dist/chunk-3CBDTD46.mjs.gz +0 -0
  195. package/dist/chunk-3UGVURWU.js.br +0 -0
  196. package/dist/chunk-3UGVURWU.js.gz +0 -0
  197. package/dist/chunk-4SPZ5IZN.js.br +0 -0
  198. package/dist/chunk-4SPZ5IZN.js.gz +0 -0
  199. package/dist/chunk-6C2WYLZY.js.br +0 -0
  200. package/dist/chunk-6C2WYLZY.js.gz +0 -0
  201. package/dist/chunk-72LYFUGL.js.br +0 -0
  202. package/dist/chunk-72LYFUGL.js.gz +0 -0
  203. package/dist/chunk-7YJBRPCT.mjs.br +0 -0
  204. package/dist/chunk-7YJBRPCT.mjs.gz +0 -0
  205. package/dist/chunk-7YOA4HNP.mjs.br +0 -0
  206. package/dist/chunk-7YOA4HNP.mjs.gz +0 -0
  207. package/dist/chunk-B4QYQLZU.js.br +0 -0
  208. package/dist/chunk-B4QYQLZU.js.gz +0 -0
  209. package/dist/chunk-EDMJYVCS.mjs.br +0 -0
  210. package/dist/chunk-EDMJYVCS.mjs.gz +0 -0
  211. package/dist/chunk-HMX3MQR7.mjs.br +0 -0
  212. package/dist/chunk-KVXB22D3.js.br +0 -0
  213. package/dist/chunk-KVXB22D3.js.gz +0 -0
  214. package/dist/chunk-NJ3WCYYG.js.br +0 -0
  215. package/dist/chunk-NJ3WCYYG.js.gz +0 -0
  216. package/dist/chunk-QTGCOL5H.mjs.br +0 -0
  217. package/dist/chunk-QTGCOL5H.mjs.gz +0 -0
  218. package/dist/chunk-XBMKFZVP.mjs.br +0 -0
  219. package/dist/chunk-XBMKFZVP.mjs.gz +0 -0
  220. package/dist/three.module-AC7ESV4W.mjs +0 -2
  221. package/dist/three.module-AC7ESV4W.mjs.br +0 -0
  222. package/dist/three.module-AC7ESV4W.mjs.gz +0 -0
  223. package/dist/three.module-GNNNRIMK.js.br +0 -0
  224. package/dist/three.module-GNNNRIMK.js.gz +0 -0
  225. package/dist/useViewerBuildingBlocks-DkUGmlkP.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
- // ../../node_modules/.bun/three@0.185.1/node_modules/three/build/three.core.js
2
- var REVISION = "185";
1
+ // ../../node_modules/.bun/three@0.186.0/node_modules/three/build/three.core.js
2
+ var REVISION = "186";
3
3
  var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
4
4
  var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
5
5
  var CullFaceNone = 0;
@@ -225,6 +225,11 @@ var InterpolationSamplingMode = {
225
225
  var Compatibility = {
226
226
  TEXTURE_COMPARE: "depthTextureCompare"
227
227
  };
228
+ var RenderObjectRefreshType = {
229
+ NONE: 0,
230
+ SHARED: 1,
231
+ FULL: 2
232
+ };
228
233
  function arrayNeedsUint32(array) {
229
234
  for (let i = array.length - 1; i >= 0; --i) {
230
235
  if (array[i] >= 65535) return true;
@@ -482,7 +487,7 @@ function radToDeg(radians) {
482
487
  return radians * RAD2DEG;
483
488
  }
484
489
  function isPowerOfTwo(value) {
485
- return (value & value - 1) === 0 && value !== 0;
490
+ return value > 0 && Number.isInteger(value) && 2 ** Math.round(Math.log2(value)) === value;
486
491
  }
487
492
  function ceilPowerOfTwo(value) {
488
493
  return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2));
@@ -533,6 +538,7 @@ function denormalize(value, array) {
533
538
  case Uint16Array:
534
539
  return value / 65535;
535
540
  case Uint8Array:
541
+ case Uint8ClampedArray:
536
542
  return value / 255;
537
543
  case Int32Array:
538
544
  return Math.max(value / 2147483647, -1);
@@ -553,6 +559,7 @@ function normalize(value, array) {
553
559
  case Uint16Array:
554
560
  return Math.round(value * 65535);
555
561
  case Uint8Array:
562
+ case Uint8ClampedArray:
556
563
  return Math.round(value * 255);
557
564
  case Int32Array:
558
565
  return Math.round(value * 2147483647);
@@ -2390,8 +2397,8 @@ var Vector3 = class _Vector3 {
2390
2397
  return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld);
2391
2398
  }
2392
2399
  /**
2393
- * Transforms the direction of this vector by a matrix (the upper left 3 x 3
2394
- * subset of the given 4x4 matrix and then normalizes the result.
2400
+ * Transforms this vector by the upper left 3x3 sub-matrix of the given 4x4 matrix,
2401
+ * and normalizes the result.
2395
2402
  *
2396
2403
  * @param {Matrix4} m - The matrix.
2397
2404
  * @return {Vector3} A reference to this vector.
@@ -3643,14 +3650,14 @@ var ImageUtils = class {
3643
3650
  }
3644
3651
  };
3645
3652
  var _sourceId = 0;
3646
- var Source = class {
3653
+ var TextureSource = class {
3647
3654
  /**
3648
- * Constructs a new video texture.
3655
+ * Constructs a new texture source.
3649
3656
  *
3650
3657
  * @param {any} [data=null] - The data definition of a texture.
3651
3658
  */
3652
3659
  constructor(data = null) {
3653
- this.isSource = true;
3660
+ this.isTextureSource = true;
3654
3661
  Object.defineProperty(this, "id", { value: _sourceId++ });
3655
3662
  this.uuid = generateUUID();
3656
3663
  this.data = data;
@@ -3744,6 +3751,19 @@ function serializeImage(image) {
3744
3751
  }
3745
3752
  }
3746
3753
  }
3754
+ var Source = class extends TextureSource {
3755
+ /**
3756
+ * Constructs a new texture source.
3757
+ *
3758
+ * @param {any} [data=null] - The data definition of a texture.
3759
+ * @deprecated since r186. Use {@link TextureSource} instead.
3760
+ */
3761
+ constructor(data = null) {
3762
+ warnOnce('Source: "Source" has been renamed to "TextureSource". Please update your code to use "THREE.TextureSource" instead.');
3763
+ super(data);
3764
+ this.isSource = true;
3765
+ }
3766
+ };
3747
3767
  var _textureId = 0;
3748
3768
  var _tempVec3 = /* @__PURE__ */ new Vector3();
3749
3769
  var Texture = class _Texture extends EventDispatcher {
@@ -3767,7 +3787,7 @@ var Texture = class _Texture extends EventDispatcher {
3767
3787
  Object.defineProperty(this, "id", { value: _textureId++ });
3768
3788
  this.uuid = generateUUID();
3769
3789
  this.name = "";
3770
- this.source = new Source(image);
3790
+ this.source = new TextureSource(image);
3771
3791
  this.mipmaps = [];
3772
3792
  this.mapping = mapping;
3773
3793
  this.channel = 0;
@@ -4810,8 +4830,12 @@ var RenderTarget = class extends EventDispatcher {
4810
4830
  * @property {string} [colorSpace=NoColorSpace] - The texture's color space.
4811
4831
  * @property {boolean} [depthBuffer=true] - Whether to allocate a depth buffer or not.
4812
4832
  * @property {boolean} [stencilBuffer=false] - Whether to allocate a stencil buffer or not.
4813
- * @property {boolean} [resolveDepthBuffer=true] - Whether to resolve the depth buffer or not.
4814
- * @property {boolean} [resolveStencilBuffer=true] - Whether to resolve the stencil buffer or not.
4833
+ * @property {boolean} [resolveColorBuffer=true] - Whether to resolve the color buffer or not. Only relevant for multisampled render targets.
4834
+ * @property {boolean} [resolveDepthBuffer=true] - Whether to resolve the depth buffer or not. Only relevant for multisampled render targets.
4835
+ * @property {boolean} [resolveStencilBuffer=true] - Whether to resolve the stencil buffer or not. Only relevant for multisampled render targets.
4836
+ * @property {boolean} [storeMultisampledColorBuffer=true] - Whether to store the multisampled color buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass.
4837
+ * @property {boolean} [storeMultisampledDepthBuffer=true] - Whether to store the multisampled depth buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass.
4838
+ * @property {boolean} [storeMultisampledStencilBuffer=true] - Whether to store the multisampled stencil buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass.
4815
4839
  * @property {?Texture} [depthTexture=null] - Reference to a depth texture.
4816
4840
  * @property {number} [samples=0] - The MSAA samples count.
4817
4841
  * @property {number} [count=1] - Defines the number of color attachments . Must be at least `1`.
@@ -4834,8 +4858,12 @@ var RenderTarget = class extends EventDispatcher {
4834
4858
  minFilter: LinearFilter,
4835
4859
  depthBuffer: true,
4836
4860
  stencilBuffer: false,
4861
+ resolveColorBuffer: true,
4837
4862
  resolveDepthBuffer: true,
4838
4863
  resolveStencilBuffer: true,
4864
+ storeMultisampledColorBuffer: true,
4865
+ storeMultisampledDepthBuffer: true,
4866
+ storeMultisampledStencilBuffer: true,
4839
4867
  depthTexture: null,
4840
4868
  samples: 0,
4841
4869
  count: 1,
@@ -4862,8 +4890,12 @@ var RenderTarget = class extends EventDispatcher {
4862
4890
  this._setTextureOptions(options);
4863
4891
  this.depthBuffer = options.depthBuffer;
4864
4892
  this.stencilBuffer = options.stencilBuffer;
4893
+ this.resolveColorBuffer = options.resolveColorBuffer;
4865
4894
  this.resolveDepthBuffer = options.resolveDepthBuffer;
4866
4895
  this.resolveStencilBuffer = options.resolveStencilBuffer;
4896
+ this.storeMultisampledColorBuffer = options.storeMultisampledColorBuffer;
4897
+ this.storeMultisampledDepthBuffer = options.storeMultisampledDepthBuffer;
4898
+ this.storeMultisampledStencilBuffer = options.storeMultisampledStencilBuffer;
4867
4899
  this._depthTexture = null;
4868
4900
  this.depthTexture = options.depthTexture;
4869
4901
  this.samples = options.samples;
@@ -4907,8 +4939,8 @@ var RenderTarget = class extends EventDispatcher {
4907
4939
  this.textures[0] = value;
4908
4940
  }
4909
4941
  set depthTexture(current) {
4910
- if (this._depthTexture !== null) this._depthTexture.renderTarget = null;
4911
- if (current !== null) current.renderTarget = this;
4942
+ if (this._depthTexture !== null && this._depthTexture.renderTarget === this) this._depthTexture.renderTarget = null;
4943
+ if (current !== null && current.renderTarget === null) current.renderTarget = this;
4912
4944
  this._depthTexture = current;
4913
4945
  }
4914
4946
  /**
@@ -4976,13 +5008,25 @@ var RenderTarget = class extends EventDispatcher {
4976
5008
  this.textures[i].isRenderTargetTexture = true;
4977
5009
  this.textures[i].renderTarget = this;
4978
5010
  const image = Object.assign({}, source.textures[i].image);
4979
- this.textures[i].source = new Source(image);
5011
+ this.textures[i].source = new TextureSource(image);
4980
5012
  }
4981
5013
  this.depthBuffer = source.depthBuffer;
4982
5014
  this.stencilBuffer = source.stencilBuffer;
5015
+ this.resolveColorBuffer = source.resolveColorBuffer;
4983
5016
  this.resolveDepthBuffer = source.resolveDepthBuffer;
4984
5017
  this.resolveStencilBuffer = source.resolveStencilBuffer;
4985
- if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();
5018
+ this.storeMultisampledColorBuffer = source.storeMultisampledColorBuffer;
5019
+ this.storeMultisampledDepthBuffer = source.storeMultisampledDepthBuffer;
5020
+ this.storeMultisampledStencilBuffer = source.storeMultisampledStencilBuffer;
5021
+ if (source.depthTexture !== null) {
5022
+ if (source.depthTexture.renderTarget === source) {
5023
+ const depthTexture = source.depthTexture.clone();
5024
+ depthTexture.renderTarget = null;
5025
+ this.depthTexture = depthTexture;
5026
+ } else {
5027
+ this.depthTexture = source.depthTexture;
5028
+ }
5029
+ }
4986
5030
  this.samples = source.samples;
4987
5031
  this.multiview = source.multiview;
4988
5032
  this.useArrayDepthTexture = source.useArrayDepthTexture;
@@ -5032,6 +5076,17 @@ var DataArrayTexture = class extends Texture {
5032
5076
  this.unpackAlignment = 1;
5033
5077
  this.layerUpdates = /* @__PURE__ */ new Set();
5034
5078
  }
5079
+ /**
5080
+ * Copies the values of the given texture to this instance.
5081
+ *
5082
+ * @param {DataArrayTexture} source - The texture to copy.
5083
+ * @return {DataArrayTexture} A reference to this instance.
5084
+ */
5085
+ copy(source) {
5086
+ super.copy(source);
5087
+ this.wrapR = source.wrapR;
5088
+ return this;
5089
+ }
5035
5090
  /**
5036
5091
  * Describes that a specific layer of the texture needs to be updated.
5037
5092
  * Normally when {@link Texture#needsUpdate} is set to `true`, the
@@ -5089,6 +5144,17 @@ var Data3DTexture = class extends Texture {
5089
5144
  this.flipY = false;
5090
5145
  this.unpackAlignment = 1;
5091
5146
  }
5147
+ /**
5148
+ * Copies the values of the given texture to this instance.
5149
+ *
5150
+ * @param {Data3DTexture} source - The texture to copy.
5151
+ * @return {Data3DTexture} A reference to this instance.
5152
+ */
5153
+ copy(source) {
5154
+ super.copy(source);
5155
+ this.wrapR = source.wrapR;
5156
+ return this;
5157
+ }
5092
5158
  };
5093
5159
  var WebGL3DRenderTarget = class extends WebGLRenderTarget {
5094
5160
  /**
@@ -5303,7 +5369,7 @@ var Matrix4 = class _Matrix4 {
5303
5369
  return this;
5304
5370
  }
5305
5371
  /**
5306
- * Extracts the basis of this matrix into the three axis vectors provided.
5372
+ * Extracts the basis vectors of this matrix into the three vectors provided.
5307
5373
  *
5308
5374
  * @param {Vector3} xAxis - The basis's x axis.
5309
5375
  * @param {Vector3} yAxis - The basis's y axis.
@@ -5614,8 +5680,6 @@ var Matrix4 = class _Matrix4 {
5614
5680
  /**
5615
5681
  * Computes and returns the determinant of this matrix.
5616
5682
  *
5617
- * Based on the method outlined [here](http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html).
5618
- *
5619
5683
  * @return {number} The determinant.
5620
5684
  */
5621
5685
  determinant() {
@@ -5731,7 +5795,7 @@ var Matrix4 = class _Matrix4 {
5731
5795
  return this;
5732
5796
  }
5733
5797
  /**
5734
- * Multiplies the columns of this matrix by the given vector.
5798
+ * Scales each of the first three columns of this matrix by the corresponding component of the given vector.
5735
5799
  *
5736
5800
  * @param {Vector3} v - The scale vector.
5737
5801
  * @return {Matrix4} A reference to this matrix.
@@ -5906,9 +5970,6 @@ var Matrix4 = class _Matrix4 {
5906
5970
  * Sets this matrix as a rotational transformation around the given axis by
5907
5971
  * the given angle.
5908
5972
  *
5909
- * This is a somewhat controversial but mathematically sound alternative to
5910
- * rotating via Quaternions. See the discussion [here](https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199).
5911
- *
5912
5973
  * @param {Vector3} axis - The normalized rotation axis.
5913
5974
  * @param {number} angle - The rotation in radians.
5914
5975
  * @return {Matrix4} A reference to this matrix.
@@ -7196,6 +7257,17 @@ var Object3D = class _Object3D extends EventDispatcher {
7196
7257
  */
7197
7258
  raycast() {
7198
7259
  }
7260
+ /**
7261
+ * Abstract method to test whether this 3D object intersects the given frustum.
7262
+ * Renderable 3D objects such as {@link Mesh}, {@link Line} or {@link Points}
7263
+ * implement this method in order to use frustum culling.
7264
+ *
7265
+ * @abstract
7266
+ * @param {Frustum|FrustumArray} frustum - The frustum to test.
7267
+ * @return {boolean|undefined} Whether this 3D object intersects the given frustum or not.
7268
+ */
7269
+ intersectsFrustum() {
7270
+ }
7199
7271
  /**
7200
7272
  * Executes the callback on this 3D object and all descendants.
7201
7273
  *
@@ -7350,19 +7422,19 @@ var Object3D = class _Object3D extends EventDispatcher {
7350
7422
  const object = {};
7351
7423
  object.uuid = this.uuid;
7352
7424
  object.type = this.type;
7353
- if (this.name !== "") object.name = this.name;
7354
- if (this.castShadow === true) object.castShadow = true;
7355
- if (this.receiveShadow === true) object.receiveShadow = true;
7356
- if (this.visible === false) object.visible = false;
7357
- if (this.frustumCulled === false) object.frustumCulled = false;
7358
- if (this.renderOrder !== 0) object.renderOrder = this.renderOrder;
7359
- if (this.static !== false) object.static = this.static;
7425
+ object.name = this.name;
7426
+ object.castShadow = this.castShadow;
7427
+ object.receiveShadow = this.receiveShadow;
7428
+ object.visible = this.visible;
7429
+ object.frustumCulled = this.frustumCulled;
7430
+ object.renderOrder = this.renderOrder;
7431
+ object.static = this.static;
7432
+ object.matrixAutoUpdate = this.matrixAutoUpdate;
7360
7433
  if (Object.keys(this.userData).length > 0) object.userData = this.userData;
7361
7434
  object.layers = this.layers.mask;
7362
7435
  object.matrix = this.matrix.toArray();
7363
7436
  object.up = this.up.toArray();
7364
7437
  if (this.pivot !== null) object.pivot = this.pivot.toArray();
7365
- if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false;
7366
7438
  if (this.morphTargetDictionary !== void 0) object.morphTargetDictionary = Object.assign({}, this.morphTargetDictionary);
7367
7439
  if (this.morphTargetInfluences !== void 0) object.morphTargetInfluences = this.morphTargetInfluences.slice();
7368
7440
  if (this.isInstancedMesh) {
@@ -7544,6 +7616,18 @@ var Object3D = class _Object3D extends EventDispatcher {
7544
7616
  }
7545
7617
  return this;
7546
7618
  }
7619
+ /**
7620
+ * Frees the GPU-related resources allocated by this instance. Call this
7621
+ * method whenever this instance is no longer used in your app.
7622
+ *
7623
+ * Geometries, materials and textures are potentially shared with other
7624
+ * 3D objects and must be disposed of separately.
7625
+ *
7626
+ * @fires Object3D#dispose
7627
+ */
7628
+ dispose() {
7629
+ this.dispatchEvent({ type: "dispose" });
7630
+ }
7547
7631
  };
7548
7632
  Object3D.DEFAULT_UP = /* @__PURE__ */ new Vector3(0, 1, 0);
7549
7633
  Object3D.DEFAULT_MATRIX_AUTO_UPDATE = true;
@@ -8671,10 +8755,10 @@ var Scene = class extends Object3D {
8671
8755
  toJSON(meta) {
8672
8756
  const data = super.toJSON(meta);
8673
8757
  if (this.fog !== null) data.object.fog = this.fog.toJSON();
8674
- if (this.backgroundBlurriness > 0) data.object.backgroundBlurriness = this.backgroundBlurriness;
8675
- if (this.backgroundIntensity !== 1) data.object.backgroundIntensity = this.backgroundIntensity;
8758
+ data.object.backgroundBlurriness = this.backgroundBlurriness;
8759
+ data.object.backgroundIntensity = this.backgroundIntensity;
8676
8760
  data.object.backgroundRotation = this.backgroundRotation.toArray();
8677
- if (this.environmentIntensity !== 1) data.object.environmentIntensity = this.environmentIntensity;
8761
+ data.object.environmentIntensity = this.environmentIntensity;
8678
8762
  data.object.environmentRotation = this.environmentRotation.toArray();
8679
8763
  return data;
8680
8764
  }
@@ -10115,8 +10199,9 @@ var BufferAttribute = class extends EventDispatcher {
10115
10199
  array: Array.from(this.array),
10116
10200
  normalized: this.normalized
10117
10201
  };
10118
- if (this.name !== "") data.name = this.name;
10119
- if (this.usage !== StaticDrawUsage) data.usage = this.usage;
10202
+ data.name = this.name;
10203
+ data.usage = this.usage;
10204
+ data.gpuType = this.gpuType;
10120
10205
  return data;
10121
10206
  }
10122
10207
  /**
@@ -11237,7 +11322,7 @@ var BufferGeometry = class _BufferGeometry extends EventDispatcher {
11237
11322
  };
11238
11323
  data.uuid = this.uuid;
11239
11324
  data.type = this.parameters !== void 0 && this._transformed === true ? "BufferGeometry" : this.type;
11240
- if (this.name !== "") data.name = this.name;
11325
+ data.name = this.name;
11241
11326
  if (Object.keys(this.userData).length > 0) data.userData = this.userData;
11242
11327
  if (this.parameters !== void 0 && this._transformed !== true) {
11243
11328
  const parameters = this.parameters;
@@ -11508,12 +11593,14 @@ var InterleavedBuffer = class {
11508
11593
  if (data.arrayBuffers[this.array.buffer._uuid] === void 0) {
11509
11594
  data.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer));
11510
11595
  }
11511
- return {
11596
+ const json = {
11512
11597
  uuid: this.uuid,
11513
11598
  buffer: this.array.buffer._uuid,
11514
11599
  type: this.array.constructor.name,
11515
11600
  stride: this.stride
11516
11601
  };
11602
+ json.usage = this.usage;
11603
+ return json;
11517
11604
  }
11518
11605
  };
11519
11606
  var _vector$8 = /* @__PURE__ */ new Vector3();
@@ -11857,6 +11944,270 @@ var InterleavedBufferAttribute = class _InterleavedBufferAttribute {
11857
11944
  }
11858
11945
  }
11859
11946
  };
11947
+ var _vector1 = /* @__PURE__ */ new Vector3();
11948
+ var _vector2 = /* @__PURE__ */ new Vector3();
11949
+ var _normalMatrix = /* @__PURE__ */ new Matrix3();
11950
+ var Plane = class {
11951
+ /**
11952
+ * Constructs a new plane.
11953
+ *
11954
+ * @param {Vector3} [normal=(1,0,0)] - A unit length vector defining the normal of the plane.
11955
+ * @param {number} [constant=0] - The signed distance from the origin to the plane.
11956
+ */
11957
+ constructor(normal = new Vector3(1, 0, 0), constant = 0) {
11958
+ this.isPlane = true;
11959
+ this.normal = normal;
11960
+ this.constant = constant;
11961
+ }
11962
+ /**
11963
+ * Sets the plane components by copying the given values.
11964
+ *
11965
+ * @param {Vector3} normal - The normal.
11966
+ * @param {number} constant - The constant.
11967
+ * @return {Plane} A reference to this plane.
11968
+ */
11969
+ set(normal, constant) {
11970
+ this.normal.copy(normal);
11971
+ this.constant = constant;
11972
+ return this;
11973
+ }
11974
+ /**
11975
+ * Sets the plane components by defining `x`, `y`, `z` as the
11976
+ * plane normal and `w` as the constant.
11977
+ *
11978
+ * @param {number} x - The value for the normal's x component.
11979
+ * @param {number} y - The value for the normal's y component.
11980
+ * @param {number} z - The value for the normal's z component.
11981
+ * @param {number} w - The constant value.
11982
+ * @return {Plane} A reference to this plane.
11983
+ */
11984
+ setComponents(x, y, z, w) {
11985
+ this.normal.set(x, y, z);
11986
+ this.constant = w;
11987
+ return this;
11988
+ }
11989
+ /**
11990
+ * Sets the plane from the given normal and coplanar point (that is a point
11991
+ * that lies onto the plane).
11992
+ *
11993
+ * @param {Vector3} normal - The normal.
11994
+ * @param {Vector3} point - A coplanar point.
11995
+ * @return {Plane} A reference to this plane.
11996
+ */
11997
+ setFromNormalAndCoplanarPoint(normal, point) {
11998
+ this.normal.copy(normal);
11999
+ this.constant = -point.dot(this.normal);
12000
+ return this;
12001
+ }
12002
+ /**
12003
+ * Sets the plane from three coplanar points. The winding order is
12004
+ * assumed to be counter-clockwise, and determines the direction of
12005
+ * the plane normal.
12006
+ *
12007
+ * @param {Vector3} a - The first coplanar point.
12008
+ * @param {Vector3} b - The second coplanar point.
12009
+ * @param {Vector3} c - The third coplanar point.
12010
+ * @return {Plane} A reference to this plane.
12011
+ */
12012
+ setFromCoplanarPoints(a, b, c) {
12013
+ const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize();
12014
+ this.setFromNormalAndCoplanarPoint(normal, a);
12015
+ return this;
12016
+ }
12017
+ /**
12018
+ * Copies the values of the given plane to this instance.
12019
+ *
12020
+ * @param {Plane} plane - The plane to copy.
12021
+ * @return {Plane} A reference to this plane.
12022
+ */
12023
+ copy(plane) {
12024
+ this.normal.copy(plane.normal);
12025
+ this.constant = plane.constant;
12026
+ return this;
12027
+ }
12028
+ /**
12029
+ * Normalizes the plane normal and adjusts the constant accordingly.
12030
+ *
12031
+ * @return {Plane} A reference to this plane.
12032
+ */
12033
+ normalize() {
12034
+ const inverseNormalLength = 1 / this.normal.length();
12035
+ this.normal.multiplyScalar(inverseNormalLength);
12036
+ this.constant *= inverseNormalLength;
12037
+ return this;
12038
+ }
12039
+ /**
12040
+ * Negates both the plane normal and the constant.
12041
+ *
12042
+ * @return {Plane} A reference to this plane.
12043
+ */
12044
+ negate() {
12045
+ this.constant *= -1;
12046
+ this.normal.negate();
12047
+ return this;
12048
+ }
12049
+ /**
12050
+ * Returns the signed distance from the given point to this plane.
12051
+ *
12052
+ * @param {Vector3} point - The point to compute the distance for.
12053
+ * @return {number} The signed distance.
12054
+ */
12055
+ distanceToPoint(point) {
12056
+ return this.normal.dot(point) + this.constant;
12057
+ }
12058
+ /**
12059
+ * Returns the signed distance from the given sphere to this plane.
12060
+ *
12061
+ * @param {Sphere} sphere - The sphere to compute the distance for.
12062
+ * @return {number} The signed distance.
12063
+ */
12064
+ distanceToSphere(sphere) {
12065
+ return this.distanceToPoint(sphere.center) - sphere.radius;
12066
+ }
12067
+ /**
12068
+ * Projects a the given point onto the plane.
12069
+ *
12070
+ * @param {Vector3} point - The point to project.
12071
+ * @param {Vector3} target - The target vector that is used to store the method's result.
12072
+ * @return {Vector3} The projected point on the plane.
12073
+ */
12074
+ projectPoint(point, target) {
12075
+ return target.copy(point).addScaledVector(this.normal, -this.distanceToPoint(point));
12076
+ }
12077
+ /**
12078
+ * Returns the intersection point of the passed line and the plane. Returns
12079
+ * `null` if the line does not intersect. Returns the line's starting point if
12080
+ * the line is coplanar with the plane.
12081
+ *
12082
+ * @param {Line3} line - The line to compute the intersection for.
12083
+ * @param {Vector3} target - The target vector that is used to store the method's result.
12084
+ * @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
12085
+ * @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
12086
+ */
12087
+ intersectLine(line, target, clampToLine = true) {
12088
+ const direction = line.delta(_vector1);
12089
+ const denominator = this.normal.dot(direction);
12090
+ if (denominator === 0) {
12091
+ if (this.distanceToPoint(line.start) === 0) {
12092
+ return target.copy(line.start);
12093
+ }
12094
+ return null;
12095
+ }
12096
+ const t = -(line.start.dot(this.normal) + this.constant) / denominator;
12097
+ if (clampToLine === true && (t < 0 || t > 1)) {
12098
+ return null;
12099
+ }
12100
+ return target.copy(line.start).addScaledVector(direction, t);
12101
+ }
12102
+ /**
12103
+ * Returns `true` if the given line segment intersects with (passes through) the plane.
12104
+ *
12105
+ * @param {Line3} line - The line to test.
12106
+ * @return {boolean} Whether the given line segment intersects with the plane or not.
12107
+ */
12108
+ intersectsLine(line) {
12109
+ const startSign = this.distanceToPoint(line.start);
12110
+ const endSign = this.distanceToPoint(line.end);
12111
+ return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0;
12112
+ }
12113
+ /**
12114
+ * Returns `true` if the given bounding box intersects with the plane.
12115
+ *
12116
+ * @param {Box3} box - The bounding box to test.
12117
+ * @return {boolean} Whether the given bounding box intersects with the plane or not.
12118
+ */
12119
+ intersectsBox(box) {
12120
+ return box.intersectsPlane(this);
12121
+ }
12122
+ /**
12123
+ * Returns `true` if the given bounding sphere intersects with the plane.
12124
+ *
12125
+ * @param {Sphere} sphere - The bounding sphere to test.
12126
+ * @return {boolean} Whether the given bounding sphere intersects with the plane or not.
12127
+ */
12128
+ intersectsSphere(sphere) {
12129
+ return sphere.intersectsPlane(this);
12130
+ }
12131
+ /**
12132
+ * Returns a coplanar vector to the plane, by calculating the
12133
+ * projection of the normal at the origin onto the plane.
12134
+ *
12135
+ * @param {Vector3} target - The target vector that is used to store the method's result.
12136
+ * @return {Vector3} The coplanar point.
12137
+ */
12138
+ coplanarPoint(target) {
12139
+ return target.copy(this.normal).multiplyScalar(-this.constant);
12140
+ }
12141
+ /**
12142
+ * Apply a 4x4 matrix to the plane. The matrix must be an affine, homogeneous transform.
12143
+ *
12144
+ * The optional normal matrix can be pre-computed like so:
12145
+ * ```js
12146
+ * const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );
12147
+ * ```
12148
+ *
12149
+ * @param {Matrix4} matrix - The transformation matrix.
12150
+ * @param {Matrix4} [optionalNormalMatrix] - A pre-computed normal matrix.
12151
+ * @return {Plane} A reference to this plane.
12152
+ */
12153
+ applyMatrix4(matrix, optionalNormalMatrix) {
12154
+ const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix);
12155
+ const referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix);
12156
+ const normal = this.normal.applyMatrix3(normalMatrix).normalize();
12157
+ this.constant = -referencePoint.dot(normal);
12158
+ return this;
12159
+ }
12160
+ /**
12161
+ * Translates the plane by the distance defined by the given offset vector.
12162
+ * Note that this only affects the plane constant and will not affect the normal vector.
12163
+ *
12164
+ * @param {Vector3} offset - The offset vector.
12165
+ * @return {Plane} A reference to this plane.
12166
+ */
12167
+ translate(offset) {
12168
+ this.constant -= offset.dot(this.normal);
12169
+ return this;
12170
+ }
12171
+ /**
12172
+ * Returns `true` if this plane is equal with the given one.
12173
+ *
12174
+ * @param {Plane} plane - The plane to test for equality.
12175
+ * @return {boolean} Whether this plane is equal with the given one.
12176
+ */
12177
+ equals(plane) {
12178
+ return plane.normal.equals(this.normal) && plane.constant === this.constant;
12179
+ }
12180
+ /**
12181
+ * Returns a new plane with copied values from this instance.
12182
+ *
12183
+ * @return {Plane} A clone of this instance.
12184
+ */
12185
+ clone() {
12186
+ return new this.constructor().copy(this);
12187
+ }
12188
+ /**
12189
+ * Returns a serialized structure of the plane.
12190
+ *
12191
+ * @return {Object} Serialized structure with fields representing the object state.
12192
+ */
12193
+ toJSON() {
12194
+ return {
12195
+ normal: this.normal.toArray(),
12196
+ constant: this.constant
12197
+ };
12198
+ }
12199
+ /**
12200
+ * Sets the plane properties from the given JSON.
12201
+ *
12202
+ * @param {Object} json - The serialized json to set the plane from.
12203
+ * @return {Plane} A reference to this plane.
12204
+ */
12205
+ fromJSON(json) {
12206
+ this.normal.fromArray(json.normal);
12207
+ this.constant = json.constant;
12208
+ return this;
12209
+ }
12210
+ };
11860
12211
  var _materialId = 0;
11861
12212
  var Material = class extends EventDispatcher {
11862
12213
  /**
@@ -12024,7 +12375,47 @@ var Material = class extends EventDispatcher {
12024
12375
  };
12025
12376
  data.uuid = this.uuid;
12026
12377
  data.type = this.type;
12027
- if (this.name !== "") data.name = this.name;
12378
+ data.blending = this.blending;
12379
+ data.side = this.side;
12380
+ data.shadowSide = this.shadowSide;
12381
+ data.vertexColors = this.vertexColors;
12382
+ data.opacity = this.opacity;
12383
+ data.transparent = this.transparent;
12384
+ data.blendSrc = this.blendSrc;
12385
+ data.blendDst = this.blendDst;
12386
+ data.blendEquation = this.blendEquation;
12387
+ data.blendSrcAlpha = this.blendSrcAlpha;
12388
+ data.blendDstAlpha = this.blendDstAlpha;
12389
+ data.blendEquationAlpha = this.blendEquationAlpha;
12390
+ data.blendColor = this.blendColor.getHex();
12391
+ data.blendAlpha = this.blendAlpha;
12392
+ data.depthFunc = this.depthFunc;
12393
+ data.depthTest = this.depthTest;
12394
+ data.depthWrite = this.depthWrite;
12395
+ data.colorWrite = this.colorWrite;
12396
+ data.clipIntersection = this.clipIntersection;
12397
+ data.clipShadows = this.clipShadows;
12398
+ data.stencilWriteMask = this.stencilWriteMask;
12399
+ data.stencilFunc = this.stencilFunc;
12400
+ data.stencilRef = this.stencilRef;
12401
+ data.stencilFuncMask = this.stencilFuncMask;
12402
+ data.stencilFail = this.stencilFail;
12403
+ data.stencilZFail = this.stencilZFail;
12404
+ data.stencilZPass = this.stencilZPass;
12405
+ data.stencilWrite = this.stencilWrite;
12406
+ data.polygonOffset = this.polygonOffset;
12407
+ data.polygonOffsetFactor = this.polygonOffsetFactor;
12408
+ data.polygonOffsetUnits = this.polygonOffsetUnits;
12409
+ data.dithering = this.dithering;
12410
+ data.alphaTest = this.alphaTest;
12411
+ data.alphaHash = this.alphaHash;
12412
+ data.alphaToCoverage = this.alphaToCoverage;
12413
+ data.premultipliedAlpha = this.premultipliedAlpha;
12414
+ data.forceSinglePass = this.forceSinglePass;
12415
+ data.allowOverride = this.allowOverride;
12416
+ data.visible = this.visible;
12417
+ data.toneMapped = this.toneMapped;
12418
+ data.name = this.name;
12028
12419
  if (this.color && this.color.isColor) data.color = this.color.getHex();
12029
12420
  if (this.roughness !== void 0) data.roughness = this.roughness;
12030
12421
  if (this.metalness !== void 0) data.metalness = this.metalness;
@@ -12032,7 +12423,7 @@ var Material = class extends EventDispatcher {
12032
12423
  if (this.sheenColor && this.sheenColor.isColor) data.sheenColor = this.sheenColor.getHex();
12033
12424
  if (this.sheenRoughness !== void 0) data.sheenRoughness = this.sheenRoughness;
12034
12425
  if (this.emissive && this.emissive.isColor) data.emissive = this.emissive.getHex();
12035
- if (this.emissiveIntensity !== void 0 && this.emissiveIntensity !== 1) data.emissiveIntensity = this.emissiveIntensity;
12426
+ if (this.emissiveIntensity !== void 0) data.emissiveIntensity = this.emissiveIntensity;
12036
12427
  if (this.specular && this.specular.isColor) data.specular = this.specular.getHex();
12037
12428
  if (this.specularIntensity !== void 0) data.specularIntensity = this.specularIntensity;
12038
12429
  if (this.specularColor && this.specularColor.isColor) data.specularColor = this.specularColor.getHex();
@@ -12056,6 +12447,7 @@ var Material = class extends EventDispatcher {
12056
12447
  data.sheenRoughnessMap = this.sheenRoughnessMap.toJSON(meta).uuid;
12057
12448
  }
12058
12449
  if (this.dispersion !== void 0) data.dispersion = this.dispersion;
12450
+ if (this.retroreflectivity !== void 0) data.retroreflectivity = this.retroreflectivity;
12059
12451
  if (this.iridescence !== void 0) data.iridescence = this.iridescence;
12060
12452
  if (this.iridescenceIOR !== void 0) data.iridescenceIOR = this.iridescenceIOR;
12061
12453
  if (this.iridescenceThicknessRange !== void 0) data.iridescenceThicknessRange = this.iridescenceThicknessRange;
@@ -12116,59 +12508,27 @@ var Material = class extends EventDispatcher {
12116
12508
  if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;
12117
12509
  if (this.thickness !== void 0) data.thickness = this.thickness;
12118
12510
  if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;
12119
- if (this.attenuationDistance !== void 0 && this.attenuationDistance !== Infinity) data.attenuationDistance = this.attenuationDistance;
12511
+ if (this.attenuationDistance !== void 0) data.attenuationDistance = this.attenuationDistance;
12120
12512
  if (this.attenuationColor !== void 0) data.attenuationColor = this.attenuationColor.getHex();
12121
12513
  if (this.size !== void 0) data.size = this.size;
12122
- if (this.shadowSide !== null) data.shadowSide = this.shadowSide;
12123
12514
  if (this.sizeAttenuation !== void 0) data.sizeAttenuation = this.sizeAttenuation;
12124
- if (this.blending !== NormalBlending) data.blending = this.blending;
12125
- if (this.side !== FrontSide) data.side = this.side;
12126
- if (this.vertexColors === true) data.vertexColors = true;
12127
- if (this.opacity < 1) data.opacity = this.opacity;
12128
- if (this.transparent === true) data.transparent = true;
12129
- if (this.blendSrc !== SrcAlphaFactor) data.blendSrc = this.blendSrc;
12130
- if (this.blendDst !== OneMinusSrcAlphaFactor) data.blendDst = this.blendDst;
12131
- if (this.blendEquation !== AddEquation) data.blendEquation = this.blendEquation;
12132
- if (this.blendSrcAlpha !== null) data.blendSrcAlpha = this.blendSrcAlpha;
12133
- if (this.blendDstAlpha !== null) data.blendDstAlpha = this.blendDstAlpha;
12134
- if (this.blendEquationAlpha !== null) data.blendEquationAlpha = this.blendEquationAlpha;
12135
- if (this.blendColor && this.blendColor.isColor) data.blendColor = this.blendColor.getHex();
12136
- if (this.blendAlpha !== 0) data.blendAlpha = this.blendAlpha;
12137
- if (this.depthFunc !== LessEqualDepth) data.depthFunc = this.depthFunc;
12138
- if (this.depthTest === false) data.depthTest = this.depthTest;
12139
- if (this.depthWrite === false) data.depthWrite = this.depthWrite;
12140
- if (this.colorWrite === false) data.colorWrite = this.colorWrite;
12141
- if (this.stencilWriteMask !== 255) data.stencilWriteMask = this.stencilWriteMask;
12142
- if (this.stencilFunc !== AlwaysStencilFunc) data.stencilFunc = this.stencilFunc;
12143
- if (this.stencilRef !== 0) data.stencilRef = this.stencilRef;
12144
- if (this.stencilFuncMask !== 255) data.stencilFuncMask = this.stencilFuncMask;
12145
- if (this.stencilFail !== KeepStencilOp) data.stencilFail = this.stencilFail;
12146
- if (this.stencilZFail !== KeepStencilOp) data.stencilZFail = this.stencilZFail;
12147
- if (this.stencilZPass !== KeepStencilOp) data.stencilZPass = this.stencilZPass;
12148
- if (this.stencilWrite === true) data.stencilWrite = this.stencilWrite;
12149
- if (this.rotation !== void 0 && this.rotation !== 0) data.rotation = this.rotation;
12150
- if (this.polygonOffset === true) data.polygonOffset = true;
12151
- if (this.polygonOffsetFactor !== 0) data.polygonOffsetFactor = this.polygonOffsetFactor;
12152
- if (this.polygonOffsetUnits !== 0) data.polygonOffsetUnits = this.polygonOffsetUnits;
12153
- if (this.linewidth !== void 0 && this.linewidth !== 1) data.linewidth = this.linewidth;
12515
+ if (Array.isArray(this.clippingPlanes) && this.clippingPlanes.length > 0) {
12516
+ data.clippingPlanes = this.clippingPlanes.map((plane) => plane.toJSON());
12517
+ }
12518
+ if (this.rotation !== void 0) data.rotation = this.rotation;
12519
+ if (this.depthPacking !== void 0) data.depthPacking = this.depthPacking;
12520
+ if (this.linewidth !== void 0) data.linewidth = this.linewidth;
12521
+ if (this.linecap !== void 0) data.linecap = this.linecap;
12522
+ if (this.linejoin !== void 0) data.linejoin = this.linejoin;
12154
12523
  if (this.dashSize !== void 0) data.dashSize = this.dashSize;
12155
12524
  if (this.gapSize !== void 0) data.gapSize = this.gapSize;
12156
12525
  if (this.scale !== void 0) data.scale = this.scale;
12157
- if (this.dithering === true) data.dithering = true;
12158
- if (this.alphaTest > 0) data.alphaTest = this.alphaTest;
12159
- if (this.alphaHash === true) data.alphaHash = true;
12160
- if (this.alphaToCoverage === true) data.alphaToCoverage = true;
12161
- if (this.premultipliedAlpha === true) data.premultipliedAlpha = true;
12162
- if (this.forceSinglePass === true) data.forceSinglePass = true;
12163
- if (this.allowOverride === false) data.allowOverride = false;
12164
- if (this.wireframe === true) data.wireframe = true;
12165
- if (this.wireframeLinewidth > 1) data.wireframeLinewidth = this.wireframeLinewidth;
12166
- if (this.wireframeLinecap !== "round") data.wireframeLinecap = this.wireframeLinecap;
12167
- if (this.wireframeLinejoin !== "round") data.wireframeLinejoin = this.wireframeLinejoin;
12168
- if (this.flatShading === true) data.flatShading = true;
12169
- if (this.visible === false) data.visible = false;
12170
- if (this.toneMapped === false) data.toneMapped = false;
12171
- if (this.fog === false) data.fog = false;
12526
+ if (this.wireframe !== void 0) data.wireframe = this.wireframe;
12527
+ if (this.wireframeLinewidth !== void 0) data.wireframeLinewidth = this.wireframeLinewidth;
12528
+ if (this.wireframeLinecap !== void 0) data.wireframeLinecap = this.wireframeLinecap;
12529
+ if (this.wireframeLinejoin !== void 0) data.wireframeLinejoin = this.wireframeLinejoin;
12530
+ if (this.flatShading !== void 0) data.flatShading = this.flatShading;
12531
+ if (this.fog !== void 0) data.fog = this.fog;
12172
12532
  if (Object.keys(this.userData).length > 0) data.userData = this.userData;
12173
12533
  function extractFromCache(cache) {
12174
12534
  const values = [];
@@ -12211,6 +12571,7 @@ var Material = class extends EventDispatcher {
12211
12571
  if (json.clearcoat !== void 0) this.clearcoat = json.clearcoat;
12212
12572
  if (json.clearcoatRoughness !== void 0) this.clearcoatRoughness = json.clearcoatRoughness;
12213
12573
  if (json.dispersion !== void 0) this.dispersion = json.dispersion;
12574
+ if (json.retroreflectivity !== void 0) this.retroreflectivity = json.retroreflectivity;
12214
12575
  if (json.iridescence !== void 0) this.iridescence = json.iridescence;
12215
12576
  if (json.iridescenceIOR !== void 0) this.iridescenceIOR = json.iridescenceIOR;
12216
12577
  if (json.iridescenceThicknessRange !== void 0) this.iridescenceThicknessRange = json.iridescenceThicknessRange;
@@ -12234,6 +12595,10 @@ var Material = class extends EventDispatcher {
12234
12595
  if (json.depthTest !== void 0) this.depthTest = json.depthTest;
12235
12596
  if (json.depthWrite !== void 0) this.depthWrite = json.depthWrite;
12236
12597
  if (json.colorWrite !== void 0) this.colorWrite = json.colorWrite;
12598
+ if (json.clippingPlanes !== void 0) this.clippingPlanes = json.clippingPlanes.map((plane) => new Plane().fromJSON(plane));
12599
+ if (json.clipIntersection !== void 0) this.clipIntersection = json.clipIntersection;
12600
+ if (json.clipShadows !== void 0) this.clipShadows = json.clipShadows;
12601
+ if (json.depthPacking !== void 0) this.depthPacking = json.depthPacking;
12237
12602
  if (json.blendSrc !== void 0) this.blendSrc = json.blendSrc;
12238
12603
  if (json.blendDst !== void 0) this.blendDst = json.blendDst;
12239
12604
  if (json.blendEquation !== void 0) this.blendEquation = json.blendEquation;
@@ -12256,6 +12621,8 @@ var Material = class extends EventDispatcher {
12256
12621
  if (json.wireframeLinejoin !== void 0) this.wireframeLinejoin = json.wireframeLinejoin;
12257
12622
  if (json.rotation !== void 0) this.rotation = json.rotation;
12258
12623
  if (json.linewidth !== void 0) this.linewidth = json.linewidth;
12624
+ if (json.linecap !== void 0) this.linecap = json.linecap;
12625
+ if (json.linejoin !== void 0) this.linejoin = json.linejoin;
12259
12626
  if (json.dashSize !== void 0) this.dashSize = json.dashSize;
12260
12627
  if (json.gapSize !== void 0) this.gapSize = json.gapSize;
12261
12628
  if (json.scale !== void 0) this.scale = json.scale;
@@ -12508,6 +12875,15 @@ var Sprite = class extends Object3D {
12508
12875
  this.center = new Vector2(0.5, 0.5);
12509
12876
  this.count = 1;
12510
12877
  }
12878
+ /**
12879
+ * Returns `true` if this sprite intersects the given frustum.
12880
+ *
12881
+ * @param {Frustum|FrustumArray} frustum - The frustum to test.
12882
+ * @return {boolean} Whether this sprite intersects the given frustum or not.
12883
+ */
12884
+ intersectsFrustum(frustum) {
12885
+ return frustum.intersectsSprite(this);
12886
+ }
12511
12887
  /**
12512
12888
  * Computes intersection points between a casted ray and this sprite.
12513
12889
  *
@@ -12732,7 +13108,7 @@ var LOD = class extends Object3D {
12732
13108
  }
12733
13109
  toJSON(meta) {
12734
13110
  const data = super.toJSON(meta);
12735
- if (this.autoUpdate === false) data.object.autoUpdate = false;
13111
+ data.object.autoUpdate = this.autoUpdate;
12736
13112
  data.object.levels = [];
12737
13113
  const levels = this.levels;
12738
13114
  for (let i = 0, l = levels.length; i < l; i++) {
@@ -12750,9 +13126,6 @@ var _vector$7 = /* @__PURE__ */ new Vector3();
12750
13126
  var _segCenter = /* @__PURE__ */ new Vector3();
12751
13127
  var _segDir = /* @__PURE__ */ new Vector3();
12752
13128
  var _diff = /* @__PURE__ */ new Vector3();
12753
- var _edge1 = /* @__PURE__ */ new Vector3();
12754
- var _edge2 = /* @__PURE__ */ new Vector3();
12755
- var _normal$1 = /* @__PURE__ */ new Vector3();
12756
13129
  var Ray = class {
12757
13130
  /**
12758
13131
  * Constructs a new ray.
@@ -12933,6 +13306,7 @@ var Ray = class {
12933
13306
  * @return {?Vector3} The intersection point.
12934
13307
  */
12935
13308
  intersectSphere(sphere, target) {
13309
+ if (sphere.radius < 0) return null;
12936
13310
  _vector$7.subVectors(sphere.center, this.origin);
12937
13311
  const tca = _vector$7.dot(this.direction);
12938
13312
  const d2 = _vector$7.dot(_vector$7) - tca * tca;
@@ -13068,37 +13442,108 @@ var Ray = class {
13068
13442
  * @return {?Vector3} The intersection point.
13069
13443
  */
13070
13444
  intersectTriangle(a, b, c, backfaceCulling, target) {
13071
- _edge1.subVectors(b, a);
13072
- _edge2.subVectors(c, a);
13073
- _normal$1.crossVectors(_edge1, _edge2);
13074
- let DdN = this.direction.dot(_normal$1);
13075
- let sign2;
13076
- if (DdN > 0) {
13077
- if (backfaceCulling) return null;
13078
- sign2 = 1;
13079
- } else if (DdN < 0) {
13080
- sign2 = -1;
13081
- DdN = -DdN;
13445
+ const origin = this.origin;
13446
+ const direction = this.direction;
13447
+ const dx = direction.x;
13448
+ const dy = direction.y;
13449
+ const dz = direction.z;
13450
+ const aox = a.x - origin.x, aoy = a.y - origin.y, aoz = a.z - origin.z;
13451
+ const box = b.x - origin.x, boy = b.y - origin.y, boz = b.z - origin.z;
13452
+ const cox = c.x - origin.x, coy = c.y - origin.y, coz = c.z - origin.z;
13453
+ const adx = Math.abs(dx), ady = Math.abs(dy), adz = Math.abs(dz);
13454
+ let dkx, dky, dkz;
13455
+ let akx, aky, akz, bkx, bky, bkz, ckx, cky, ckz;
13456
+ if (adx >= ady && adx >= adz) {
13457
+ dkz = dx;
13458
+ akz = aox;
13459
+ bkz = box;
13460
+ ckz = cox;
13461
+ if (dx >= 0) {
13462
+ dkx = dy;
13463
+ dky = dz;
13464
+ akx = aoy;
13465
+ aky = aoz;
13466
+ bkx = boy;
13467
+ bky = boz;
13468
+ ckx = coy;
13469
+ cky = coz;
13470
+ } else {
13471
+ dkx = dz;
13472
+ dky = dy;
13473
+ akx = aoz;
13474
+ aky = aoy;
13475
+ bkx = boz;
13476
+ bky = boy;
13477
+ ckx = coz;
13478
+ cky = coy;
13479
+ }
13480
+ } else if (ady >= adz) {
13481
+ dkz = dy;
13482
+ akz = aoy;
13483
+ bkz = boy;
13484
+ ckz = coy;
13485
+ if (dy >= 0) {
13486
+ dkx = dz;
13487
+ dky = dx;
13488
+ akx = aoz;
13489
+ aky = aox;
13490
+ bkx = boz;
13491
+ bky = box;
13492
+ ckx = coz;
13493
+ cky = cox;
13494
+ } else {
13495
+ dkx = dx;
13496
+ dky = dz;
13497
+ akx = aox;
13498
+ aky = aoz;
13499
+ bkx = box;
13500
+ bky = boz;
13501
+ ckx = cox;
13502
+ cky = coz;
13503
+ }
13082
13504
  } else {
13083
- return null;
13084
- }
13085
- _diff.subVectors(this.origin, a);
13086
- const DdQxE2 = sign2 * this.direction.dot(_edge2.crossVectors(_diff, _edge2));
13087
- if (DdQxE2 < 0) {
13088
- return null;
13089
- }
13090
- const DdE1xQ = sign2 * this.direction.dot(_edge1.cross(_diff));
13091
- if (DdE1xQ < 0) {
13092
- return null;
13093
- }
13094
- if (DdQxE2 + DdE1xQ > DdN) {
13095
- return null;
13096
- }
13097
- const QdN = -sign2 * _diff.dot(_normal$1);
13098
- if (QdN < 0) {
13099
- return null;
13505
+ dkz = dz;
13506
+ akz = aoz;
13507
+ bkz = boz;
13508
+ ckz = coz;
13509
+ if (dz >= 0) {
13510
+ dkx = dx;
13511
+ dky = dy;
13512
+ akx = aox;
13513
+ aky = aoy;
13514
+ bkx = box;
13515
+ bky = boy;
13516
+ ckx = cox;
13517
+ cky = coy;
13518
+ } else {
13519
+ dkx = dy;
13520
+ dky = dx;
13521
+ akx = aoy;
13522
+ aky = aox;
13523
+ bkx = boy;
13524
+ bky = box;
13525
+ ckx = coy;
13526
+ cky = cox;
13527
+ }
13528
+ }
13529
+ if (dkz === 0) return null;
13530
+ const sx = dkx / dkz, sy = dky / dkz, sz = 1 / dkz;
13531
+ const ax = akx - sx * akz, ay = aky - sy * akz;
13532
+ const bx = bkx - sx * bkz, by = bky - sy * bkz;
13533
+ const cx = ckx - sx * ckz, cy = cky - sy * ckz;
13534
+ const u = cx * by - cy * bx;
13535
+ const v = ax * cy - ay * cx;
13536
+ const w = bx * ay - by * ax;
13537
+ if (backfaceCulling) {
13538
+ if (u < 0 || v < 0 || w < 0) return null;
13539
+ } else {
13540
+ if ((u < 0 || v < 0 || w < 0) && (u > 0 || v > 0 || w > 0)) return null;
13100
13541
  }
13101
- return this.at(QdN / DdN, target);
13542
+ const det = u + v + w;
13543
+ if (det === 0) return null;
13544
+ const tScaled = sz * (u * akz + v * bkz + w * ckz);
13545
+ if (det > 0 ? tScaled < 0 : tScaled > 0) return null;
13546
+ return this.at(tScaled / det, target);
13102
13547
  }
13103
13548
  /**
13104
13549
  * Transforms this ray with the given 4x4 transformation matrix.
@@ -13280,6 +13725,15 @@ var Mesh = class extends Object3D {
13280
13725
  }
13281
13726
  return target;
13282
13727
  }
13728
+ /**
13729
+ * Returns `true` if this mesh intersects the given frustum.
13730
+ *
13731
+ * @param {Frustum|FrustumArray} frustum - The frustum to test.
13732
+ * @return {boolean} Whether this mesh intersects the given frustum or not.
13733
+ */
13734
+ intersectsFrustum(frustum) {
13735
+ return frustum.intersectsObject(this);
13736
+ }
13283
13737
  /**
13284
13738
  * Computes intersection points between a casted ray and this line.
13285
13739
  *
@@ -14075,255 +14529,13 @@ var InstancedMesh = class extends Mesh {
14075
14529
  * method whenever this instance is no longer used in your app.
14076
14530
  */
14077
14531
  dispose() {
14078
- this.dispatchEvent({ type: "dispose" });
14532
+ super.dispose();
14079
14533
  if (this.morphTexture !== null) {
14080
14534
  this.morphTexture.dispose();
14081
14535
  this.morphTexture = null;
14082
14536
  }
14083
14537
  }
14084
14538
  };
14085
- var _vector1 = /* @__PURE__ */ new Vector3();
14086
- var _vector2 = /* @__PURE__ */ new Vector3();
14087
- var _normalMatrix = /* @__PURE__ */ new Matrix3();
14088
- var Plane = class {
14089
- /**
14090
- * Constructs a new plane.
14091
- *
14092
- * @param {Vector3} [normal=(1,0,0)] - A unit length vector defining the normal of the plane.
14093
- * @param {number} [constant=0] - The signed distance from the origin to the plane.
14094
- */
14095
- constructor(normal = new Vector3(1, 0, 0), constant = 0) {
14096
- this.isPlane = true;
14097
- this.normal = normal;
14098
- this.constant = constant;
14099
- }
14100
- /**
14101
- * Sets the plane components by copying the given values.
14102
- *
14103
- * @param {Vector3} normal - The normal.
14104
- * @param {number} constant - The constant.
14105
- * @return {Plane} A reference to this plane.
14106
- */
14107
- set(normal, constant) {
14108
- this.normal.copy(normal);
14109
- this.constant = constant;
14110
- return this;
14111
- }
14112
- /**
14113
- * Sets the plane components by defining `x`, `y`, `z` as the
14114
- * plane normal and `w` as the constant.
14115
- *
14116
- * @param {number} x - The value for the normal's x component.
14117
- * @param {number} y - The value for the normal's y component.
14118
- * @param {number} z - The value for the normal's z component.
14119
- * @param {number} w - The constant value.
14120
- * @return {Plane} A reference to this plane.
14121
- */
14122
- setComponents(x, y, z, w) {
14123
- this.normal.set(x, y, z);
14124
- this.constant = w;
14125
- return this;
14126
- }
14127
- /**
14128
- * Sets the plane from the given normal and coplanar point (that is a point
14129
- * that lies onto the plane).
14130
- *
14131
- * @param {Vector3} normal - The normal.
14132
- * @param {Vector3} point - A coplanar point.
14133
- * @return {Plane} A reference to this plane.
14134
- */
14135
- setFromNormalAndCoplanarPoint(normal, point) {
14136
- this.normal.copy(normal);
14137
- this.constant = -point.dot(this.normal);
14138
- return this;
14139
- }
14140
- /**
14141
- * Sets the plane from three coplanar points. The winding order is
14142
- * assumed to be counter-clockwise, and determines the direction of
14143
- * the plane normal.
14144
- *
14145
- * @param {Vector3} a - The first coplanar point.
14146
- * @param {Vector3} b - The second coplanar point.
14147
- * @param {Vector3} c - The third coplanar point.
14148
- * @return {Plane} A reference to this plane.
14149
- */
14150
- setFromCoplanarPoints(a, b, c) {
14151
- const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize();
14152
- this.setFromNormalAndCoplanarPoint(normal, a);
14153
- return this;
14154
- }
14155
- /**
14156
- * Copies the values of the given plane to this instance.
14157
- *
14158
- * @param {Plane} plane - The plane to copy.
14159
- * @return {Plane} A reference to this plane.
14160
- */
14161
- copy(plane) {
14162
- this.normal.copy(plane.normal);
14163
- this.constant = plane.constant;
14164
- return this;
14165
- }
14166
- /**
14167
- * Normalizes the plane normal and adjusts the constant accordingly.
14168
- *
14169
- * @return {Plane} A reference to this plane.
14170
- */
14171
- normalize() {
14172
- const inverseNormalLength = 1 / this.normal.length();
14173
- this.normal.multiplyScalar(inverseNormalLength);
14174
- this.constant *= inverseNormalLength;
14175
- return this;
14176
- }
14177
- /**
14178
- * Negates both the plane normal and the constant.
14179
- *
14180
- * @return {Plane} A reference to this plane.
14181
- */
14182
- negate() {
14183
- this.constant *= -1;
14184
- this.normal.negate();
14185
- return this;
14186
- }
14187
- /**
14188
- * Returns the signed distance from the given point to this plane.
14189
- *
14190
- * @param {Vector3} point - The point to compute the distance for.
14191
- * @return {number} The signed distance.
14192
- */
14193
- distanceToPoint(point) {
14194
- return this.normal.dot(point) + this.constant;
14195
- }
14196
- /**
14197
- * Returns the signed distance from the given sphere to this plane.
14198
- *
14199
- * @param {Sphere} sphere - The sphere to compute the distance for.
14200
- * @return {number} The signed distance.
14201
- */
14202
- distanceToSphere(sphere) {
14203
- return this.distanceToPoint(sphere.center) - sphere.radius;
14204
- }
14205
- /**
14206
- * Projects a the given point onto the plane.
14207
- *
14208
- * @param {Vector3} point - The point to project.
14209
- * @param {Vector3} target - The target vector that is used to store the method's result.
14210
- * @return {Vector3} The projected point on the plane.
14211
- */
14212
- projectPoint(point, target) {
14213
- return target.copy(point).addScaledVector(this.normal, -this.distanceToPoint(point));
14214
- }
14215
- /**
14216
- * Returns the intersection point of the passed line and the plane. Returns
14217
- * `null` if the line does not intersect. Returns the line's starting point if
14218
- * the line is coplanar with the plane.
14219
- *
14220
- * @param {Line3} line - The line to compute the intersection for.
14221
- * @param {Vector3} target - The target vector that is used to store the method's result.
14222
- * @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
14223
- * @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
14224
- */
14225
- intersectLine(line, target, clampToLine = true) {
14226
- const direction = line.delta(_vector1);
14227
- const denominator = this.normal.dot(direction);
14228
- if (denominator === 0) {
14229
- if (this.distanceToPoint(line.start) === 0) {
14230
- return target.copy(line.start);
14231
- }
14232
- return null;
14233
- }
14234
- const t = -(line.start.dot(this.normal) + this.constant) / denominator;
14235
- if (clampToLine === true && (t < 0 || t > 1)) {
14236
- return null;
14237
- }
14238
- return target.copy(line.start).addScaledVector(direction, t);
14239
- }
14240
- /**
14241
- * Returns `true` if the given line segment intersects with (passes through) the plane.
14242
- *
14243
- * @param {Line3} line - The line to test.
14244
- * @return {boolean} Whether the given line segment intersects with the plane or not.
14245
- */
14246
- intersectsLine(line) {
14247
- const startSign = this.distanceToPoint(line.start);
14248
- const endSign = this.distanceToPoint(line.end);
14249
- return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0;
14250
- }
14251
- /**
14252
- * Returns `true` if the given bounding box intersects with the plane.
14253
- *
14254
- * @param {Box3} box - The bounding box to test.
14255
- * @return {boolean} Whether the given bounding box intersects with the plane or not.
14256
- */
14257
- intersectsBox(box) {
14258
- return box.intersectsPlane(this);
14259
- }
14260
- /**
14261
- * Returns `true` if the given bounding sphere intersects with the plane.
14262
- *
14263
- * @param {Sphere} sphere - The bounding sphere to test.
14264
- * @return {boolean} Whether the given bounding sphere intersects with the plane or not.
14265
- */
14266
- intersectsSphere(sphere) {
14267
- return sphere.intersectsPlane(this);
14268
- }
14269
- /**
14270
- * Returns a coplanar vector to the plane, by calculating the
14271
- * projection of the normal at the origin onto the plane.
14272
- *
14273
- * @param {Vector3} target - The target vector that is used to store the method's result.
14274
- * @return {Vector3} The coplanar point.
14275
- */
14276
- coplanarPoint(target) {
14277
- return target.copy(this.normal).multiplyScalar(-this.constant);
14278
- }
14279
- /**
14280
- * Apply a 4x4 matrix to the plane. The matrix must be an affine, homogeneous transform.
14281
- *
14282
- * The optional normal matrix can be pre-computed like so:
14283
- * ```js
14284
- * const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );
14285
- * ```
14286
- *
14287
- * @param {Matrix4} matrix - The transformation matrix.
14288
- * @param {Matrix4} [optionalNormalMatrix] - A pre-computed normal matrix.
14289
- * @return {Plane} A reference to this plane.
14290
- */
14291
- applyMatrix4(matrix, optionalNormalMatrix) {
14292
- const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix);
14293
- const referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix);
14294
- const normal = this.normal.applyMatrix3(normalMatrix).normalize();
14295
- this.constant = -referencePoint.dot(normal);
14296
- return this;
14297
- }
14298
- /**
14299
- * Translates the plane by the distance defined by the given offset vector.
14300
- * Note that this only affects the plane constant and will not affect the normal vector.
14301
- *
14302
- * @param {Vector3} offset - The offset vector.
14303
- * @return {Plane} A reference to this plane.
14304
- */
14305
- translate(offset) {
14306
- this.constant -= offset.dot(this.normal);
14307
- return this;
14308
- }
14309
- /**
14310
- * Returns `true` if this plane is equal with the given one.
14311
- *
14312
- * @param {Plane} plane - The plane to test for equality.
14313
- * @return {boolean} Whether this plane is equal with the given one.
14314
- */
14315
- equals(plane) {
14316
- return plane.normal.equals(this.normal) && plane.constant === this.constant;
14317
- }
14318
- /**
14319
- * Returns a new plane with copied values from this instance.
14320
- *
14321
- * @return {Plane} A clone of this instance.
14322
- */
14323
- clone() {
14324
- return new this.constructor().copy(this);
14325
- }
14326
- };
14327
14539
  var _sphere$3 = /* @__PURE__ */ new Sphere();
14328
14540
  var _defaultSpriteCenter = /* @__PURE__ */ new Vector2(0.5, 0.5);
14329
14541
  var _vector$6 = /* @__PURE__ */ new Vector3();
@@ -14444,6 +14656,10 @@ var Frustum = class {
14444
14656
  /**
14445
14657
  * Returns `true` if the given bounding sphere is intersecting this frustum.
14446
14658
  *
14659
+ * This is a fast, conservative test that favors performance over precision. It can
14660
+ * report false positives for spheres that lie outside the frustum but are not separated
14661
+ * by a single frustum plane. It never reports false negatives, so it is safe for culling.
14662
+ *
14447
14663
  * @param {Sphere} sphere - The bounding sphere to test.
14448
14664
  * @return {boolean} Whether the bounding sphere is intersecting this frustum or not.
14449
14665
  */
@@ -14462,6 +14678,11 @@ var Frustum = class {
14462
14678
  /**
14463
14679
  * Returns `true` if the given bounding box is intersecting this frustum.
14464
14680
  *
14681
+ * This is a fast, conservative test that favors performance over precision. It can
14682
+ * report false positives for large boxes that lie outside the frustum but are not
14683
+ * separated by a single frustum plane. It never reports false negatives, so it is
14684
+ * safe for culling.
14685
+ *
14465
14686
  * @param {Box3} box - The bounding box to test.
14466
14687
  * @return {boolean} Whether the bounding box is intersecting this frustum or not.
14467
14688
  */
@@ -14609,7 +14830,7 @@ var FrustumArray = class _FrustumArray {
14609
14830
  /**
14610
14831
  * Copies the values of the given frustum array to this instance.
14611
14832
  *
14612
- * @param {FrustumArray} frustumArray - The frustum array to copy.
14833
+ * @param {FrustumArray} source - The frustum array to copy.
14613
14834
  * @return {FrustumArray} A reference to this frustum array.
14614
14835
  */
14615
14836
  copy(source) {
@@ -14740,6 +14961,7 @@ var BatchedMesh = class extends Mesh {
14740
14961
  this._multiDrawCounts = new Int32Array(maxInstanceCount);
14741
14962
  this._multiDrawStarts = new Int32Array(maxInstanceCount);
14742
14963
  this._multiDrawCount = 0;
14964
+ this._multiDrawBytesPerElement = 1;
14743
14965
  this._matricesTexture = null;
14744
14966
  this._indirectTexture = null;
14745
14967
  this._colorsTexture = null;
@@ -15331,6 +15553,7 @@ var BatchedMesh = class extends Mesh {
15331
15553
  this.validateInstanceId(instanceId);
15332
15554
  this.validateGeometryId(geometryId);
15333
15555
  this._instanceInfo[instanceId].geometryIndex = geometryId;
15556
+ this._visibilityChanged = true;
15334
15557
  return this;
15335
15558
  }
15336
15559
  /**
@@ -15507,6 +15730,7 @@ var BatchedMesh = class extends Mesh {
15507
15730
  this._geometryInitialized = source._geometryInitialized;
15508
15731
  this._multiDrawCounts = source._multiDrawCounts.slice();
15509
15732
  this._multiDrawStarts = source._multiDrawStarts.slice();
15733
+ this._multiDrawBytesPerElement = source._multiDrawBytesPerElement;
15510
15734
  this._indirectTexture = source._indirectTexture.clone();
15511
15735
  this._indirectTexture.image.data = this._indirectTexture.image.data.slice();
15512
15736
  this._matricesTexture = source._matricesTexture.clone();
@@ -15522,6 +15746,7 @@ var BatchedMesh = class extends Mesh {
15522
15746
  * method whenever this instance is no longer used in your app.
15523
15747
  */
15524
15748
  dispose() {
15749
+ super.dispose();
15525
15750
  this.geometry.dispose();
15526
15751
  this._matricesTexture.dispose();
15527
15752
  this._matricesTexture = null;
@@ -15621,6 +15846,7 @@ var BatchedMesh = class extends Mesh {
15621
15846
  }
15622
15847
  indirectTexture.needsUpdate = true;
15623
15848
  this._multiDrawCount = multiDrawCount;
15849
+ this._multiDrawBytesPerElement = bytesPerElement;
15624
15850
  this._visibilityChanged = false;
15625
15851
  }
15626
15852
  onBeforeShadow(renderer, object, camera, shadowCamera, geometry, depthMaterial) {
@@ -15714,6 +15940,15 @@ var Line = class extends Object3D {
15714
15940
  }
15715
15941
  return this;
15716
15942
  }
15943
+ /**
15944
+ * Returns `true` if this line intersects the given frustum.
15945
+ *
15946
+ * @param {Frustum|FrustumArray} frustum - The frustum to test.
15947
+ * @return {boolean} Whether this line intersects the given frustum or not.
15948
+ */
15949
+ intersectsFrustum(frustum) {
15950
+ return frustum.intersectsObject(this);
15951
+ }
15717
15952
  /**
15718
15953
  * Computes intersection points between a casted ray and this line.
15719
15954
  *
@@ -15922,6 +16157,15 @@ var Points = class extends Object3D {
15922
16157
  this.geometry = source.geometry;
15923
16158
  return this;
15924
16159
  }
16160
+ /**
16161
+ * Returns `true` if this point cloud intersects the given frustum.
16162
+ *
16163
+ * @param {Frustum|FrustumArray} frustum - The frustum to test.
16164
+ * @return {boolean} Whether this point cloud intersects the given frustum or not.
16165
+ */
16166
+ intersectsFrustum(frustum) {
16167
+ return frustum.intersectsObject(this);
16168
+ }
15925
16169
  /**
15926
16170
  * Computes intersection points between a casted ray and this point cloud.
15927
16171
  *
@@ -16155,6 +16399,17 @@ var CompressedArrayTexture = class extends CompressedTexture {
16155
16399
  this.wrapR = ClampToEdgeWrapping;
16156
16400
  this.layerUpdates = /* @__PURE__ */ new Set();
16157
16401
  }
16402
+ /**
16403
+ * Copies the values of the given texture to this instance.
16404
+ *
16405
+ * @param {CompressedArrayTexture} source - The texture to copy.
16406
+ * @return {CompressedArrayTexture} A reference to this instance.
16407
+ */
16408
+ copy(source) {
16409
+ super.copy(source);
16410
+ this.wrapR = source.wrapR;
16411
+ return this;
16412
+ }
16158
16413
  /**
16159
16414
  * Describes that a specific layer of the texture needs to be updated.
16160
16415
  * Normally when {@link Texture#needsUpdate} is set to `true`, the
@@ -16305,13 +16560,13 @@ var DepthTexture = class extends Texture {
16305
16560
  }
16306
16561
  copy(source) {
16307
16562
  super.copy(source);
16308
- this.source = new Source(Object.assign({}, source.image));
16563
+ this.source = new TextureSource(Object.assign({}, source.image));
16309
16564
  this.compareFunction = source.compareFunction;
16310
16565
  return this;
16311
16566
  }
16312
16567
  toJSON(meta) {
16313
16568
  const data = super.toJSON(meta);
16314
- if (this.compareFunction !== null) data.compareFunction = this.compareFunction;
16569
+ data.compareFunction = this.compareFunction;
16315
16570
  return data;
16316
16571
  }
16317
16572
  };
@@ -20488,7 +20743,7 @@ var TorusGeometry = class _TorusGeometry extends BufferGeometry {
20488
20743
  * @return {TorusGeometry} A new instance.
20489
20744
  */
20490
20745
  static fromJSON(data) {
20491
- return new _TorusGeometry(data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc);
20746
+ return new _TorusGeometry(data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc, data.thetaStart, data.thetaLength);
20492
20747
  }
20493
20748
  };
20494
20749
  var TorusKnotGeometry = class _TorusKnotGeometry extends BufferGeometry {
@@ -21225,6 +21480,7 @@ var MeshPhysicalMaterial = class extends MeshStandardMaterial {
21225
21480
  this._clearcoat = 0;
21226
21481
  this._dispersion = 0;
21227
21482
  this._iridescence = 0;
21483
+ this._retroreflectivity = 0;
21228
21484
  this._sheen = 0;
21229
21485
  this._transmission = 0;
21230
21486
  this.setValues(parameters);
@@ -21294,6 +21550,24 @@ var MeshPhysicalMaterial = class extends MeshStandardMaterial {
21294
21550
  }
21295
21551
  this._dispersion = value;
21296
21552
  }
21553
+ /**
21554
+ * The strength of retroreflection, from `0.0` to `1.0`. A value of `1.0`
21555
+ * evaluates the material's microfacet reflection with the view direction
21556
+ * reflected about the surface normal, redirecting the specular lobe back
21557
+ * toward the light source.
21558
+ *
21559
+ * @type {number}
21560
+ * @default 0
21561
+ */
21562
+ get retroreflectivity() {
21563
+ return this._retroreflectivity;
21564
+ }
21565
+ set retroreflectivity(value) {
21566
+ if (this._retroreflectivity > 0 !== value > 0) {
21567
+ this.version++;
21568
+ }
21569
+ this._retroreflectivity = value;
21570
+ }
21297
21571
  /**
21298
21572
  * The intensity of the sheen layer, from `0.0` to `1.0`.
21299
21573
  *
@@ -21352,6 +21626,7 @@ var MeshPhysicalMaterial = class extends MeshStandardMaterial {
21352
21626
  this.iridescenceIOR = source.iridescenceIOR;
21353
21627
  this.iridescenceThicknessRange = [...source.iridescenceThicknessRange];
21354
21628
  this.iridescenceThicknessMap = source.iridescenceThicknessMap;
21629
+ this.retroreflectivity = source.retroreflectivity;
21355
21630
  this.sheen = source.sheen;
21356
21631
  this.sheenColor.copy(source.sheenColor);
21357
21632
  this.sheenColorMap = source.sheenColorMap;
@@ -21810,6 +22085,9 @@ function convertArray(array, type) {
21810
22085
  }
21811
22086
  return Array.prototype.slice.call(array);
21812
22087
  }
22088
+ function hasTangents(settings) {
22089
+ return settings !== void 0 && settings.inTangents !== void 0 && settings.outTangents !== void 0;
22090
+ }
21813
22091
  function getKeyframeOrder(times) {
21814
22092
  function compareTime(i, j) {
21815
22093
  return times[i] - times[j];
@@ -21991,6 +22269,16 @@ var AnimationUtils = class {
21991
22269
  static isTypedArray(object) {
21992
22270
  return isTypedArray(object);
21993
22271
  }
22272
+ /**
22273
+ * Returns `true` if the given keyframe track settings hold Bezier tangent data.
22274
+ *
22275
+ * @static
22276
+ * @param {?Object} settings - The settings of a keyframe track.
22277
+ * @return {boolean} Whether both tangent arrays are defined or not.
22278
+ */
22279
+ static hasTangents(settings) {
22280
+ return hasTangents(settings);
22281
+ }
21994
22282
  /**
21995
22283
  * Returns an array by which times and values can be sorted.
21996
22284
  *
@@ -22330,27 +22618,31 @@ var BezierInterpolant = class extends Interpolant {
22330
22618
  const inTangentOffset = i1 * tangentStride + i * 2;
22331
22619
  const c1x = inTangents[inTangentOffset];
22332
22620
  const c1y = inTangents[inTangentOffset + 1];
22333
- let s = (t - t0) / (t1 - t0);
22334
- let s2, s3, oneMinusS, oneMinusS2, oneMinusS3;
22335
- for (let iter = 0; iter < 8; iter++) {
22336
- s2 = s * s;
22337
- s3 = s2 * s;
22338
- oneMinusS = 1 - s;
22339
- oneMinusS2 = oneMinusS * oneMinusS;
22340
- oneMinusS3 = oneMinusS2 * oneMinusS;
22341
- const bx = oneMinusS3 * t0 + 3 * oneMinusS2 * s * c0x + 3 * oneMinusS * s2 * c1x + s3 * t1;
22342
- const error2 = bx - t;
22343
- if (Math.abs(error2) < 1e-10) break;
22344
- const dbx = 3 * oneMinusS2 * (c0x - t0) + 6 * oneMinusS * s * (c1x - c0x) + 3 * s2 * (t1 - c1x);
22345
- if (Math.abs(dbx) < 1e-10) break;
22346
- s = s - error2 / dbx;
22347
- s = Math.max(0, Math.min(1, s));
22348
- }
22349
- result[i] = oneMinusS3 * v0 + 3 * oneMinusS2 * s * c0y + 3 * oneMinusS * s2 * c1y + s3 * v1;
22621
+ const s = solveBezierParameter(t, t0, c0x, c1x, t1);
22622
+ result[i] = cubicBezier(s, v0, c0y, c1y, v1);
22350
22623
  }
22351
22624
  return result;
22352
22625
  }
22353
22626
  };
22627
+ function cubicBezier(s, p0, p1, p2, p3) {
22628
+ const k = 1 - s;
22629
+ return k * k * k * p0 + 3 * k * k * s * p1 + 3 * k * s * s * p2 + s * s * s * p3;
22630
+ }
22631
+ function cubicBezierSlope(s, p0, p1, p2, p3) {
22632
+ const k = 1 - s;
22633
+ return 3 * k * k * (p1 - p0) + 6 * k * s * (p2 - p1) + 3 * s * s * (p3 - p2);
22634
+ }
22635
+ function solveBezierParameter(x, x0, x1, x2, x3) {
22636
+ let s = (x - x0) / (x3 - x0);
22637
+ for (let i = 0; i < 8; i++) {
22638
+ const error2 = cubicBezier(s, x0, x1, x2, x3) - x;
22639
+ if (Math.abs(error2) < 1e-10) break;
22640
+ const slope = cubicBezierSlope(s, x0, x1, x2, x3);
22641
+ if (Math.abs(slope) < 1e-10) break;
22642
+ s = Math.max(0, Math.min(1, s - error2 / slope));
22643
+ }
22644
+ return s;
22645
+ }
22354
22646
  var KeyframeTrack = class {
22355
22647
  /**
22356
22648
  * Constructs a new keyframe track.
@@ -22390,6 +22682,12 @@ var KeyframeTrack = class {
22390
22682
  if (interpolation !== track.DefaultInterpolation) {
22391
22683
  json.interpolation = interpolation;
22392
22684
  }
22685
+ if (hasTangents(track.settings)) {
22686
+ json.settings = {
22687
+ inTangents: convertArray(track.settings.inTangents, Array),
22688
+ outTangents: convertArray(track.settings.outTangents, Array)
22689
+ };
22690
+ }
22393
22691
  }
22394
22692
  json.type = track.ValueTypeName;
22395
22693
  return json;
@@ -22533,6 +22831,10 @@ var KeyframeTrack = class {
22533
22831
  for (let i = 0, n = times.length; i !== n; ++i) {
22534
22832
  times[i] *= timeScale;
22535
22833
  }
22834
+ if (hasTangents(this.settings)) {
22835
+ scaleTangentTimes(this.settings.inTangents, timeScale);
22836
+ scaleTangentTimes(this.settings.outTangents, timeScale);
22837
+ }
22536
22838
  }
22537
22839
  return this;
22538
22840
  }
@@ -22679,9 +22981,20 @@ var KeyframeTrack = class {
22679
22981
  const TypedKeyframeTrack = this.constructor;
22680
22982
  const track = new TypedKeyframeTrack(this.name, times, values);
22681
22983
  track.createInterpolant = this.createInterpolant;
22984
+ if (hasTangents(this.settings)) {
22985
+ track.settings = {
22986
+ inTangents: this.settings.inTangents.slice(),
22987
+ outTangents: this.settings.outTangents.slice()
22988
+ };
22989
+ }
22682
22990
  return track;
22683
22991
  }
22684
22992
  };
22993
+ function scaleTangentTimes(tangents, timeScale) {
22994
+ for (let i = 0, n = tangents.length; i !== n; i += 2) {
22995
+ tangents[i] *= timeScale;
22996
+ }
22997
+ }
22685
22998
  KeyframeTrack.prototype.ValueTypeName = "";
22686
22999
  KeyframeTrack.prototype.TimeBufferType = Float32Array;
22687
23000
  KeyframeTrack.prototype.ValueBufferType = Float32Array;
@@ -23089,11 +23402,19 @@ function parseKeyframeTrack(json) {
23089
23402
  json.times = times;
23090
23403
  json.values = values;
23091
23404
  }
23405
+ let track;
23092
23406
  if (trackType.parse !== void 0) {
23093
- return trackType.parse(json);
23407
+ track = trackType.parse(json);
23094
23408
  } else {
23095
- return new trackType(json.name, json.times, json.values, json.interpolation);
23409
+ track = new trackType(json.name, json.times, json.values, json.interpolation);
23410
+ }
23411
+ if (hasTangents(json.settings)) {
23412
+ track.settings = {
23413
+ inTangents: convertArray(json.settings.inTangents, Float32Array),
23414
+ outTangents: convertArray(json.settings.outTangents, Float32Array)
23415
+ };
23096
23416
  }
23417
+ return track;
23097
23418
  }
23098
23419
  var Cache = {
23099
23420
  /**
@@ -23983,13 +24304,6 @@ var Light = class extends Object3D {
23983
24304
  this.color = new Color(color);
23984
24305
  this.intensity = intensity;
23985
24306
  }
23986
- /**
23987
- * Frees the GPU-related resources allocated by this instance. Call this
23988
- * method whenever this instance is no longer used in your app.
23989
- */
23990
- dispose() {
23991
- this.dispatchEvent({ type: "dispose" });
23992
- }
23993
24307
  copy(source, recursive) {
23994
24308
  super.copy(source, recursive);
23995
24309
  this.color.copy(source.color);
@@ -24070,6 +24384,15 @@ var LightShadow = class {
24070
24384
  getViewportCount() {
24071
24385
  return this._viewportCount;
24072
24386
  }
24387
+ /**
24388
+ * Used internally by the renderer to get the camera that renders the given viewport.
24389
+ *
24390
+ * @param {number} [viewportIndex=0] - The viewport index.
24391
+ * @return {Camera} The shadow camera.
24392
+ */
24393
+ getCamera() {
24394
+ return this.camera;
24395
+ }
24073
24396
  /**
24074
24397
  * Gets the shadow cameras frustum. Used internally by the renderer to cull objects.
24075
24398
  *
@@ -24085,24 +24408,40 @@ var LightShadow = class {
24085
24408
  */
24086
24409
  updateMatrices(light) {
24087
24410
  const shadowCamera = this.camera;
24088
- const shadowMatrix = this.matrix;
24089
24411
  _lightPositionWorld.setFromMatrixPosition(light.matrixWorld);
24090
24412
  shadowCamera.position.copy(_lightPositionWorld);
24091
24413
  _lookTarget.setFromMatrixPosition(light.target.matrixWorld);
24092
24414
  shadowCamera.lookAt(_lookTarget);
24093
24415
  shadowCamera.updateMatrixWorld();
24416
+ this._updateMatrix(shadowCamera, this.matrix, this._frustum);
24417
+ }
24418
+ /**
24419
+ * Updates a shadow projection matrix and its corresponding frustum.
24420
+ *
24421
+ * @private
24422
+ * @param {Camera} shadowCamera - The shadow camera.
24423
+ * @param {Matrix4} shadowMatrix - The target shadow matrix.
24424
+ * @param {Frustum} frustum - The target frustum.
24425
+ * @param {Vector4} [viewport] - The viewport within the shadow atlas.
24426
+ */
24427
+ _updateMatrix(shadowCamera, shadowMatrix, frustum, viewport) {
24094
24428
  _projScreenMatrix.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse);
24095
- this._frustum.setFromProjectionMatrix(_projScreenMatrix, shadowCamera.coordinateSystem, shadowCamera.reversedDepth);
24429
+ frustum.setFromProjectionMatrix(_projScreenMatrix, shadowCamera.coordinateSystem, shadowCamera.reversedDepth);
24430
+ const frameExtents = this._frameExtents;
24431
+ const scaleX = viewport ? viewport.z / frameExtents.x : 1;
24432
+ const scaleY = viewport ? viewport.w / frameExtents.y : 1;
24433
+ const offsetX = viewport ? viewport.x / frameExtents.x : 0;
24434
+ const offsetY = viewport ? viewport.y / frameExtents.y : 0;
24096
24435
  if (shadowCamera.coordinateSystem === WebGPUCoordinateSystem || shadowCamera.reversedDepth) {
24097
24436
  shadowMatrix.set(
24098
- 0.5,
24437
+ 0.5 * scaleX,
24099
24438
  0,
24100
24439
  0,
24101
- 0.5,
24440
+ 0.5 * scaleX + offsetX,
24102
24441
  0,
24103
- 0.5,
24442
+ 0.5 * scaleY,
24104
24443
  0,
24105
- 0.5,
24444
+ 0.5 * scaleY + offsetY,
24106
24445
  0,
24107
24446
  0,
24108
24447
  1,
@@ -24115,14 +24454,14 @@ var LightShadow = class {
24115
24454
  );
24116
24455
  } else {
24117
24456
  shadowMatrix.set(
24118
- 0.5,
24457
+ 0.5 * scaleX,
24119
24458
  0,
24120
24459
  0,
24121
- 0.5,
24460
+ 0.5 * scaleX + offsetX,
24122
24461
  0,
24123
- 0.5,
24462
+ 0.5 * scaleY,
24124
24463
  0,
24125
- 0.5,
24464
+ 0.5 * scaleY + offsetY,
24126
24465
  0,
24127
24466
  0,
24128
24467
  0.5,
@@ -24199,11 +24538,12 @@ var LightShadow = class {
24199
24538
  */
24200
24539
  toJSON() {
24201
24540
  const object = {};
24202
- if (this.intensity !== 1) object.intensity = this.intensity;
24203
- if (this.bias !== 0) object.bias = this.bias;
24204
- if (this.normalBias !== 0) object.normalBias = this.normalBias;
24205
- if (this.radius !== 1) object.radius = this.radius;
24206
- if (this.mapSize.x !== 512 || this.mapSize.y !== 512) object.mapSize = this.mapSize.toArray();
24541
+ object.intensity = this.intensity;
24542
+ object.bias = this.bias;
24543
+ object.normalBias = this.normalBias;
24544
+ object.radius = this.radius;
24545
+ object.blurSamples = this.blurSamples;
24546
+ object.mapSize = this.mapSize.toArray();
24207
24547
  object.camera = this.camera.toJSON(false).object;
24208
24548
  delete object.camera.matrix;
24209
24549
  return object;
@@ -24530,8 +24870,21 @@ var SpotLightShadow = class extends LightShadow {
24530
24870
  copy(source) {
24531
24871
  super.copy(source);
24532
24872
  this.focus = source.focus;
24873
+ this.aspect = source.aspect;
24533
24874
  return this;
24534
24875
  }
24876
+ /**
24877
+ * Serializes the light shadow into JSON.
24878
+ *
24879
+ * @return {Object} A JSON object representing the serialized light shadow.
24880
+ * @see {@link ObjectLoader#parse}
24881
+ */
24882
+ toJSON() {
24883
+ const object = super.toJSON();
24884
+ object.focus = this.focus;
24885
+ object.aspect = this.aspect;
24886
+ return object;
24887
+ }
24535
24888
  };
24536
24889
  var SpotLight = class extends Light {
24537
24890
  /**
@@ -25325,6 +25678,7 @@ var BufferGeometryLoader = class extends Loader {
25325
25678
  const array = getTypedArray(interleavedBuffer.type, buffer);
25326
25679
  const ib = new InterleavedBuffer(array, interleavedBuffer.stride);
25327
25680
  ib.uuid = interleavedBuffer.uuid;
25681
+ if (interleavedBuffer.usage !== void 0) ib.setUsage(interleavedBuffer.usage);
25328
25682
  interleavedBufferMap[uuid] = ib;
25329
25683
  return ib;
25330
25684
  }
@@ -25356,6 +25710,7 @@ var BufferGeometryLoader = class extends Loader {
25356
25710
  }
25357
25711
  if (attribute.name !== void 0) bufferAttribute.name = attribute.name;
25358
25712
  if (attribute.usage !== void 0) bufferAttribute.setUsage(attribute.usage);
25713
+ if (attribute.gpuType !== void 0) bufferAttribute.gpuType = attribute.gpuType;
25359
25714
  geometry.setAttribute(key, bufferAttribute);
25360
25715
  }
25361
25716
  const morphAttributes = json.data.morphAttributes;
@@ -25374,6 +25729,8 @@ var BufferGeometryLoader = class extends Loader {
25374
25729
  bufferAttribute = new BufferAttribute(typedArray, attribute.itemSize, attribute.normalized);
25375
25730
  }
25376
25731
  if (attribute.name !== void 0) bufferAttribute.name = attribute.name;
25732
+ if (attribute.usage !== void 0) bufferAttribute.setUsage(attribute.usage);
25733
+ if (attribute.gpuType !== void 0) bufferAttribute.gpuType = attribute.gpuType;
25377
25734
  array.push(bufferAttribute);
25378
25735
  }
25379
25736
  geometry.morphAttributes[key] = array;
@@ -25667,10 +26024,10 @@ var ObjectLoader = class extends Loader {
25667
26024
  }
25668
26025
  }
25669
26026
  }
25670
- images[image.uuid] = new Source(imageArray);
26027
+ images[image.uuid] = new TextureSource(imageArray);
25671
26028
  } else {
25672
26029
  const deserializedImage = deserializeImage(image.url);
25673
- images[image.uuid] = new Source(deserializedImage);
26030
+ images[image.uuid] = new TextureSource(deserializedImage);
25674
26031
  }
25675
26032
  }
25676
26033
  }
@@ -25716,10 +26073,10 @@ var ObjectLoader = class extends Loader {
25716
26073
  }
25717
26074
  }
25718
26075
  }
25719
- images[image.uuid] = new Source(imageArray);
26076
+ images[image.uuid] = new TextureSource(imageArray);
25720
26077
  } else {
25721
26078
  const deserializedImage = await deserializeImage(image.url);
25722
- images[image.uuid] = new Source(deserializedImage);
26079
+ images[image.uuid] = new TextureSource(deserializedImage);
25723
26080
  }
25724
26081
  }
25725
26082
  }
@@ -26006,6 +26363,9 @@ var ObjectLoader = class extends Loader {
26006
26363
  if (data.shadow.bias !== void 0) object.shadow.bias = data.shadow.bias;
26007
26364
  if (data.shadow.normalBias !== void 0) object.shadow.normalBias = data.shadow.normalBias;
26008
26365
  if (data.shadow.radius !== void 0) object.shadow.radius = data.shadow.radius;
26366
+ if (data.shadow.blurSamples !== void 0) object.shadow.blurSamples = data.shadow.blurSamples;
26367
+ if (data.shadow.focus !== void 0) object.shadow.focus = data.shadow.focus;
26368
+ if (data.shadow.aspect !== void 0) object.shadow.aspect = data.shadow.aspect;
26009
26369
  if (data.shadow.mapSize !== void 0) object.shadow.mapSize.fromArray(data.shadow.mapSize);
26010
26370
  if (data.shadow.camera !== void 0) object.shadow.camera = this.parseObject(data.shadow.camera);
26011
26371
  }
@@ -26164,11 +26524,12 @@ var ImageBitmapLoader = class extends Loader {
26164
26524
  const promise = fetch(url, fetchOptions).then(function(res) {
26165
26525
  return res.blob();
26166
26526
  }).then(function(blob) {
26167
- return createImageBitmap(blob, Object.assign(scope.options, { colorSpaceConversion: "none" }));
26527
+ return createImageBitmap(blob, Object.assign({}, scope.options, { colorSpaceConversion: "none" }));
26168
26528
  }).then(function(imageBitmap) {
26169
26529
  Cache.add(`image-bitmap:${url}`, imageBitmap);
26170
26530
  if (onLoad) onLoad(imageBitmap);
26171
26531
  scope.manager.itemEnd(url);
26532
+ return imageBitmap;
26172
26533
  }).catch(function(e) {
26173
26534
  if (onError) onError(e);
26174
26535
  _errorMap.set(promise, e);
@@ -28008,9 +28369,13 @@ var AnimationObjectGroup = class {
28008
28369
  delete indicesByUUID[uuid];
28009
28370
  if (index < nCachedObjects) {
28010
28371
  const firstActiveIndex = --nCachedObjects, lastCachedObject = objects[firstActiveIndex], lastIndex = --nObjects, lastObject = objects[lastIndex];
28011
- indicesByUUID[lastCachedObject.uuid] = index;
28372
+ if (index !== firstActiveIndex) {
28373
+ indicesByUUID[lastCachedObject.uuid] = index;
28374
+ }
28012
28375
  objects[index] = lastCachedObject;
28013
- indicesByUUID[lastObject.uuid] = firstActiveIndex;
28376
+ if (firstActiveIndex !== lastIndex) {
28377
+ indicesByUUID[lastObject.uuid] = firstActiveIndex;
28378
+ }
28014
28379
  objects[firstActiveIndex] = lastObject;
28015
28380
  objects.pop();
28016
28381
  for (let j = 0, m = nBindings; j !== m; ++j) {
@@ -28021,7 +28386,7 @@ var AnimationObjectGroup = class {
28021
28386
  }
28022
28387
  } else {
28023
28388
  const lastIndex = --nObjects, lastObject = objects[lastIndex];
28024
- if (lastIndex > 0) {
28389
+ if (index !== lastIndex) {
28025
28390
  indicesByUUID[lastObject.uuid] = index;
28026
28391
  }
28027
28392
  objects[index] = lastObject;
@@ -28057,7 +28422,7 @@ var AnimationObjectGroup = class {
28057
28422
  unsubscribe_(path) {
28058
28423
  const indicesByPath = this._bindingsIndicesByPath, index = indicesByPath[path];
28059
28424
  if (index !== void 0) {
28060
- const paths = this._paths, parsedPaths = this._parsedPaths, bindings = this._bindings, lastBindingsIndex = bindings.length - 1, lastBindings = bindings[lastBindingsIndex], lastBindingsPath = path[lastBindingsIndex];
28425
+ const paths = this._paths, parsedPaths = this._parsedPaths, bindings = this._bindings, lastBindingsIndex = bindings.length - 1, lastBindings = bindings[lastBindingsIndex], lastBindingsPath = paths[lastBindingsIndex];
28061
28426
  indicesByPath[lastBindingsPath] = index;
28062
28427
  bindings[index] = lastBindings;
28063
28428
  bindings.pop();
@@ -29022,9 +29387,13 @@ var RenderTarget3D = class extends RenderTarget {
29022
29387
  super(width, height, options);
29023
29388
  this.isRenderTarget3D = true;
29024
29389
  this.depth = depth;
29025
- this.texture = new Data3DTexture(null, width, height, depth);
29390
+ for (let i = 0; i < this.textures.length; i++) {
29391
+ const texture = new Data3DTexture(null, width, height, depth);
29392
+ texture.isRenderTargetTexture = true;
29393
+ texture.renderTarget = this;
29394
+ this.textures[i] = texture;
29395
+ }
29026
29396
  this._setTextureOptions(options);
29027
- this.texture.isRenderTargetTexture = true;
29028
29397
  }
29029
29398
  };
29030
29399
  var Uniform = class _Uniform {
@@ -29337,6 +29706,10 @@ var Raycaster = class {
29337
29706
  * be detected. To raycast against both faces of an object, you'll want to set {@link Material#side}
29338
29707
  * to `THREE.DoubleSide`.
29339
29708
  *
29709
+ * Note that a ray hitting a triangle mesh exactly along an edge shared by two faces may be
29710
+ * reported by both faces, resulting in two coincident intersections (identical point and
29711
+ * distance) in the returned array.
29712
+ *
29340
29713
  * @param {Object3D} object - The 3D object to check for intersection with the ray.
29341
29714
  * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants.
29342
29715
  * Otherwise it only checks intersection with the object.
@@ -30209,6 +30582,7 @@ var SpotLightHelper = class extends Object3D {
30209
30582
  * method whenever this instance is no longer used in your app.
30210
30583
  */
30211
30584
  dispose() {
30585
+ super.dispose();
30212
30586
  this.cone.geometry.dispose();
30213
30587
  this.cone.material.dispose();
30214
30588
  }
@@ -30318,6 +30692,7 @@ var SkeletonHelper = class extends LineSegments {
30318
30692
  * method whenever this instance is no longer used in your app.
30319
30693
  */
30320
30694
  dispose() {
30695
+ super.dispose();
30321
30696
  this.geometry.dispose();
30322
30697
  this.material.dispose();
30323
30698
  }
@@ -30357,6 +30732,7 @@ var PointLightHelper = class extends Mesh {
30357
30732
  * method whenever this instance is no longer used in your app.
30358
30733
  */
30359
30734
  dispose() {
30735
+ super.dispose();
30360
30736
  this.geometry.dispose();
30361
30737
  this.material.dispose();
30362
30738
  }
@@ -30408,6 +30784,7 @@ var HemisphereLightHelper = class extends Object3D {
30408
30784
  * method whenever this instance is no longer used in your app.
30409
30785
  */
30410
30786
  dispose() {
30787
+ super.dispose();
30411
30788
  this.children[0].geometry.dispose();
30412
30789
  this.children[0].material.dispose();
30413
30790
  }
@@ -30475,6 +30852,7 @@ var GridHelper = class extends LineSegments {
30475
30852
  * method whenever this instance is no longer used in your app.
30476
30853
  */
30477
30854
  dispose() {
30855
+ super.dispose();
30478
30856
  this.geometry.dispose();
30479
30857
  this.material.dispose();
30480
30858
  }
@@ -30535,6 +30913,7 @@ var PolarGridHelper = class extends LineSegments {
30535
30913
  * method whenever this instance is no longer used in your app.
30536
30914
  */
30537
30915
  dispose() {
30916
+ super.dispose();
30538
30917
  this.geometry.dispose();
30539
30918
  this.material.dispose();
30540
30919
  }
@@ -30591,6 +30970,7 @@ var DirectionalLightHelper = class extends Object3D {
30591
30970
  * method whenever this instance is no longer used in your app.
30592
30971
  */
30593
30972
  dispose() {
30973
+ super.dispose();
30594
30974
  this.lightPlane.geometry.dispose();
30595
30975
  this.lightPlane.material.dispose();
30596
30976
  this.targetLine.geometry.dispose();
@@ -30804,6 +31184,7 @@ var CameraHelper = class extends LineSegments {
30804
31184
  * method whenever this instance is no longer used in your app.
30805
31185
  */
30806
31186
  dispose() {
31187
+ super.dispose();
30807
31188
  this.geometry.dispose();
30808
31189
  this.material.dispose();
30809
31190
  }
@@ -30899,6 +31280,7 @@ var BoxHelper = class extends LineSegments {
30899
31280
  * method whenever this instance is no longer used in your app.
30900
31281
  */
30901
31282
  dispose() {
31283
+ super.dispose();
30902
31284
  this.geometry.dispose();
30903
31285
  this.material.dispose();
30904
31286
  }
@@ -30934,6 +31316,7 @@ var Box3Helper = class extends LineSegments {
30934
31316
  * method whenever this instance is no longer used in your app.
30935
31317
  */
30936
31318
  dispose() {
31319
+ super.dispose();
30937
31320
  this.geometry.dispose();
30938
31321
  this.material.dispose();
30939
31322
  }
@@ -30974,6 +31357,7 @@ var PlaneHelper = class extends Line {
30974
31357
  * light being visualized.
30975
31358
  */
30976
31359
  dispose() {
31360
+ super.dispose();
30977
31361
  this.geometry.dispose();
30978
31362
  this.material.dispose();
30979
31363
  this.children[0].geometry.dispose();
@@ -31063,6 +31447,7 @@ var ArrowHelper = class extends Object3D {
31063
31447
  * method whenever this instance is no longer used in your app.
31064
31448
  */
31065
31449
  dispose() {
31450
+ super.dispose();
31066
31451
  this.line.geometry.dispose();
31067
31452
  this.line.material.dispose();
31068
31453
  this.cone.geometry.dispose();
@@ -31151,6 +31536,7 @@ var AxesHelper = class extends LineSegments {
31151
31536
  * method whenever this instance is no longer used in your app.
31152
31537
  */
31153
31538
  dispose() {
31539
+ super.dispose();
31154
31540
  this.geometry.dispose();
31155
31541
  this.material.dispose();
31156
31542
  }
@@ -31361,10 +31747,6 @@ var Controls = class extends EventDispatcher {
31361
31747
  * @param {HTMLElement} element - The DOM element to connect to.
31362
31748
  */
31363
31749
  connect(element) {
31364
- if (element === void 0) {
31365
- warn("Controls: connect() now requires an element.");
31366
- return;
31367
- }
31368
31750
  if (this.domElement !== null) this.disconnect();
31369
31751
  this.domElement = element;
31370
31752
  }
@@ -31597,15 +31979,15 @@ if (typeof window !== "undefined") {
31597
31979
  }
31598
31980
  }
31599
31981
 
31600
- // ../../node_modules/.bun/three@0.185.1/node_modules/three/build/three.module.js
31982
+ // ../../node_modules/.bun/three@0.186.0/node_modules/three/build/three.module.js
31601
31983
  function WebGLAnimation() {
31602
31984
  let context = null;
31603
31985
  let isAnimating = false;
31604
31986
  let animationLoop = null;
31605
31987
  let requestId = null;
31606
31988
  function onAnimationFrame(time, frame) {
31607
- animationLoop(time, frame);
31608
31989
  requestId = context.requestAnimationFrame(onAnimationFrame);
31990
+ animationLoop(time, frame);
31609
31991
  }
31610
31992
  return {
31611
31993
  start: function() {
@@ -31796,16 +32178,16 @@ var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n uniform sampler2D grad
31796
32178
  var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif";
31797
32179
  var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
31798
32180
  var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert";
31799
- var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif\n#include <lightprobes_pars_fragment>";
31800
- var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif";
32181
+ var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_SUN_LIGHTS > 0\n struct SunLight {\n vec3 direction;\n vec3 color;\n };\n uniform SunLight sunLights[ NUM_SUN_LIGHTS ];\n void getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) {\n light.color = sunLight.color;\n light.direction = sunLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif\n#include <lightprobes_pars_fragment>";
32182
+ var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_RETROREFLECTION\n vec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) );\n retroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * retroVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_RETROREFLECTION\n vec3 getIBLAnisotropyRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRetroRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n #endif\n#endif";
31801
32183
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
31802
32184
  var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon";
31803
32185
  var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
31804
32186
  var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong";
31805
- var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
31806
- var lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n #ifdef USE_CLEARCOAT\n vec3 Ncc = geometryClearcoatNormal;\n vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n mat3 mInvClearcoat = mat3(\n vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n vec3( 0, 1, 0 ),\n vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n );\n vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n #endif\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
31807
- var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n #ifdef USE_LIGHT_PROBES_GRID\n vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );\n irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
31808
- var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif";
32187
+ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_RETROREFLECTION\n material.retroreflectivity = retroreflectivity;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
32188
+ var lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n vec2 dfg;\n vec3 multiScatteringCompensation;\n #ifdef USE_RETROREFLECTION\n float retroreflectivity;\n #endif\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0Dielectric;\n vec3 iridescenceF0Metallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n #ifdef USE_CLEARCOAT\n vec3 Ncc = geometryClearcoatNormal;\n vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n mat3 mInvClearcoat = mat3(\n vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n vec3( 0, 1, 0 ),\n vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n );\n vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n #endif\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n vec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n #ifdef USE_RETROREFLECTION\n vec3 retroViewDir = reflect( - geometryViewDir, geometryNormal );\n vec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material );\n specularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) );\n #endif\n reflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation;\n vec3 halfDir = normalize( directLight.direction + geometryViewDir );\n float dotVH = saturate( dot( geometryViewDir, halfDir ) );\n vec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH );\n #ifdef USE_RETROREFLECTION\n vec3 retroHalfDir = normalize( directLight.direction + retroViewDir );\n float dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) );\n vec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );\n F = mix( F, retroF, saturate( material.retroreflectivity ) );\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering );\n #else\n computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );\n #endif\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n sheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
32189
+ var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n vec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n vec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi );\n material.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi );\n }\n#endif\n#ifdef STANDARD\n float dotNVms = saturate( dot( geometryNormal, geometryViewDir ) );\n material.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg;\n #if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 )\n float EssMs = material.dfg.x + material.dfg.y;\n material.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 );\n #endif\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SUN_LIGHTS > 0 ) && defined( RE_Direct )\n SunLight sunLight;\n #if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0\n SunLightShadow sunLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) {\n sunLight = sunLights[ i ];\n getSunLightInfo( sunLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS )\n sunLightShadow = sunLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n #ifdef USE_LIGHT_PROBES_GRID\n vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );\n irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
32190
+ var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n vec3 iblRadiance = getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n vec3 iblRadiance = getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_RETROREFLECTION\n #ifdef USE_ANISOTROPY\n vec3 retroIBLRadiance = getIBLAnisotropyRetroRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n vec3 retroIBLRadiance = getIBLRetroRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n iblRadiance = mix( iblRadiance, retroIBLRadiance, saturate( material.retroreflectivity ) );\n #endif\n radiance += iblRadiance;\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif";
31809
32191
  var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n #if defined( LAMBERT ) || defined( PHONG )\n irradiance += iblIrradiance;\n #endif\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
31810
32192
  var lightprobes_pars_fragment = "#ifdef USE_LIGHT_PROBES_GRID\nuniform highp sampler3D probesSH;\nuniform vec3 probesMin;\nuniform vec3 probesMax;\nuniform vec3 probesResolution;\nvec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {\n vec3 res = probesResolution;\n vec3 gridRange = probesMax - probesMin;\n vec3 resMinusOne = res - 1.0;\n vec3 probeSpacing = gridRange / resMinusOne;\n vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\n vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );\n uvw = uvw * resMinusOne / res + 0.5 / res;\n float nz = res.z;\n float paddedSlices = nz + 2.0;\n float atlasDepth = 7.0 * paddedSlices;\n float uvZBase = uvw.z * nz + 1.0;\n vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );\n vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );\n vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );\n vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );\n vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );\n vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );\n vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );\n vec3 c0 = s0.xyz;\n vec3 c1 = vec3( s0.w, s1.xy );\n vec3 c2 = vec3( s1.zw, s2.x );\n vec3 c3 = s2.yzw;\n vec3 c4 = s3.xyz;\n vec3 c5 = vec3( s3.w, s4.xy );\n vec3 c6 = vec3( s4.zw, s5.x );\n vec3 c7 = s5.yzw;\n vec3 c8 = s6.xyz;\n float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\n vec3 result = c0 * 0.886227;\n result += c1 * 2.0 * 0.511664 * y;\n result += c2 * 2.0 * 0.511664 * z;\n result += c3 * 2.0 * 0.511664 * x;\n result += c4 * 2.0 * 0.429043 * x * y;\n result += c5 * 2.0 * 0.429043 * y * z;\n result += c6 * ( 0.743125 * z * z - 0.247708 );\n result += c7 * 2.0 * 0.429043 * x * z;\n result += c8 * 0.429043 * ( x * x - y * y );\n return max( result, vec3( 0.0 ) );\n}\n#endif";
31811
32193
  var logdepthbuf_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
@@ -31841,10 +32223,10 @@ var dithering_fragment = "#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_Fr
31841
32223
  var dithering_pars_fragment = "#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif";
31842
32224
  var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif";
31843
32225
  var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif";
31844
- var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n \n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp -= shadowBias;\n #else\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n #endif\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n vec2 sample0 = vogelDiskSample( 0, 5, phi );\n vec2 sample1 = vogelDiskSample( 1, 5, phi );\n vec2 sample2 = vogelDiskSample( 2, 5, phi );\n vec2 sample3 = vogelDiskSample( 3, 5, phi );\n vec2 sample4 = vogelDiskSample( 4, 5, phi );\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n depth = 1.0 - depth;\n #endif\n shadow = step( dp, depth );\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif";
31845
- var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif";
31846
- var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n #ifdef HAS_NORMAL\n vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n #else\n vec3 shadowWorldNormal = vec3( 0.0 );\n #endif\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif";
31847
- var shadowmask_pars_fragment = "float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}";
32226
+ var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_SUN_LIGHT_SHADOWS > 0\n #define SUN_LIGHT_CASCADES 2\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n #else\n uniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n #endif\n uniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];\n uniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];\n varying vec4 vSunShadowWorldPosition;\n varying vec3 vSunShadowWorldNormal;\n struct SunLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ];\n #endif\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n \n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_SUN_LIGHT_SHADOWS > 0\n float getSunShadow(\n #if defined( SHADOWMAP_TYPE_PCF )\n sampler2DShadow shadowMap,\n #else\n sampler2D shadowMap,\n #endif\n SunLightShadow sunLightShadow,\n int shadowIndex\n ) {\n vec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 );\n float viewDepth = vSunShadowWorldPosition.w;\n int cascadeOffset = shadowIndex * SUN_LIGHT_CASCADES;\n float shadow = 1.0;\n for ( int i = SUN_LIGHT_CASCADES - 1; i >= 0; i -- ) {\n vec4 cascade = sunShadowCascade[ cascadeOffset + i ];\n if ( viewDepth >= cascade.x && viewDepth < cascade.y ) {\n float cascadeShadow = getShadow(\n shadowMap,\n sunLightShadow.shadowMapSize,\n sunLightShadow.shadowIntensity,\n sunLightShadow.shadowBias,\n sunLightShadow.shadowRadius,\n sunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition\n );\n shadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) );\n }\n }\n return shadow;\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp -= shadowBias;\n #else\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n #endif\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n vec2 sample0 = vogelDiskSample( 0, 5, phi );\n vec2 sample1 = vogelDiskSample( 1, 5, phi );\n vec2 sample2 = vogelDiskSample( 2, 5, phi );\n vec2 sample3 = vogelDiskSample( 3, 5, phi );\n vec2 sample4 = vogelDiskSample( 4, 5, phi );\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n depth = 1.0 - depth;\n #endif\n shadow = step( dp, depth );\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif";
32227
+ var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_SUN_LIGHT_SHADOWS > 0\n varying vec4 vSunShadowWorldPosition;\n varying vec3 vSunShadowWorldNormal;\n #endif\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif";
32228
+ var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n #ifdef HAS_NORMAL\n vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n #else\n vec3 shadowWorldNormal = vec3( 0.0 );\n #endif\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_SUN_LIGHT_SHADOWS > 0\n vSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z );\n vSunShadowWorldNormal = shadowWorldNormal;\n #endif\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif";
32229
+ var shadowmask_pars_fragment = "float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_SUN_LIGHT_SHADOWS > 0\n SunLightShadow sunLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) {\n sunLight = sunLightShadows[ i ];\n shadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}";
31848
32230
  var skinbase_vertex = "#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
31849
32231
  var skinning_pars_vertex = "#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif";
31850
32232
  var skinning_vertex = "#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif";
@@ -31884,7 +32266,7 @@ var fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHAD
31884
32266
  var vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}";
31885
32267
  var fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}";
31886
32268
  var vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}";
31887
- var fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}";
32269
+ var fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_RETROREFLECTION\n uniform float retroreflectivity;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}";
31888
32270
  var vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}";
31889
32271
  var fragment$4 = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}";
31890
32272
  var vertex$3 = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}";
@@ -32113,6 +32495,19 @@ var UniformsLib = {
32113
32495
  lights: {
32114
32496
  ambientLightColor: { value: [] },
32115
32497
  lightProbe: { value: [] },
32498
+ sunLights: { value: [], properties: {
32499
+ direction: {},
32500
+ color: {}
32501
+ } },
32502
+ sunLightShadows: { value: [], properties: {
32503
+ shadowIntensity: 1,
32504
+ shadowBias: {},
32505
+ shadowNormalBias: {},
32506
+ shadowRadius: {},
32507
+ shadowMapSize: {}
32508
+ } },
32509
+ sunShadowMatrix: { value: [] },
32510
+ sunShadowCascade: { value: [] },
32116
32511
  directionalLights: { value: [], properties: {
32117
32512
  direction: {},
32118
32513
  color: {}
@@ -32440,6 +32835,7 @@ ShaderLib.physical = {
32440
32835
  clearcoatRoughnessMap: { value: null },
32441
32836
  clearcoatRoughnessMapTransform: { value: /* @__PURE__ */ new Matrix3() },
32442
32837
  dispersion: { value: 0 },
32838
+ retroreflectivity: { value: 0 },
32443
32839
  iridescence: { value: 0 },
32444
32840
  iridescenceMap: { value: null },
32445
32841
  iridescenceMapTransform: { value: /* @__PURE__ */ new Matrix3() },
@@ -33058,8 +33454,7 @@ function WebGLCapabilities(gl, extensions, parameters, utils) {
33058
33454
  }
33059
33455
  function textureTypeReadable(textureType) {
33060
33456
  const halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has("EXT_color_buffer_half_float") || extensions.has("EXT_color_buffer_float"));
33061
- if (textureType !== UnsignedByteType && utils.convert(textureType) !== gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513)
33062
- textureType !== FloatType && !halfFloatSupportedByExt) {
33457
+ if (textureType !== UnsignedByteType && textureType !== FloatType && !halfFloatSupportedByExt && utils.convert(textureType) !== gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE)) {
33063
33458
  return false;
33064
33459
  }
33065
33460
  return true;
@@ -33202,8 +33597,8 @@ function WebGLClipping(properties) {
33202
33597
  }
33203
33598
  }
33204
33599
  var LOD_MIN = 4;
33205
- var EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582];
33206
- var MAX_SAMPLES = 20;
33600
+ var EXTRA_LODS = 6;
33601
+ var BLUR_SAMPLES = 20;
33207
33602
  var GGX_SAMPLES = 256;
33208
33603
  var _flatCamera = /* @__PURE__ */ new OrthographicCamera();
33209
33604
  var _clearColor = /* @__PURE__ */ new Color();
@@ -33212,6 +33607,7 @@ var _oldActiveCubeFace = 0;
33212
33607
  var _oldActiveMipmapLevel = 0;
33213
33608
  var _oldXrEnabled = false;
33214
33609
  var _origin = /* @__PURE__ */ new Vector3();
33610
+ var _direction = /* @__PURE__ */ new Vector3();
33215
33611
  var PMREMGenerator = class {
33216
33612
  /**
33217
33613
  * Constructs a new PMREM generator.
@@ -33224,7 +33620,6 @@ var PMREMGenerator = class {
33224
33620
  this._lodMax = 0;
33225
33621
  this._cubeSize = 0;
33226
33622
  this._sizeLods = [];
33227
- this._sigmas = [];
33228
33623
  this._lodMeshes = [];
33229
33624
  this._backgroundBox = null;
33230
33625
  this._cubemapMaterial = null;
@@ -33383,7 +33778,7 @@ var PMREMGenerator = class {
33383
33778
  }
33384
33779
  this._pingPongRenderTarget = _createRenderTarget(width, height, params);
33385
33780
  const { _lodMax } = this;
33386
- ({ lodMeshes: this._lodMeshes, sizeLods: this._sizeLods, sigmas: this._sigmas } = _createPlanes(_lodMax));
33781
+ ({ lodMeshes: this._lodMeshes, sizeLods: this._sizeLods } = _createPlanes(_lodMax));
33387
33782
  this._blurMaterial = _getBlurShader(_lodMax, width, height);
33388
33783
  this._ggxMaterial = _getGGXShader(_lodMax, width, height);
33389
33784
  }
@@ -33517,7 +33912,7 @@ var PMREMGenerator = class {
33517
33912
  const targetRoughness = lodOut / (this._lodMeshes.length - 1);
33518
33913
  const sourceRoughness = lodIn / (this._lodMeshes.length - 1);
33519
33914
  const incrementalRoughness = Math.sqrt(targetRoughness * targetRoughness - sourceRoughness * sourceRoughness);
33520
- const blurStrength = 0 + targetRoughness * 1.25;
33915
+ const blurStrength = targetRoughness * 1.25;
33521
33916
  const adjustedRoughness = incrementalRoughness * blurStrength;
33522
33917
  const { _lodMax } = this;
33523
33918
  const outputSize = this._sizeLods[lodOut];
@@ -33537,11 +33932,9 @@ var PMREMGenerator = class {
33537
33932
  renderer.render(ggxMesh, _flatCamera);
33538
33933
  }
33539
33934
  /**
33540
- * This is a two-pass Gaussian blur for a cubemap. Normally this is done
33541
- * vertically and horizontally, but this breaks down on a cube. Here we apply
33542
- * the blur latitudinally (around the poles), and then longitudinally (towards
33543
- * the poles) to approximate the orthogonally-separable blur. It is least
33544
- * accurate at the poles, but still does a decent job.
33935
+ * This is a two-pass Gaussian blur for a cubemap. Each pass importance-samples
33936
+ * the Gaussian along a spiral kernel (Golden Angle), which distributes samples
33937
+ * isotropically on the sphere (no pole artifacts).
33545
33938
  *
33546
33939
  * Used for initial scene blur in fromScene() method when sigma > 0.
33547
33940
  *
@@ -33550,75 +33943,24 @@ var PMREMGenerator = class {
33550
33943
  * @param {number} lodIn
33551
33944
  * @param {number} lodOut
33552
33945
  * @param {number} sigma
33553
- * @param {Vector3} [poleAxis]
33554
33946
  */
33555
- _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) {
33947
+ _blur(cubeUVRenderTarget, lodIn, lodOut, sigma) {
33556
33948
  const pingPongRenderTarget = this._pingPongRenderTarget;
33557
- this._halfBlur(
33558
- cubeUVRenderTarget,
33559
- pingPongRenderTarget,
33560
- lodIn,
33561
- lodOut,
33562
- sigma,
33563
- "latitudinal",
33564
- poleAxis
33565
- );
33566
- this._halfBlur(
33567
- pingPongRenderTarget,
33568
- cubeUVRenderTarget,
33569
- lodOut,
33570
- lodOut,
33571
- sigma,
33572
- "longitudinal",
33573
- poleAxis
33574
- );
33949
+ const blurSigma = Math.min(sigma, Math.PI) / Math.SQRT2;
33950
+ this._blurPass(cubeUVRenderTarget, pingPongRenderTarget, lodIn, lodOut, blurSigma);
33951
+ this._blurPass(pingPongRenderTarget, cubeUVRenderTarget, lodOut, lodOut, blurSigma);
33575
33952
  }
33576
- _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) {
33953
+ _blurPass(targetIn, targetOut, lodIn, lodOut, sigmaRadians) {
33577
33954
  const renderer = this._renderer;
33578
33955
  const blurMaterial = this._blurMaterial;
33579
- if (direction !== "latitudinal" && direction !== "longitudinal") {
33580
- error(
33581
- "blur direction must be either latitudinal or longitudinal!"
33582
- );
33583
- }
33584
- const STANDARD_DEVIATIONS = 3;
33585
33956
  const blurMesh = this._lodMeshes[lodOut];
33586
33957
  blurMesh.material = blurMaterial;
33587
33958
  const blurUniforms = blurMaterial.uniforms;
33588
- const pixels = this._sizeLods[lodIn] - 1;
33589
- const radiansPerPixel = isFinite(sigmaRadians) ? Math.PI / (2 * pixels) : 2 * Math.PI / (2 * MAX_SAMPLES - 1);
33590
- const sigmaPixels = sigmaRadians / radiansPerPixel;
33591
- const samples = isFinite(sigmaRadians) ? 1 + Math.floor(STANDARD_DEVIATIONS * sigmaPixels) : MAX_SAMPLES;
33592
- if (samples > MAX_SAMPLES) {
33593
- warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested ${samples} samples when the maximum is set to ${MAX_SAMPLES}`);
33594
- }
33595
- const weights = [];
33596
- let sum = 0;
33597
- for (let i = 0; i < MAX_SAMPLES; ++i) {
33598
- const x2 = i / sigmaPixels;
33599
- const weight = Math.exp(-x2 * x2 / 2);
33600
- weights.push(weight);
33601
- if (i === 0) {
33602
- sum += weight;
33603
- } else if (i < samples) {
33604
- sum += 2 * weight;
33605
- }
33606
- }
33607
- for (let i = 0; i < weights.length; i++) {
33608
- weights[i] = weights[i] / sum;
33609
- }
33610
33959
  blurUniforms["envMap"].value = targetIn.texture;
33611
- blurUniforms["samples"].value = samples;
33612
- blurUniforms["weights"].value = weights;
33613
- blurUniforms["latitudinal"].value = direction === "latitudinal";
33614
- if (poleAxis) {
33615
- blurUniforms["poleAxis"].value = poleAxis;
33616
- }
33617
- const { _lodMax } = this;
33618
- blurUniforms["dTheta"].value = radiansPerPixel;
33619
- blurUniforms["mipInt"].value = _lodMax - lodIn;
33960
+ blurUniforms["sigma"].value = sigmaRadians;
33961
+ blurUniforms["mipInt"].value = this._lodMax - lodIn;
33620
33962
  const outputSize = this._sizeLods[lodOut];
33621
- const x = 3 * outputSize * (lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0);
33963
+ const x = 3 * outputSize * (lodOut > this._lodMax - LOD_MIN ? lodOut - this._lodMax + LOD_MIN : 0);
33622
33964
  const y = 4 * (this._cubeSize - outputSize);
33623
33965
  _setViewport(targetOut, x, y, 3 * outputSize, 2 * outputSize);
33624
33966
  renderer.setRenderTarget(targetOut);
@@ -33627,20 +33969,12 @@ var PMREMGenerator = class {
33627
33969
  };
33628
33970
  function _createPlanes(lodMax) {
33629
33971
  const sizeLods = [];
33630
- const sigmas = [];
33631
33972
  const lodMeshes = [];
33632
33973
  let lod = lodMax;
33633
- const totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;
33974
+ const totalLods = lodMax - LOD_MIN + 1 + EXTRA_LODS;
33634
33975
  for (let i = 0; i < totalLods; i++) {
33635
33976
  const sizeLod = Math.pow(2, lod);
33636
33977
  sizeLods.push(sizeLod);
33637
- let sigma = 1 / sizeLod;
33638
- if (i > lodMax - LOD_MIN) {
33639
- sigma = EXTRA_LOD_SIGMA[i - lodMax + LOD_MIN - 1];
33640
- } else if (i === 0) {
33641
- sigma = 0;
33642
- }
33643
- sigmas.push(sigma);
33644
33978
  const texelSize = 1 / (sizeLod - 2);
33645
33979
  const min = -texelSize;
33646
33980
  const max = 1 + texelSize;
@@ -33648,11 +33982,8 @@ function _createPlanes(lodMax) {
33648
33982
  const cubeFaces = 6;
33649
33983
  const vertices = 6;
33650
33984
  const positionSize = 3;
33651
- const uvSize = 2;
33652
- const faceIndexSize = 1;
33653
33985
  const position = new Float32Array(positionSize * vertices * cubeFaces);
33654
- const uv = new Float32Array(uvSize * vertices * cubeFaces);
33655
- const faceIndex = new Float32Array(faceIndexSize * vertices * cubeFaces);
33986
+ const outputDirection = new Float32Array(positionSize * vertices * cubeFaces);
33656
33987
  for (let face = 0; face < cubeFaces; face++) {
33657
33988
  const x = face % 3 * 2 / 3 - 1;
33658
33989
  const y = face > 2 ? 0 : -1;
@@ -33677,20 +34008,34 @@ function _createPlanes(lodMax) {
33677
34008
  0
33678
34009
  ];
33679
34010
  position.set(coordinates, positionSize * vertices * face);
33680
- uv.set(uv1, uvSize * vertices * face);
33681
- const fill2 = [face, face, face, face, face, face];
33682
- faceIndex.set(fill2, faceIndexSize * vertices * face);
34011
+ for (let vertex2 = 0; vertex2 < vertices; vertex2++) {
34012
+ const u = uv1[vertex2 * 2] * 2 - 1;
34013
+ const v = uv1[vertex2 * 2 + 1] * 2 - 1;
34014
+ if (face === 0) {
34015
+ _direction.set(1, v, u);
34016
+ } else if (face === 1) {
34017
+ _direction.set(-u, 1, -v);
34018
+ } else if (face === 2) {
34019
+ _direction.set(-u, v, 1);
34020
+ } else if (face === 3) {
34021
+ _direction.set(-1, v, -u);
34022
+ } else if (face === 4) {
34023
+ _direction.set(-u, -1, v);
34024
+ } else {
34025
+ _direction.set(u, v, -1);
34026
+ }
34027
+ _direction.toArray(outputDirection, (face * vertices + vertex2) * positionSize);
34028
+ }
33683
34029
  }
33684
34030
  const planes = new BufferGeometry();
33685
34031
  planes.setAttribute("position", new BufferAttribute(position, positionSize));
33686
- planes.setAttribute("uv", new BufferAttribute(uv, uvSize));
33687
- planes.setAttribute("faceIndex", new BufferAttribute(faceIndex, faceIndexSize));
34032
+ planes.setAttribute("outputDirection", new BufferAttribute(outputDirection, positionSize));
33688
34033
  lodMeshes.push(new Mesh(planes, null));
33689
34034
  if (lod > LOD_MIN) {
33690
34035
  lod--;
33691
34036
  }
33692
34037
  }
33693
- return { lodMeshes, sizeLods, sigmas };
34038
+ return { lodMeshes, sizeLods };
33694
34039
  }
33695
34040
  function _createRenderTarget(width, height, params) {
33696
34041
  const cubeUVRenderTarget = new WebGLRenderTarget(width, height, params);
@@ -33833,87 +34178,81 @@ function _getGGXShader(lodMax, width, height) {
33833
34178
  return shaderMaterial;
33834
34179
  }
33835
34180
  function _getBlurShader(lodMax, width, height) {
33836
- const weights = new Float32Array(MAX_SAMPLES);
33837
- const poleAxis = new Vector3(0, 1, 0);
33838
34181
  const shaderMaterial = new ShaderMaterial({
33839
34182
  name: "SphericalGaussianBlur",
33840
34183
  defines: {
33841
- "n": MAX_SAMPLES,
34184
+ "SAMPLES": BLUR_SAMPLES,
33842
34185
  "CUBEUV_TEXEL_WIDTH": 1 / width,
33843
34186
  "CUBEUV_TEXEL_HEIGHT": 1 / height,
33844
34187
  "CUBEUV_MAX_MIP": `${lodMax}.0`
33845
34188
  },
33846
34189
  uniforms: {
33847
34190
  "envMap": { value: null },
33848
- "samples": { value: 1 },
33849
- "weights": { value: weights },
33850
- "latitudinal": { value: false },
33851
- "dTheta": { value: 0 },
33852
- "mipInt": { value: 0 },
33853
- "poleAxis": { value: poleAxis }
34191
+ "sigma": { value: 0 },
34192
+ "mipInt": { value: 0 }
33854
34193
  },
33855
34194
  vertexShader: _getCommonVertexShader(),
33856
34195
  fragmentShader: (
33857
34196
  /* glsl */
33858
34197
  `
33859
34198
 
33860
- precision mediump float;
33861
- precision mediump int;
34199
+ precision highp float;
34200
+ precision highp int;
33862
34201
 
33863
34202
  varying vec3 vOutputDirection;
33864
34203
 
33865
34204
  uniform sampler2D envMap;
33866
- uniform int samples;
33867
- uniform float weights[ n ];
33868
- uniform bool latitudinal;
33869
- uniform float dTheta;
34205
+ uniform float sigma;
33870
34206
  uniform float mipInt;
33871
- uniform vec3 poleAxis;
33872
34207
 
33873
34208
  #define ENVMAP_TYPE_CUBE_UV
33874
34209
  #include <cube_uv_reflection_fragment>
33875
34210
 
33876
- vec3 getSample( float theta, vec3 axis ) {
33877
-
33878
- float cosTheta = cos( theta );
33879
- // Rodrigues' axis-angle rotation
33880
- vec3 sampleDirection = vOutputDirection * cosTheta
33881
- + cross( axis, vOutputDirection ) * sin( theta )
33882
- + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
33883
-
33884
- return bilinearCubeUV( envMap, sampleDirection, mipInt );
33885
-
33886
- }
34211
+ #define PI 3.14159265359
34212
+ #define GOLDEN_ANGLE 2.39996322973
33887
34213
 
33888
34214
  void main() {
33889
34215
 
33890
- vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
33891
-
33892
- if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
34216
+ if ( sigma == 0.0 ) {
33893
34217
 
33894
- axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
34218
+ gl_FragColor = vec4( bilinearCubeUV( envMap, vOutputDirection, mipInt ), 1.0 );
34219
+ return;
33895
34220
 
33896
34221
  }
33897
34222
 
33898
- axis = normalize( axis );
34223
+ vec3 outputDirection = normalize( vOutputDirection );
34224
+
34225
+ vec3 up = abs( outputDirection.z ) < 0.999 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 1.0, 0.0, 0.0 );
34226
+ vec3 tangent = normalize( cross( up, outputDirection ) );
34227
+ vec3 bitangent = cross( outputDirection, tangent );
33899
34228
 
33900
- gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
33901
- gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
34229
+ // Truncate the kernel at three standard deviations or at the antipode.
34230
+ float thetaMax = min( 3.0 * sigma, PI );
34231
+ float truncation = 1.0 - exp( - 0.5 * thetaMax * thetaMax / ( sigma * sigma ) );
33902
34232
 
33903
- for ( int i = 1; i < n; i++ ) {
34233
+ vec3 accumColor = vec3( 0.0 );
34234
+ float accumWeight = 0.0;
33904
34235
 
33905
- if ( i >= samples ) {
34236
+ for ( int i = 0; i < SAMPLES; i ++ ) {
33906
34237
 
33907
- break;
34238
+ // Stratified inverse-CDF sampling of the Gaussian, placed on a golden-angle spiral.
34239
+ float stratum = ( float( i ) + 0.5 ) / float( SAMPLES );
34240
+ float theta = sigma * sqrt( - 2.0 * log( 1.0 - stratum * truncation ) );
34241
+ float phi = float( i ) * GOLDEN_ANGLE;
33908
34242
 
33909
- }
34243
+ vec3 offset = cos( phi ) * tangent + sin( phi ) * bitangent;
34244
+ vec3 sampleDirection = cos( theta ) * outputDirection + sin( theta ) * offset;
33910
34245
 
33911
- float theta = dTheta * float( i );
33912
- gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
33913
- gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
34246
+ // Correct the planar sample density to solid angle.
34247
+ float weight = sin( theta ) / theta;
34248
+
34249
+ accumColor += weight * bilinearCubeUV( envMap, sampleDirection, mipInt );
34250
+ accumWeight += weight;
33914
34251
 
33915
34252
  }
33916
34253
 
34254
+ gl_FragColor = vec4( accumColor / accumWeight, 1.0 );
34255
+
33917
34256
  }
33918
34257
  `
33919
34258
  ),
@@ -33999,53 +34338,13 @@ function _getCommonVertexShader() {
33999
34338
  precision mediump float;
34000
34339
  precision mediump int;
34001
34340
 
34002
- attribute float faceIndex;
34341
+ attribute vec3 outputDirection;
34003
34342
 
34004
34343
  varying vec3 vOutputDirection;
34005
34344
 
34006
- // RH coordinate system; PMREM face-indexing convention
34007
- vec3 getDirection( vec2 uv, float face ) {
34008
-
34009
- uv = 2.0 * uv - 1.0;
34010
-
34011
- vec3 direction = vec3( uv, 1.0 );
34012
-
34013
- if ( face == 0.0 ) {
34014
-
34015
- direction = direction.zyx; // ( 1, v, u ) pos x
34016
-
34017
- } else if ( face == 1.0 ) {
34018
-
34019
- direction = direction.xzy;
34020
- direction.xz *= -1.0; // ( -u, 1, -v ) pos y
34021
-
34022
- } else if ( face == 2.0 ) {
34023
-
34024
- direction.x *= -1.0; // ( -u, v, 1 ) pos z
34025
-
34026
- } else if ( face == 3.0 ) {
34027
-
34028
- direction = direction.zyx;
34029
- direction.xz *= -1.0; // ( -1, v, -u ) neg x
34030
-
34031
- } else if ( face == 4.0 ) {
34032
-
34033
- direction = direction.xzy;
34034
- direction.xy *= -1.0; // ( -u, -1, v ) neg y
34035
-
34036
- } else if ( face == 5.0 ) {
34037
-
34038
- direction.z *= -1.0; // ( u, v, -1 ) neg z
34039
-
34040
- }
34041
-
34042
- return direction;
34043
-
34044
- }
34045
-
34046
34345
  void main() {
34047
34346
 
34048
- vOutputDirection = getDirection( uv, faceIndex );
34347
+ vOutputDirection = outputDirection;
34049
34348
  gl_Position = vec4( position, 1.0 );
34050
34349
 
34051
34350
  }
@@ -34636,18 +34935,18 @@ var toneMappingMap = {
34636
34935
  [CustomToneMapping]: "CUSTOM_TONE_MAPPING"
34637
34936
  };
34638
34937
  function WebGLOutput(type, width, height, antialias, depth, stencil) {
34639
- const targetA = new WebGLRenderTarget(width, height, {
34938
+ const targetScene = new WebGLRenderTarget(width, height, {
34640
34939
  type,
34641
34940
  depthBuffer: depth,
34642
34941
  stencilBuffer: stencil,
34643
34942
  samples: antialias ? 4 : 0,
34644
- depthTexture: depth ? new DepthTexture(width, height) : void 0
34645
- });
34646
- const targetB = new WebGLRenderTarget(width, height, {
34647
- type: HalfFloatType,
34648
- depthBuffer: false,
34649
- stencilBuffer: false
34943
+ storeMultisampledDepthBuffer: false,
34944
+ storeMultisampledStencilBuffer: false,
34945
+ resolveDepthBuffer: false,
34946
+ resolveStencilBuffer: false
34650
34947
  });
34948
+ let targetA = null;
34949
+ let targetB = null;
34651
34950
  const geometry = new BufferGeometry();
34652
34951
  geometry.setAttribute("position", new Float32BufferAttribute([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3));
34653
34952
  geometry.setAttribute("uv", new Float32BufferAttribute([0, 2, 0, 0, 2, 0], 2));
@@ -34722,8 +35021,9 @@ function WebGLOutput(type, width, height, antialias, depth, stencil) {
34722
35021
  let _effects = [];
34723
35022
  let _hasRenderPass = false;
34724
35023
  this.setSize = function(width2, height2) {
34725
- targetA.setSize(width2, height2);
34726
- targetB.setSize(width2, height2);
35024
+ targetScene.setSize(width2, height2);
35025
+ if (targetA !== null) targetA.setSize(width2, height2);
35026
+ if (targetB !== null) targetB.setSize(width2, height2);
34727
35027
  for (let i = 0; i < _effects.length; i++) {
34728
35028
  const effect = _effects[i];
34729
35029
  if (effect.setSize) effect.setSize(width2, height2);
@@ -34732,8 +35032,12 @@ function WebGLOutput(type, width, height, antialias, depth, stencil) {
34732
35032
  this.setEffects = function(effects) {
34733
35033
  _effects = effects;
34734
35034
  _hasRenderPass = _effects.length > 0 && _effects[0].isRenderPass === true;
34735
- const width2 = targetA.width;
34736
- const height2 = targetA.height;
35035
+ const width2 = targetScene.width;
35036
+ const height2 = targetScene.height;
35037
+ if (_effects.length > 0 && targetA === null) {
35038
+ targetA = new WebGLRenderTarget(width2, height2, { type: HalfFloatType, depthBuffer: false, stencilBuffer: false });
35039
+ targetB = new WebGLRenderTarget(width2, height2, { type: HalfFloatType, depthBuffer: false, stencilBuffer: false });
35040
+ }
34737
35041
  for (let i = 0; i < _effects.length; i++) {
34738
35042
  const effect = _effects[i];
34739
35043
  if (effect.setSize) effect.setSize(width2, height2);
@@ -34746,12 +35050,12 @@ function WebGLOutput(type, width, height, antialias, depth, stencil) {
34746
35050
  if (renderTarget !== null) {
34747
35051
  const width2 = renderTarget.width;
34748
35052
  const height2 = renderTarget.height;
34749
- if (targetA.width !== width2 || targetA.height !== height2) {
35053
+ if (targetScene.width !== width2 || targetScene.height !== height2) {
34750
35054
  this.setSize(width2, height2);
34751
35055
  }
34752
35056
  }
34753
35057
  if (_hasRenderPass === false) {
34754
- renderer.setRenderTarget(targetA);
35058
+ renderer.setRenderTarget(targetScene);
34755
35059
  }
34756
35060
  _savedToneMapping = renderer.toneMapping;
34757
35061
  renderer.toneMapping = NoToneMapping;
@@ -34763,16 +35067,15 @@ function WebGLOutput(type, width, height, antialias, depth, stencil) {
34763
35067
  this.end = function(renderer, deltaTime) {
34764
35068
  renderer.toneMapping = _savedToneMapping;
34765
35069
  _isCompositing = true;
34766
- let readBuffer = targetA;
34767
- let writeBuffer = targetB;
35070
+ let readBuffer = targetScene;
35071
+ let writeBuffer = targetA;
34768
35072
  for (let i = 0; i < _effects.length; i++) {
34769
35073
  const effect = _effects[i];
34770
35074
  if (effect.enabled === false) continue;
34771
35075
  effect.render(renderer, writeBuffer, readBuffer, deltaTime);
34772
35076
  if (effect.needsSwap !== false) {
34773
- const temp = readBuffer;
34774
35077
  readBuffer = writeBuffer;
34775
- writeBuffer = temp;
35078
+ writeBuffer = writeBuffer === targetA ? targetB : targetA;
34776
35079
  }
34777
35080
  }
34778
35081
  if (_outputColorSpace !== renderer.outputColorSpace || _outputToneMapping !== renderer.toneMapping) {
@@ -34794,9 +35097,9 @@ function WebGLOutput(type, width, height, antialias, depth, stencil) {
34794
35097
  return _isCompositing;
34795
35098
  };
34796
35099
  this.dispose = function() {
34797
- if (targetA.depthTexture) targetA.depthTexture.dispose();
34798
- targetA.dispose();
34799
- targetB.dispose();
35100
+ targetScene.dispose();
35101
+ if (targetA !== null) targetA.dispose();
35102
+ if (targetB !== null) targetB.dispose();
34800
35103
  geometry.dispose();
34801
35104
  material.dispose();
34802
35105
  };
@@ -35602,7 +35905,7 @@ function filterEmptyLine(string) {
35602
35905
  }
35603
35906
  function replaceLightNums(string, parameters) {
35604
35907
  const numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;
35605
- return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows);
35908
+ return string.replace(/NUM_SUN_LIGHTS/g, parameters.numSunLights).replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g, parameters.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows);
35606
35909
  }
35607
35910
  function replaceClippingPlaneNums(string, parameters) {
35608
35911
  return string.replace(/NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, parameters.numClippingPlanes - parameters.numClipIntersection);
@@ -35902,6 +36205,7 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) {
35902
36205
  parameters.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "",
35903
36206
  parameters.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "",
35904
36207
  parameters.dispersion ? "#define USE_DISPERSION" : "",
36208
+ parameters.retroreflection ? "#define USE_RETROREFLECTION" : "",
35905
36209
  parameters.iridescence ? "#define USE_IRIDESCENCE" : "",
35906
36210
  parameters.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "",
35907
36211
  parameters.iridescenceThicknessMap ? "#define USE_IRIDESCENCE_THICKNESSMAP" : "",
@@ -36231,6 +36535,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
36231
36535
  const HAS_ANISOTROPY = material.anisotropy > 0;
36232
36536
  const HAS_CLEARCOAT = material.clearcoat > 0;
36233
36537
  const HAS_DISPERSION = material.dispersion > 0;
36538
+ const HAS_RETROREFLECTION = material.retroreflectivity > 0;
36234
36539
  const HAS_IRIDESCENCE = material.iridescence > 0;
36235
36540
  const HAS_SHEEN = material.sheen > 0;
36236
36541
  const HAS_TRANSMISSION = material.transmission > 0;
@@ -36300,6 +36605,7 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
36300
36605
  clearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,
36301
36606
  clearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,
36302
36607
  dispersion: HAS_DISPERSION,
36608
+ retroreflection: HAS_RETROREFLECTION,
36303
36609
  iridescence: HAS_IRIDESCENCE,
36304
36610
  iridescenceMap: HAS_IRIDESCENCEMAP,
36305
36611
  iridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,
@@ -36362,12 +36668,14 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
36362
36668
  morphColors: geometry.morphAttributes.color !== void 0,
36363
36669
  morphTargetsCount,
36364
36670
  morphTextureStride,
36671
+ numSunLights: lights.sun.length,
36365
36672
  numDirLights: lights.directional.length,
36366
36673
  numPointLights: lights.point.length,
36367
36674
  numSpotLights: lights.spot.length,
36368
36675
  numSpotLightMaps: lights.spotLightMap.length,
36369
36676
  numRectAreaLights: lights.rectArea.length,
36370
36677
  numHemiLights: lights.hemi.length,
36678
+ numSunLightShadows: lights.sunShadowMap.length,
36371
36679
  numDirLightShadows: lights.directionalShadowMap.length,
36372
36680
  numPointLightShadows: lights.pointShadowMap.length,
36373
36681
  numSpotLightShadows: lights.spotShadowMap.length,
@@ -36454,12 +36762,14 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
36454
36762
  array.push(parameters.sizeAttenuation);
36455
36763
  array.push(parameters.morphTargetsCount);
36456
36764
  array.push(parameters.morphAttributeCount);
36765
+ array.push(parameters.numSunLights);
36457
36766
  array.push(parameters.numDirLights);
36458
36767
  array.push(parameters.numPointLights);
36459
36768
  array.push(parameters.numSpotLights);
36460
36769
  array.push(parameters.numSpotLightMaps);
36461
36770
  array.push(parameters.numHemiLights);
36462
36771
  array.push(parameters.numRectAreaLights);
36772
+ array.push(parameters.numSunLightShadows);
36463
36773
  array.push(parameters.numDirLightShadows);
36464
36774
  array.push(parameters.numPointLightShadows);
36465
36775
  array.push(parameters.numSpotLightShadows);
@@ -36513,6 +36823,8 @@ function WebGLPrograms(renderer, environments, extensions, capabilities, binding
36513
36823
  _programLayers.enable(18);
36514
36824
  if (parameters.dispersion)
36515
36825
  _programLayers.enable(19);
36826
+ if (parameters.retroreflection)
36827
+ _programLayers.enable(24);
36516
36828
  if (parameters.batchingColor)
36517
36829
  _programLayers.enable(20);
36518
36830
  if (parameters.gradientMap)
@@ -36725,7 +37037,8 @@ function WebGLRenderList() {
36725
37037
  renderItemsIndex++;
36726
37038
  return renderItem;
36727
37039
  }
36728
- function push(object, geometry, material, groupOrder, z, group) {
37040
+ function push(object, geometry, material, groupOrder, z, group, camera) {
37041
+ if (camera.reversedDepth === true) z = -z;
36729
37042
  const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group);
36730
37043
  if (material.transmission > 0) {
36731
37044
  transmissive.push(renderItem);
@@ -36745,15 +37058,10 @@ function WebGLRenderList() {
36745
37058
  opaque.unshift(renderItem);
36746
37059
  }
36747
37060
  }
36748
- function sort(customOpaqueSort, customTransparentSort, reversedDepth) {
37061
+ function sort(customOpaqueSort, customTransparentSort) {
36749
37062
  if (opaque.length > 1) opaque.sort(customOpaqueSort || painterSortStable);
36750
37063
  if (transmissive.length > 1) transmissive.sort(customTransparentSort || reversePainterSortStable);
36751
37064
  if (transparent.length > 1) transparent.sort(customTransparentSort || reversePainterSortStable);
36752
- if (reversedDepth) {
36753
- opaque.reverse();
36754
- transmissive.reverse();
36755
- transparent.reverse();
36756
- }
36757
37065
  }
36758
37066
  function finish() {
36759
37067
  for (let i = renderItemsIndex, il = renderItems.length; i < il; i++) {
@@ -36812,6 +37120,7 @@ function UniformsCache() {
36812
37120
  }
36813
37121
  let uniforms;
36814
37122
  switch (light.type) {
37123
+ case "SunLight":
36815
37124
  case "DirectionalLight":
36816
37125
  uniforms = {
36817
37126
  direction: new Vector3(),
@@ -36867,6 +37176,7 @@ function ShadowUniformsCache() {
36867
37176
  }
36868
37177
  let uniforms;
36869
37178
  switch (light.type) {
37179
+ case "SunLight":
36870
37180
  case "DirectionalLight":
36871
37181
  uniforms = {
36872
37182
  shadowIntensity: 1,
@@ -36912,11 +37222,13 @@ function WebGLLights(extensions) {
36912
37222
  const state = {
36913
37223
  version: 0,
36914
37224
  hash: {
37225
+ sunLength: -1,
36915
37226
  directionalLength: -1,
36916
37227
  pointLength: -1,
36917
37228
  spotLength: -1,
36918
37229
  rectAreaLength: -1,
36919
37230
  hemiLength: -1,
37231
+ numSunShadows: -1,
36920
37232
  numDirectionalShadows: -1,
36921
37233
  numPointShadows: -1,
36922
37234
  numSpotShadows: -1,
@@ -36925,6 +37237,11 @@ function WebGLLights(extensions) {
36925
37237
  },
36926
37238
  ambient: [0, 0, 0],
36927
37239
  probe: [],
37240
+ sun: [],
37241
+ sunShadow: [],
37242
+ sunShadowMap: [],
37243
+ sunShadowMatrix: [],
37244
+ sunShadowCascade: [],
36928
37245
  directional: [],
36929
37246
  directionalShadow: [],
36930
37247
  directionalShadowMap: [],
@@ -36952,6 +37269,9 @@ function WebGLLights(extensions) {
36952
37269
  function setup(lights) {
36953
37270
  let r = 0, g = 0, b = 0;
36954
37271
  for (let i = 0; i < 9; i++) state.probe[i].set(0, 0, 0);
37272
+ let sunLength = 0;
37273
+ let numSunShadows = 0;
37274
+ let numSunShadowCascades = 0;
36955
37275
  let directionalLength = 0;
36956
37276
  let pointLength = 0;
36957
37277
  let spotLength = 0;
@@ -36986,6 +37306,29 @@ function WebGLLights(extensions) {
36986
37306
  state.probe[j].addScaledVector(light.sh.coefficients[j], intensity);
36987
37307
  }
36988
37308
  numLightProbes++;
37309
+ } else if (light.isSunLight) {
37310
+ const uniforms = cache.get(light);
37311
+ uniforms.color.copy(light.color).multiplyScalar(light.intensity);
37312
+ if (light.castShadow) {
37313
+ const shadow = light.shadow;
37314
+ const shadowUniforms = shadowCache.get(light);
37315
+ shadowUniforms.shadowIntensity = shadow.intensity;
37316
+ shadowUniforms.shadowBias = shadow.bias;
37317
+ shadowUniforms.shadowNormalBias = shadow.normalBias;
37318
+ shadowUniforms.shadowRadius = shadow.radius;
37319
+ shadowUniforms.shadowMapSize.copy(shadow.mapSize).multiply(shadow.getFrameExtents());
37320
+ state.sunShadow[numSunShadows] = shadowUniforms;
37321
+ state.sunShadowMap[numSunShadows] = shadowMap;
37322
+ const cascadeCount = shadow.getViewportCount();
37323
+ for (let j = 0; j < cascadeCount; j++) {
37324
+ state.sunShadowMatrix[numSunShadowCascades + j] = shadow.getMatrix(j);
37325
+ state.sunShadowCascade[numSunShadowCascades + j] = shadow._cascadeData[j];
37326
+ }
37327
+ numSunShadowCascades += cascadeCount;
37328
+ numSunShadows++;
37329
+ }
37330
+ state.sun[sunLength] = uniforms;
37331
+ sunLength++;
36989
37332
  } else if (light.isDirectionalLight) {
36990
37333
  const uniforms = cache.get(light);
36991
37334
  uniforms.color.copy(light.color).multiplyScalar(light.intensity);
@@ -37083,29 +37426,36 @@ function WebGLLights(extensions) {
37083
37426
  state.ambient[1] = g;
37084
37427
  state.ambient[2] = b;
37085
37428
  const hash = state.hash;
37086
- if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows || hash.numSpotMaps !== numSpotMaps || hash.numLightProbes !== numLightProbes) {
37429
+ if (hash.sunLength !== sunLength || hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numSunShadows !== numSunShadows || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows || hash.numSpotMaps !== numSpotMaps || hash.numLightProbes !== numLightProbes) {
37430
+ state.sun.length = sunLength;
37087
37431
  state.directional.length = directionalLength;
37088
37432
  state.spot.length = spotLength;
37089
37433
  state.rectArea.length = rectAreaLength;
37090
37434
  state.point.length = pointLength;
37091
37435
  state.hemi.length = hemiLength;
37436
+ state.sunShadow.length = numSunShadows;
37437
+ state.sunShadowMap.length = numSunShadows;
37438
+ state.sunShadowMatrix.length = numSunShadowCascades;
37439
+ state.sunShadowCascade.length = numSunShadowCascades;
37092
37440
  state.directionalShadow.length = numDirectionalShadows;
37093
37441
  state.directionalShadowMap.length = numDirectionalShadows;
37442
+ state.directionalShadowMatrix.length = numDirectionalShadows;
37094
37443
  state.pointShadow.length = numPointShadows;
37095
37444
  state.pointShadowMap.length = numPointShadows;
37445
+ state.pointShadowMatrix.length = numPointShadows;
37096
37446
  state.spotShadow.length = numSpotShadows;
37097
37447
  state.spotShadowMap.length = numSpotShadows;
37098
- state.directionalShadowMatrix.length = numDirectionalShadows;
37099
- state.pointShadowMatrix.length = numPointShadows;
37100
37448
  state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;
37101
37449
  state.spotLightMap.length = numSpotMaps;
37102
37450
  state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;
37103
37451
  state.numLightProbes = numLightProbes;
37452
+ hash.sunLength = sunLength;
37104
37453
  hash.directionalLength = directionalLength;
37105
37454
  hash.pointLength = pointLength;
37106
37455
  hash.spotLength = spotLength;
37107
37456
  hash.rectAreaLength = rectAreaLength;
37108
37457
  hash.hemiLength = hemiLength;
37458
+ hash.numSunShadows = numSunShadows;
37109
37459
  hash.numDirectionalShadows = numDirectionalShadows;
37110
37460
  hash.numPointShadows = numPointShadows;
37111
37461
  hash.numSpotShadows = numSpotShadows;
@@ -37115,6 +37465,7 @@ function WebGLLights(extensions) {
37115
37465
  }
37116
37466
  }
37117
37467
  function setupView(lights, camera) {
37468
+ let sunLength = 0;
37118
37469
  let directionalLength = 0;
37119
37470
  let pointLength = 0;
37120
37471
  let spotLength = 0;
@@ -37123,7 +37474,12 @@ function WebGLLights(extensions) {
37123
37474
  const viewMatrix = camera.matrixWorldInverse;
37124
37475
  for (let i = 0, l = lights.length; i < l; i++) {
37125
37476
  const light = lights[i];
37126
- if (light.isDirectionalLight) {
37477
+ if (light.isSunLight) {
37478
+ const uniforms = state.sun[sunLength];
37479
+ uniforms.direction.setFromMatrixPosition(light.matrixWorld);
37480
+ uniforms.direction.transformDirection(viewMatrix);
37481
+ sunLength++;
37482
+ } else if (light.isDirectionalLight) {
37127
37483
  const uniforms = state.directional[directionalLength];
37128
37484
  uniforms.direction.setFromMatrixPosition(light.matrixWorld);
37129
37485
  vector3.setFromMatrixPosition(light.target.matrixWorld);
@@ -37301,7 +37657,7 @@ function WebGLShadowMap(renderer, objects, capabilities) {
37301
37657
  if (scope.autoUpdate === false && scope.needsUpdate === false) return;
37302
37658
  if (lights.length === 0) return;
37303
37659
  if (this.type === PCFSoftShadowMap) {
37304
- warn("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead.");
37660
+ warn("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead.");
37305
37661
  this.type = PCFShadowMap;
37306
37662
  }
37307
37663
  const currentRenderTarget = renderer.getRenderTarget();
@@ -37403,25 +37759,13 @@ function WebGLShadowMap(renderer, objects, capabilities) {
37403
37759
  }
37404
37760
  shadow.camera.updateProjectionMatrix();
37405
37761
  }
37406
- const faceCount = shadow.map.isWebGLCubeRenderTarget ? 6 : 1;
37762
+ if (shadow.map.isWebGLCubeRenderTarget !== true && (shadow.map.width !== _shadowMapSize.x || shadow.map.height !== _shadowMapSize.y)) {
37763
+ shadow.map.setSize(_shadowMapSize.x, _shadowMapSize.y);
37764
+ }
37765
+ const faceCount = shadow.map.isWebGLCubeRenderTarget ? 6 : shadow.getViewportCount();
37766
+ if (light.isPointLight !== true) shadow.updateMatrices(light, camera);
37407
37767
  for (let face = 0; face < faceCount; face++) {
37408
- if (shadow.map.isWebGLCubeRenderTarget) {
37409
- renderer.setRenderTarget(shadow.map, face);
37410
- renderer.clear();
37411
- } else {
37412
- if (face === 0) {
37413
- renderer.setRenderTarget(shadow.map);
37414
- renderer.clear();
37415
- }
37416
- const viewport = shadow.getViewport(face);
37417
- _viewport.set(
37418
- _viewportSize.x * viewport.x,
37419
- _viewportSize.y * viewport.y,
37420
- _viewportSize.x * viewport.z,
37421
- _viewportSize.y * viewport.w
37422
- );
37423
- _state.viewport(_viewport);
37424
- }
37768
+ const shadowCamera = shadow.getCamera(face);
37425
37769
  if (light.isPointLight) {
37426
37770
  const camera2 = shadow.camera;
37427
37771
  const shadowMatrix = shadow.matrix;
@@ -37440,11 +37784,26 @@ function WebGLShadowMap(renderer, objects, capabilities) {
37440
37784
  shadowMatrix.makeTranslation(-_lightPositionWorld2.x, -_lightPositionWorld2.y, -_lightPositionWorld2.z);
37441
37785
  _projScreenMatrix2.multiplyMatrices(camera2.projectionMatrix, camera2.matrixWorldInverse);
37442
37786
  shadow._frustum.setFromProjectionMatrix(_projScreenMatrix2, camera2.coordinateSystem, camera2.reversedDepth);
37787
+ }
37788
+ if (shadow.map.isWebGLCubeRenderTarget) {
37789
+ renderer.setRenderTarget(shadow.map, face);
37790
+ renderer.clear();
37443
37791
  } else {
37444
- shadow.updateMatrices(light);
37792
+ if (face === 0) {
37793
+ renderer.setRenderTarget(shadow.map);
37794
+ renderer.clear();
37795
+ }
37796
+ const viewport = shadow.getViewport(face);
37797
+ _viewport.set(
37798
+ _viewportSize.x * viewport.x,
37799
+ _viewportSize.y * viewport.y,
37800
+ _viewportSize.x * viewport.z,
37801
+ _viewportSize.y * viewport.w
37802
+ );
37803
+ _state.viewport(_viewport);
37445
37804
  }
37446
- _frustum2 = shadow.getFrustum();
37447
- renderObject(scene, camera, shadow.camera, light, this.type);
37805
+ _frustum2 = shadow.getFrustum(face);
37806
+ renderObject(scene, camera, shadowCamera, light, this.type);
37448
37807
  }
37449
37808
  if (shadow.isPointLightShadow !== true && this.type === VSMShadowMap) {
37450
37809
  VSMPass(shadow, camera);
@@ -37468,15 +37827,17 @@ function WebGLShadowMap(renderer, objects, capabilities) {
37468
37827
  format: RGFormat,
37469
37828
  type: HalfFloatType
37470
37829
  });
37830
+ } else if (shadow.mapPass.width !== shadow.map.width || shadow.mapPass.height !== shadow.map.height) {
37831
+ shadow.mapPass.setSize(shadow.map.width, shadow.map.height);
37471
37832
  }
37472
37833
  shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.depthTexture;
37473
- shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;
37834
+ shadowMaterialVertical.uniforms.resolution.value.set(shadow.map.width, shadow.map.height);
37474
37835
  shadowMaterialVertical.uniforms.radius.value = shadow.radius;
37475
37836
  renderer.setRenderTarget(shadow.mapPass);
37476
37837
  renderer.clear();
37477
37838
  renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null);
37478
37839
  shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;
37479
- shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;
37840
+ shadowMaterialHorizontal.uniforms.resolution.value.set(shadow.map.width, shadow.map.height);
37480
37841
  shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;
37481
37842
  renderer.setRenderTarget(shadow.map);
37482
37843
  renderer.clear();
@@ -37533,7 +37894,7 @@ function WebGLShadowMap(renderer, objects, capabilities) {
37533
37894
  if (object.visible === false) return;
37534
37895
  const visible = object.layers.test(camera.layers);
37535
37896
  if (visible && (object.isMesh || object.isLine || object.isPoints)) {
37536
- if ((object.castShadow || object.receiveShadow && type === VSMShadowMap) && (!object.frustumCulled || _frustum2.intersectsObject(object))) {
37897
+ if ((object.castShadow || object.receiveShadow && type === VSMShadowMap) && (!object.frustumCulled || object.intersectsFrustum(_frustum2))) {
37537
37898
  object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse, object.matrixWorld);
37538
37899
  const geometry = objects.update(object);
37539
37900
  const material = object.material;
@@ -38622,7 +38983,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38622
38983
  function allocateTextureUnit() {
38623
38984
  const textureUnit = textureUnits;
38624
38985
  if (textureUnit >= capabilities.maxTextures) {
38625
- warn("WebGLTextures: Trying to use " + textureUnit + " texture units while this GPU supports only " + capabilities.maxTextures);
38986
+ warn("WebGLTextures: Trying to use " + (textureUnit + 1) + " texture units while this GPU supports only " + capabilities.maxTextures);
38626
38987
  }
38627
38988
  textureUnits += 1;
38628
38989
  return textureUnit;
@@ -38912,7 +39273,6 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38912
39273
  );
38913
39274
  state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData);
38914
39275
  }
38915
- texture.clearLayerUpdates();
38916
39276
  } else {
38917
39277
  state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data);
38918
39278
  }
@@ -38933,6 +39293,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
38933
39293
  }
38934
39294
  }
38935
39295
  }
39296
+ if (texture.layerUpdates.size > 0) texture.clearLayerUpdates();
38936
39297
  } else {
38937
39298
  if (useTexStorage && allocateMemory) {
38938
39299
  state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
@@ -39569,7 +39930,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
39569
39930
  invalidationArrayRead.length = 0;
39570
39931
  invalidationArrayDraw.length = 0;
39571
39932
  invalidationArrayRead.push(_gl.COLOR_ATTACHMENT0 + i);
39572
- if (renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false) {
39933
+ if (renderTarget.depthBuffer && renderTarget.storeMultisampledDepthBuffer === false) {
39573
39934
  invalidationArrayRead.push(depthStyle);
39574
39935
  invalidationArrayDraw.push(depthStyle);
39575
39936
  _gl.invalidateFramebuffer(_gl.DRAW_FRAMEBUFFER, invalidationArrayDraw);
@@ -39590,7 +39951,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
39590
39951
  }
39591
39952
  state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);
39592
39953
  } else {
39593
- if (renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false && supportsInvalidateFramebuffer) {
39954
+ if (renderTarget.depthBuffer && renderTarget.storeMultisampledDepthBuffer === false && supportsInvalidateFramebuffer) {
39594
39955
  const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
39595
39956
  _gl.invalidateFramebuffer(_gl.DRAW_FRAMEBUFFER, [depthStyle]);
39596
39957
  }
@@ -39902,6 +40263,7 @@ var WebXRManager = class extends EventDispatcher {
39902
40263
  const controllerInputSources = [];
39903
40264
  const currentSize = new Vector2();
39904
40265
  let currentPixelRatio = null;
40266
+ let currentCameraSettings = null;
39905
40267
  const cameraL = new PerspectiveCamera();
39906
40268
  cameraL.viewport = new Vector4();
39907
40269
  const cameraR = new PerspectiveCamera();
@@ -39979,6 +40341,13 @@ var WebXRManager = class extends EventDispatcher {
39979
40341
  scope.isPresenting = false;
39980
40342
  renderer.setPixelRatio(currentPixelRatio);
39981
40343
  renderer.setSize(currentSize.width, currentSize.height, false);
40344
+ if (currentCameraSettings !== null) {
40345
+ const camera = currentCameraSettings.camera;
40346
+ camera.fov = currentCameraSettings.fov;
40347
+ camera.zoom = currentCameraSettings.zoom;
40348
+ camera.updateProjectionMatrix();
40349
+ currentCameraSettings = null;
40350
+ }
39982
40351
  scope.dispatchEvent({ type: "sessionend" });
39983
40352
  }
39984
40353
  this.setFramebufferScaleFactor = function(value) {
@@ -40053,7 +40422,9 @@ var WebXRManager = class extends EventDispatcher {
40053
40422
  colorSpace: renderer.outputColorSpace,
40054
40423
  stencilBuffer: attributes.stencil,
40055
40424
  resolveDepthBuffer: glBaseLayer.ignoreDepthValues === false,
40056
- resolveStencilBuffer: glBaseLayer.ignoreDepthValues === false
40425
+ resolveStencilBuffer: glBaseLayer.ignoreDepthValues === false,
40426
+ storeMultisampledDepthBuffer: glBaseLayer.ignoreDepthValues === false,
40427
+ storeMultisampledStencilBuffer: glBaseLayer.ignoreDepthValues === false
40057
40428
  }
40058
40429
  );
40059
40430
  } else {
@@ -40086,7 +40457,9 @@ var WebXRManager = class extends EventDispatcher {
40086
40457
  colorSpace: renderer.outputColorSpace,
40087
40458
  samples: attributes.antialias ? 4 : 0,
40088
40459
  resolveDepthBuffer: glProjLayer.ignoreDepthValues === false,
40089
- resolveStencilBuffer: glProjLayer.ignoreDepthValues === false
40460
+ resolveStencilBuffer: glProjLayer.ignoreDepthValues === false,
40461
+ storeMultisampledDepthBuffer: glProjLayer.ignoreDepthValues === false,
40462
+ storeMultisampledStencilBuffer: glProjLayer.ignoreDepthValues === false
40090
40463
  }
40091
40464
  );
40092
40465
  }
@@ -40217,6 +40590,9 @@ var WebXRManager = class extends EventDispatcher {
40217
40590
  } else {
40218
40591
  cameraXR.projectionMatrix.copy(cameraL.projectionMatrix);
40219
40592
  }
40593
+ if (currentCameraSettings === null && camera.isPerspectiveCamera) {
40594
+ currentCameraSettings = { camera, fov: camera.fov, zoom: camera.zoom };
40595
+ }
40220
40596
  updateUserCamera(camera, cameraXR, parent);
40221
40597
  };
40222
40598
  function updateUserCamera(camera, cameraXR2, parent) {
@@ -40614,6 +40990,9 @@ function WebGLMaterials(renderer, properties) {
40614
40990
  if (material.dispersion > 0) {
40615
40991
  uniforms.dispersion.value = material.dispersion;
40616
40992
  }
40993
+ if (material.retroreflectivity > 0) {
40994
+ uniforms.retroreflectivity.value = material.retroreflectivity;
40995
+ }
40617
40996
  if (material.iridescence > 0) {
40618
40997
  uniforms.iridescence.value = material.iridescence;
40619
40998
  uniforms.iridescenceIOR.value = material.iridescenceIOR;
@@ -41491,6 +41870,14 @@ var WebGLRenderer = class {
41491
41870
  * @type {boolean}
41492
41871
  */
41493
41872
  checkShaderErrors: true,
41873
+ /**
41874
+ * Diagnostics configuration for the shader generation. Only relevant for TSL.
41875
+ * @type {Object}
41876
+ * @property {boolean} keywords - Whether declaration names that collide with reserved keywords of the shading language should be renamed or not.
41877
+ */
41878
+ diagnostics: {
41879
+ keywords: false
41880
+ },
41494
41881
  /**
41495
41882
  * Callback for custom error reporting.
41496
41883
  * @type {?Function}
@@ -41547,6 +41934,11 @@ var WebGLRenderer = class {
41547
41934
  function getContext(contextName, contextAttributes) {
41548
41935
  return canvas.getContext(contextName, contextAttributes);
41549
41936
  }
41937
+ let extensions, capabilities, state, info;
41938
+ let properties, textures, environments, attributes, geometries, objects;
41939
+ let programCache, materials, renderLists, renderStates, clipping, shadowMap;
41940
+ let background, morphtargets, bufferRenderer, indexedBufferRenderer;
41941
+ let utils, bindingStates, uniformsGroups;
41550
41942
  try {
41551
41943
  const contextAttributes = {
41552
41944
  alpha: true,
@@ -41573,15 +41965,14 @@ var WebGLRenderer = class {
41573
41965
  }
41574
41966
  }
41575
41967
  }
41968
+ initGLContext();
41576
41969
  } catch (e) {
41970
+ canvas.removeEventListener("webglcontextlost", onContextLost, false);
41971
+ canvas.removeEventListener("webglcontextrestored", onContextRestore, false);
41972
+ canvas.removeEventListener("webglcontextcreationerror", onContextCreationError, false);
41577
41973
  error("WebGLRenderer: " + e.message);
41578
41974
  throw e;
41579
41975
  }
41580
- let extensions, capabilities, state, info;
41581
- let properties, textures, environments, attributes, geometries, objects;
41582
- let programCache, materials, renderLists, renderStates, clipping, shadowMap;
41583
- let background, morphtargets, bufferRenderer, indexedBufferRenderer;
41584
- let utils, bindingStates, uniformsGroups;
41585
41976
  function initGLContext() {
41586
41977
  extensions = new WebGLExtensions(_gl);
41587
41978
  extensions.init();
@@ -41622,7 +42013,6 @@ var WebGLRenderer = class {
41622
42013
  _this.state = state;
41623
42014
  _this.info = info;
41624
42015
  }
41625
- initGLContext();
41626
42016
  if (_outputBufferType !== UnsignedByteType) {
41627
42017
  output = new WebGLOutput(_outputBufferType, canvas.width, canvas.height, antialias, depth, stencil);
41628
42018
  }
@@ -41949,7 +42339,9 @@ var WebGLRenderer = class {
41949
42339
  renderer.render(drawStart, drawCount);
41950
42340
  }
41951
42341
  };
41952
- function prepareMaterial(material, scene, object) {
42342
+ function prepareMaterial(material, scene, camera, object) {
42343
+ if (_nodesHandler !== null && material.isNodeMaterial) _nodesHandler.setObject(object, material);
42344
+ if (_clippingEnabled === true) clipping.setState(material, camera, false);
41953
42345
  if (material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false) {
41954
42346
  material.side = BackSide;
41955
42347
  material.needsUpdate = true;
@@ -41964,6 +42356,7 @@ var WebGLRenderer = class {
41964
42356
  }
41965
42357
  this.compile = function(scene, camera, targetScene = null) {
41966
42358
  if (targetScene === null) targetScene = scene;
42359
+ if (_nodesHandler !== null) _nodesHandler.renderStart(scene, camera, targetScene);
41967
42360
  currentRenderState = renderStates.get(targetScene);
41968
42361
  currentRenderState.init(camera);
41969
42362
  renderStateStack.push(currentRenderState);
@@ -41986,6 +42379,11 @@ var WebGLRenderer = class {
41986
42379
  });
41987
42380
  }
41988
42381
  currentRenderState.setupLights();
42382
+ if (_nodesHandler !== null) _nodesHandler.updateLights(currentRenderState.state.lightsArray);
42383
+ _localClippingEnabled = this.localClippingEnabled;
42384
+ _clippingEnabled = clipping.init(this.clippingPlanes, _localClippingEnabled);
42385
+ if (_clippingEnabled === true) clipping.setGlobalState(this.clippingPlanes, camera);
42386
+ if (_nodesHandler !== null) shadowMap.render(currentRenderState.state.shadowsArray, targetScene, camera);
41989
42387
  const materials2 = /* @__PURE__ */ new Set();
41990
42388
  scene.traverse(function(object) {
41991
42389
  if (!(object.isMesh || object.isPoints || object.isLine || object.isSprite)) {
@@ -41996,16 +42394,17 @@ var WebGLRenderer = class {
41996
42394
  if (Array.isArray(material)) {
41997
42395
  for (let i = 0; i < material.length; i++) {
41998
42396
  const material2 = material[i];
41999
- prepareMaterial(material2, targetScene, object);
42397
+ prepareMaterial(material2, targetScene, camera, object);
42000
42398
  materials2.add(material2);
42001
42399
  }
42002
42400
  } else {
42003
- prepareMaterial(material, targetScene, object);
42401
+ prepareMaterial(material, targetScene, camera, object);
42004
42402
  materials2.add(material);
42005
42403
  }
42006
42404
  }
42007
42405
  });
42008
42406
  currentRenderState = renderStateStack.pop();
42407
+ if (_nodesHandler !== null) _nodesHandler.renderEnd();
42009
42408
  return materials2;
42010
42409
  };
42011
42410
  this.compileAsync = function(scene, camera, targetScene = null) {
@@ -42015,7 +42414,7 @@ var WebGLRenderer = class {
42015
42414
  materials2.forEach(function(material) {
42016
42415
  const materialProperties = properties.get(material);
42017
42416
  const program = materialProperties.currentProgram;
42018
- if (program.isReady()) {
42417
+ if (program === void 0 || program.isReady()) {
42019
42418
  materials2.delete(material);
42020
42419
  }
42021
42420
  });
@@ -42089,8 +42488,9 @@ var WebGLRenderer = class {
42089
42488
  }
42090
42489
  projectObject(scene, camera, 0, _this.sortObjects);
42091
42490
  currentRenderList.finish();
42491
+ if (_nodesHandler !== null) _nodesHandler.updateLights(currentRenderState.state.lightsArray);
42092
42492
  if (_this.sortObjects === true) {
42093
- currentRenderList.sort(_opaqueSort, _transparentSort, camera.reversedDepth);
42493
+ currentRenderList.sort(_opaqueSort, _transparentSort);
42094
42494
  }
42095
42495
  _renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;
42096
42496
  if (_renderBackground) {
@@ -42171,18 +42571,18 @@ var WebGLRenderer = class {
42171
42571
  currentRenderState.pushShadow(object);
42172
42572
  }
42173
42573
  } else if (object.isSprite) {
42174
- if (!object.frustumCulled || _frustum2.intersectsSprite(object)) {
42574
+ if (!object.frustumCulled || object.intersectsFrustum(_frustum2)) {
42175
42575
  if (sortObjects) {
42176
42576
  _vector42.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix3);
42177
42577
  }
42178
42578
  const geometry = objects.update(object);
42179
42579
  const material = object.material;
42180
42580
  if (material.visible) {
42181
- currentRenderList.push(object, geometry, material, groupOrder, _vector42.z, null);
42581
+ currentRenderList.push(object, geometry, material, groupOrder, _vector42.z, null, camera);
42182
42582
  }
42183
42583
  }
42184
42584
  } else if (object.isMesh || object.isLine || object.isPoints) {
42185
- if (!object.frustumCulled || _frustum2.intersectsObject(object)) {
42585
+ if (!object.frustumCulled || object.intersectsFrustum(_frustum2)) {
42186
42586
  const geometry = objects.update(object);
42187
42587
  const material = object.material;
42188
42588
  if (sortObjects) {
@@ -42201,11 +42601,11 @@ var WebGLRenderer = class {
42201
42601
  const group = groups[i];
42202
42602
  const groupMaterial = material[group.materialIndex];
42203
42603
  if (groupMaterial && groupMaterial.visible) {
42204
- currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector42.z, group);
42604
+ currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector42.z, group, camera);
42205
42605
  }
42206
42606
  }
42207
42607
  } else if (material.visible) {
42208
- currentRenderList.push(object, geometry, material, groupOrder, _vector42.z, null);
42608
+ currentRenderList.push(object, geometry, material, groupOrder, _vector42.z, null, camera);
42209
42609
  }
42210
42610
  }
42211
42611
  }
@@ -42244,6 +42644,8 @@ var WebGLRenderer = class {
42244
42644
  stencilBuffer: stencil,
42245
42645
  resolveDepthBuffer: false,
42246
42646
  resolveStencilBuffer: false,
42647
+ storeMultisampledDepthBuffer: false,
42648
+ storeMultisampledStencilBuffer: false,
42247
42649
  colorSpace: ColorManagement.workingColorSpace
42248
42650
  });
42249
42651
  }
@@ -42308,6 +42710,7 @@ var WebGLRenderer = class {
42308
42710
  }
42309
42711
  }
42310
42712
  function renderObject(object, scene, camera, geometry, material, group) {
42713
+ if (_nodesHandler !== null && material.isNodeMaterial) _nodesHandler.setObject(object, material);
42311
42714
  object.onBeforeRender(_this, scene, camera, geometry, material, group);
42312
42715
  object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld);
42313
42716
  object.normalMatrix.getNormalMatrix(object.modelViewMatrix);
@@ -42370,6 +42773,8 @@ var WebGLRenderer = class {
42370
42773
  if (materialProperties.needsLights) {
42371
42774
  uniforms.ambientLightColor.value = lights.state.ambient;
42372
42775
  uniforms.lightProbe.value = lights.state.probe;
42776
+ uniforms.sunLights.value = lights.state.sun;
42777
+ uniforms.sunLightShadows.value = lights.state.sunShadow;
42373
42778
  uniforms.directionalLights.value = lights.state.directional;
42374
42779
  uniforms.directionalLightShadows.value = lights.state.directionalShadow;
42375
42780
  uniforms.spotLights.value = lights.state.spot;
@@ -42380,6 +42785,8 @@ var WebGLRenderer = class {
42380
42785
  uniforms.pointLights.value = lights.state.point;
42381
42786
  uniforms.pointLightShadows.value = lights.state.pointShadow;
42382
42787
  uniforms.hemisphereLights.value = lights.state.hemi;
42788
+ uniforms.sunShadowMatrix.value = lights.state.sunShadowMatrix;
42789
+ uniforms.sunShadowCascade.value = lights.state.sunShadowCascade;
42383
42790
  uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;
42384
42791
  uniforms.spotLightMatrix.value = lights.state.spotLightMatrix;
42385
42792
  uniforms.spotLightMap.value = lights.state.spotLightMap;
@@ -42467,9 +42874,9 @@ var WebGLRenderer = class {
42467
42874
  needsProgramChange = true;
42468
42875
  } else if (!object.isBatchedMesh && materialProperties.batching === true) {
42469
42876
  needsProgramChange = true;
42470
- } else if (object.isBatchedMesh && materialProperties.batchingColor === true && object.colorTexture === null) {
42877
+ } else if (object.isBatchedMesh && materialProperties.batchingColor === true && object._colorsTexture === null) {
42471
42878
  needsProgramChange = true;
42472
- } else if (object.isBatchedMesh && materialProperties.batchingColor === false && object.colorTexture !== null) {
42879
+ } else if (object.isBatchedMesh && materialProperties.batchingColor === false && object._colorsTexture !== null) {
42473
42880
  needsProgramChange = true;
42474
42881
  } else if (object.isInstancedMesh && materialProperties.instancing === false) {
42475
42882
  needsProgramChange = true;
@@ -42570,6 +42977,9 @@ var WebGLRenderer = class {
42570
42977
  }
42571
42978
  }
42572
42979
  if (materialProperties.needsLights) {
42980
+ if (lights.state.sunShadowMap.length > 0) {
42981
+ p_uniforms.setValue(_gl, "sunShadowMap", lights.state.sunShadowMap, textures);
42982
+ }
42573
42983
  if (lights.state.directionalShadowMap.length > 0) {
42574
42984
  p_uniforms.setValue(_gl, "directionalShadowMap", lights.state.directionalShadowMap, textures);
42575
42985
  }
@@ -42654,6 +43064,8 @@ var WebGLRenderer = class {
42654
43064
  function markUniformsLightsNeedsUpdate(uniforms, value) {
42655
43065
  uniforms.ambientLightColor.needsUpdate = value;
42656
43066
  uniforms.lightProbe.needsUpdate = value;
43067
+ uniforms.sunLights.needsUpdate = value;
43068
+ uniforms.sunLightShadows.needsUpdate = value;
42657
43069
  uniforms.directionalLights.needsUpdate = value;
42658
43070
  uniforms.directionalLightShadows.needsUpdate = value;
42659
43071
  uniforms.pointLights.needsUpdate = value;
@@ -42776,6 +43188,16 @@ var WebGLRenderer = class {
42776
43188
  }
42777
43189
  _currentMaterialId = -1;
42778
43190
  };
43191
+ function getReadableState(texture) {
43192
+ const textureProperties = properties.get(texture);
43193
+ if (textureProperties.__readFormat !== texture.format || textureProperties.__readType !== texture.type) {
43194
+ textureProperties.__readFormat = texture.format;
43195
+ textureProperties.__readType = texture.type;
43196
+ textureProperties.__formatReadable = capabilities.textureFormatReadable(texture.format);
43197
+ textureProperties.__typeReadable = capabilities.textureTypeReadable(texture.type);
43198
+ }
43199
+ return textureProperties;
43200
+ }
42779
43201
  this.readRenderTargetPixels = function(renderTarget, x, y, width, height, buffer, activeCubeFaceIndex, textureIndex = 0) {
42780
43202
  if (!(renderTarget && renderTarget.isWebGLRenderTarget)) {
42781
43203
  error("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");
@@ -42792,11 +43214,12 @@ var WebGLRenderer = class {
42792
43214
  const textureFormat = texture.format;
42793
43215
  const textureType = texture.type;
42794
43216
  if (renderTarget.textures.length > 1) _gl.readBuffer(_gl.COLOR_ATTACHMENT0 + textureIndex);
42795
- if (!capabilities.textureFormatReadable(textureFormat)) {
43217
+ const readableState = getReadableState(texture);
43218
+ if (readableState.__formatReadable === false) {
42796
43219
  error("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");
42797
43220
  return;
42798
43221
  }
42799
- if (!capabilities.textureTypeReadable(textureType)) {
43222
+ if (readableState.__typeReadable === false) {
42800
43223
  error("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");
42801
43224
  return;
42802
43225
  }
@@ -42824,16 +43247,18 @@ var WebGLRenderer = class {
42824
43247
  const textureFormat = texture.format;
42825
43248
  const textureType = texture.type;
42826
43249
  if (renderTarget.textures.length > 1) _gl.readBuffer(_gl.COLOR_ATTACHMENT0 + textureIndex);
42827
- if (!capabilities.textureFormatReadable(textureFormat)) {
43250
+ const readableState = getReadableState(texture);
43251
+ if (readableState.__formatReadable === false) {
42828
43252
  throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");
42829
43253
  }
42830
- if (!capabilities.textureTypeReadable(textureType)) {
43254
+ if (readableState.__typeReadable === false) {
42831
43255
  throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");
42832
43256
  }
42833
43257
  const glBuffer = _gl.createBuffer();
42834
43258
  _gl.bindBuffer(_gl.PIXEL_PACK_BUFFER, glBuffer);
42835
43259
  _gl.bufferData(_gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ);
42836
43260
  _gl.readPixels(x, y, width, height, utils.convert(textureFormat), utils.convert(textureType), 0);
43261
+ _gl.bindBuffer(_gl.PIXEL_PACK_BUFFER, null);
42837
43262
  const currFramebuffer = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null;
42838
43263
  state.bindFramebuffer(_gl.FRAMEBUFFER, currFramebuffer);
42839
43264
  const sync = _gl.fenceSync(_gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
@@ -42841,6 +43266,7 @@ var WebGLRenderer = class {
42841
43266
  await probeAsync(_gl, sync, 4);
42842
43267
  _gl.bindBuffer(_gl.PIXEL_PACK_BUFFER, glBuffer);
42843
43268
  _gl.getBufferSubData(_gl.PIXEL_PACK_BUFFER, 0, buffer);
43269
+ _gl.bindBuffer(_gl.PIXEL_PACK_BUFFER, null);
42844
43270
  _gl.deleteBuffer(glBuffer);
42845
43271
  _gl.deleteSync(sync);
42846
43272
  return buffer;
@@ -43061,4 +43487,4 @@ three/build/three.module.js:
43061
43487
  *)
43062
43488
  */
43063
43489
 
43064
- export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, createCanvasElement, error, getConsoleFunction, log, setConsoleFunction, warn, warnOnce };
43490
+ export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, LightShadow, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderObjectRefreshType, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureSource, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, createCanvasElement, error, getConsoleFunction, log, setConsoleFunction, warn, warnOnce };