@xiping/react-components 1.0.19 → 1.0.21

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 (435) hide show
  1. package/dist/cjs/_virtual/generateBounds.js +1 -0
  2. package/dist/cjs/_virtual/generateCreateBody.js +1 -0
  3. package/dist/cjs/_virtual/generateCreateDragForce.js +1 -0
  4. package/dist/cjs/_virtual/generateCreateSpringForce.js +1 -0
  5. package/dist/cjs/_virtual/generateIntegrator.js +1 -0
  6. package/dist/cjs/_virtual/generateQuadTree.js +1 -0
  7. package/dist/cjs/_virtual/index.js +1 -0
  8. package/dist/cjs/_virtual/index2.js +1 -0
  9. package/dist/cjs/_virtual/index3.js +1 -0
  10. package/dist/cjs/_virtual/index4.js +1 -0
  11. package/dist/cjs/_virtual/index5.js +1 -0
  12. package/dist/cjs/_virtual/index6.js +1 -0
  13. package/dist/cjs/_virtual/index7.js +1 -0
  14. package/dist/cjs/_virtual/react-is.development.js +1 -0
  15. package/dist/cjs/_virtual/react-is.production.min.js +1 -0
  16. package/dist/cjs/components/confetti-button/index.d.ts +24 -0
  17. package/dist/cjs/components/confetti-button/index.js +1 -0
  18. package/dist/cjs/components/react-force-graph-3d/index.d.ts +1 -0
  19. package/dist/cjs/components/txt-editor/TxtEditor.js +1 -1
  20. package/dist/cjs/hooks/useStayTimeReport.d.ts +6 -0
  21. package/dist/cjs/hooks/useStayTimeReport.js +1 -0
  22. package/dist/cjs/index.d.ts +2 -0
  23. package/dist/cjs/index.js +1 -1
  24. package/dist/cjs/node_modules/.pnpm/3d-force-graph@1.78.2/node_modules/3d-force-graph/dist/3d-force-graph.js +28 -0
  25. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +1 -0
  26. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/construct.js +1 -0
  27. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js +1 -0
  28. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +1 -0
  29. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +1 -0
  30. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +1 -0
  31. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +1 -0
  32. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +1 -0
  33. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +1 -0
  34. package/dist/cjs/node_modules/.pnpm/@tweenjs_tween.js@25.0.0/node_modules/@tweenjs/tween.js/dist/tween.esm.js +1 -0
  35. package/dist/cjs/node_modules/.pnpm/accessor-fn@1.5.3/node_modules/accessor-fn/dist/accessor-fn.js +1 -0
  36. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/bowser.js +6 -0
  37. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/constants.js +1 -0
  38. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-browsers.js +1 -0
  39. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-engines.js +1 -0
  40. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-os.js +1 -0
  41. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-platforms.js +1 -0
  42. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser.js +1 -0
  43. package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/utils.js +1 -0
  44. package/dist/cjs/node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js +2 -0
  45. package/dist/cjs/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/max.js +1 -0
  46. package/dist/cjs/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/min.js +1 -0
  47. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/add.js +1 -0
  48. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/binarytree.js +1 -0
  49. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/cover.js +1 -0
  50. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/data.js +1 -0
  51. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/extent.js +1 -0
  52. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/find.js +1 -0
  53. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/half.js +1 -0
  54. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/remove.js +1 -0
  55. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/root.js +1 -0
  56. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/size.js +1 -0
  57. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/visit.js +1 -0
  58. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/visitAfter.js +1 -0
  59. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/x.js +1 -0
  60. package/dist/cjs/node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js +1 -0
  61. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/center.js +1 -0
  62. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/constant.js +1 -0
  63. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/jiggle.js +1 -0
  64. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/lcg.js +1 -0
  65. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/link.js +1 -0
  66. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/manyBody.js +1 -0
  67. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/radial.js +1 -0
  68. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/simulation.js +1 -0
  69. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/add.js +1 -0
  70. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/cover.js +1 -0
  71. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/data.js +1 -0
  72. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/extent.js +1 -0
  73. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/find.js +1 -0
  74. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/findAll.js +1 -0
  75. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/octant.js +1 -0
  76. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/octree.js +1 -0
  77. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/remove.js +1 -0
  78. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/root.js +1 -0
  79. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/size.js +1 -0
  80. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/visit.js +1 -0
  81. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/visitAfter.js +1 -0
  82. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/x.js +1 -0
  83. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/y.js +1 -0
  84. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/z.js +1 -0
  85. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/add.js +1 -0
  86. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/cover.js +1 -0
  87. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/data.js +1 -0
  88. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/extent.js +1 -0
  89. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/find.js +1 -0
  90. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/quad.js +1 -0
  91. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/quadtree.js +1 -0
  92. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/remove.js +1 -0
  93. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/root.js +1 -0
  94. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/size.js +1 -0
  95. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/visit.js +1 -0
  96. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/visitAfter.js +1 -0
  97. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/x.js +1 -0
  98. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/y.js +1 -0
  99. package/dist/cjs/node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Paired.js +1 -0
  100. package/dist/cjs/node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/colors.js +1 -0
  101. package/dist/cjs/node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/init.js +1 -0
  102. package/dist/cjs/node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js +1 -0
  103. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/array.js +1 -0
  104. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/constant.js +1 -0
  105. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/creator.js +1 -0
  106. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/matcher.js +1 -0
  107. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespace.js +1 -0
  108. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespaces.js +1 -0
  109. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/pointer.js +1 -0
  110. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/select.js +1 -0
  111. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/append.js +1 -0
  112. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/attr.js +1 -0
  113. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/call.js +1 -0
  114. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/classed.js +1 -0
  115. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/clone.js +1 -0
  116. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/data.js +1 -0
  117. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/datum.js +1 -0
  118. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/dispatch.js +1 -0
  119. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/each.js +1 -0
  120. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/empty.js +1 -0
  121. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/enter.js +1 -0
  122. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/exit.js +1 -0
  123. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/filter.js +1 -0
  124. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/html.js +1 -0
  125. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/index.js +1 -0
  126. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/insert.js +1 -0
  127. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/iterator.js +1 -0
  128. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/join.js +1 -0
  129. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/lower.js +1 -0
  130. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/merge.js +1 -0
  131. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/node.js +1 -0
  132. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/nodes.js +1 -0
  133. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/on.js +1 -0
  134. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/order.js +1 -0
  135. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/property.js +1 -0
  136. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/raise.js +1 -0
  137. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/remove.js +1 -0
  138. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/select.js +1 -0
  139. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectAll.js +1 -0
  140. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChild.js +1 -0
  141. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChildren.js +1 -0
  142. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/size.js +1 -0
  143. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sort.js +1 -0
  144. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sparse.js +1 -0
  145. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/style.js +1 -0
  146. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/text.js +1 -0
  147. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selector.js +1 -0
  148. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selectorAll.js +1 -0
  149. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/sourceEvent.js +1 -0
  150. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/window.js +1 -0
  151. package/dist/cjs/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js +1 -0
  152. package/dist/cjs/node_modules/.pnpm/data-bind-mapper@1.0.3/node_modules/data-bind-mapper/dist/data-bind-mapper.js +3 -0
  153. package/dist/cjs/node_modules/.pnpm/float-tooltip@1.7.5/node_modules/float-tooltip/dist/float-tooltip.js +13 -0
  154. package/dist/cjs/node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js +1 -0
  155. package/dist/cjs/node_modules/.pnpm/jerrypick@1.1.2/node_modules/jerrypick/dist/jerrypick.js +3 -0
  156. package/dist/cjs/node_modules/.pnpm/kapsule@1.16.3/node_modules/kapsule/dist/kapsule.js +2 -0
  157. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +1 -0
  158. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +1 -0
  159. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js +1 -0
  160. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +1 -0
  161. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +1 -0
  162. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +1 -0
  163. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +1 -0
  164. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js +1 -0
  165. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js +1 -0
  166. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +1 -0
  167. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js +1 -0
  168. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js +1 -0
  169. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/now.js +1 -0
  170. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js +1 -0
  171. package/dist/cjs/node_modules/.pnpm/ngraph.events@1.2.2/node_modules/ngraph.events/index.js +1 -0
  172. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/index.js +1 -0
  173. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/createPatternBuilder.js +2 -0
  174. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateBounds.js +55 -0
  175. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateBody.js +47 -0
  176. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateDragForce.js +9 -0
  177. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateSpringForce.js +33 -0
  178. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateIntegrator.js +35 -0
  179. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateQuadTree.js +325 -0
  180. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/getVariableName.js +1 -0
  181. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/createPhysicsSimulator.js +1 -0
  182. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/spring.js +1 -0
  183. package/dist/cjs/node_modules/.pnpm/ngraph.graph@20.0.1/node_modules/ngraph.graph/index.js +3 -0
  184. package/dist/cjs/node_modules/.pnpm/ngraph.merge@1.0.0/node_modules/ngraph.merge/index.js +1 -0
  185. package/dist/cjs/node_modules/.pnpm/ngraph.random@1.2.0/node_modules/ngraph.random/index.js +1 -0
  186. package/dist/cjs/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +5 -0
  187. package/dist/cjs/node_modules/.pnpm/polished@4.3.1/node_modules/polished/dist/polished.esm.js +149 -0
  188. package/dist/cjs/node_modules/.pnpm/preact@10.26.9/node_modules/preact/dist/preact.module.js +1 -0
  189. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/checkPropTypes.js +1 -0
  190. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js +1 -0
  191. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js +2 -0
  192. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -0
  193. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js +1 -0
  194. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/has.js +1 -0
  195. package/dist/cjs/node_modules/.pnpm/react-force-graph-3d@1.28.0_react@19.1.0/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +1 -0
  196. package/dist/cjs/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +8 -0
  197. package/dist/cjs/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +8 -0
  198. package/dist/cjs/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +1 -0
  199. package/dist/cjs/node_modules/.pnpm/react-kapsule@2.5.7_react@19.1.0/node_modules/react-kapsule/dist/react-kapsule.js +3 -0
  200. package/dist/cjs/node_modules/.pnpm/three-forcegraph@1.43.0_three@0.178.0/node_modules/three-forcegraph/dist/three-forcegraph.js +3 -0
  201. package/dist/cjs/node_modules/.pnpm/three-render-objects@1.40.3_three@0.178.0/node_modules/three-render-objects/dist/three-render-objects.js +18 -0
  202. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.core.js +44 -0
  203. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.module.js +3784 -0
  204. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +392 -0
  205. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/DragControls.js +1 -0
  206. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/FlyControls.js +1 -0
  207. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -0
  208. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/TrackballControls.js +1 -0
  209. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/EffectComposer.js +1 -0
  210. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/MaskPass.js +1 -0
  211. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/Pass.js +1 -0
  212. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/RenderPass.js +1 -0
  213. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +1 -0
  214. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/shaders/CopyShader.js +24 -0
  215. package/dist/cjs/node_modules/.pnpm/tinycolor2@1.6.0/node_modules/tinycolor2/esm/tinycolor.js +1 -0
  216. package/dist/cjs/react-components.css +1 -1
  217. package/dist/es/_virtual/generateBounds.js +4 -0
  218. package/dist/es/_virtual/generateCreateBody.js +4 -0
  219. package/dist/es/_virtual/generateCreateDragForce.js +4 -0
  220. package/dist/es/_virtual/generateCreateSpringForce.js +4 -0
  221. package/dist/es/_virtual/generateIntegrator.js +4 -0
  222. package/dist/es/_virtual/generateQuadTree.js +4 -0
  223. package/dist/es/_virtual/index.js +7 -0
  224. package/dist/es/_virtual/index2.js +4 -0
  225. package/dist/es/_virtual/index3.js +4 -0
  226. package/dist/es/_virtual/index4.js +7 -0
  227. package/dist/es/_virtual/index5.js +7 -0
  228. package/dist/es/_virtual/index6.js +4 -0
  229. package/dist/es/_virtual/index7.js +4 -0
  230. package/dist/es/_virtual/react-is.development.js +4 -0
  231. package/dist/es/_virtual/react-is.production.min.js +4 -0
  232. package/dist/es/components/confetti-button/index.d.ts +24 -0
  233. package/dist/es/components/confetti-button/index.js +77 -0
  234. package/dist/es/components/react-force-graph-3d/index.d.ts +1 -0
  235. package/dist/es/components/txt-editor/TxtEditor.js +1 -1
  236. package/dist/es/hooks/useStayTimeReport.d.ts +6 -0
  237. package/dist/es/hooks/useStayTimeReport.js +31 -0
  238. package/dist/es/index.d.ts +2 -0
  239. package/dist/es/index.js +31 -24
  240. package/dist/es/node_modules/.pnpm/3d-force-graph@1.78.2/node_modules/3d-force-graph/dist/3d-force-graph.js +398 -0
  241. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +7 -0
  242. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/construct.js +12 -0
  243. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
  244. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +8 -0
  245. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
  246. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +10 -0
  247. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +13 -0
  248. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
  249. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +29 -0
  250. package/dist/es/node_modules/.pnpm/@tweenjs_tween.js@25.0.0/node_modules/@tweenjs/tween.js/dist/tween.esm.js +396 -0
  251. package/dist/es/node_modules/.pnpm/accessor-fn@1.5.3/node_modules/accessor-fn/dist/accessor-fn.js +10 -0
  252. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/bowser.js +55 -0
  253. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/constants.js +113 -0
  254. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-browsers.js +404 -0
  255. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-engines.js +78 -0
  256. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-os.js +159 -0
  257. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-platforms.js +238 -0
  258. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser.js +303 -0
  259. package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/utils.js +280 -0
  260. package/dist/es/node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js +409 -0
  261. package/dist/es/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/max.js +15 -0
  262. package/dist/es/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/min.js +15 -0
  263. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/add.js +32 -0
  264. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/binarytree.js +48 -0
  265. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/cover.js +22 -0
  266. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/data.js +11 -0
  267. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/extent.js +6 -0
  268. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/find.js +20 -0
  269. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/half.js +6 -0
  270. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/remove.js +20 -0
  271. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/root.js +6 -0
  272. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/size.js +11 -0
  273. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/visit.js +13 -0
  274. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/visitAfter.js +18 -0
  275. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/x.js +10 -0
  276. package/dist/es/node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js +64 -0
  277. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/center.js +25 -0
  278. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/constant.js +8 -0
  279. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/jiggle.js +6 -0
  280. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/lcg.js +7 -0
  281. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/link.js +58 -0
  282. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/manyBody.js +58 -0
  283. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/radial.js +34 -0
  284. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/simulation.js +95 -0
  285. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/add.js +32 -0
  286. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/cover.js +40 -0
  287. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/data.js +11 -0
  288. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/extent.js +6 -0
  289. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/find.js +29 -0
  290. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/findAll.js +15 -0
  291. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/octant.js +6 -0
  292. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/octree.js +54 -0
  293. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/remove.js +20 -0
  294. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/root.js +6 -0
  295. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/size.js +11 -0
  296. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/visit.js +13 -0
  297. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/visitAfter.js +18 -0
  298. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/x.js +10 -0
  299. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/y.js +10 -0
  300. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/z.js +10 -0
  301. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/add.js +29 -0
  302. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/cover.js +28 -0
  303. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/data.js +11 -0
  304. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/extent.js +6 -0
  305. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/find.js +25 -0
  306. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/quad.js +6 -0
  307. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/quadtree.js +50 -0
  308. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/remove.js +20 -0
  309. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/root.js +6 -0
  310. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/size.js +11 -0
  311. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/visit.js +13 -0
  312. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/visitAfter.js +18 -0
  313. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/x.js +10 -0
  314. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/y.js +10 -0
  315. package/dist/es/node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Paired.js +5 -0
  316. package/dist/es/node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/colors.js +7 -0
  317. package/dist/es/node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/init.js +16 -0
  318. package/dist/es/node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js +31 -0
  319. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/array.js +6 -0
  320. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/constant.js +8 -0
  321. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/creator.js +20 -0
  322. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/matcher.js +14 -0
  323. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespace.js +8 -0
  324. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespaces.js +12 -0
  325. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/pointer.js +18 -0
  326. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/select.js +7 -0
  327. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/append.js +10 -0
  328. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/attr.js +44 -0
  329. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/call.js +7 -0
  330. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/classed.js +54 -0
  331. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/clone.js +14 -0
  332. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/data.js +42 -0
  333. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/datum.js +6 -0
  334. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/dispatch.js +21 -0
  335. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/each.js +9 -0
  336. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/empty.js +6 -0
  337. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/enter.js +27 -0
  338. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/exit.js +8 -0
  339. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/filter.js +12 -0
  340. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/html.js +20 -0
  341. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/index.js +83 -0
  342. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/insert.js +14 -0
  343. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/iterator.js +8 -0
  344. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/join.js +7 -0
  345. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/lower.js +9 -0
  346. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/merge.js +12 -0
  347. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/node.js +11 -0
  348. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/nodes.js +6 -0
  349. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/on.js +52 -0
  350. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/order.js +9 -0
  351. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/property.js +22 -0
  352. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/raise.js +9 -0
  353. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/remove.js +10 -0
  354. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/select.js +12 -0
  355. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectAll.js +18 -0
  356. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChild.js +16 -0
  357. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChildren.js +16 -0
  358. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/size.js +8 -0
  359. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sort.js +19 -0
  360. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sparse.js +6 -0
  361. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/style.js +27 -0
  362. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/text.js +20 -0
  363. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selector.js +10 -0
  364. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selectorAll.js +11 -0
  365. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/sourceEvent.js +8 -0
  366. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/window.js +6 -0
  367. package/dist/es/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js +62 -0
  368. package/dist/es/node_modules/.pnpm/data-bind-mapper@1.0.3/node_modules/data-bind-mapper/dist/data-bind-mapper.js +173 -0
  369. package/dist/es/node_modules/.pnpm/float-tooltip@1.7.5/node_modules/float-tooltip/dist/float-tooltip.js +169 -0
  370. package/dist/es/node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js +35 -0
  371. package/dist/es/node_modules/.pnpm/jerrypick@1.1.2/node_modules/jerrypick/dist/jerrypick.js +92 -0
  372. package/dist/es/node_modules/.pnpm/kapsule@1.16.3/node_modules/kapsule/dist/kapsule.js +113 -0
  373. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +5 -0
  374. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +10 -0
  375. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js +8 -0
  376. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +4 -0
  377. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +15 -0
  378. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +7 -0
  379. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +5 -0
  380. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js +9 -0
  381. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js +54 -0
  382. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +7 -0
  383. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js +6 -0
  384. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js +9 -0
  385. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/now.js +7 -0
  386. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js +22 -0
  387. package/dist/es/node_modules/.pnpm/ngraph.events@1.2.2/node_modules/ngraph.events/index.js +57 -0
  388. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/index.js +239 -0
  389. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/createPatternBuilder.js +22 -0
  390. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateBounds.js +74 -0
  391. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateBody.js +74 -0
  392. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateDragForce.js +28 -0
  393. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateSpringForce.js +53 -0
  394. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateIntegrator.js +55 -0
  395. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateQuadTree.js +403 -0
  396. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/getVariableName.js +9 -0
  397. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/createPhysicsSimulator.js +273 -0
  398. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/spring.js +12 -0
  399. package/dist/es/node_modules/.pnpm/ngraph.graph@20.0.1/node_modules/ngraph.graph/index.js +319 -0
  400. package/dist/es/node_modules/.pnpm/ngraph.merge@1.0.0/node_modules/ngraph.merge/index.js +20 -0
  401. package/dist/es/node_modules/.pnpm/ngraph.random@1.2.0/node_modules/ngraph.random/index.js +71 -0
  402. package/dist/es/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +54 -0
  403. package/dist/es/node_modules/.pnpm/polished@4.3.1/node_modules/polished/dist/polished.esm.js +717 -0
  404. package/dist/es/node_modules/.pnpm/preact@10.26.9/node_modules/preact/dist/preact.module.js +257 -0
  405. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/checkPropTypes.js +54 -0
  406. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js +52 -0
  407. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js +329 -0
  408. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +17 -0
  409. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js +10 -0
  410. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/has.js +7 -0
  411. package/dist/es/node_modules/.pnpm/react-force-graph-3d@1.28.0_react@19.1.0/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +148 -0
  412. package/dist/es/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +95 -0
  413. package/dist/es/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +78 -0
  414. package/dist/es/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +10 -0
  415. package/dist/es/node_modules/.pnpm/react-kapsule@2.5.7_react@19.1.0/node_modules/react-kapsule/dist/react-kapsule.js +113 -0
  416. package/dist/es/node_modules/.pnpm/three-forcegraph@1.43.0_three@0.178.0/node_modules/three-forcegraph/dist/three-forcegraph.js +1037 -0
  417. package/dist/es/node_modules/.pnpm/three-render-objects@1.40.3_three@0.178.0/node_modules/three-render-objects/dist/three-render-objects.js +453 -0
  418. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.core.js +13236 -0
  419. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.module.js +9725 -0
  420. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +24475 -0
  421. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/DragControls.js +116 -0
  422. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/FlyControls.js +188 -0
  423. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/OrbitControls.js +459 -0
  424. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/TrackballControls.js +223 -0
  425. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/EffectComposer.js +139 -0
  426. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/MaskPass.js +55 -0
  427. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/Pass.js +89 -0
  428. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/RenderPass.js +38 -0
  429. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +46 -0
  430. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/shaders/CopyShader.js +41 -0
  431. package/dist/es/node_modules/.pnpm/tinycolor2@1.6.0/node_modules/tinycolor2/esm/tinycolor.js +711 -0
  432. package/dist/es/react-components.css +1 -1
  433. package/package.json +29 -27
  434. /package/dist/cjs/node_modules/.pnpm/{@monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@18.3.1_react@18.3.1__react@18.3.1 → @monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@19.1.0_react@19.1.0__react@19.1.0}/node_modules/@monaco-editor/react/dist/index.js +0 -0
  435. /package/dist/es/node_modules/.pnpm/{@monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@18.3.1_react@18.3.1__react@18.3.1 → @monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@19.1.0_react@19.1.0__react@19.1.0}/node_modules/@monaco-editor/react/dist/index.js +0 -0
@@ -0,0 +1,3784 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./three.core.js");/**
2
+ * @license
3
+ * Copyright 2010-2025 Three.js Authors
4
+ * SPDX-License-Identifier: MIT
5
+ */function Sn(){let e=null,i=!1,n=null,r=null;function c(s,m){n(s,m),r=e.requestAnimationFrame(c)}return{start:function(){i!==!0&&n!==null&&(r=e.requestAnimationFrame(c),i=!0)},stop:function(){e.cancelAnimationFrame(r),i=!1},setAnimationLoop:function(s){n=s},setContext:function(s){e=s}}}function Un(e){const i=new WeakMap;function n(d,b){const T=d.array,w=d.usage,x=T.byteLength,S=e.createBuffer();e.bindBuffer(b,S),e.bufferData(b,T,w),d.onUploadCallback();let R;if(T instanceof Float32Array)R=e.FLOAT;else if(typeof Float16Array<"u"&&T instanceof Float16Array)R=e.HALF_FLOAT;else if(T instanceof Uint16Array)d.isFloat16BufferAttribute?R=e.HALF_FLOAT:R=e.UNSIGNED_SHORT;else if(T instanceof Int16Array)R=e.SHORT;else if(T instanceof Uint32Array)R=e.UNSIGNED_INT;else if(T instanceof Int32Array)R=e.INT;else if(T instanceof Int8Array)R=e.BYTE;else if(T instanceof Uint8Array)R=e.UNSIGNED_BYTE;else if(T instanceof Uint8ClampedArray)R=e.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+T);return{buffer:S,type:R,bytesPerElement:T.BYTES_PER_ELEMENT,version:d.version,size:x}}function r(d,b,T){const w=b.array,x=b.updateRanges;if(e.bindBuffer(T,d),x.length===0)e.bufferSubData(T,0,w);else{x.sort((R,F)=>R.start-F.start);let S=0;for(let R=1;R<x.length;R++){const F=x[S],D=x[R];D.start<=F.start+F.count+1?F.count=Math.max(F.count,D.start+D.count-F.start):(++S,x[S]=D)}x.length=S+1;for(let R=0,F=x.length;R<F;R++){const D=x[R];e.bufferSubData(T,D.start*w.BYTES_PER_ELEMENT,w,D.start,D.count)}b.clearUpdateRanges()}b.onUploadCallback()}function c(d){return d.isInterleavedBufferAttribute&&(d=d.data),i.get(d)}function s(d){d.isInterleavedBufferAttribute&&(d=d.data);const b=i.get(d);b&&(e.deleteBuffer(b.buffer),i.delete(d))}function m(d,b){if(d.isInterleavedBufferAttribute&&(d=d.data),d.isGLBufferAttribute){const w=i.get(d);(!w||w.version<d.version)&&i.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}const T=i.get(d);if(T===void 0)i.set(d,n(d,b));else if(T.version<d.version){if(T.size!==d.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");r(T.buffer,d,b),T.version=d.version}}return{get:c,remove:s,update:m}}var wn=`#ifdef USE_ALPHAHASH
6
+ if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
7
+ #endif`,In=`#ifdef USE_ALPHAHASH
8
+ const float ALPHA_HASH_SCALE = 0.05;
9
+ float hash2D( vec2 value ) {
10
+ return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
11
+ }
12
+ float hash3D( vec3 value ) {
13
+ return hash2D( vec2( hash2D( value.xy ), value.z ) );
14
+ }
15
+ float getAlphaHashThreshold( vec3 position ) {
16
+ float maxDeriv = max(
17
+ length( dFdx( position.xyz ) ),
18
+ length( dFdy( position.xyz ) )
19
+ );
20
+ float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
21
+ vec2 pixScales = vec2(
22
+ exp2( floor( log2( pixScale ) ) ),
23
+ exp2( ceil( log2( pixScale ) ) )
24
+ );
25
+ vec2 alpha = vec2(
26
+ hash3D( floor( pixScales.x * position.xyz ) ),
27
+ hash3D( floor( pixScales.y * position.xyz ) )
28
+ );
29
+ float lerpFactor = fract( log2( pixScale ) );
30
+ float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
31
+ float a = min( lerpFactor, 1.0 - lerpFactor );
32
+ vec3 cases = vec3(
33
+ x * x / ( 2.0 * a * ( 1.0 - a ) ),
34
+ ( x - 0.5 * a ) / ( 1.0 - a ),
35
+ 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
36
+ );
37
+ float threshold = ( x < ( 1.0 - a ) )
38
+ ? ( ( x < a ) ? cases.x : cases.y )
39
+ : cases.z;
40
+ return clamp( threshold , 1.0e-6, 1.0 );
41
+ }
42
+ #endif`,Nn=`#ifdef USE_ALPHAMAP
43
+ diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
44
+ #endif`,yn=`#ifdef USE_ALPHAMAP
45
+ uniform sampler2D alphaMap;
46
+ #endif`,Fn=`#ifdef USE_ALPHATEST
47
+ #ifdef ALPHA_TO_COVERAGE
48
+ diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
49
+ if ( diffuseColor.a == 0.0 ) discard;
50
+ #else
51
+ if ( diffuseColor.a < alphaTest ) discard;
52
+ #endif
53
+ #endif`,On=`#ifdef USE_ALPHATEST
54
+ uniform float alphaTest;
55
+ #endif`,Bn=`#ifdef USE_AOMAP
56
+ float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
57
+ reflectedLight.indirectDiffuse *= ambientOcclusion;
58
+ #if defined( USE_CLEARCOAT )
59
+ clearcoatSpecularIndirect *= ambientOcclusion;
60
+ #endif
61
+ #if defined( USE_SHEEN )
62
+ sheenSpecularIndirect *= ambientOcclusion;
63
+ #endif
64
+ #if defined( USE_ENVMAP ) && defined( STANDARD )
65
+ float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
66
+ reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
67
+ #endif
68
+ #endif`,Gn=`#ifdef USE_AOMAP
69
+ uniform sampler2D aoMap;
70
+ uniform float aoMapIntensity;
71
+ #endif`,Hn=`#ifdef USE_BATCHING
72
+ #if ! defined( GL_ANGLE_multi_draw )
73
+ #define gl_DrawID _gl_DrawID
74
+ uniform int _gl_DrawID;
75
+ #endif
76
+ uniform highp sampler2D batchingTexture;
77
+ uniform highp usampler2D batchingIdTexture;
78
+ mat4 getBatchingMatrix( const in float i ) {
79
+ int size = textureSize( batchingTexture, 0 ).x;
80
+ int j = int( i ) * 4;
81
+ int x = j % size;
82
+ int y = j / size;
83
+ vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
84
+ vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
85
+ vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
86
+ vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
87
+ return mat4( v1, v2, v3, v4 );
88
+ }
89
+ float getIndirectIndex( const in int i ) {
90
+ int size = textureSize( batchingIdTexture, 0 ).x;
91
+ int x = i % size;
92
+ int y = i / size;
93
+ return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
94
+ }
95
+ #endif
96
+ #ifdef USE_BATCHING_COLOR
97
+ uniform sampler2D batchingColorTexture;
98
+ vec3 getBatchingColor( const in float i ) {
99
+ int size = textureSize( batchingColorTexture, 0 ).x;
100
+ int j = int( i );
101
+ int x = j % size;
102
+ int y = j / size;
103
+ return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
104
+ }
105
+ #endif`,Vn=`#ifdef USE_BATCHING
106
+ mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
107
+ #endif`,kn=`vec3 transformed = vec3( position );
108
+ #ifdef USE_ALPHAHASH
109
+ vPosition = vec3( position );
110
+ #endif`,Wn=`vec3 objectNormal = vec3( normal );
111
+ #ifdef USE_TANGENT
112
+ vec3 objectTangent = vec3( tangent.xyz );
113
+ #endif`,zn=`float G_BlinnPhong_Implicit( ) {
114
+ return 0.25;
115
+ }
116
+ float D_BlinnPhong( const in float shininess, const in float dotNH ) {
117
+ return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
118
+ }
119
+ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
120
+ vec3 halfDir = normalize( lightDir + viewDir );
121
+ float dotNH = saturate( dot( normal, halfDir ) );
122
+ float dotVH = saturate( dot( viewDir, halfDir ) );
123
+ vec3 F = F_Schlick( specularColor, 1.0, dotVH );
124
+ float G = G_BlinnPhong_Implicit( );
125
+ float D = D_BlinnPhong( shininess, dotNH );
126
+ return F * ( G * D );
127
+ } // validated`,Xn=`#ifdef USE_IRIDESCENCE
128
+ const mat3 XYZ_TO_REC709 = mat3(
129
+ 3.2404542, -0.9692660, 0.0556434,
130
+ -1.5371385, 1.8760108, -0.2040259,
131
+ -0.4985314, 0.0415560, 1.0572252
132
+ );
133
+ vec3 Fresnel0ToIor( vec3 fresnel0 ) {
134
+ vec3 sqrtF0 = sqrt( fresnel0 );
135
+ return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
136
+ }
137
+ vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
138
+ return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
139
+ }
140
+ float IorToFresnel0( float transmittedIor, float incidentIor ) {
141
+ return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
142
+ }
143
+ vec3 evalSensitivity( float OPD, vec3 shift ) {
144
+ float phase = 2.0 * PI * OPD * 1.0e-9;
145
+ vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
146
+ vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
147
+ vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
148
+ vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
149
+ xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
150
+ xyz /= 1.0685e-7;
151
+ vec3 rgb = XYZ_TO_REC709 * xyz;
152
+ return rgb;
153
+ }
154
+ vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
155
+ vec3 I;
156
+ float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
157
+ float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
158
+ float cosTheta2Sq = 1.0 - sinTheta2Sq;
159
+ if ( cosTheta2Sq < 0.0 ) {
160
+ return vec3( 1.0 );
161
+ }
162
+ float cosTheta2 = sqrt( cosTheta2Sq );
163
+ float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
164
+ float R12 = F_Schlick( R0, 1.0, cosTheta1 );
165
+ float T121 = 1.0 - R12;
166
+ float phi12 = 0.0;
167
+ if ( iridescenceIOR < outsideIOR ) phi12 = PI;
168
+ float phi21 = PI - phi12;
169
+ vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
170
+ vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
171
+ vec3 phi23 = vec3( 0.0 );
172
+ if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
173
+ if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
174
+ if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
175
+ float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
176
+ vec3 phi = vec3( phi21 ) + phi23;
177
+ vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
178
+ vec3 r123 = sqrt( R123 );
179
+ vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
180
+ vec3 C0 = R12 + Rs;
181
+ I = C0;
182
+ vec3 Cm = Rs - T121;
183
+ for ( int m = 1; m <= 2; ++ m ) {
184
+ Cm *= r123;
185
+ vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
186
+ I += Cm * Sm;
187
+ }
188
+ return max( I, vec3( 0.0 ) );
189
+ }
190
+ #endif`,qn=`#ifdef USE_BUMPMAP
191
+ uniform sampler2D bumpMap;
192
+ uniform float bumpScale;
193
+ vec2 dHdxy_fwd() {
194
+ vec2 dSTdx = dFdx( vBumpMapUv );
195
+ vec2 dSTdy = dFdy( vBumpMapUv );
196
+ float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
197
+ float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
198
+ float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
199
+ return vec2( dBx, dBy );
200
+ }
201
+ vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
202
+ vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
203
+ vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
204
+ vec3 vN = surf_norm;
205
+ vec3 R1 = cross( vSigmaY, vN );
206
+ vec3 R2 = cross( vN, vSigmaX );
207
+ float fDet = dot( vSigmaX, R1 ) * faceDirection;
208
+ vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
209
+ return normalize( abs( fDet ) * surf_norm - vGrad );
210
+ }
211
+ #endif`,Yn=`#if NUM_CLIPPING_PLANES > 0
212
+ vec4 plane;
213
+ #ifdef ALPHA_TO_COVERAGE
214
+ float distanceToPlane, distanceGradient;
215
+ float clipOpacity = 1.0;
216
+ #pragma unroll_loop_start
217
+ for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
218
+ plane = clippingPlanes[ i ];
219
+ distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
220
+ distanceGradient = fwidth( distanceToPlane ) / 2.0;
221
+ clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
222
+ if ( clipOpacity == 0.0 ) discard;
223
+ }
224
+ #pragma unroll_loop_end
225
+ #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
226
+ float unionClipOpacity = 1.0;
227
+ #pragma unroll_loop_start
228
+ for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
229
+ plane = clippingPlanes[ i ];
230
+ distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
231
+ distanceGradient = fwidth( distanceToPlane ) / 2.0;
232
+ unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
233
+ }
234
+ #pragma unroll_loop_end
235
+ clipOpacity *= 1.0 - unionClipOpacity;
236
+ #endif
237
+ diffuseColor.a *= clipOpacity;
238
+ if ( diffuseColor.a == 0.0 ) discard;
239
+ #else
240
+ #pragma unroll_loop_start
241
+ for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
242
+ plane = clippingPlanes[ i ];
243
+ if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
244
+ }
245
+ #pragma unroll_loop_end
246
+ #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
247
+ bool clipped = true;
248
+ #pragma unroll_loop_start
249
+ for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
250
+ plane = clippingPlanes[ i ];
251
+ clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
252
+ }
253
+ #pragma unroll_loop_end
254
+ if ( clipped ) discard;
255
+ #endif
256
+ #endif
257
+ #endif`,Kn=`#if NUM_CLIPPING_PLANES > 0
258
+ varying vec3 vClipPosition;
259
+ uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
260
+ #endif`,$n=`#if NUM_CLIPPING_PLANES > 0
261
+ varying vec3 vClipPosition;
262
+ #endif`,Zn=`#if NUM_CLIPPING_PLANES > 0
263
+ vClipPosition = - mvPosition.xyz;
264
+ #endif`,Qn=`#if defined( USE_COLOR_ALPHA )
265
+ diffuseColor *= vColor;
266
+ #elif defined( USE_COLOR )
267
+ diffuseColor.rgb *= vColor;
268
+ #endif`,Jn=`#if defined( USE_COLOR_ALPHA )
269
+ varying vec4 vColor;
270
+ #elif defined( USE_COLOR )
271
+ varying vec3 vColor;
272
+ #endif`,jn=`#if defined( USE_COLOR_ALPHA )
273
+ varying vec4 vColor;
274
+ #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
275
+ varying vec3 vColor;
276
+ #endif`,ei=`#if defined( USE_COLOR_ALPHA )
277
+ vColor = vec4( 1.0 );
278
+ #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
279
+ vColor = vec3( 1.0 );
280
+ #endif
281
+ #ifdef USE_COLOR
282
+ vColor *= color;
283
+ #endif
284
+ #ifdef USE_INSTANCING_COLOR
285
+ vColor.xyz *= instanceColor.xyz;
286
+ #endif
287
+ #ifdef USE_BATCHING_COLOR
288
+ vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
289
+ vColor.xyz *= batchingColor.xyz;
290
+ #endif`,ti=`#define PI 3.141592653589793
291
+ #define PI2 6.283185307179586
292
+ #define PI_HALF 1.5707963267948966
293
+ #define RECIPROCAL_PI 0.3183098861837907
294
+ #define RECIPROCAL_PI2 0.15915494309189535
295
+ #define EPSILON 1e-6
296
+ #ifndef saturate
297
+ #define saturate( a ) clamp( a, 0.0, 1.0 )
298
+ #endif
299
+ #define whiteComplement( a ) ( 1.0 - saturate( a ) )
300
+ float pow2( const in float x ) { return x*x; }
301
+ vec3 pow2( const in vec3 x ) { return x*x; }
302
+ float pow3( const in float x ) { return x*x*x; }
303
+ float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
304
+ float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
305
+ float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
306
+ highp float rand( const in vec2 uv ) {
307
+ const highp float a = 12.9898, b = 78.233, c = 43758.5453;
308
+ highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
309
+ return fract( sin( sn ) * c );
310
+ }
311
+ #ifdef HIGH_PRECISION
312
+ float precisionSafeLength( vec3 v ) { return length( v ); }
313
+ #else
314
+ float precisionSafeLength( vec3 v ) {
315
+ float maxComponent = max3( abs( v ) );
316
+ return length( v / maxComponent ) * maxComponent;
317
+ }
318
+ #endif
319
+ struct IncidentLight {
320
+ vec3 color;
321
+ vec3 direction;
322
+ bool visible;
323
+ };
324
+ struct ReflectedLight {
325
+ vec3 directDiffuse;
326
+ vec3 directSpecular;
327
+ vec3 indirectDiffuse;
328
+ vec3 indirectSpecular;
329
+ };
330
+ #ifdef USE_ALPHAHASH
331
+ varying vec3 vPosition;
332
+ #endif
333
+ vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
334
+ return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
335
+ }
336
+ vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
337
+ return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
338
+ }
339
+ mat3 transposeMat3( const in mat3 m ) {
340
+ mat3 tmp;
341
+ tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
342
+ tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
343
+ tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
344
+ return tmp;
345
+ }
346
+ bool isPerspectiveMatrix( mat4 m ) {
347
+ return m[ 2 ][ 3 ] == - 1.0;
348
+ }
349
+ vec2 equirectUv( in vec3 dir ) {
350
+ float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
351
+ float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
352
+ return vec2( u, v );
353
+ }
354
+ vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
355
+ return RECIPROCAL_PI * diffuseColor;
356
+ }
357
+ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
358
+ float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
359
+ return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
360
+ }
361
+ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
362
+ float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
363
+ return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
364
+ } // validated`,ni=`#ifdef ENVMAP_TYPE_CUBE_UV
365
+ #define cubeUV_minMipLevel 4.0
366
+ #define cubeUV_minTileSize 16.0
367
+ float getFace( vec3 direction ) {
368
+ vec3 absDirection = abs( direction );
369
+ float face = - 1.0;
370
+ if ( absDirection.x > absDirection.z ) {
371
+ if ( absDirection.x > absDirection.y )
372
+ face = direction.x > 0.0 ? 0.0 : 3.0;
373
+ else
374
+ face = direction.y > 0.0 ? 1.0 : 4.0;
375
+ } else {
376
+ if ( absDirection.z > absDirection.y )
377
+ face = direction.z > 0.0 ? 2.0 : 5.0;
378
+ else
379
+ face = direction.y > 0.0 ? 1.0 : 4.0;
380
+ }
381
+ return face;
382
+ }
383
+ vec2 getUV( vec3 direction, float face ) {
384
+ vec2 uv;
385
+ if ( face == 0.0 ) {
386
+ uv = vec2( direction.z, direction.y ) / abs( direction.x );
387
+ } else if ( face == 1.0 ) {
388
+ uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
389
+ } else if ( face == 2.0 ) {
390
+ uv = vec2( - direction.x, direction.y ) / abs( direction.z );
391
+ } else if ( face == 3.0 ) {
392
+ uv = vec2( - direction.z, direction.y ) / abs( direction.x );
393
+ } else if ( face == 4.0 ) {
394
+ uv = vec2( - direction.x, direction.z ) / abs( direction.y );
395
+ } else {
396
+ uv = vec2( direction.x, direction.y ) / abs( direction.z );
397
+ }
398
+ return 0.5 * ( uv + 1.0 );
399
+ }
400
+ vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
401
+ float face = getFace( direction );
402
+ float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
403
+ mipInt = max( mipInt, cubeUV_minMipLevel );
404
+ float faceSize = exp2( mipInt );
405
+ highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
406
+ if ( face > 2.0 ) {
407
+ uv.y += faceSize;
408
+ face -= 3.0;
409
+ }
410
+ uv.x += face * faceSize;
411
+ uv.x += filterInt * 3.0 * cubeUV_minTileSize;
412
+ uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
413
+ uv.x *= CUBEUV_TEXEL_WIDTH;
414
+ uv.y *= CUBEUV_TEXEL_HEIGHT;
415
+ #ifdef texture2DGradEXT
416
+ return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
417
+ #else
418
+ return texture2D( envMap, uv ).rgb;
419
+ #endif
420
+ }
421
+ #define cubeUV_r0 1.0
422
+ #define cubeUV_m0 - 2.0
423
+ #define cubeUV_r1 0.8
424
+ #define cubeUV_m1 - 1.0
425
+ #define cubeUV_r4 0.4
426
+ #define cubeUV_m4 2.0
427
+ #define cubeUV_r5 0.305
428
+ #define cubeUV_m5 3.0
429
+ #define cubeUV_r6 0.21
430
+ #define cubeUV_m6 4.0
431
+ float roughnessToMip( float roughness ) {
432
+ float mip = 0.0;
433
+ if ( roughness >= cubeUV_r1 ) {
434
+ mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
435
+ } else if ( roughness >= cubeUV_r4 ) {
436
+ mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
437
+ } else if ( roughness >= cubeUV_r5 ) {
438
+ mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
439
+ } else if ( roughness >= cubeUV_r6 ) {
440
+ mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
441
+ } else {
442
+ mip = - 2.0 * log2( 1.16 * roughness ); }
443
+ return mip;
444
+ }
445
+ vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
446
+ float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
447
+ float mipF = fract( mip );
448
+ float mipInt = floor( mip );
449
+ vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
450
+ if ( mipF == 0.0 ) {
451
+ return vec4( color0, 1.0 );
452
+ } else {
453
+ vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
454
+ return vec4( mix( color0, color1, mipF ), 1.0 );
455
+ }
456
+ }
457
+ #endif`,ii=`vec3 transformedNormal = objectNormal;
458
+ #ifdef USE_TANGENT
459
+ vec3 transformedTangent = objectTangent;
460
+ #endif
461
+ #ifdef USE_BATCHING
462
+ mat3 bm = mat3( batchingMatrix );
463
+ transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
464
+ transformedNormal = bm * transformedNormal;
465
+ #ifdef USE_TANGENT
466
+ transformedTangent = bm * transformedTangent;
467
+ #endif
468
+ #endif
469
+ #ifdef USE_INSTANCING
470
+ mat3 im = mat3( instanceMatrix );
471
+ transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
472
+ transformedNormal = im * transformedNormal;
473
+ #ifdef USE_TANGENT
474
+ transformedTangent = im * transformedTangent;
475
+ #endif
476
+ #endif
477
+ transformedNormal = normalMatrix * transformedNormal;
478
+ #ifdef FLIP_SIDED
479
+ transformedNormal = - transformedNormal;
480
+ #endif
481
+ #ifdef USE_TANGENT
482
+ transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
483
+ #ifdef FLIP_SIDED
484
+ transformedTangent = - transformedTangent;
485
+ #endif
486
+ #endif`,ri=`#ifdef USE_DISPLACEMENTMAP
487
+ uniform sampler2D displacementMap;
488
+ uniform float displacementScale;
489
+ uniform float displacementBias;
490
+ #endif`,ai=`#ifdef USE_DISPLACEMENTMAP
491
+ transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
492
+ #endif`,oi=`#ifdef USE_EMISSIVEMAP
493
+ vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
494
+ #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
495
+ emissiveColor = sRGBTransferEOTF( emissiveColor );
496
+ #endif
497
+ totalEmissiveRadiance *= emissiveColor.rgb;
498
+ #endif`,si=`#ifdef USE_EMISSIVEMAP
499
+ uniform sampler2D emissiveMap;
500
+ #endif`,li="gl_FragColor = linearToOutputTexel( gl_FragColor );",ci=`vec4 LinearTransferOETF( in vec4 value ) {
501
+ return value;
502
+ }
503
+ vec4 sRGBTransferEOTF( in vec4 value ) {
504
+ return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
505
+ }
506
+ vec4 sRGBTransferOETF( in vec4 value ) {
507
+ return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
508
+ }`,fi=`#ifdef USE_ENVMAP
509
+ #ifdef ENV_WORLDPOS
510
+ vec3 cameraToFrag;
511
+ if ( isOrthographic ) {
512
+ cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
513
+ } else {
514
+ cameraToFrag = normalize( vWorldPosition - cameraPosition );
515
+ }
516
+ vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
517
+ #ifdef ENVMAP_MODE_REFLECTION
518
+ vec3 reflectVec = reflect( cameraToFrag, worldNormal );
519
+ #else
520
+ vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
521
+ #endif
522
+ #else
523
+ vec3 reflectVec = vReflect;
524
+ #endif
525
+ #ifdef ENVMAP_TYPE_CUBE
526
+ vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
527
+ #else
528
+ vec4 envColor = vec4( 0.0 );
529
+ #endif
530
+ #ifdef ENVMAP_BLENDING_MULTIPLY
531
+ outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
532
+ #elif defined( ENVMAP_BLENDING_MIX )
533
+ outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
534
+ #elif defined( ENVMAP_BLENDING_ADD )
535
+ outgoingLight += envColor.xyz * specularStrength * reflectivity;
536
+ #endif
537
+ #endif`,ui=`#ifdef USE_ENVMAP
538
+ uniform float envMapIntensity;
539
+ uniform float flipEnvMap;
540
+ uniform mat3 envMapRotation;
541
+ #ifdef ENVMAP_TYPE_CUBE
542
+ uniform samplerCube envMap;
543
+ #else
544
+ uniform sampler2D envMap;
545
+ #endif
546
+
547
+ #endif`,di=`#ifdef USE_ENVMAP
548
+ uniform float reflectivity;
549
+ #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
550
+ #define ENV_WORLDPOS
551
+ #endif
552
+ #ifdef ENV_WORLDPOS
553
+ varying vec3 vWorldPosition;
554
+ uniform float refractionRatio;
555
+ #else
556
+ varying vec3 vReflect;
557
+ #endif
558
+ #endif`,pi=`#ifdef USE_ENVMAP
559
+ #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
560
+ #define ENV_WORLDPOS
561
+ #endif
562
+ #ifdef ENV_WORLDPOS
563
+
564
+ varying vec3 vWorldPosition;
565
+ #else
566
+ varying vec3 vReflect;
567
+ uniform float refractionRatio;
568
+ #endif
569
+ #endif`,hi=`#ifdef USE_ENVMAP
570
+ #ifdef ENV_WORLDPOS
571
+ vWorldPosition = worldPosition.xyz;
572
+ #else
573
+ vec3 cameraToVertex;
574
+ if ( isOrthographic ) {
575
+ cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
576
+ } else {
577
+ cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
578
+ }
579
+ vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
580
+ #ifdef ENVMAP_MODE_REFLECTION
581
+ vReflect = reflect( cameraToVertex, worldNormal );
582
+ #else
583
+ vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
584
+ #endif
585
+ #endif
586
+ #endif`,mi=`#ifdef USE_FOG
587
+ vFogDepth = - mvPosition.z;
588
+ #endif`,_i=`#ifdef USE_FOG
589
+ varying float vFogDepth;
590
+ #endif`,gi=`#ifdef USE_FOG
591
+ #ifdef FOG_EXP2
592
+ float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
593
+ #else
594
+ float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
595
+ #endif
596
+ gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
597
+ #endif`,vi=`#ifdef USE_FOG
598
+ uniform vec3 fogColor;
599
+ varying float vFogDepth;
600
+ #ifdef FOG_EXP2
601
+ uniform float fogDensity;
602
+ #else
603
+ uniform float fogNear;
604
+ uniform float fogFar;
605
+ #endif
606
+ #endif`,Si=`#ifdef USE_GRADIENTMAP
607
+ uniform sampler2D gradientMap;
608
+ #endif
609
+ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
610
+ float dotNL = dot( normal, lightDirection );
611
+ vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
612
+ #ifdef USE_GRADIENTMAP
613
+ return vec3( texture2D( gradientMap, coord ).r );
614
+ #else
615
+ vec2 fw = fwidth( coord ) * 0.5;
616
+ return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
617
+ #endif
618
+ }`,Ei=`#ifdef USE_LIGHTMAP
619
+ uniform sampler2D lightMap;
620
+ uniform float lightMapIntensity;
621
+ #endif`,Mi=`LambertMaterial material;
622
+ material.diffuseColor = diffuseColor.rgb;
623
+ material.specularStrength = specularStrength;`,Ti=`varying vec3 vViewPosition;
624
+ struct LambertMaterial {
625
+ vec3 diffuseColor;
626
+ float specularStrength;
627
+ };
628
+ void 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 ) {
629
+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
630
+ vec3 irradiance = dotNL * directLight.color;
631
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
632
+ }
633
+ void 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 ) {
634
+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
635
+ }
636
+ #define RE_Direct RE_Direct_Lambert
637
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,xi=`uniform bool receiveShadow;
638
+ uniform vec3 ambientLightColor;
639
+ #if defined( USE_LIGHT_PROBES )
640
+ uniform vec3 lightProbe[ 9 ];
641
+ #endif
642
+ vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
643
+ float x = normal.x, y = normal.y, z = normal.z;
644
+ vec3 result = shCoefficients[ 0 ] * 0.886227;
645
+ result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
646
+ result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
647
+ result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
648
+ result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
649
+ result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
650
+ result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
651
+ result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
652
+ result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
653
+ return result;
654
+ }
655
+ vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
656
+ vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
657
+ vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
658
+ return irradiance;
659
+ }
660
+ vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
661
+ vec3 irradiance = ambientLightColor;
662
+ return irradiance;
663
+ }
664
+ float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
665
+ float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
666
+ if ( cutoffDistance > 0.0 ) {
667
+ distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
668
+ }
669
+ return distanceFalloff;
670
+ }
671
+ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
672
+ return smoothstep( coneCosine, penumbraCosine, angleCosine );
673
+ }
674
+ #if NUM_DIR_LIGHTS > 0
675
+ struct DirectionalLight {
676
+ vec3 direction;
677
+ vec3 color;
678
+ };
679
+ uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
680
+ void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
681
+ light.color = directionalLight.color;
682
+ light.direction = directionalLight.direction;
683
+ light.visible = true;
684
+ }
685
+ #endif
686
+ #if NUM_POINT_LIGHTS > 0
687
+ struct PointLight {
688
+ vec3 position;
689
+ vec3 color;
690
+ float distance;
691
+ float decay;
692
+ };
693
+ uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
694
+ void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
695
+ vec3 lVector = pointLight.position - geometryPosition;
696
+ light.direction = normalize( lVector );
697
+ float lightDistance = length( lVector );
698
+ light.color = pointLight.color;
699
+ light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
700
+ light.visible = ( light.color != vec3( 0.0 ) );
701
+ }
702
+ #endif
703
+ #if NUM_SPOT_LIGHTS > 0
704
+ struct SpotLight {
705
+ vec3 position;
706
+ vec3 direction;
707
+ vec3 color;
708
+ float distance;
709
+ float decay;
710
+ float coneCos;
711
+ float penumbraCos;
712
+ };
713
+ uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
714
+ void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
715
+ vec3 lVector = spotLight.position - geometryPosition;
716
+ light.direction = normalize( lVector );
717
+ float angleCos = dot( light.direction, spotLight.direction );
718
+ float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
719
+ if ( spotAttenuation > 0.0 ) {
720
+ float lightDistance = length( lVector );
721
+ light.color = spotLight.color * spotAttenuation;
722
+ light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
723
+ light.visible = ( light.color != vec3( 0.0 ) );
724
+ } else {
725
+ light.color = vec3( 0.0 );
726
+ light.visible = false;
727
+ }
728
+ }
729
+ #endif
730
+ #if NUM_RECT_AREA_LIGHTS > 0
731
+ struct RectAreaLight {
732
+ vec3 color;
733
+ vec3 position;
734
+ vec3 halfWidth;
735
+ vec3 halfHeight;
736
+ };
737
+ uniform sampler2D ltc_1; uniform sampler2D ltc_2;
738
+ uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
739
+ #endif
740
+ #if NUM_HEMI_LIGHTS > 0
741
+ struct HemisphereLight {
742
+ vec3 direction;
743
+ vec3 skyColor;
744
+ vec3 groundColor;
745
+ };
746
+ uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
747
+ vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
748
+ float dotNL = dot( normal, hemiLight.direction );
749
+ float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
750
+ vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
751
+ return irradiance;
752
+ }
753
+ #endif`,Ai=`#ifdef USE_ENVMAP
754
+ vec3 getIBLIrradiance( const in vec3 normal ) {
755
+ #ifdef ENVMAP_TYPE_CUBE_UV
756
+ vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
757
+ vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
758
+ return PI * envMapColor.rgb * envMapIntensity;
759
+ #else
760
+ return vec3( 0.0 );
761
+ #endif
762
+ }
763
+ vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
764
+ #ifdef ENVMAP_TYPE_CUBE_UV
765
+ vec3 reflectVec = reflect( - viewDir, normal );
766
+ reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
767
+ reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
768
+ vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
769
+ return envMapColor.rgb * envMapIntensity;
770
+ #else
771
+ return vec3( 0.0 );
772
+ #endif
773
+ }
774
+ #ifdef USE_ANISOTROPY
775
+ vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
776
+ #ifdef ENVMAP_TYPE_CUBE_UV
777
+ vec3 bentNormal = cross( bitangent, viewDir );
778
+ bentNormal = normalize( cross( bentNormal, bitangent ) );
779
+ bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
780
+ return getIBLRadiance( viewDir, bentNormal, roughness );
781
+ #else
782
+ return vec3( 0.0 );
783
+ #endif
784
+ }
785
+ #endif
786
+ #endif`,Ri=`ToonMaterial material;
787
+ material.diffuseColor = diffuseColor.rgb;`,Ci=`varying vec3 vViewPosition;
788
+ struct ToonMaterial {
789
+ vec3 diffuseColor;
790
+ };
791
+ void 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 ) {
792
+ vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
793
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
794
+ }
795
+ void 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 ) {
796
+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
797
+ }
798
+ #define RE_Direct RE_Direct_Toon
799
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,bi=`BlinnPhongMaterial material;
800
+ material.diffuseColor = diffuseColor.rgb;
801
+ material.specularColor = specular;
802
+ material.specularShininess = shininess;
803
+ material.specularStrength = specularStrength;`,Pi=`varying vec3 vViewPosition;
804
+ struct BlinnPhongMaterial {
805
+ vec3 diffuseColor;
806
+ vec3 specularColor;
807
+ float specularShininess;
808
+ float specularStrength;
809
+ };
810
+ void 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 ) {
811
+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
812
+ vec3 irradiance = dotNL * directLight.color;
813
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
814
+ reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
815
+ }
816
+ void 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 ) {
817
+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
818
+ }
819
+ #define RE_Direct RE_Direct_BlinnPhong
820
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Li=`PhysicalMaterial material;
821
+ material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
822
+ vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
823
+ float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
824
+ material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
825
+ material.roughness = min( material.roughness, 1.0 );
826
+ #ifdef IOR
827
+ material.ior = ior;
828
+ #ifdef USE_SPECULAR
829
+ float specularIntensityFactor = specularIntensity;
830
+ vec3 specularColorFactor = specularColor;
831
+ #ifdef USE_SPECULAR_COLORMAP
832
+ specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
833
+ #endif
834
+ #ifdef USE_SPECULAR_INTENSITYMAP
835
+ specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
836
+ #endif
837
+ material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
838
+ #else
839
+ float specularIntensityFactor = 1.0;
840
+ vec3 specularColorFactor = vec3( 1.0 );
841
+ material.specularF90 = 1.0;
842
+ #endif
843
+ material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
844
+ #else
845
+ material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
846
+ material.specularF90 = 1.0;
847
+ #endif
848
+ #ifdef USE_CLEARCOAT
849
+ material.clearcoat = clearcoat;
850
+ material.clearcoatRoughness = clearcoatRoughness;
851
+ material.clearcoatF0 = vec3( 0.04 );
852
+ material.clearcoatF90 = 1.0;
853
+ #ifdef USE_CLEARCOATMAP
854
+ material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
855
+ #endif
856
+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP
857
+ material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
858
+ #endif
859
+ material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
860
+ material.clearcoatRoughness += geometryRoughness;
861
+ material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
862
+ #endif
863
+ #ifdef USE_DISPERSION
864
+ material.dispersion = dispersion;
865
+ #endif
866
+ #ifdef USE_IRIDESCENCE
867
+ material.iridescence = iridescence;
868
+ material.iridescenceIOR = iridescenceIOR;
869
+ #ifdef USE_IRIDESCENCEMAP
870
+ material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
871
+ #endif
872
+ #ifdef USE_IRIDESCENCE_THICKNESSMAP
873
+ material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
874
+ #else
875
+ material.iridescenceThickness = iridescenceThicknessMaximum;
876
+ #endif
877
+ #endif
878
+ #ifdef USE_SHEEN
879
+ material.sheenColor = sheenColor;
880
+ #ifdef USE_SHEEN_COLORMAP
881
+ material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
882
+ #endif
883
+ material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
884
+ #ifdef USE_SHEEN_ROUGHNESSMAP
885
+ material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
886
+ #endif
887
+ #endif
888
+ #ifdef USE_ANISOTROPY
889
+ #ifdef USE_ANISOTROPYMAP
890
+ mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
891
+ vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
892
+ vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
893
+ #else
894
+ vec2 anisotropyV = anisotropyVector;
895
+ #endif
896
+ material.anisotropy = length( anisotropyV );
897
+ if( material.anisotropy == 0.0 ) {
898
+ anisotropyV = vec2( 1.0, 0.0 );
899
+ } else {
900
+ anisotropyV /= material.anisotropy;
901
+ material.anisotropy = saturate( material.anisotropy );
902
+ }
903
+ material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
904
+ material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
905
+ material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
906
+ #endif`,Di=`struct PhysicalMaterial {
907
+ vec3 diffuseColor;
908
+ float roughness;
909
+ vec3 specularColor;
910
+ float specularF90;
911
+ float dispersion;
912
+ #ifdef USE_CLEARCOAT
913
+ float clearcoat;
914
+ float clearcoatRoughness;
915
+ vec3 clearcoatF0;
916
+ float clearcoatF90;
917
+ #endif
918
+ #ifdef USE_IRIDESCENCE
919
+ float iridescence;
920
+ float iridescenceIOR;
921
+ float iridescenceThickness;
922
+ vec3 iridescenceFresnel;
923
+ vec3 iridescenceF0;
924
+ #endif
925
+ #ifdef USE_SHEEN
926
+ vec3 sheenColor;
927
+ float sheenRoughness;
928
+ #endif
929
+ #ifdef IOR
930
+ float ior;
931
+ #endif
932
+ #ifdef USE_TRANSMISSION
933
+ float transmission;
934
+ float transmissionAlpha;
935
+ float thickness;
936
+ float attenuationDistance;
937
+ vec3 attenuationColor;
938
+ #endif
939
+ #ifdef USE_ANISOTROPY
940
+ float anisotropy;
941
+ float alphaT;
942
+ vec3 anisotropyT;
943
+ vec3 anisotropyB;
944
+ #endif
945
+ };
946
+ vec3 clearcoatSpecularDirect = vec3( 0.0 );
947
+ vec3 clearcoatSpecularIndirect = vec3( 0.0 );
948
+ vec3 sheenSpecularDirect = vec3( 0.0 );
949
+ vec3 sheenSpecularIndirect = vec3(0.0 );
950
+ vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
951
+ float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
952
+ float x2 = x * x;
953
+ float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
954
+ return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
955
+ }
956
+ float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
957
+ float a2 = pow2( alpha );
958
+ float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
959
+ float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
960
+ return 0.5 / max( gv + gl, EPSILON );
961
+ }
962
+ float D_GGX( const in float alpha, const in float dotNH ) {
963
+ float a2 = pow2( alpha );
964
+ float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
965
+ return RECIPROCAL_PI * a2 / pow2( denom );
966
+ }
967
+ #ifdef USE_ANISOTROPY
968
+ 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 ) {
969
+ float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
970
+ float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
971
+ float v = 0.5 / ( gv + gl );
972
+ return saturate(v);
973
+ }
974
+ float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
975
+ float a2 = alphaT * alphaB;
976
+ highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
977
+ highp float v2 = dot( v, v );
978
+ float w2 = a2 / v2;
979
+ return RECIPROCAL_PI * a2 * pow2 ( w2 );
980
+ }
981
+ #endif
982
+ #ifdef USE_CLEARCOAT
983
+ vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
984
+ vec3 f0 = material.clearcoatF0;
985
+ float f90 = material.clearcoatF90;
986
+ float roughness = material.clearcoatRoughness;
987
+ float alpha = pow2( roughness );
988
+ vec3 halfDir = normalize( lightDir + viewDir );
989
+ float dotNL = saturate( dot( normal, lightDir ) );
990
+ float dotNV = saturate( dot( normal, viewDir ) );
991
+ float dotNH = saturate( dot( normal, halfDir ) );
992
+ float dotVH = saturate( dot( viewDir, halfDir ) );
993
+ vec3 F = F_Schlick( f0, f90, dotVH );
994
+ float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
995
+ float D = D_GGX( alpha, dotNH );
996
+ return F * ( V * D );
997
+ }
998
+ #endif
999
+ vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1000
+ vec3 f0 = material.specularColor;
1001
+ float f90 = material.specularF90;
1002
+ float roughness = material.roughness;
1003
+ float alpha = pow2( roughness );
1004
+ vec3 halfDir = normalize( lightDir + viewDir );
1005
+ float dotNL = saturate( dot( normal, lightDir ) );
1006
+ float dotNV = saturate( dot( normal, viewDir ) );
1007
+ float dotNH = saturate( dot( normal, halfDir ) );
1008
+ float dotVH = saturate( dot( viewDir, halfDir ) );
1009
+ vec3 F = F_Schlick( f0, f90, dotVH );
1010
+ #ifdef USE_IRIDESCENCE
1011
+ F = mix( F, material.iridescenceFresnel, material.iridescence );
1012
+ #endif
1013
+ #ifdef USE_ANISOTROPY
1014
+ float dotTL = dot( material.anisotropyT, lightDir );
1015
+ float dotTV = dot( material.anisotropyT, viewDir );
1016
+ float dotTH = dot( material.anisotropyT, halfDir );
1017
+ float dotBL = dot( material.anisotropyB, lightDir );
1018
+ float dotBV = dot( material.anisotropyB, viewDir );
1019
+ float dotBH = dot( material.anisotropyB, halfDir );
1020
+ float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1021
+ float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1022
+ #else
1023
+ float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1024
+ float D = D_GGX( alpha, dotNH );
1025
+ #endif
1026
+ return F * ( V * D );
1027
+ }
1028
+ vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1029
+ const float LUT_SIZE = 64.0;
1030
+ const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1031
+ const float LUT_BIAS = 0.5 / LUT_SIZE;
1032
+ float dotNV = saturate( dot( N, V ) );
1033
+ vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1034
+ uv = uv * LUT_SCALE + LUT_BIAS;
1035
+ return uv;
1036
+ }
1037
+ float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1038
+ float l = length( f );
1039
+ return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1040
+ }
1041
+ vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1042
+ float x = dot( v1, v2 );
1043
+ float y = abs( x );
1044
+ float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1045
+ float b = 3.4175940 + ( 4.1616724 + y ) * y;
1046
+ float v = a / b;
1047
+ float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1048
+ return cross( v1, v2 ) * theta_sintheta;
1049
+ }
1050
+ vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1051
+ vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1052
+ vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1053
+ vec3 lightNormal = cross( v1, v2 );
1054
+ if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1055
+ vec3 T1, T2;
1056
+ T1 = normalize( V - N * dot( V, N ) );
1057
+ T2 = - cross( N, T1 );
1058
+ mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
1059
+ vec3 coords[ 4 ];
1060
+ coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1061
+ coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1062
+ coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1063
+ coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1064
+ coords[ 0 ] = normalize( coords[ 0 ] );
1065
+ coords[ 1 ] = normalize( coords[ 1 ] );
1066
+ coords[ 2 ] = normalize( coords[ 2 ] );
1067
+ coords[ 3 ] = normalize( coords[ 3 ] );
1068
+ vec3 vectorFormFactor = vec3( 0.0 );
1069
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1070
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1071
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1072
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1073
+ float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1074
+ return vec3( result );
1075
+ }
1076
+ #if defined( USE_SHEEN )
1077
+ float D_Charlie( float roughness, float dotNH ) {
1078
+ float alpha = pow2( roughness );
1079
+ float invAlpha = 1.0 / alpha;
1080
+ float cos2h = dotNH * dotNH;
1081
+ float sin2h = max( 1.0 - cos2h, 0.0078125 );
1082
+ return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1083
+ }
1084
+ float V_Neubelt( float dotNV, float dotNL ) {
1085
+ return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1086
+ }
1087
+ vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1088
+ vec3 halfDir = normalize( lightDir + viewDir );
1089
+ float dotNL = saturate( dot( normal, lightDir ) );
1090
+ float dotNV = saturate( dot( normal, viewDir ) );
1091
+ float dotNH = saturate( dot( normal, halfDir ) );
1092
+ float D = D_Charlie( sheenRoughness, dotNH );
1093
+ float V = V_Neubelt( dotNV, dotNL );
1094
+ return sheenColor * ( D * V );
1095
+ }
1096
+ #endif
1097
+ float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1098
+ float dotNV = saturate( dot( normal, viewDir ) );
1099
+ float r2 = roughness * roughness;
1100
+ float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
1101
+ float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
1102
+ float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
1103
+ return saturate( DG * RECIPROCAL_PI );
1104
+ }
1105
+ vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1106
+ float dotNV = saturate( dot( normal, viewDir ) );
1107
+ const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
1108
+ const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
1109
+ vec4 r = roughness * c0 + c1;
1110
+ float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
1111
+ vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
1112
+ return fab;
1113
+ }
1114
+ vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1115
+ vec2 fab = DFGApprox( normal, viewDir, roughness );
1116
+ return specularColor * fab.x + specularF90 * fab.y;
1117
+ }
1118
+ #ifdef USE_IRIDESCENCE
1119
+ void 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 ) {
1120
+ #else
1121
+ void 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 ) {
1122
+ #endif
1123
+ vec2 fab = DFGApprox( normal, viewDir, roughness );
1124
+ #ifdef USE_IRIDESCENCE
1125
+ vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1126
+ #else
1127
+ vec3 Fr = specularColor;
1128
+ #endif
1129
+ vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1130
+ float Ess = fab.x + fab.y;
1131
+ float Ems = 1.0 - Ess;
1132
+ vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1133
+ singleScatter += FssEss;
1134
+ multiScatter += Fms * Ems;
1135
+ }
1136
+ #if NUM_RECT_AREA_LIGHTS > 0
1137
+ 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 ) {
1138
+ vec3 normal = geometryNormal;
1139
+ vec3 viewDir = geometryViewDir;
1140
+ vec3 position = geometryPosition;
1141
+ vec3 lightPos = rectAreaLight.position;
1142
+ vec3 halfWidth = rectAreaLight.halfWidth;
1143
+ vec3 halfHeight = rectAreaLight.halfHeight;
1144
+ vec3 lightColor = rectAreaLight.color;
1145
+ float roughness = material.roughness;
1146
+ vec3 rectCoords[ 4 ];
1147
+ rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1148
+ rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1149
+ rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1150
+ vec2 uv = LTC_Uv( normal, viewDir, roughness );
1151
+ vec4 t1 = texture2D( ltc_1, uv );
1152
+ vec4 t2 = texture2D( ltc_2, uv );
1153
+ mat3 mInv = mat3(
1154
+ vec3( t1.x, 0, t1.y ),
1155
+ vec3( 0, 1, 0 ),
1156
+ vec3( t1.z, 0, t1.w )
1157
+ );
1158
+ vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1159
+ reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1160
+ reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1161
+ }
1162
+ #endif
1163
+ void 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 ) {
1164
+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1165
+ vec3 irradiance = dotNL * directLight.color;
1166
+ #ifdef USE_CLEARCOAT
1167
+ float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1168
+ vec3 ccIrradiance = dotNLcc * directLight.color;
1169
+ clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1170
+ #endif
1171
+ #ifdef USE_SHEEN
1172
+ sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1173
+ #endif
1174
+ reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1175
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1176
+ }
1177
+ void 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 ) {
1178
+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1179
+ }
1180
+ void 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) {
1181
+ #ifdef USE_CLEARCOAT
1182
+ clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1183
+ #endif
1184
+ #ifdef USE_SHEEN
1185
+ sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1186
+ #endif
1187
+ vec3 singleScattering = vec3( 0.0 );
1188
+ vec3 multiScattering = vec3( 0.0 );
1189
+ vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1190
+ #ifdef USE_IRIDESCENCE
1191
+ computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1192
+ #else
1193
+ computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1194
+ #endif
1195
+ vec3 totalScattering = singleScattering + multiScattering;
1196
+ vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1197
+ reflectedLight.indirectSpecular += radiance * singleScattering;
1198
+ reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1199
+ reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1200
+ }
1201
+ #define RE_Direct RE_Direct_Physical
1202
+ #define RE_Direct_RectArea RE_Direct_RectArea_Physical
1203
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
1204
+ #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1205
+ float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1206
+ return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1207
+ }`,Ui=`
1208
+ vec3 geometryPosition = - vViewPosition;
1209
+ vec3 geometryNormal = normal;
1210
+ vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1211
+ vec3 geometryClearcoatNormal = vec3( 0.0 );
1212
+ #ifdef USE_CLEARCOAT
1213
+ geometryClearcoatNormal = clearcoatNormal;
1214
+ #endif
1215
+ #ifdef USE_IRIDESCENCE
1216
+ float dotNVi = saturate( dot( normal, geometryViewDir ) );
1217
+ if ( material.iridescenceThickness == 0.0 ) {
1218
+ material.iridescence = 0.0;
1219
+ } else {
1220
+ material.iridescence = saturate( material.iridescence );
1221
+ }
1222
+ if ( material.iridescence > 0.0 ) {
1223
+ material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1224
+ material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1225
+ }
1226
+ #endif
1227
+ IncidentLight directLight;
1228
+ #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1229
+ PointLight pointLight;
1230
+ #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1231
+ PointLightShadow pointLightShadow;
1232
+ #endif
1233
+ #pragma unroll_loop_start
1234
+ for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1235
+ pointLight = pointLights[ i ];
1236
+ getPointLightInfo( pointLight, geometryPosition, directLight );
1237
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1238
+ pointLightShadow = pointLightShadows[ i ];
1239
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1240
+ #endif
1241
+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1242
+ }
1243
+ #pragma unroll_loop_end
1244
+ #endif
1245
+ #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1246
+ SpotLight spotLight;
1247
+ vec4 spotColor;
1248
+ vec3 spotLightCoord;
1249
+ bool inSpotLightMap;
1250
+ #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1251
+ SpotLightShadow spotLightShadow;
1252
+ #endif
1253
+ #pragma unroll_loop_start
1254
+ for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1255
+ spotLight = spotLights[ i ];
1256
+ getSpotLightInfo( spotLight, geometryPosition, directLight );
1257
+ #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1258
+ #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1259
+ #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1260
+ #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1261
+ #else
1262
+ #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1263
+ #endif
1264
+ #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1265
+ spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1266
+ inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1267
+ spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1268
+ directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1269
+ #endif
1270
+ #undef SPOT_LIGHT_MAP_INDEX
1271
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1272
+ spotLightShadow = spotLightShadows[ i ];
1273
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1274
+ #endif
1275
+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1276
+ }
1277
+ #pragma unroll_loop_end
1278
+ #endif
1279
+ #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1280
+ DirectionalLight directionalLight;
1281
+ #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1282
+ DirectionalLightShadow directionalLightShadow;
1283
+ #endif
1284
+ #pragma unroll_loop_start
1285
+ for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1286
+ directionalLight = directionalLights[ i ];
1287
+ getDirectionalLightInfo( directionalLight, directLight );
1288
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1289
+ directionalLightShadow = directionalLightShadows[ i ];
1290
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1291
+ #endif
1292
+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1293
+ }
1294
+ #pragma unroll_loop_end
1295
+ #endif
1296
+ #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1297
+ RectAreaLight rectAreaLight;
1298
+ #pragma unroll_loop_start
1299
+ for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1300
+ rectAreaLight = rectAreaLights[ i ];
1301
+ RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1302
+ }
1303
+ #pragma unroll_loop_end
1304
+ #endif
1305
+ #if defined( RE_IndirectDiffuse )
1306
+ vec3 iblIrradiance = vec3( 0.0 );
1307
+ vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1308
+ #if defined( USE_LIGHT_PROBES )
1309
+ irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1310
+ #endif
1311
+ #if ( NUM_HEMI_LIGHTS > 0 )
1312
+ #pragma unroll_loop_start
1313
+ for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1314
+ irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1315
+ }
1316
+ #pragma unroll_loop_end
1317
+ #endif
1318
+ #endif
1319
+ #if defined( RE_IndirectSpecular )
1320
+ vec3 radiance = vec3( 0.0 );
1321
+ vec3 clearcoatRadiance = vec3( 0.0 );
1322
+ #endif`,wi=`#if defined( RE_IndirectDiffuse )
1323
+ #ifdef USE_LIGHTMAP
1324
+ vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1325
+ vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1326
+ irradiance += lightMapIrradiance;
1327
+ #endif
1328
+ #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1329
+ iblIrradiance += getIBLIrradiance( geometryNormal );
1330
+ #endif
1331
+ #endif
1332
+ #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1333
+ #ifdef USE_ANISOTROPY
1334
+ radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1335
+ #else
1336
+ radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1337
+ #endif
1338
+ #ifdef USE_CLEARCOAT
1339
+ clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1340
+ #endif
1341
+ #endif`,Ii=`#if defined( RE_IndirectDiffuse )
1342
+ RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1343
+ #endif
1344
+ #if defined( RE_IndirectSpecular )
1345
+ RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1346
+ #endif`,Ni=`#if defined( USE_LOGDEPTHBUF )
1347
+ gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1348
+ #endif`,yi=`#if defined( USE_LOGDEPTHBUF )
1349
+ uniform float logDepthBufFC;
1350
+ varying float vFragDepth;
1351
+ varying float vIsPerspective;
1352
+ #endif`,Fi=`#ifdef USE_LOGDEPTHBUF
1353
+ varying float vFragDepth;
1354
+ varying float vIsPerspective;
1355
+ #endif`,Oi=`#ifdef USE_LOGDEPTHBUF
1356
+ vFragDepth = 1.0 + gl_Position.w;
1357
+ vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1358
+ #endif`,Bi=`#ifdef USE_MAP
1359
+ vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1360
+ #ifdef DECODE_VIDEO_TEXTURE
1361
+ sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1362
+ #endif
1363
+ diffuseColor *= sampledDiffuseColor;
1364
+ #endif`,Gi=`#ifdef USE_MAP
1365
+ uniform sampler2D map;
1366
+ #endif`,Hi=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1367
+ #if defined( USE_POINTS_UV )
1368
+ vec2 uv = vUv;
1369
+ #else
1370
+ vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1371
+ #endif
1372
+ #endif
1373
+ #ifdef USE_MAP
1374
+ diffuseColor *= texture2D( map, uv );
1375
+ #endif
1376
+ #ifdef USE_ALPHAMAP
1377
+ diffuseColor.a *= texture2D( alphaMap, uv ).g;
1378
+ #endif`,Vi=`#if defined( USE_POINTS_UV )
1379
+ varying vec2 vUv;
1380
+ #else
1381
+ #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1382
+ uniform mat3 uvTransform;
1383
+ #endif
1384
+ #endif
1385
+ #ifdef USE_MAP
1386
+ uniform sampler2D map;
1387
+ #endif
1388
+ #ifdef USE_ALPHAMAP
1389
+ uniform sampler2D alphaMap;
1390
+ #endif`,ki=`float metalnessFactor = metalness;
1391
+ #ifdef USE_METALNESSMAP
1392
+ vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1393
+ metalnessFactor *= texelMetalness.b;
1394
+ #endif`,Wi=`#ifdef USE_METALNESSMAP
1395
+ uniform sampler2D metalnessMap;
1396
+ #endif`,zi=`#ifdef USE_INSTANCING_MORPH
1397
+ float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1398
+ float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1399
+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1400
+ morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1401
+ }
1402
+ #endif`,Xi=`#if defined( USE_MORPHCOLORS )
1403
+ vColor *= morphTargetBaseInfluence;
1404
+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1405
+ #if defined( USE_COLOR_ALPHA )
1406
+ if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1407
+ #elif defined( USE_COLOR )
1408
+ if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1409
+ #endif
1410
+ }
1411
+ #endif`,qi=`#ifdef USE_MORPHNORMALS
1412
+ objectNormal *= morphTargetBaseInfluence;
1413
+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1414
+ if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1415
+ }
1416
+ #endif`,Yi=`#ifdef USE_MORPHTARGETS
1417
+ #ifndef USE_INSTANCING_MORPH
1418
+ uniform float morphTargetBaseInfluence;
1419
+ uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1420
+ #endif
1421
+ uniform sampler2DArray morphTargetsTexture;
1422
+ uniform ivec2 morphTargetsTextureSize;
1423
+ vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1424
+ int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1425
+ int y = texelIndex / morphTargetsTextureSize.x;
1426
+ int x = texelIndex - y * morphTargetsTextureSize.x;
1427
+ ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1428
+ return texelFetch( morphTargetsTexture, morphUV, 0 );
1429
+ }
1430
+ #endif`,Ki=`#ifdef USE_MORPHTARGETS
1431
+ transformed *= morphTargetBaseInfluence;
1432
+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1433
+ if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1434
+ }
1435
+ #endif`,$i=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1436
+ #ifdef FLAT_SHADED
1437
+ vec3 fdx = dFdx( vViewPosition );
1438
+ vec3 fdy = dFdy( vViewPosition );
1439
+ vec3 normal = normalize( cross( fdx, fdy ) );
1440
+ #else
1441
+ vec3 normal = normalize( vNormal );
1442
+ #ifdef DOUBLE_SIDED
1443
+ normal *= faceDirection;
1444
+ #endif
1445
+ #endif
1446
+ #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1447
+ #ifdef USE_TANGENT
1448
+ mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1449
+ #else
1450
+ mat3 tbn = getTangentFrame( - vViewPosition, normal,
1451
+ #if defined( USE_NORMALMAP )
1452
+ vNormalMapUv
1453
+ #elif defined( USE_CLEARCOAT_NORMALMAP )
1454
+ vClearcoatNormalMapUv
1455
+ #else
1456
+ vUv
1457
+ #endif
1458
+ );
1459
+ #endif
1460
+ #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1461
+ tbn[0] *= faceDirection;
1462
+ tbn[1] *= faceDirection;
1463
+ #endif
1464
+ #endif
1465
+ #ifdef USE_CLEARCOAT_NORMALMAP
1466
+ #ifdef USE_TANGENT
1467
+ mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1468
+ #else
1469
+ mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1470
+ #endif
1471
+ #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1472
+ tbn2[0] *= faceDirection;
1473
+ tbn2[1] *= faceDirection;
1474
+ #endif
1475
+ #endif
1476
+ vec3 nonPerturbedNormal = normal;`,Zi=`#ifdef USE_NORMALMAP_OBJECTSPACE
1477
+ normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1478
+ #ifdef FLIP_SIDED
1479
+ normal = - normal;
1480
+ #endif
1481
+ #ifdef DOUBLE_SIDED
1482
+ normal = normal * faceDirection;
1483
+ #endif
1484
+ normal = normalize( normalMatrix * normal );
1485
+ #elif defined( USE_NORMALMAP_TANGENTSPACE )
1486
+ vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1487
+ mapN.xy *= normalScale;
1488
+ normal = normalize( tbn * mapN );
1489
+ #elif defined( USE_BUMPMAP )
1490
+ normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1491
+ #endif`,Qi=`#ifndef FLAT_SHADED
1492
+ varying vec3 vNormal;
1493
+ #ifdef USE_TANGENT
1494
+ varying vec3 vTangent;
1495
+ varying vec3 vBitangent;
1496
+ #endif
1497
+ #endif`,Ji=`#ifndef FLAT_SHADED
1498
+ varying vec3 vNormal;
1499
+ #ifdef USE_TANGENT
1500
+ varying vec3 vTangent;
1501
+ varying vec3 vBitangent;
1502
+ #endif
1503
+ #endif`,ji=`#ifndef FLAT_SHADED
1504
+ vNormal = normalize( transformedNormal );
1505
+ #ifdef USE_TANGENT
1506
+ vTangent = normalize( transformedTangent );
1507
+ vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1508
+ #endif
1509
+ #endif`,er=`#ifdef USE_NORMALMAP
1510
+ uniform sampler2D normalMap;
1511
+ uniform vec2 normalScale;
1512
+ #endif
1513
+ #ifdef USE_NORMALMAP_OBJECTSPACE
1514
+ uniform mat3 normalMatrix;
1515
+ #endif
1516
+ #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1517
+ mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1518
+ vec3 q0 = dFdx( eye_pos.xyz );
1519
+ vec3 q1 = dFdy( eye_pos.xyz );
1520
+ vec2 st0 = dFdx( uv.st );
1521
+ vec2 st1 = dFdy( uv.st );
1522
+ vec3 N = surf_norm;
1523
+ vec3 q1perp = cross( q1, N );
1524
+ vec3 q0perp = cross( N, q0 );
1525
+ vec3 T = q1perp * st0.x + q0perp * st1.x;
1526
+ vec3 B = q1perp * st0.y + q0perp * st1.y;
1527
+ float det = max( dot( T, T ), dot( B, B ) );
1528
+ float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1529
+ return mat3( T * scale, B * scale, N );
1530
+ }
1531
+ #endif`,tr=`#ifdef USE_CLEARCOAT
1532
+ vec3 clearcoatNormal = nonPerturbedNormal;
1533
+ #endif`,nr=`#ifdef USE_CLEARCOAT_NORMALMAP
1534
+ vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1535
+ clearcoatMapN.xy *= clearcoatNormalScale;
1536
+ clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1537
+ #endif`,ir=`#ifdef USE_CLEARCOATMAP
1538
+ uniform sampler2D clearcoatMap;
1539
+ #endif
1540
+ #ifdef USE_CLEARCOAT_NORMALMAP
1541
+ uniform sampler2D clearcoatNormalMap;
1542
+ uniform vec2 clearcoatNormalScale;
1543
+ #endif
1544
+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1545
+ uniform sampler2D clearcoatRoughnessMap;
1546
+ #endif`,rr=`#ifdef USE_IRIDESCENCEMAP
1547
+ uniform sampler2D iridescenceMap;
1548
+ #endif
1549
+ #ifdef USE_IRIDESCENCE_THICKNESSMAP
1550
+ uniform sampler2D iridescenceThicknessMap;
1551
+ #endif`,ar=`#ifdef OPAQUE
1552
+ diffuseColor.a = 1.0;
1553
+ #endif
1554
+ #ifdef USE_TRANSMISSION
1555
+ diffuseColor.a *= material.transmissionAlpha;
1556
+ #endif
1557
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,or=`vec3 packNormalToRGB( const in vec3 normal ) {
1558
+ return normalize( normal ) * 0.5 + 0.5;
1559
+ }
1560
+ vec3 unpackRGBToNormal( const in vec3 rgb ) {
1561
+ return 2.0 * rgb.xyz - 1.0;
1562
+ }
1563
+ const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1564
+ const float Inv255 = 1. / 255.;
1565
+ const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1566
+ const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1567
+ const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1568
+ const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1569
+ vec4 packDepthToRGBA( const in float v ) {
1570
+ if( v <= 0.0 )
1571
+ return vec4( 0., 0., 0., 0. );
1572
+ if( v >= 1.0 )
1573
+ return vec4( 1., 1., 1., 1. );
1574
+ float vuf;
1575
+ float af = modf( v * PackFactors.a, vuf );
1576
+ float bf = modf( vuf * ShiftRight8, vuf );
1577
+ float gf = modf( vuf * ShiftRight8, vuf );
1578
+ return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1579
+ }
1580
+ vec3 packDepthToRGB( const in float v ) {
1581
+ if( v <= 0.0 )
1582
+ return vec3( 0., 0., 0. );
1583
+ if( v >= 1.0 )
1584
+ return vec3( 1., 1., 1. );
1585
+ float vuf;
1586
+ float bf = modf( v * PackFactors.b, vuf );
1587
+ float gf = modf( vuf * ShiftRight8, vuf );
1588
+ return vec3( vuf * Inv255, gf * PackUpscale, bf );
1589
+ }
1590
+ vec2 packDepthToRG( const in float v ) {
1591
+ if( v <= 0.0 )
1592
+ return vec2( 0., 0. );
1593
+ if( v >= 1.0 )
1594
+ return vec2( 1., 1. );
1595
+ float vuf;
1596
+ float gf = modf( v * 256., vuf );
1597
+ return vec2( vuf * Inv255, gf );
1598
+ }
1599
+ float unpackRGBAToDepth( const in vec4 v ) {
1600
+ return dot( v, UnpackFactors4 );
1601
+ }
1602
+ float unpackRGBToDepth( const in vec3 v ) {
1603
+ return dot( v, UnpackFactors3 );
1604
+ }
1605
+ float unpackRGToDepth( const in vec2 v ) {
1606
+ return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1607
+ }
1608
+ vec4 pack2HalfToRGBA( const in vec2 v ) {
1609
+ vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1610
+ return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1611
+ }
1612
+ vec2 unpackRGBATo2Half( const in vec4 v ) {
1613
+ return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1614
+ }
1615
+ float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1616
+ return ( viewZ + near ) / ( near - far );
1617
+ }
1618
+ float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1619
+ return depth * ( near - far ) - near;
1620
+ }
1621
+ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1622
+ return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1623
+ }
1624
+ float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1625
+ return ( near * far ) / ( ( far - near ) * depth - far );
1626
+ }`,sr=`#ifdef PREMULTIPLIED_ALPHA
1627
+ gl_FragColor.rgb *= gl_FragColor.a;
1628
+ #endif`,lr=`vec4 mvPosition = vec4( transformed, 1.0 );
1629
+ #ifdef USE_BATCHING
1630
+ mvPosition = batchingMatrix * mvPosition;
1631
+ #endif
1632
+ #ifdef USE_INSTANCING
1633
+ mvPosition = instanceMatrix * mvPosition;
1634
+ #endif
1635
+ mvPosition = modelViewMatrix * mvPosition;
1636
+ gl_Position = projectionMatrix * mvPosition;`,cr=`#ifdef DITHERING
1637
+ gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1638
+ #endif`,fr=`#ifdef DITHERING
1639
+ vec3 dithering( vec3 color ) {
1640
+ float grid_position = rand( gl_FragCoord.xy );
1641
+ vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1642
+ dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1643
+ return color + dither_shift_RGB;
1644
+ }
1645
+ #endif`,ur=`float roughnessFactor = roughness;
1646
+ #ifdef USE_ROUGHNESSMAP
1647
+ vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1648
+ roughnessFactor *= texelRoughness.g;
1649
+ #endif`,dr=`#ifdef USE_ROUGHNESSMAP
1650
+ uniform sampler2D roughnessMap;
1651
+ #endif`,pr=`#if NUM_SPOT_LIGHT_COORDS > 0
1652
+ varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1653
+ #endif
1654
+ #if NUM_SPOT_LIGHT_MAPS > 0
1655
+ uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1656
+ #endif
1657
+ #ifdef USE_SHADOWMAP
1658
+ #if NUM_DIR_LIGHT_SHADOWS > 0
1659
+ uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1660
+ varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1661
+ struct DirectionalLightShadow {
1662
+ float shadowIntensity;
1663
+ float shadowBias;
1664
+ float shadowNormalBias;
1665
+ float shadowRadius;
1666
+ vec2 shadowMapSize;
1667
+ };
1668
+ uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1669
+ #endif
1670
+ #if NUM_SPOT_LIGHT_SHADOWS > 0
1671
+ uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1672
+ struct SpotLightShadow {
1673
+ float shadowIntensity;
1674
+ float shadowBias;
1675
+ float shadowNormalBias;
1676
+ float shadowRadius;
1677
+ vec2 shadowMapSize;
1678
+ };
1679
+ uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1680
+ #endif
1681
+ #if NUM_POINT_LIGHT_SHADOWS > 0
1682
+ uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1683
+ varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1684
+ struct PointLightShadow {
1685
+ float shadowIntensity;
1686
+ float shadowBias;
1687
+ float shadowNormalBias;
1688
+ float shadowRadius;
1689
+ vec2 shadowMapSize;
1690
+ float shadowCameraNear;
1691
+ float shadowCameraFar;
1692
+ };
1693
+ uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1694
+ #endif
1695
+ float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1696
+ return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1697
+ }
1698
+ vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1699
+ return unpackRGBATo2Half( texture2D( shadow, uv ) );
1700
+ }
1701
+ float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1702
+ float occlusion = 1.0;
1703
+ vec2 distribution = texture2DDistribution( shadow, uv );
1704
+ float hard_shadow = step( compare , distribution.x );
1705
+ if (hard_shadow != 1.0 ) {
1706
+ float distance = compare - distribution.x ;
1707
+ float variance = max( 0.00000, distribution.y * distribution.y );
1708
+ float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
1709
+ }
1710
+ return occlusion;
1711
+ }
1712
+ float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1713
+ float shadow = 1.0;
1714
+ shadowCoord.xyz /= shadowCoord.w;
1715
+ shadowCoord.z += shadowBias;
1716
+ bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1717
+ bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1718
+ if ( frustumTest ) {
1719
+ #if defined( SHADOWMAP_TYPE_PCF )
1720
+ vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1721
+ float dx0 = - texelSize.x * shadowRadius;
1722
+ float dy0 = - texelSize.y * shadowRadius;
1723
+ float dx1 = + texelSize.x * shadowRadius;
1724
+ float dy1 = + texelSize.y * shadowRadius;
1725
+ float dx2 = dx0 / 2.0;
1726
+ float dy2 = dy0 / 2.0;
1727
+ float dx3 = dx1 / 2.0;
1728
+ float dy3 = dy1 / 2.0;
1729
+ shadow = (
1730
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1731
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1732
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1733
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1734
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1735
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1736
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1737
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1738
+ texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1739
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1740
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1741
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1742
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1743
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1744
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1745
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1746
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1747
+ ) * ( 1.0 / 17.0 );
1748
+ #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1749
+ vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1750
+ float dx = texelSize.x;
1751
+ float dy = texelSize.y;
1752
+ vec2 uv = shadowCoord.xy;
1753
+ vec2 f = fract( uv * shadowMapSize + 0.5 );
1754
+ uv -= f * texelSize;
1755
+ shadow = (
1756
+ texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1757
+ texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1758
+ texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1759
+ texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1760
+ mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1761
+ texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1762
+ f.x ) +
1763
+ mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1764
+ texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1765
+ f.x ) +
1766
+ mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1767
+ texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1768
+ f.y ) +
1769
+ mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1770
+ texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1771
+ f.y ) +
1772
+ mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1773
+ texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1774
+ f.x ),
1775
+ mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1776
+ texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1777
+ f.x ),
1778
+ f.y )
1779
+ ) * ( 1.0 / 9.0 );
1780
+ #elif defined( SHADOWMAP_TYPE_VSM )
1781
+ shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1782
+ #else
1783
+ shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1784
+ #endif
1785
+ }
1786
+ return mix( 1.0, shadow, shadowIntensity );
1787
+ }
1788
+ vec2 cubeToUV( vec3 v, float texelSizeY ) {
1789
+ vec3 absV = abs( v );
1790
+ float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1791
+ absV *= scaleToCube;
1792
+ v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1793
+ vec2 planar = v.xy;
1794
+ float almostATexel = 1.5 * texelSizeY;
1795
+ float almostOne = 1.0 - almostATexel;
1796
+ if ( absV.z >= almostOne ) {
1797
+ if ( v.z > 0.0 )
1798
+ planar.x = 4.0 - v.x;
1799
+ } else if ( absV.x >= almostOne ) {
1800
+ float signX = sign( v.x );
1801
+ planar.x = v.z * signX + 2.0 * signX;
1802
+ } else if ( absV.y >= almostOne ) {
1803
+ float signY = sign( v.y );
1804
+ planar.x = v.x + 2.0 * signY + 2.0;
1805
+ planar.y = v.z * signY - 2.0;
1806
+ }
1807
+ return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1808
+ }
1809
+ float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1810
+ float shadow = 1.0;
1811
+ vec3 lightToPosition = shadowCoord.xyz;
1812
+
1813
+ float lightToPositionLength = length( lightToPosition );
1814
+ if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
1815
+ float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
1816
+ vec3 bd3D = normalize( lightToPosition );
1817
+ vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1818
+ #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1819
+ vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1820
+ shadow = (
1821
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1822
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1823
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1824
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1825
+ texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1826
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1827
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1828
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1829
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1830
+ ) * ( 1.0 / 9.0 );
1831
+ #else
1832
+ shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1833
+ #endif
1834
+ }
1835
+ return mix( 1.0, shadow, shadowIntensity );
1836
+ }
1837
+ #endif`,hr=`#if NUM_SPOT_LIGHT_COORDS > 0
1838
+ uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1839
+ varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1840
+ #endif
1841
+ #ifdef USE_SHADOWMAP
1842
+ #if NUM_DIR_LIGHT_SHADOWS > 0
1843
+ uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1844
+ varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1845
+ struct DirectionalLightShadow {
1846
+ float shadowIntensity;
1847
+ float shadowBias;
1848
+ float shadowNormalBias;
1849
+ float shadowRadius;
1850
+ vec2 shadowMapSize;
1851
+ };
1852
+ uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1853
+ #endif
1854
+ #if NUM_SPOT_LIGHT_SHADOWS > 0
1855
+ struct SpotLightShadow {
1856
+ float shadowIntensity;
1857
+ float shadowBias;
1858
+ float shadowNormalBias;
1859
+ float shadowRadius;
1860
+ vec2 shadowMapSize;
1861
+ };
1862
+ uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1863
+ #endif
1864
+ #if NUM_POINT_LIGHT_SHADOWS > 0
1865
+ uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1866
+ varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1867
+ struct PointLightShadow {
1868
+ float shadowIntensity;
1869
+ float shadowBias;
1870
+ float shadowNormalBias;
1871
+ float shadowRadius;
1872
+ vec2 shadowMapSize;
1873
+ float shadowCameraNear;
1874
+ float shadowCameraFar;
1875
+ };
1876
+ uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1877
+ #endif
1878
+ #endif`,mr=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1879
+ vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1880
+ vec4 shadowWorldPosition;
1881
+ #endif
1882
+ #if defined( USE_SHADOWMAP )
1883
+ #if NUM_DIR_LIGHT_SHADOWS > 0
1884
+ #pragma unroll_loop_start
1885
+ for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1886
+ shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1887
+ vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1888
+ }
1889
+ #pragma unroll_loop_end
1890
+ #endif
1891
+ #if NUM_POINT_LIGHT_SHADOWS > 0
1892
+ #pragma unroll_loop_start
1893
+ for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1894
+ shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1895
+ vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1896
+ }
1897
+ #pragma unroll_loop_end
1898
+ #endif
1899
+ #endif
1900
+ #if NUM_SPOT_LIGHT_COORDS > 0
1901
+ #pragma unroll_loop_start
1902
+ for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1903
+ shadowWorldPosition = worldPosition;
1904
+ #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1905
+ shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1906
+ #endif
1907
+ vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1908
+ }
1909
+ #pragma unroll_loop_end
1910
+ #endif`,_r=`float getShadowMask() {
1911
+ float shadow = 1.0;
1912
+ #ifdef USE_SHADOWMAP
1913
+ #if NUM_DIR_LIGHT_SHADOWS > 0
1914
+ DirectionalLightShadow directionalLight;
1915
+ #pragma unroll_loop_start
1916
+ for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1917
+ directionalLight = directionalLightShadows[ i ];
1918
+ shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1919
+ }
1920
+ #pragma unroll_loop_end
1921
+ #endif
1922
+ #if NUM_SPOT_LIGHT_SHADOWS > 0
1923
+ SpotLightShadow spotLight;
1924
+ #pragma unroll_loop_start
1925
+ for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1926
+ spotLight = spotLightShadows[ i ];
1927
+ shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1928
+ }
1929
+ #pragma unroll_loop_end
1930
+ #endif
1931
+ #if NUM_POINT_LIGHT_SHADOWS > 0
1932
+ PointLightShadow pointLight;
1933
+ #pragma unroll_loop_start
1934
+ for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1935
+ pointLight = pointLightShadows[ i ];
1936
+ shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1937
+ }
1938
+ #pragma unroll_loop_end
1939
+ #endif
1940
+ #endif
1941
+ return shadow;
1942
+ }`,gr=`#ifdef USE_SKINNING
1943
+ mat4 boneMatX = getBoneMatrix( skinIndex.x );
1944
+ mat4 boneMatY = getBoneMatrix( skinIndex.y );
1945
+ mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1946
+ mat4 boneMatW = getBoneMatrix( skinIndex.w );
1947
+ #endif`,vr=`#ifdef USE_SKINNING
1948
+ uniform mat4 bindMatrix;
1949
+ uniform mat4 bindMatrixInverse;
1950
+ uniform highp sampler2D boneTexture;
1951
+ mat4 getBoneMatrix( const in float i ) {
1952
+ int size = textureSize( boneTexture, 0 ).x;
1953
+ int j = int( i ) * 4;
1954
+ int x = j % size;
1955
+ int y = j / size;
1956
+ vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
1957
+ vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
1958
+ vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
1959
+ vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
1960
+ return mat4( v1, v2, v3, v4 );
1961
+ }
1962
+ #endif`,Sr=`#ifdef USE_SKINNING
1963
+ vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
1964
+ vec4 skinned = vec4( 0.0 );
1965
+ skinned += boneMatX * skinVertex * skinWeight.x;
1966
+ skinned += boneMatY * skinVertex * skinWeight.y;
1967
+ skinned += boneMatZ * skinVertex * skinWeight.z;
1968
+ skinned += boneMatW * skinVertex * skinWeight.w;
1969
+ transformed = ( bindMatrixInverse * skinned ).xyz;
1970
+ #endif`,Er=`#ifdef USE_SKINNING
1971
+ mat4 skinMatrix = mat4( 0.0 );
1972
+ skinMatrix += skinWeight.x * boneMatX;
1973
+ skinMatrix += skinWeight.y * boneMatY;
1974
+ skinMatrix += skinWeight.z * boneMatZ;
1975
+ skinMatrix += skinWeight.w * boneMatW;
1976
+ skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
1977
+ objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
1978
+ #ifdef USE_TANGENT
1979
+ objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
1980
+ #endif
1981
+ #endif`,Mr=`float specularStrength;
1982
+ #ifdef USE_SPECULARMAP
1983
+ vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
1984
+ specularStrength = texelSpecular.r;
1985
+ #else
1986
+ specularStrength = 1.0;
1987
+ #endif`,Tr=`#ifdef USE_SPECULARMAP
1988
+ uniform sampler2D specularMap;
1989
+ #endif`,xr=`#if defined( TONE_MAPPING )
1990
+ gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
1991
+ #endif`,Ar=`#ifndef saturate
1992
+ #define saturate( a ) clamp( a, 0.0, 1.0 )
1993
+ #endif
1994
+ uniform float toneMappingExposure;
1995
+ vec3 LinearToneMapping( vec3 color ) {
1996
+ return saturate( toneMappingExposure * color );
1997
+ }
1998
+ vec3 ReinhardToneMapping( vec3 color ) {
1999
+ color *= toneMappingExposure;
2000
+ return saturate( color / ( vec3( 1.0 ) + color ) );
2001
+ }
2002
+ vec3 CineonToneMapping( vec3 color ) {
2003
+ color *= toneMappingExposure;
2004
+ color = max( vec3( 0.0 ), color - 0.004 );
2005
+ return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2006
+ }
2007
+ vec3 RRTAndODTFit( vec3 v ) {
2008
+ vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2009
+ vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2010
+ return a / b;
2011
+ }
2012
+ vec3 ACESFilmicToneMapping( vec3 color ) {
2013
+ const mat3 ACESInputMat = mat3(
2014
+ vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
2015
+ vec3( 0.04823, 0.01566, 0.83777 )
2016
+ );
2017
+ const mat3 ACESOutputMat = mat3(
2018
+ vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
2019
+ vec3( -0.07367, -0.00605, 1.07602 )
2020
+ );
2021
+ color *= toneMappingExposure / 0.6;
2022
+ color = ACESInputMat * color;
2023
+ color = RRTAndODTFit( color );
2024
+ color = ACESOutputMat * color;
2025
+ return saturate( color );
2026
+ }
2027
+ const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2028
+ vec3( 1.6605, - 0.1246, - 0.0182 ),
2029
+ vec3( - 0.5876, 1.1329, - 0.1006 ),
2030
+ vec3( - 0.0728, - 0.0083, 1.1187 )
2031
+ );
2032
+ const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2033
+ vec3( 0.6274, 0.0691, 0.0164 ),
2034
+ vec3( 0.3293, 0.9195, 0.0880 ),
2035
+ vec3( 0.0433, 0.0113, 0.8956 )
2036
+ );
2037
+ vec3 agxDefaultContrastApprox( vec3 x ) {
2038
+ vec3 x2 = x * x;
2039
+ vec3 x4 = x2 * x2;
2040
+ return + 15.5 * x4 * x2
2041
+ - 40.14 * x4 * x
2042
+ + 31.96 * x4
2043
+ - 6.868 * x2 * x
2044
+ + 0.4298 * x2
2045
+ + 0.1191 * x
2046
+ - 0.00232;
2047
+ }
2048
+ vec3 AgXToneMapping( vec3 color ) {
2049
+ const mat3 AgXInsetMatrix = mat3(
2050
+ vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2051
+ vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2052
+ vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2053
+ );
2054
+ const mat3 AgXOutsetMatrix = mat3(
2055
+ vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2056
+ vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2057
+ vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2058
+ );
2059
+ const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
2060
+ color *= toneMappingExposure;
2061
+ color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2062
+ color = AgXInsetMatrix * color;
2063
+ color = max( color, 1e-10 ); color = log2( color );
2064
+ color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2065
+ color = clamp( color, 0.0, 1.0 );
2066
+ color = agxDefaultContrastApprox( color );
2067
+ color = AgXOutsetMatrix * color;
2068
+ color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2069
+ color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2070
+ color = clamp( color, 0.0, 1.0 );
2071
+ return color;
2072
+ }
2073
+ vec3 NeutralToneMapping( vec3 color ) {
2074
+ const float StartCompression = 0.8 - 0.04;
2075
+ const float Desaturation = 0.15;
2076
+ color *= toneMappingExposure;
2077
+ float x = min( color.r, min( color.g, color.b ) );
2078
+ float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2079
+ color -= offset;
2080
+ float peak = max( color.r, max( color.g, color.b ) );
2081
+ if ( peak < StartCompression ) return color;
2082
+ float d = 1. - StartCompression;
2083
+ float newPeak = 1. - d * d / ( peak + d - StartCompression );
2084
+ color *= newPeak / peak;
2085
+ float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2086
+ return mix( color, vec3( newPeak ), g );
2087
+ }
2088
+ vec3 CustomToneMapping( vec3 color ) { return color; }`,Rr=`#ifdef USE_TRANSMISSION
2089
+ material.transmission = transmission;
2090
+ material.transmissionAlpha = 1.0;
2091
+ material.thickness = thickness;
2092
+ material.attenuationDistance = attenuationDistance;
2093
+ material.attenuationColor = attenuationColor;
2094
+ #ifdef USE_TRANSMISSIONMAP
2095
+ material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2096
+ #endif
2097
+ #ifdef USE_THICKNESSMAP
2098
+ material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2099
+ #endif
2100
+ vec3 pos = vWorldPosition;
2101
+ vec3 v = normalize( cameraPosition - pos );
2102
+ vec3 n = inverseTransformDirection( normal, viewMatrix );
2103
+ vec4 transmitted = getIBLVolumeRefraction(
2104
+ n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
2105
+ pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2106
+ material.attenuationColor, material.attenuationDistance );
2107
+ material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2108
+ totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2109
+ #endif`,Cr=`#ifdef USE_TRANSMISSION
2110
+ uniform float transmission;
2111
+ uniform float thickness;
2112
+ uniform float attenuationDistance;
2113
+ uniform vec3 attenuationColor;
2114
+ #ifdef USE_TRANSMISSIONMAP
2115
+ uniform sampler2D transmissionMap;
2116
+ #endif
2117
+ #ifdef USE_THICKNESSMAP
2118
+ uniform sampler2D thicknessMap;
2119
+ #endif
2120
+ uniform vec2 transmissionSamplerSize;
2121
+ uniform sampler2D transmissionSamplerMap;
2122
+ uniform mat4 modelMatrix;
2123
+ uniform mat4 projectionMatrix;
2124
+ varying vec3 vWorldPosition;
2125
+ float w0( float a ) {
2126
+ return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2127
+ }
2128
+ float w1( float a ) {
2129
+ return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
2130
+ }
2131
+ float w2( float a ){
2132
+ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2133
+ }
2134
+ float w3( float a ) {
2135
+ return ( 1.0 / 6.0 ) * ( a * a * a );
2136
+ }
2137
+ float g0( float a ) {
2138
+ return w0( a ) + w1( a );
2139
+ }
2140
+ float g1( float a ) {
2141
+ return w2( a ) + w3( a );
2142
+ }
2143
+ float h0( float a ) {
2144
+ return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2145
+ }
2146
+ float h1( float a ) {
2147
+ return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2148
+ }
2149
+ vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2150
+ uv = uv * texelSize.zw + 0.5;
2151
+ vec2 iuv = floor( uv );
2152
+ vec2 fuv = fract( uv );
2153
+ float g0x = g0( fuv.x );
2154
+ float g1x = g1( fuv.x );
2155
+ float h0x = h0( fuv.x );
2156
+ float h1x = h1( fuv.x );
2157
+ float h0y = h0( fuv.y );
2158
+ float h1y = h1( fuv.y );
2159
+ vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2160
+ vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2161
+ vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2162
+ vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2163
+ return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2164
+ g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2165
+ }
2166
+ vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2167
+ vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2168
+ vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2169
+ vec2 fLodSizeInv = 1.0 / fLodSize;
2170
+ vec2 cLodSizeInv = 1.0 / cLodSize;
2171
+ vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2172
+ vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2173
+ return mix( fSample, cSample, fract( lod ) );
2174
+ }
2175
+ vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2176
+ vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2177
+ vec3 modelScale;
2178
+ modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2179
+ modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2180
+ modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2181
+ return normalize( refractionVector ) * thickness * modelScale;
2182
+ }
2183
+ float applyIorToRoughness( const in float roughness, const in float ior ) {
2184
+ return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2185
+ }
2186
+ vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2187
+ float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2188
+ return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2189
+ }
2190
+ vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2191
+ if ( isinf( attenuationDistance ) ) {
2192
+ return vec3( 1.0 );
2193
+ } else {
2194
+ vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2195
+ vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
2196
+ }
2197
+ }
2198
+ vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2199
+ const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2200
+ const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2201
+ const in vec3 attenuationColor, const in float attenuationDistance ) {
2202
+ vec4 transmittedLight;
2203
+ vec3 transmittance;
2204
+ #ifdef USE_DISPERSION
2205
+ float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2206
+ vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2207
+ for ( int i = 0; i < 3; i ++ ) {
2208
+ vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2209
+ vec3 refractedRayExit = position + transmissionRay;
2210
+ vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2211
+ vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2212
+ refractionCoords += 1.0;
2213
+ refractionCoords /= 2.0;
2214
+ vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2215
+ transmittedLight[ i ] = transmissionSample[ i ];
2216
+ transmittedLight.a += transmissionSample.a;
2217
+ transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2218
+ }
2219
+ transmittedLight.a /= 3.0;
2220
+ #else
2221
+ vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2222
+ vec3 refractedRayExit = position + transmissionRay;
2223
+ vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2224
+ vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2225
+ refractionCoords += 1.0;
2226
+ refractionCoords /= 2.0;
2227
+ transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2228
+ transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2229
+ #endif
2230
+ vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2231
+ vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2232
+ float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2233
+ return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2234
+ }
2235
+ #endif`,br=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2236
+ varying vec2 vUv;
2237
+ #endif
2238
+ #ifdef USE_MAP
2239
+ varying vec2 vMapUv;
2240
+ #endif
2241
+ #ifdef USE_ALPHAMAP
2242
+ varying vec2 vAlphaMapUv;
2243
+ #endif
2244
+ #ifdef USE_LIGHTMAP
2245
+ varying vec2 vLightMapUv;
2246
+ #endif
2247
+ #ifdef USE_AOMAP
2248
+ varying vec2 vAoMapUv;
2249
+ #endif
2250
+ #ifdef USE_BUMPMAP
2251
+ varying vec2 vBumpMapUv;
2252
+ #endif
2253
+ #ifdef USE_NORMALMAP
2254
+ varying vec2 vNormalMapUv;
2255
+ #endif
2256
+ #ifdef USE_EMISSIVEMAP
2257
+ varying vec2 vEmissiveMapUv;
2258
+ #endif
2259
+ #ifdef USE_METALNESSMAP
2260
+ varying vec2 vMetalnessMapUv;
2261
+ #endif
2262
+ #ifdef USE_ROUGHNESSMAP
2263
+ varying vec2 vRoughnessMapUv;
2264
+ #endif
2265
+ #ifdef USE_ANISOTROPYMAP
2266
+ varying vec2 vAnisotropyMapUv;
2267
+ #endif
2268
+ #ifdef USE_CLEARCOATMAP
2269
+ varying vec2 vClearcoatMapUv;
2270
+ #endif
2271
+ #ifdef USE_CLEARCOAT_NORMALMAP
2272
+ varying vec2 vClearcoatNormalMapUv;
2273
+ #endif
2274
+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP
2275
+ varying vec2 vClearcoatRoughnessMapUv;
2276
+ #endif
2277
+ #ifdef USE_IRIDESCENCEMAP
2278
+ varying vec2 vIridescenceMapUv;
2279
+ #endif
2280
+ #ifdef USE_IRIDESCENCE_THICKNESSMAP
2281
+ varying vec2 vIridescenceThicknessMapUv;
2282
+ #endif
2283
+ #ifdef USE_SHEEN_COLORMAP
2284
+ varying vec2 vSheenColorMapUv;
2285
+ #endif
2286
+ #ifdef USE_SHEEN_ROUGHNESSMAP
2287
+ varying vec2 vSheenRoughnessMapUv;
2288
+ #endif
2289
+ #ifdef USE_SPECULARMAP
2290
+ varying vec2 vSpecularMapUv;
2291
+ #endif
2292
+ #ifdef USE_SPECULAR_COLORMAP
2293
+ varying vec2 vSpecularColorMapUv;
2294
+ #endif
2295
+ #ifdef USE_SPECULAR_INTENSITYMAP
2296
+ varying vec2 vSpecularIntensityMapUv;
2297
+ #endif
2298
+ #ifdef USE_TRANSMISSIONMAP
2299
+ uniform mat3 transmissionMapTransform;
2300
+ varying vec2 vTransmissionMapUv;
2301
+ #endif
2302
+ #ifdef USE_THICKNESSMAP
2303
+ uniform mat3 thicknessMapTransform;
2304
+ varying vec2 vThicknessMapUv;
2305
+ #endif`,Pr=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2306
+ varying vec2 vUv;
2307
+ #endif
2308
+ #ifdef USE_MAP
2309
+ uniform mat3 mapTransform;
2310
+ varying vec2 vMapUv;
2311
+ #endif
2312
+ #ifdef USE_ALPHAMAP
2313
+ uniform mat3 alphaMapTransform;
2314
+ varying vec2 vAlphaMapUv;
2315
+ #endif
2316
+ #ifdef USE_LIGHTMAP
2317
+ uniform mat3 lightMapTransform;
2318
+ varying vec2 vLightMapUv;
2319
+ #endif
2320
+ #ifdef USE_AOMAP
2321
+ uniform mat3 aoMapTransform;
2322
+ varying vec2 vAoMapUv;
2323
+ #endif
2324
+ #ifdef USE_BUMPMAP
2325
+ uniform mat3 bumpMapTransform;
2326
+ varying vec2 vBumpMapUv;
2327
+ #endif
2328
+ #ifdef USE_NORMALMAP
2329
+ uniform mat3 normalMapTransform;
2330
+ varying vec2 vNormalMapUv;
2331
+ #endif
2332
+ #ifdef USE_DISPLACEMENTMAP
2333
+ uniform mat3 displacementMapTransform;
2334
+ varying vec2 vDisplacementMapUv;
2335
+ #endif
2336
+ #ifdef USE_EMISSIVEMAP
2337
+ uniform mat3 emissiveMapTransform;
2338
+ varying vec2 vEmissiveMapUv;
2339
+ #endif
2340
+ #ifdef USE_METALNESSMAP
2341
+ uniform mat3 metalnessMapTransform;
2342
+ varying vec2 vMetalnessMapUv;
2343
+ #endif
2344
+ #ifdef USE_ROUGHNESSMAP
2345
+ uniform mat3 roughnessMapTransform;
2346
+ varying vec2 vRoughnessMapUv;
2347
+ #endif
2348
+ #ifdef USE_ANISOTROPYMAP
2349
+ uniform mat3 anisotropyMapTransform;
2350
+ varying vec2 vAnisotropyMapUv;
2351
+ #endif
2352
+ #ifdef USE_CLEARCOATMAP
2353
+ uniform mat3 clearcoatMapTransform;
2354
+ varying vec2 vClearcoatMapUv;
2355
+ #endif
2356
+ #ifdef USE_CLEARCOAT_NORMALMAP
2357
+ uniform mat3 clearcoatNormalMapTransform;
2358
+ varying vec2 vClearcoatNormalMapUv;
2359
+ #endif
2360
+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP
2361
+ uniform mat3 clearcoatRoughnessMapTransform;
2362
+ varying vec2 vClearcoatRoughnessMapUv;
2363
+ #endif
2364
+ #ifdef USE_SHEEN_COLORMAP
2365
+ uniform mat3 sheenColorMapTransform;
2366
+ varying vec2 vSheenColorMapUv;
2367
+ #endif
2368
+ #ifdef USE_SHEEN_ROUGHNESSMAP
2369
+ uniform mat3 sheenRoughnessMapTransform;
2370
+ varying vec2 vSheenRoughnessMapUv;
2371
+ #endif
2372
+ #ifdef USE_IRIDESCENCEMAP
2373
+ uniform mat3 iridescenceMapTransform;
2374
+ varying vec2 vIridescenceMapUv;
2375
+ #endif
2376
+ #ifdef USE_IRIDESCENCE_THICKNESSMAP
2377
+ uniform mat3 iridescenceThicknessMapTransform;
2378
+ varying vec2 vIridescenceThicknessMapUv;
2379
+ #endif
2380
+ #ifdef USE_SPECULARMAP
2381
+ uniform mat3 specularMapTransform;
2382
+ varying vec2 vSpecularMapUv;
2383
+ #endif
2384
+ #ifdef USE_SPECULAR_COLORMAP
2385
+ uniform mat3 specularColorMapTransform;
2386
+ varying vec2 vSpecularColorMapUv;
2387
+ #endif
2388
+ #ifdef USE_SPECULAR_INTENSITYMAP
2389
+ uniform mat3 specularIntensityMapTransform;
2390
+ varying vec2 vSpecularIntensityMapUv;
2391
+ #endif
2392
+ #ifdef USE_TRANSMISSIONMAP
2393
+ uniform mat3 transmissionMapTransform;
2394
+ varying vec2 vTransmissionMapUv;
2395
+ #endif
2396
+ #ifdef USE_THICKNESSMAP
2397
+ uniform mat3 thicknessMapTransform;
2398
+ varying vec2 vThicknessMapUv;
2399
+ #endif`,Lr=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2400
+ vUv = vec3( uv, 1 ).xy;
2401
+ #endif
2402
+ #ifdef USE_MAP
2403
+ vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2404
+ #endif
2405
+ #ifdef USE_ALPHAMAP
2406
+ vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2407
+ #endif
2408
+ #ifdef USE_LIGHTMAP
2409
+ vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2410
+ #endif
2411
+ #ifdef USE_AOMAP
2412
+ vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2413
+ #endif
2414
+ #ifdef USE_BUMPMAP
2415
+ vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2416
+ #endif
2417
+ #ifdef USE_NORMALMAP
2418
+ vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2419
+ #endif
2420
+ #ifdef USE_DISPLACEMENTMAP
2421
+ vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2422
+ #endif
2423
+ #ifdef USE_EMISSIVEMAP
2424
+ vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2425
+ #endif
2426
+ #ifdef USE_METALNESSMAP
2427
+ vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2428
+ #endif
2429
+ #ifdef USE_ROUGHNESSMAP
2430
+ vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2431
+ #endif
2432
+ #ifdef USE_ANISOTROPYMAP
2433
+ vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2434
+ #endif
2435
+ #ifdef USE_CLEARCOATMAP
2436
+ vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2437
+ #endif
2438
+ #ifdef USE_CLEARCOAT_NORMALMAP
2439
+ vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2440
+ #endif
2441
+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP
2442
+ vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2443
+ #endif
2444
+ #ifdef USE_IRIDESCENCEMAP
2445
+ vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2446
+ #endif
2447
+ #ifdef USE_IRIDESCENCE_THICKNESSMAP
2448
+ vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2449
+ #endif
2450
+ #ifdef USE_SHEEN_COLORMAP
2451
+ vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2452
+ #endif
2453
+ #ifdef USE_SHEEN_ROUGHNESSMAP
2454
+ vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2455
+ #endif
2456
+ #ifdef USE_SPECULARMAP
2457
+ vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2458
+ #endif
2459
+ #ifdef USE_SPECULAR_COLORMAP
2460
+ vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2461
+ #endif
2462
+ #ifdef USE_SPECULAR_INTENSITYMAP
2463
+ vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2464
+ #endif
2465
+ #ifdef USE_TRANSMISSIONMAP
2466
+ vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2467
+ #endif
2468
+ #ifdef USE_THICKNESSMAP
2469
+ vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2470
+ #endif`,Dr=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2471
+ vec4 worldPosition = vec4( transformed, 1.0 );
2472
+ #ifdef USE_BATCHING
2473
+ worldPosition = batchingMatrix * worldPosition;
2474
+ #endif
2475
+ #ifdef USE_INSTANCING
2476
+ worldPosition = instanceMatrix * worldPosition;
2477
+ #endif
2478
+ worldPosition = modelMatrix * worldPosition;
2479
+ #endif`;const Ur=`varying vec2 vUv;
2480
+ uniform mat3 uvTransform;
2481
+ void main() {
2482
+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2483
+ gl_Position = vec4( position.xy, 1.0, 1.0 );
2484
+ }`,wr=`uniform sampler2D t2D;
2485
+ uniform float backgroundIntensity;
2486
+ varying vec2 vUv;
2487
+ void main() {
2488
+ vec4 texColor = texture2D( t2D, vUv );
2489
+ #ifdef DECODE_VIDEO_TEXTURE
2490
+ texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
2491
+ #endif
2492
+ texColor.rgb *= backgroundIntensity;
2493
+ gl_FragColor = texColor;
2494
+ #include <tonemapping_fragment>
2495
+ #include <colorspace_fragment>
2496
+ }`,Ir=`varying vec3 vWorldDirection;
2497
+ #include <common>
2498
+ void main() {
2499
+ vWorldDirection = transformDirection( position, modelMatrix );
2500
+ #include <begin_vertex>
2501
+ #include <project_vertex>
2502
+ gl_Position.z = gl_Position.w;
2503
+ }`,Nr=`#ifdef ENVMAP_TYPE_CUBE
2504
+ uniform samplerCube envMap;
2505
+ #elif defined( ENVMAP_TYPE_CUBE_UV )
2506
+ uniform sampler2D envMap;
2507
+ #endif
2508
+ uniform float flipEnvMap;
2509
+ uniform float backgroundBlurriness;
2510
+ uniform float backgroundIntensity;
2511
+ uniform mat3 backgroundRotation;
2512
+ varying vec3 vWorldDirection;
2513
+ #include <cube_uv_reflection_fragment>
2514
+ void main() {
2515
+ #ifdef ENVMAP_TYPE_CUBE
2516
+ vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2517
+ #elif defined( ENVMAP_TYPE_CUBE_UV )
2518
+ vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2519
+ #else
2520
+ vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2521
+ #endif
2522
+ texColor.rgb *= backgroundIntensity;
2523
+ gl_FragColor = texColor;
2524
+ #include <tonemapping_fragment>
2525
+ #include <colorspace_fragment>
2526
+ }`,yr=`varying vec3 vWorldDirection;
2527
+ #include <common>
2528
+ void main() {
2529
+ vWorldDirection = transformDirection( position, modelMatrix );
2530
+ #include <begin_vertex>
2531
+ #include <project_vertex>
2532
+ gl_Position.z = gl_Position.w;
2533
+ }`,Fr=`uniform samplerCube tCube;
2534
+ uniform float tFlip;
2535
+ uniform float opacity;
2536
+ varying vec3 vWorldDirection;
2537
+ void main() {
2538
+ vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2539
+ gl_FragColor = texColor;
2540
+ gl_FragColor.a *= opacity;
2541
+ #include <tonemapping_fragment>
2542
+ #include <colorspace_fragment>
2543
+ }`,Or=`#include <common>
2544
+ #include <batching_pars_vertex>
2545
+ #include <uv_pars_vertex>
2546
+ #include <displacementmap_pars_vertex>
2547
+ #include <morphtarget_pars_vertex>
2548
+ #include <skinning_pars_vertex>
2549
+ #include <logdepthbuf_pars_vertex>
2550
+ #include <clipping_planes_pars_vertex>
2551
+ varying vec2 vHighPrecisionZW;
2552
+ void main() {
2553
+ #include <uv_vertex>
2554
+ #include <batching_vertex>
2555
+ #include <skinbase_vertex>
2556
+ #include <morphinstance_vertex>
2557
+ #ifdef USE_DISPLACEMENTMAP
2558
+ #include <beginnormal_vertex>
2559
+ #include <morphnormal_vertex>
2560
+ #include <skinnormal_vertex>
2561
+ #endif
2562
+ #include <begin_vertex>
2563
+ #include <morphtarget_vertex>
2564
+ #include <skinning_vertex>
2565
+ #include <displacementmap_vertex>
2566
+ #include <project_vertex>
2567
+ #include <logdepthbuf_vertex>
2568
+ #include <clipping_planes_vertex>
2569
+ vHighPrecisionZW = gl_Position.zw;
2570
+ }`,Br=`#if DEPTH_PACKING == 3200
2571
+ uniform float opacity;
2572
+ #endif
2573
+ #include <common>
2574
+ #include <packing>
2575
+ #include <uv_pars_fragment>
2576
+ #include <map_pars_fragment>
2577
+ #include <alphamap_pars_fragment>
2578
+ #include <alphatest_pars_fragment>
2579
+ #include <alphahash_pars_fragment>
2580
+ #include <logdepthbuf_pars_fragment>
2581
+ #include <clipping_planes_pars_fragment>
2582
+ varying vec2 vHighPrecisionZW;
2583
+ void main() {
2584
+ vec4 diffuseColor = vec4( 1.0 );
2585
+ #include <clipping_planes_fragment>
2586
+ #if DEPTH_PACKING == 3200
2587
+ diffuseColor.a = opacity;
2588
+ #endif
2589
+ #include <map_fragment>
2590
+ #include <alphamap_fragment>
2591
+ #include <alphatest_fragment>
2592
+ #include <alphahash_fragment>
2593
+ #include <logdepthbuf_fragment>
2594
+ float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2595
+ #if DEPTH_PACKING == 3200
2596
+ gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2597
+ #elif DEPTH_PACKING == 3201
2598
+ gl_FragColor = packDepthToRGBA( fragCoordZ );
2599
+ #elif DEPTH_PACKING == 3202
2600
+ gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2601
+ #elif DEPTH_PACKING == 3203
2602
+ gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2603
+ #endif
2604
+ }`,Gr=`#define DISTANCE
2605
+ varying vec3 vWorldPosition;
2606
+ #include <common>
2607
+ #include <batching_pars_vertex>
2608
+ #include <uv_pars_vertex>
2609
+ #include <displacementmap_pars_vertex>
2610
+ #include <morphtarget_pars_vertex>
2611
+ #include <skinning_pars_vertex>
2612
+ #include <clipping_planes_pars_vertex>
2613
+ void main() {
2614
+ #include <uv_vertex>
2615
+ #include <batching_vertex>
2616
+ #include <skinbase_vertex>
2617
+ #include <morphinstance_vertex>
2618
+ #ifdef USE_DISPLACEMENTMAP
2619
+ #include <beginnormal_vertex>
2620
+ #include <morphnormal_vertex>
2621
+ #include <skinnormal_vertex>
2622
+ #endif
2623
+ #include <begin_vertex>
2624
+ #include <morphtarget_vertex>
2625
+ #include <skinning_vertex>
2626
+ #include <displacementmap_vertex>
2627
+ #include <project_vertex>
2628
+ #include <worldpos_vertex>
2629
+ #include <clipping_planes_vertex>
2630
+ vWorldPosition = worldPosition.xyz;
2631
+ }`,Hr=`#define DISTANCE
2632
+ uniform vec3 referencePosition;
2633
+ uniform float nearDistance;
2634
+ uniform float farDistance;
2635
+ varying vec3 vWorldPosition;
2636
+ #include <common>
2637
+ #include <packing>
2638
+ #include <uv_pars_fragment>
2639
+ #include <map_pars_fragment>
2640
+ #include <alphamap_pars_fragment>
2641
+ #include <alphatest_pars_fragment>
2642
+ #include <alphahash_pars_fragment>
2643
+ #include <clipping_planes_pars_fragment>
2644
+ void main () {
2645
+ vec4 diffuseColor = vec4( 1.0 );
2646
+ #include <clipping_planes_fragment>
2647
+ #include <map_fragment>
2648
+ #include <alphamap_fragment>
2649
+ #include <alphatest_fragment>
2650
+ #include <alphahash_fragment>
2651
+ float dist = length( vWorldPosition - referencePosition );
2652
+ dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2653
+ dist = saturate( dist );
2654
+ gl_FragColor = packDepthToRGBA( dist );
2655
+ }`,Vr=`varying vec3 vWorldDirection;
2656
+ #include <common>
2657
+ void main() {
2658
+ vWorldDirection = transformDirection( position, modelMatrix );
2659
+ #include <begin_vertex>
2660
+ #include <project_vertex>
2661
+ }`,kr=`uniform sampler2D tEquirect;
2662
+ varying vec3 vWorldDirection;
2663
+ #include <common>
2664
+ void main() {
2665
+ vec3 direction = normalize( vWorldDirection );
2666
+ vec2 sampleUV = equirectUv( direction );
2667
+ gl_FragColor = texture2D( tEquirect, sampleUV );
2668
+ #include <tonemapping_fragment>
2669
+ #include <colorspace_fragment>
2670
+ }`,Wr=`uniform float scale;
2671
+ attribute float lineDistance;
2672
+ varying float vLineDistance;
2673
+ #include <common>
2674
+ #include <uv_pars_vertex>
2675
+ #include <color_pars_vertex>
2676
+ #include <fog_pars_vertex>
2677
+ #include <morphtarget_pars_vertex>
2678
+ #include <logdepthbuf_pars_vertex>
2679
+ #include <clipping_planes_pars_vertex>
2680
+ void main() {
2681
+ vLineDistance = scale * lineDistance;
2682
+ #include <uv_vertex>
2683
+ #include <color_vertex>
2684
+ #include <morphinstance_vertex>
2685
+ #include <morphcolor_vertex>
2686
+ #include <begin_vertex>
2687
+ #include <morphtarget_vertex>
2688
+ #include <project_vertex>
2689
+ #include <logdepthbuf_vertex>
2690
+ #include <clipping_planes_vertex>
2691
+ #include <fog_vertex>
2692
+ }`,zr=`uniform vec3 diffuse;
2693
+ uniform float opacity;
2694
+ uniform float dashSize;
2695
+ uniform float totalSize;
2696
+ varying float vLineDistance;
2697
+ #include <common>
2698
+ #include <color_pars_fragment>
2699
+ #include <uv_pars_fragment>
2700
+ #include <map_pars_fragment>
2701
+ #include <fog_pars_fragment>
2702
+ #include <logdepthbuf_pars_fragment>
2703
+ #include <clipping_planes_pars_fragment>
2704
+ void main() {
2705
+ vec4 diffuseColor = vec4( diffuse, opacity );
2706
+ #include <clipping_planes_fragment>
2707
+ if ( mod( vLineDistance, totalSize ) > dashSize ) {
2708
+ discard;
2709
+ }
2710
+ vec3 outgoingLight = vec3( 0.0 );
2711
+ #include <logdepthbuf_fragment>
2712
+ #include <map_fragment>
2713
+ #include <color_fragment>
2714
+ outgoingLight = diffuseColor.rgb;
2715
+ #include <opaque_fragment>
2716
+ #include <tonemapping_fragment>
2717
+ #include <colorspace_fragment>
2718
+ #include <fog_fragment>
2719
+ #include <premultiplied_alpha_fragment>
2720
+ }`,Xr=`#include <common>
2721
+ #include <batching_pars_vertex>
2722
+ #include <uv_pars_vertex>
2723
+ #include <envmap_pars_vertex>
2724
+ #include <color_pars_vertex>
2725
+ #include <fog_pars_vertex>
2726
+ #include <morphtarget_pars_vertex>
2727
+ #include <skinning_pars_vertex>
2728
+ #include <logdepthbuf_pars_vertex>
2729
+ #include <clipping_planes_pars_vertex>
2730
+ void main() {
2731
+ #include <uv_vertex>
2732
+ #include <color_vertex>
2733
+ #include <morphinstance_vertex>
2734
+ #include <morphcolor_vertex>
2735
+ #include <batching_vertex>
2736
+ #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2737
+ #include <beginnormal_vertex>
2738
+ #include <morphnormal_vertex>
2739
+ #include <skinbase_vertex>
2740
+ #include <skinnormal_vertex>
2741
+ #include <defaultnormal_vertex>
2742
+ #endif
2743
+ #include <begin_vertex>
2744
+ #include <morphtarget_vertex>
2745
+ #include <skinning_vertex>
2746
+ #include <project_vertex>
2747
+ #include <logdepthbuf_vertex>
2748
+ #include <clipping_planes_vertex>
2749
+ #include <worldpos_vertex>
2750
+ #include <envmap_vertex>
2751
+ #include <fog_vertex>
2752
+ }`,qr=`uniform vec3 diffuse;
2753
+ uniform float opacity;
2754
+ #ifndef FLAT_SHADED
2755
+ varying vec3 vNormal;
2756
+ #endif
2757
+ #include <common>
2758
+ #include <dithering_pars_fragment>
2759
+ #include <color_pars_fragment>
2760
+ #include <uv_pars_fragment>
2761
+ #include <map_pars_fragment>
2762
+ #include <alphamap_pars_fragment>
2763
+ #include <alphatest_pars_fragment>
2764
+ #include <alphahash_pars_fragment>
2765
+ #include <aomap_pars_fragment>
2766
+ #include <lightmap_pars_fragment>
2767
+ #include <envmap_common_pars_fragment>
2768
+ #include <envmap_pars_fragment>
2769
+ #include <fog_pars_fragment>
2770
+ #include <specularmap_pars_fragment>
2771
+ #include <logdepthbuf_pars_fragment>
2772
+ #include <clipping_planes_pars_fragment>
2773
+ void main() {
2774
+ vec4 diffuseColor = vec4( diffuse, opacity );
2775
+ #include <clipping_planes_fragment>
2776
+ #include <logdepthbuf_fragment>
2777
+ #include <map_fragment>
2778
+ #include <color_fragment>
2779
+ #include <alphamap_fragment>
2780
+ #include <alphatest_fragment>
2781
+ #include <alphahash_fragment>
2782
+ #include <specularmap_fragment>
2783
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2784
+ #ifdef USE_LIGHTMAP
2785
+ vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2786
+ reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2787
+ #else
2788
+ reflectedLight.indirectDiffuse += vec3( 1.0 );
2789
+ #endif
2790
+ #include <aomap_fragment>
2791
+ reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2792
+ vec3 outgoingLight = reflectedLight.indirectDiffuse;
2793
+ #include <envmap_fragment>
2794
+ #include <opaque_fragment>
2795
+ #include <tonemapping_fragment>
2796
+ #include <colorspace_fragment>
2797
+ #include <fog_fragment>
2798
+ #include <premultiplied_alpha_fragment>
2799
+ #include <dithering_fragment>
2800
+ }`,Yr=`#define LAMBERT
2801
+ varying vec3 vViewPosition;
2802
+ #include <common>
2803
+ #include <batching_pars_vertex>
2804
+ #include <uv_pars_vertex>
2805
+ #include <displacementmap_pars_vertex>
2806
+ #include <envmap_pars_vertex>
2807
+ #include <color_pars_vertex>
2808
+ #include <fog_pars_vertex>
2809
+ #include <normal_pars_vertex>
2810
+ #include <morphtarget_pars_vertex>
2811
+ #include <skinning_pars_vertex>
2812
+ #include <shadowmap_pars_vertex>
2813
+ #include <logdepthbuf_pars_vertex>
2814
+ #include <clipping_planes_pars_vertex>
2815
+ void main() {
2816
+ #include <uv_vertex>
2817
+ #include <color_vertex>
2818
+ #include <morphinstance_vertex>
2819
+ #include <morphcolor_vertex>
2820
+ #include <batching_vertex>
2821
+ #include <beginnormal_vertex>
2822
+ #include <morphnormal_vertex>
2823
+ #include <skinbase_vertex>
2824
+ #include <skinnormal_vertex>
2825
+ #include <defaultnormal_vertex>
2826
+ #include <normal_vertex>
2827
+ #include <begin_vertex>
2828
+ #include <morphtarget_vertex>
2829
+ #include <skinning_vertex>
2830
+ #include <displacementmap_vertex>
2831
+ #include <project_vertex>
2832
+ #include <logdepthbuf_vertex>
2833
+ #include <clipping_planes_vertex>
2834
+ vViewPosition = - mvPosition.xyz;
2835
+ #include <worldpos_vertex>
2836
+ #include <envmap_vertex>
2837
+ #include <shadowmap_vertex>
2838
+ #include <fog_vertex>
2839
+ }`,Kr=`#define LAMBERT
2840
+ uniform vec3 diffuse;
2841
+ uniform vec3 emissive;
2842
+ uniform float opacity;
2843
+ #include <common>
2844
+ #include <packing>
2845
+ #include <dithering_pars_fragment>
2846
+ #include <color_pars_fragment>
2847
+ #include <uv_pars_fragment>
2848
+ #include <map_pars_fragment>
2849
+ #include <alphamap_pars_fragment>
2850
+ #include <alphatest_pars_fragment>
2851
+ #include <alphahash_pars_fragment>
2852
+ #include <aomap_pars_fragment>
2853
+ #include <lightmap_pars_fragment>
2854
+ #include <emissivemap_pars_fragment>
2855
+ #include <envmap_common_pars_fragment>
2856
+ #include <envmap_pars_fragment>
2857
+ #include <fog_pars_fragment>
2858
+ #include <bsdfs>
2859
+ #include <lights_pars_begin>
2860
+ #include <normal_pars_fragment>
2861
+ #include <lights_lambert_pars_fragment>
2862
+ #include <shadowmap_pars_fragment>
2863
+ #include <bumpmap_pars_fragment>
2864
+ #include <normalmap_pars_fragment>
2865
+ #include <specularmap_pars_fragment>
2866
+ #include <logdepthbuf_pars_fragment>
2867
+ #include <clipping_planes_pars_fragment>
2868
+ void main() {
2869
+ vec4 diffuseColor = vec4( diffuse, opacity );
2870
+ #include <clipping_planes_fragment>
2871
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2872
+ vec3 totalEmissiveRadiance = emissive;
2873
+ #include <logdepthbuf_fragment>
2874
+ #include <map_fragment>
2875
+ #include <color_fragment>
2876
+ #include <alphamap_fragment>
2877
+ #include <alphatest_fragment>
2878
+ #include <alphahash_fragment>
2879
+ #include <specularmap_fragment>
2880
+ #include <normal_fragment_begin>
2881
+ #include <normal_fragment_maps>
2882
+ #include <emissivemap_fragment>
2883
+ #include <lights_lambert_fragment>
2884
+ #include <lights_fragment_begin>
2885
+ #include <lights_fragment_maps>
2886
+ #include <lights_fragment_end>
2887
+ #include <aomap_fragment>
2888
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2889
+ #include <envmap_fragment>
2890
+ #include <opaque_fragment>
2891
+ #include <tonemapping_fragment>
2892
+ #include <colorspace_fragment>
2893
+ #include <fog_fragment>
2894
+ #include <premultiplied_alpha_fragment>
2895
+ #include <dithering_fragment>
2896
+ }`,$r=`#define MATCAP
2897
+ varying vec3 vViewPosition;
2898
+ #include <common>
2899
+ #include <batching_pars_vertex>
2900
+ #include <uv_pars_vertex>
2901
+ #include <color_pars_vertex>
2902
+ #include <displacementmap_pars_vertex>
2903
+ #include <fog_pars_vertex>
2904
+ #include <normal_pars_vertex>
2905
+ #include <morphtarget_pars_vertex>
2906
+ #include <skinning_pars_vertex>
2907
+ #include <logdepthbuf_pars_vertex>
2908
+ #include <clipping_planes_pars_vertex>
2909
+ void main() {
2910
+ #include <uv_vertex>
2911
+ #include <color_vertex>
2912
+ #include <morphinstance_vertex>
2913
+ #include <morphcolor_vertex>
2914
+ #include <batching_vertex>
2915
+ #include <beginnormal_vertex>
2916
+ #include <morphnormal_vertex>
2917
+ #include <skinbase_vertex>
2918
+ #include <skinnormal_vertex>
2919
+ #include <defaultnormal_vertex>
2920
+ #include <normal_vertex>
2921
+ #include <begin_vertex>
2922
+ #include <morphtarget_vertex>
2923
+ #include <skinning_vertex>
2924
+ #include <displacementmap_vertex>
2925
+ #include <project_vertex>
2926
+ #include <logdepthbuf_vertex>
2927
+ #include <clipping_planes_vertex>
2928
+ #include <fog_vertex>
2929
+ vViewPosition = - mvPosition.xyz;
2930
+ }`,Zr=`#define MATCAP
2931
+ uniform vec3 diffuse;
2932
+ uniform float opacity;
2933
+ uniform sampler2D matcap;
2934
+ varying vec3 vViewPosition;
2935
+ #include <common>
2936
+ #include <dithering_pars_fragment>
2937
+ #include <color_pars_fragment>
2938
+ #include <uv_pars_fragment>
2939
+ #include <map_pars_fragment>
2940
+ #include <alphamap_pars_fragment>
2941
+ #include <alphatest_pars_fragment>
2942
+ #include <alphahash_pars_fragment>
2943
+ #include <fog_pars_fragment>
2944
+ #include <normal_pars_fragment>
2945
+ #include <bumpmap_pars_fragment>
2946
+ #include <normalmap_pars_fragment>
2947
+ #include <logdepthbuf_pars_fragment>
2948
+ #include <clipping_planes_pars_fragment>
2949
+ void main() {
2950
+ vec4 diffuseColor = vec4( diffuse, opacity );
2951
+ #include <clipping_planes_fragment>
2952
+ #include <logdepthbuf_fragment>
2953
+ #include <map_fragment>
2954
+ #include <color_fragment>
2955
+ #include <alphamap_fragment>
2956
+ #include <alphatest_fragment>
2957
+ #include <alphahash_fragment>
2958
+ #include <normal_fragment_begin>
2959
+ #include <normal_fragment_maps>
2960
+ vec3 viewDir = normalize( vViewPosition );
2961
+ vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
2962
+ vec3 y = cross( viewDir, x );
2963
+ vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
2964
+ #ifdef USE_MATCAP
2965
+ vec4 matcapColor = texture2D( matcap, uv );
2966
+ #else
2967
+ vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
2968
+ #endif
2969
+ vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
2970
+ #include <opaque_fragment>
2971
+ #include <tonemapping_fragment>
2972
+ #include <colorspace_fragment>
2973
+ #include <fog_fragment>
2974
+ #include <premultiplied_alpha_fragment>
2975
+ #include <dithering_fragment>
2976
+ }`,Qr=`#define NORMAL
2977
+ #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
2978
+ varying vec3 vViewPosition;
2979
+ #endif
2980
+ #include <common>
2981
+ #include <batching_pars_vertex>
2982
+ #include <uv_pars_vertex>
2983
+ #include <displacementmap_pars_vertex>
2984
+ #include <normal_pars_vertex>
2985
+ #include <morphtarget_pars_vertex>
2986
+ #include <skinning_pars_vertex>
2987
+ #include <logdepthbuf_pars_vertex>
2988
+ #include <clipping_planes_pars_vertex>
2989
+ void main() {
2990
+ #include <uv_vertex>
2991
+ #include <batching_vertex>
2992
+ #include <beginnormal_vertex>
2993
+ #include <morphinstance_vertex>
2994
+ #include <morphnormal_vertex>
2995
+ #include <skinbase_vertex>
2996
+ #include <skinnormal_vertex>
2997
+ #include <defaultnormal_vertex>
2998
+ #include <normal_vertex>
2999
+ #include <begin_vertex>
3000
+ #include <morphtarget_vertex>
3001
+ #include <skinning_vertex>
3002
+ #include <displacementmap_vertex>
3003
+ #include <project_vertex>
3004
+ #include <logdepthbuf_vertex>
3005
+ #include <clipping_planes_vertex>
3006
+ #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3007
+ vViewPosition = - mvPosition.xyz;
3008
+ #endif
3009
+ }`,Jr=`#define NORMAL
3010
+ uniform float opacity;
3011
+ #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3012
+ varying vec3 vViewPosition;
3013
+ #endif
3014
+ #include <packing>
3015
+ #include <uv_pars_fragment>
3016
+ #include <normal_pars_fragment>
3017
+ #include <bumpmap_pars_fragment>
3018
+ #include <normalmap_pars_fragment>
3019
+ #include <logdepthbuf_pars_fragment>
3020
+ #include <clipping_planes_pars_fragment>
3021
+ void main() {
3022
+ vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3023
+ #include <clipping_planes_fragment>
3024
+ #include <logdepthbuf_fragment>
3025
+ #include <normal_fragment_begin>
3026
+ #include <normal_fragment_maps>
3027
+ gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
3028
+ #ifdef OPAQUE
3029
+ gl_FragColor.a = 1.0;
3030
+ #endif
3031
+ }`,jr=`#define PHONG
3032
+ varying vec3 vViewPosition;
3033
+ #include <common>
3034
+ #include <batching_pars_vertex>
3035
+ #include <uv_pars_vertex>
3036
+ #include <displacementmap_pars_vertex>
3037
+ #include <envmap_pars_vertex>
3038
+ #include <color_pars_vertex>
3039
+ #include <fog_pars_vertex>
3040
+ #include <normal_pars_vertex>
3041
+ #include <morphtarget_pars_vertex>
3042
+ #include <skinning_pars_vertex>
3043
+ #include <shadowmap_pars_vertex>
3044
+ #include <logdepthbuf_pars_vertex>
3045
+ #include <clipping_planes_pars_vertex>
3046
+ void main() {
3047
+ #include <uv_vertex>
3048
+ #include <color_vertex>
3049
+ #include <morphcolor_vertex>
3050
+ #include <batching_vertex>
3051
+ #include <beginnormal_vertex>
3052
+ #include <morphinstance_vertex>
3053
+ #include <morphnormal_vertex>
3054
+ #include <skinbase_vertex>
3055
+ #include <skinnormal_vertex>
3056
+ #include <defaultnormal_vertex>
3057
+ #include <normal_vertex>
3058
+ #include <begin_vertex>
3059
+ #include <morphtarget_vertex>
3060
+ #include <skinning_vertex>
3061
+ #include <displacementmap_vertex>
3062
+ #include <project_vertex>
3063
+ #include <logdepthbuf_vertex>
3064
+ #include <clipping_planes_vertex>
3065
+ vViewPosition = - mvPosition.xyz;
3066
+ #include <worldpos_vertex>
3067
+ #include <envmap_vertex>
3068
+ #include <shadowmap_vertex>
3069
+ #include <fog_vertex>
3070
+ }`,ea=`#define PHONG
3071
+ uniform vec3 diffuse;
3072
+ uniform vec3 emissive;
3073
+ uniform vec3 specular;
3074
+ uniform float shininess;
3075
+ uniform float opacity;
3076
+ #include <common>
3077
+ #include <packing>
3078
+ #include <dithering_pars_fragment>
3079
+ #include <color_pars_fragment>
3080
+ #include <uv_pars_fragment>
3081
+ #include <map_pars_fragment>
3082
+ #include <alphamap_pars_fragment>
3083
+ #include <alphatest_pars_fragment>
3084
+ #include <alphahash_pars_fragment>
3085
+ #include <aomap_pars_fragment>
3086
+ #include <lightmap_pars_fragment>
3087
+ #include <emissivemap_pars_fragment>
3088
+ #include <envmap_common_pars_fragment>
3089
+ #include <envmap_pars_fragment>
3090
+ #include <fog_pars_fragment>
3091
+ #include <bsdfs>
3092
+ #include <lights_pars_begin>
3093
+ #include <normal_pars_fragment>
3094
+ #include <lights_phong_pars_fragment>
3095
+ #include <shadowmap_pars_fragment>
3096
+ #include <bumpmap_pars_fragment>
3097
+ #include <normalmap_pars_fragment>
3098
+ #include <specularmap_pars_fragment>
3099
+ #include <logdepthbuf_pars_fragment>
3100
+ #include <clipping_planes_pars_fragment>
3101
+ void main() {
3102
+ vec4 diffuseColor = vec4( diffuse, opacity );
3103
+ #include <clipping_planes_fragment>
3104
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3105
+ vec3 totalEmissiveRadiance = emissive;
3106
+ #include <logdepthbuf_fragment>
3107
+ #include <map_fragment>
3108
+ #include <color_fragment>
3109
+ #include <alphamap_fragment>
3110
+ #include <alphatest_fragment>
3111
+ #include <alphahash_fragment>
3112
+ #include <specularmap_fragment>
3113
+ #include <normal_fragment_begin>
3114
+ #include <normal_fragment_maps>
3115
+ #include <emissivemap_fragment>
3116
+ #include <lights_phong_fragment>
3117
+ #include <lights_fragment_begin>
3118
+ #include <lights_fragment_maps>
3119
+ #include <lights_fragment_end>
3120
+ #include <aomap_fragment>
3121
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3122
+ #include <envmap_fragment>
3123
+ #include <opaque_fragment>
3124
+ #include <tonemapping_fragment>
3125
+ #include <colorspace_fragment>
3126
+ #include <fog_fragment>
3127
+ #include <premultiplied_alpha_fragment>
3128
+ #include <dithering_fragment>
3129
+ }`,ta=`#define STANDARD
3130
+ varying vec3 vViewPosition;
3131
+ #ifdef USE_TRANSMISSION
3132
+ varying vec3 vWorldPosition;
3133
+ #endif
3134
+ #include <common>
3135
+ #include <batching_pars_vertex>
3136
+ #include <uv_pars_vertex>
3137
+ #include <displacementmap_pars_vertex>
3138
+ #include <color_pars_vertex>
3139
+ #include <fog_pars_vertex>
3140
+ #include <normal_pars_vertex>
3141
+ #include <morphtarget_pars_vertex>
3142
+ #include <skinning_pars_vertex>
3143
+ #include <shadowmap_pars_vertex>
3144
+ #include <logdepthbuf_pars_vertex>
3145
+ #include <clipping_planes_pars_vertex>
3146
+ void main() {
3147
+ #include <uv_vertex>
3148
+ #include <color_vertex>
3149
+ #include <morphinstance_vertex>
3150
+ #include <morphcolor_vertex>
3151
+ #include <batching_vertex>
3152
+ #include <beginnormal_vertex>
3153
+ #include <morphnormal_vertex>
3154
+ #include <skinbase_vertex>
3155
+ #include <skinnormal_vertex>
3156
+ #include <defaultnormal_vertex>
3157
+ #include <normal_vertex>
3158
+ #include <begin_vertex>
3159
+ #include <morphtarget_vertex>
3160
+ #include <skinning_vertex>
3161
+ #include <displacementmap_vertex>
3162
+ #include <project_vertex>
3163
+ #include <logdepthbuf_vertex>
3164
+ #include <clipping_planes_vertex>
3165
+ vViewPosition = - mvPosition.xyz;
3166
+ #include <worldpos_vertex>
3167
+ #include <shadowmap_vertex>
3168
+ #include <fog_vertex>
3169
+ #ifdef USE_TRANSMISSION
3170
+ vWorldPosition = worldPosition.xyz;
3171
+ #endif
3172
+ }`,na=`#define STANDARD
3173
+ #ifdef PHYSICAL
3174
+ #define IOR
3175
+ #define USE_SPECULAR
3176
+ #endif
3177
+ uniform vec3 diffuse;
3178
+ uniform vec3 emissive;
3179
+ uniform float roughness;
3180
+ uniform float metalness;
3181
+ uniform float opacity;
3182
+ #ifdef IOR
3183
+ uniform float ior;
3184
+ #endif
3185
+ #ifdef USE_SPECULAR
3186
+ uniform float specularIntensity;
3187
+ uniform vec3 specularColor;
3188
+ #ifdef USE_SPECULAR_COLORMAP
3189
+ uniform sampler2D specularColorMap;
3190
+ #endif
3191
+ #ifdef USE_SPECULAR_INTENSITYMAP
3192
+ uniform sampler2D specularIntensityMap;
3193
+ #endif
3194
+ #endif
3195
+ #ifdef USE_CLEARCOAT
3196
+ uniform float clearcoat;
3197
+ uniform float clearcoatRoughness;
3198
+ #endif
3199
+ #ifdef USE_DISPERSION
3200
+ uniform float dispersion;
3201
+ #endif
3202
+ #ifdef USE_IRIDESCENCE
3203
+ uniform float iridescence;
3204
+ uniform float iridescenceIOR;
3205
+ uniform float iridescenceThicknessMinimum;
3206
+ uniform float iridescenceThicknessMaximum;
3207
+ #endif
3208
+ #ifdef USE_SHEEN
3209
+ uniform vec3 sheenColor;
3210
+ uniform float sheenRoughness;
3211
+ #ifdef USE_SHEEN_COLORMAP
3212
+ uniform sampler2D sheenColorMap;
3213
+ #endif
3214
+ #ifdef USE_SHEEN_ROUGHNESSMAP
3215
+ uniform sampler2D sheenRoughnessMap;
3216
+ #endif
3217
+ #endif
3218
+ #ifdef USE_ANISOTROPY
3219
+ uniform vec2 anisotropyVector;
3220
+ #ifdef USE_ANISOTROPYMAP
3221
+ uniform sampler2D anisotropyMap;
3222
+ #endif
3223
+ #endif
3224
+ varying vec3 vViewPosition;
3225
+ #include <common>
3226
+ #include <packing>
3227
+ #include <dithering_pars_fragment>
3228
+ #include <color_pars_fragment>
3229
+ #include <uv_pars_fragment>
3230
+ #include <map_pars_fragment>
3231
+ #include <alphamap_pars_fragment>
3232
+ #include <alphatest_pars_fragment>
3233
+ #include <alphahash_pars_fragment>
3234
+ #include <aomap_pars_fragment>
3235
+ #include <lightmap_pars_fragment>
3236
+ #include <emissivemap_pars_fragment>
3237
+ #include <iridescence_fragment>
3238
+ #include <cube_uv_reflection_fragment>
3239
+ #include <envmap_common_pars_fragment>
3240
+ #include <envmap_physical_pars_fragment>
3241
+ #include <fog_pars_fragment>
3242
+ #include <lights_pars_begin>
3243
+ #include <normal_pars_fragment>
3244
+ #include <lights_physical_pars_fragment>
3245
+ #include <transmission_pars_fragment>
3246
+ #include <shadowmap_pars_fragment>
3247
+ #include <bumpmap_pars_fragment>
3248
+ #include <normalmap_pars_fragment>
3249
+ #include <clearcoat_pars_fragment>
3250
+ #include <iridescence_pars_fragment>
3251
+ #include <roughnessmap_pars_fragment>
3252
+ #include <metalnessmap_pars_fragment>
3253
+ #include <logdepthbuf_pars_fragment>
3254
+ #include <clipping_planes_pars_fragment>
3255
+ void main() {
3256
+ vec4 diffuseColor = vec4( diffuse, opacity );
3257
+ #include <clipping_planes_fragment>
3258
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3259
+ vec3 totalEmissiveRadiance = emissive;
3260
+ #include <logdepthbuf_fragment>
3261
+ #include <map_fragment>
3262
+ #include <color_fragment>
3263
+ #include <alphamap_fragment>
3264
+ #include <alphatest_fragment>
3265
+ #include <alphahash_fragment>
3266
+ #include <roughnessmap_fragment>
3267
+ #include <metalnessmap_fragment>
3268
+ #include <normal_fragment_begin>
3269
+ #include <normal_fragment_maps>
3270
+ #include <clearcoat_normal_fragment_begin>
3271
+ #include <clearcoat_normal_fragment_maps>
3272
+ #include <emissivemap_fragment>
3273
+ #include <lights_physical_fragment>
3274
+ #include <lights_fragment_begin>
3275
+ #include <lights_fragment_maps>
3276
+ #include <lights_fragment_end>
3277
+ #include <aomap_fragment>
3278
+ vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3279
+ vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3280
+ #include <transmission_fragment>
3281
+ vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3282
+ #ifdef USE_SHEEN
3283
+ float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
3284
+ outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
3285
+ #endif
3286
+ #ifdef USE_CLEARCOAT
3287
+ float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3288
+ vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3289
+ outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3290
+ #endif
3291
+ #include <opaque_fragment>
3292
+ #include <tonemapping_fragment>
3293
+ #include <colorspace_fragment>
3294
+ #include <fog_fragment>
3295
+ #include <premultiplied_alpha_fragment>
3296
+ #include <dithering_fragment>
3297
+ }`,ia=`#define TOON
3298
+ varying vec3 vViewPosition;
3299
+ #include <common>
3300
+ #include <batching_pars_vertex>
3301
+ #include <uv_pars_vertex>
3302
+ #include <displacementmap_pars_vertex>
3303
+ #include <color_pars_vertex>
3304
+ #include <fog_pars_vertex>
3305
+ #include <normal_pars_vertex>
3306
+ #include <morphtarget_pars_vertex>
3307
+ #include <skinning_pars_vertex>
3308
+ #include <shadowmap_pars_vertex>
3309
+ #include <logdepthbuf_pars_vertex>
3310
+ #include <clipping_planes_pars_vertex>
3311
+ void main() {
3312
+ #include <uv_vertex>
3313
+ #include <color_vertex>
3314
+ #include <morphinstance_vertex>
3315
+ #include <morphcolor_vertex>
3316
+ #include <batching_vertex>
3317
+ #include <beginnormal_vertex>
3318
+ #include <morphnormal_vertex>
3319
+ #include <skinbase_vertex>
3320
+ #include <skinnormal_vertex>
3321
+ #include <defaultnormal_vertex>
3322
+ #include <normal_vertex>
3323
+ #include <begin_vertex>
3324
+ #include <morphtarget_vertex>
3325
+ #include <skinning_vertex>
3326
+ #include <displacementmap_vertex>
3327
+ #include <project_vertex>
3328
+ #include <logdepthbuf_vertex>
3329
+ #include <clipping_planes_vertex>
3330
+ vViewPosition = - mvPosition.xyz;
3331
+ #include <worldpos_vertex>
3332
+ #include <shadowmap_vertex>
3333
+ #include <fog_vertex>
3334
+ }`,ra=`#define TOON
3335
+ uniform vec3 diffuse;
3336
+ uniform vec3 emissive;
3337
+ uniform float opacity;
3338
+ #include <common>
3339
+ #include <packing>
3340
+ #include <dithering_pars_fragment>
3341
+ #include <color_pars_fragment>
3342
+ #include <uv_pars_fragment>
3343
+ #include <map_pars_fragment>
3344
+ #include <alphamap_pars_fragment>
3345
+ #include <alphatest_pars_fragment>
3346
+ #include <alphahash_pars_fragment>
3347
+ #include <aomap_pars_fragment>
3348
+ #include <lightmap_pars_fragment>
3349
+ #include <emissivemap_pars_fragment>
3350
+ #include <gradientmap_pars_fragment>
3351
+ #include <fog_pars_fragment>
3352
+ #include <bsdfs>
3353
+ #include <lights_pars_begin>
3354
+ #include <normal_pars_fragment>
3355
+ #include <lights_toon_pars_fragment>
3356
+ #include <shadowmap_pars_fragment>
3357
+ #include <bumpmap_pars_fragment>
3358
+ #include <normalmap_pars_fragment>
3359
+ #include <logdepthbuf_pars_fragment>
3360
+ #include <clipping_planes_pars_fragment>
3361
+ void main() {
3362
+ vec4 diffuseColor = vec4( diffuse, opacity );
3363
+ #include <clipping_planes_fragment>
3364
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3365
+ vec3 totalEmissiveRadiance = emissive;
3366
+ #include <logdepthbuf_fragment>
3367
+ #include <map_fragment>
3368
+ #include <color_fragment>
3369
+ #include <alphamap_fragment>
3370
+ #include <alphatest_fragment>
3371
+ #include <alphahash_fragment>
3372
+ #include <normal_fragment_begin>
3373
+ #include <normal_fragment_maps>
3374
+ #include <emissivemap_fragment>
3375
+ #include <lights_toon_fragment>
3376
+ #include <lights_fragment_begin>
3377
+ #include <lights_fragment_maps>
3378
+ #include <lights_fragment_end>
3379
+ #include <aomap_fragment>
3380
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3381
+ #include <opaque_fragment>
3382
+ #include <tonemapping_fragment>
3383
+ #include <colorspace_fragment>
3384
+ #include <fog_fragment>
3385
+ #include <premultiplied_alpha_fragment>
3386
+ #include <dithering_fragment>
3387
+ }`,aa=`uniform float size;
3388
+ uniform float scale;
3389
+ #include <common>
3390
+ #include <color_pars_vertex>
3391
+ #include <fog_pars_vertex>
3392
+ #include <morphtarget_pars_vertex>
3393
+ #include <logdepthbuf_pars_vertex>
3394
+ #include <clipping_planes_pars_vertex>
3395
+ #ifdef USE_POINTS_UV
3396
+ varying vec2 vUv;
3397
+ uniform mat3 uvTransform;
3398
+ #endif
3399
+ void main() {
3400
+ #ifdef USE_POINTS_UV
3401
+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3402
+ #endif
3403
+ #include <color_vertex>
3404
+ #include <morphinstance_vertex>
3405
+ #include <morphcolor_vertex>
3406
+ #include <begin_vertex>
3407
+ #include <morphtarget_vertex>
3408
+ #include <project_vertex>
3409
+ gl_PointSize = size;
3410
+ #ifdef USE_SIZEATTENUATION
3411
+ bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3412
+ if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3413
+ #endif
3414
+ #include <logdepthbuf_vertex>
3415
+ #include <clipping_planes_vertex>
3416
+ #include <worldpos_vertex>
3417
+ #include <fog_vertex>
3418
+ }`,oa=`uniform vec3 diffuse;
3419
+ uniform float opacity;
3420
+ #include <common>
3421
+ #include <color_pars_fragment>
3422
+ #include <map_particle_pars_fragment>
3423
+ #include <alphatest_pars_fragment>
3424
+ #include <alphahash_pars_fragment>
3425
+ #include <fog_pars_fragment>
3426
+ #include <logdepthbuf_pars_fragment>
3427
+ #include <clipping_planes_pars_fragment>
3428
+ void main() {
3429
+ vec4 diffuseColor = vec4( diffuse, opacity );
3430
+ #include <clipping_planes_fragment>
3431
+ vec3 outgoingLight = vec3( 0.0 );
3432
+ #include <logdepthbuf_fragment>
3433
+ #include <map_particle_fragment>
3434
+ #include <color_fragment>
3435
+ #include <alphatest_fragment>
3436
+ #include <alphahash_fragment>
3437
+ outgoingLight = diffuseColor.rgb;
3438
+ #include <opaque_fragment>
3439
+ #include <tonemapping_fragment>
3440
+ #include <colorspace_fragment>
3441
+ #include <fog_fragment>
3442
+ #include <premultiplied_alpha_fragment>
3443
+ }`,sa=`#include <common>
3444
+ #include <batching_pars_vertex>
3445
+ #include <fog_pars_vertex>
3446
+ #include <morphtarget_pars_vertex>
3447
+ #include <skinning_pars_vertex>
3448
+ #include <logdepthbuf_pars_vertex>
3449
+ #include <shadowmap_pars_vertex>
3450
+ void main() {
3451
+ #include <batching_vertex>
3452
+ #include <beginnormal_vertex>
3453
+ #include <morphinstance_vertex>
3454
+ #include <morphnormal_vertex>
3455
+ #include <skinbase_vertex>
3456
+ #include <skinnormal_vertex>
3457
+ #include <defaultnormal_vertex>
3458
+ #include <begin_vertex>
3459
+ #include <morphtarget_vertex>
3460
+ #include <skinning_vertex>
3461
+ #include <project_vertex>
3462
+ #include <logdepthbuf_vertex>
3463
+ #include <worldpos_vertex>
3464
+ #include <shadowmap_vertex>
3465
+ #include <fog_vertex>
3466
+ }`,la=`uniform vec3 color;
3467
+ uniform float opacity;
3468
+ #include <common>
3469
+ #include <packing>
3470
+ #include <fog_pars_fragment>
3471
+ #include <bsdfs>
3472
+ #include <lights_pars_begin>
3473
+ #include <logdepthbuf_pars_fragment>
3474
+ #include <shadowmap_pars_fragment>
3475
+ #include <shadowmask_pars_fragment>
3476
+ void main() {
3477
+ #include <logdepthbuf_fragment>
3478
+ gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3479
+ #include <tonemapping_fragment>
3480
+ #include <colorspace_fragment>
3481
+ #include <fog_fragment>
3482
+ }`,ca=`uniform float rotation;
3483
+ uniform vec2 center;
3484
+ #include <common>
3485
+ #include <uv_pars_vertex>
3486
+ #include <fog_pars_vertex>
3487
+ #include <logdepthbuf_pars_vertex>
3488
+ #include <clipping_planes_pars_vertex>
3489
+ void main() {
3490
+ #include <uv_vertex>
3491
+ vec4 mvPosition = modelViewMatrix[ 3 ];
3492
+ vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3493
+ #ifndef USE_SIZEATTENUATION
3494
+ bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3495
+ if ( isPerspective ) scale *= - mvPosition.z;
3496
+ #endif
3497
+ vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3498
+ vec2 rotatedPosition;
3499
+ rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3500
+ rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3501
+ mvPosition.xy += rotatedPosition;
3502
+ gl_Position = projectionMatrix * mvPosition;
3503
+ #include <logdepthbuf_vertex>
3504
+ #include <clipping_planes_vertex>
3505
+ #include <fog_vertex>
3506
+ }`,fa=`uniform vec3 diffuse;
3507
+ uniform float opacity;
3508
+ #include <common>
3509
+ #include <uv_pars_fragment>
3510
+ #include <map_pars_fragment>
3511
+ #include <alphamap_pars_fragment>
3512
+ #include <alphatest_pars_fragment>
3513
+ #include <alphahash_pars_fragment>
3514
+ #include <fog_pars_fragment>
3515
+ #include <logdepthbuf_pars_fragment>
3516
+ #include <clipping_planes_pars_fragment>
3517
+ void main() {
3518
+ vec4 diffuseColor = vec4( diffuse, opacity );
3519
+ #include <clipping_planes_fragment>
3520
+ vec3 outgoingLight = vec3( 0.0 );
3521
+ #include <logdepthbuf_fragment>
3522
+ #include <map_fragment>
3523
+ #include <alphamap_fragment>
3524
+ #include <alphatest_fragment>
3525
+ #include <alphahash_fragment>
3526
+ outgoingLight = diffuseColor.rgb;
3527
+ #include <opaque_fragment>
3528
+ #include <tonemapping_fragment>
3529
+ #include <colorspace_fragment>
3530
+ #include <fog_fragment>
3531
+ }`,Ue={alphahash_fragment:wn,alphahash_pars_fragment:In,alphamap_fragment:Nn,alphamap_pars_fragment:yn,alphatest_fragment:Fn,alphatest_pars_fragment:On,aomap_fragment:Bn,aomap_pars_fragment:Gn,batching_pars_vertex:Hn,batching_vertex:Vn,begin_vertex:kn,beginnormal_vertex:Wn,bsdfs:zn,iridescence_fragment:Xn,bumpmap_pars_fragment:qn,clipping_planes_fragment:Yn,clipping_planes_pars_fragment:Kn,clipping_planes_pars_vertex:$n,clipping_planes_vertex:Zn,color_fragment:Qn,color_pars_fragment:Jn,color_pars_vertex:jn,color_vertex:ei,common:ti,cube_uv_reflection_fragment:ni,defaultnormal_vertex:ii,displacementmap_pars_vertex:ri,displacementmap_vertex:ai,emissivemap_fragment:oi,emissivemap_pars_fragment:si,colorspace_fragment:li,colorspace_pars_fragment:ci,envmap_fragment:fi,envmap_common_pars_fragment:ui,envmap_pars_fragment:di,envmap_pars_vertex:pi,envmap_physical_pars_fragment:Ai,envmap_vertex:hi,fog_vertex:mi,fog_pars_vertex:_i,fog_fragment:gi,fog_pars_fragment:vi,gradientmap_pars_fragment:Si,lightmap_pars_fragment:Ei,lights_lambert_fragment:Mi,lights_lambert_pars_fragment:Ti,lights_pars_begin:xi,lights_toon_fragment:Ri,lights_toon_pars_fragment:Ci,lights_phong_fragment:bi,lights_phong_pars_fragment:Pi,lights_physical_fragment:Li,lights_physical_pars_fragment:Di,lights_fragment_begin:Ui,lights_fragment_maps:wi,lights_fragment_end:Ii,logdepthbuf_fragment:Ni,logdepthbuf_pars_fragment:yi,logdepthbuf_pars_vertex:Fi,logdepthbuf_vertex:Oi,map_fragment:Bi,map_pars_fragment:Gi,map_particle_fragment:Hi,map_particle_pars_fragment:Vi,metalnessmap_fragment:ki,metalnessmap_pars_fragment:Wi,morphinstance_vertex:zi,morphcolor_vertex:Xi,morphnormal_vertex:qi,morphtarget_pars_vertex:Yi,morphtarget_vertex:Ki,normal_fragment_begin:$i,normal_fragment_maps:Zi,normal_pars_fragment:Qi,normal_pars_vertex:Ji,normal_vertex:ji,normalmap_pars_fragment:er,clearcoat_normal_fragment_begin:tr,clearcoat_normal_fragment_maps:nr,clearcoat_pars_fragment:ir,iridescence_pars_fragment:rr,opaque_fragment:ar,packing:or,premultiplied_alpha_fragment:sr,project_vertex:lr,dithering_fragment:cr,dithering_pars_fragment:fr,roughnessmap_fragment:ur,roughnessmap_pars_fragment:dr,shadowmap_pars_fragment:pr,shadowmap_pars_vertex:hr,shadowmap_vertex:mr,shadowmask_pars_fragment:_r,skinbase_vertex:gr,skinning_pars_vertex:vr,skinning_vertex:Sr,skinnormal_vertex:Er,specularmap_fragment:Mr,specularmap_pars_fragment:Tr,tonemapping_fragment:xr,tonemapping_pars_fragment:Ar,transmission_fragment:Rr,transmission_pars_fragment:Cr,uv_pars_fragment:br,uv_pars_vertex:Pr,uv_vertex:Lr,worldpos_vertex:Dr,background_vert:Ur,background_frag:wr,backgroundCube_vert:Ir,backgroundCube_frag:Nr,cube_vert:yr,cube_frag:Fr,depth_vert:Or,depth_frag:Br,distanceRGBA_vert:Gr,distanceRGBA_frag:Hr,equirect_vert:Vr,equirect_frag:kr,linedashed_vert:Wr,linedashed_frag:zr,meshbasic_vert:Xr,meshbasic_frag:qr,meshlambert_vert:Yr,meshlambert_frag:Kr,meshmatcap_vert:$r,meshmatcap_frag:Zr,meshnormal_vert:Qr,meshnormal_frag:Jr,meshphong_vert:jr,meshphong_frag:ea,meshphysical_vert:ta,meshphysical_frag:na,meshtoon_vert:ia,meshtoon_frag:ra,points_vert:aa,points_frag:oa,shadow_vert:sa,shadow_frag:la,sprite_vert:ca,sprite_frag:fa},te={common:{diffuse:{value:new t.Color(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new t.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new t.Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new t.Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new t.Matrix3},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new t.Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new t.Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new t.Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new t.Matrix3},normalScale:{value:new t.Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new t.Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new t.Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new t.Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new t.Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new t.Color(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new t.Color(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new t.Matrix3},alphaTest:{value:0},uvTransform:{value:new t.Matrix3}},sprite:{diffuse:{value:new t.Color(16777215)},opacity:{value:1},center:{value:new t.Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new t.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new t.Matrix3},alphaTest:{value:0}}},ft={basic:{uniforms:t.mergeUniforms([te.common,te.specularmap,te.envmap,te.aomap,te.lightmap,te.fog]),vertexShader:Ue.meshbasic_vert,fragmentShader:Ue.meshbasic_frag},lambert:{uniforms:t.mergeUniforms([te.common,te.specularmap,te.envmap,te.aomap,te.lightmap,te.emissivemap,te.bumpmap,te.normalmap,te.displacementmap,te.fog,te.lights,{emissive:{value:new t.Color(0)}}]),vertexShader:Ue.meshlambert_vert,fragmentShader:Ue.meshlambert_frag},phong:{uniforms:t.mergeUniforms([te.common,te.specularmap,te.envmap,te.aomap,te.lightmap,te.emissivemap,te.bumpmap,te.normalmap,te.displacementmap,te.fog,te.lights,{emissive:{value:new t.Color(0)},specular:{value:new t.Color(1118481)},shininess:{value:30}}]),vertexShader:Ue.meshphong_vert,fragmentShader:Ue.meshphong_frag},standard:{uniforms:t.mergeUniforms([te.common,te.envmap,te.aomap,te.lightmap,te.emissivemap,te.bumpmap,te.normalmap,te.displacementmap,te.roughnessmap,te.metalnessmap,te.fog,te.lights,{emissive:{value:new t.Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag},toon:{uniforms:t.mergeUniforms([te.common,te.aomap,te.lightmap,te.emissivemap,te.bumpmap,te.normalmap,te.displacementmap,te.gradientmap,te.fog,te.lights,{emissive:{value:new t.Color(0)}}]),vertexShader:Ue.meshtoon_vert,fragmentShader:Ue.meshtoon_frag},matcap:{uniforms:t.mergeUniforms([te.common,te.bumpmap,te.normalmap,te.displacementmap,te.fog,{matcap:{value:null}}]),vertexShader:Ue.meshmatcap_vert,fragmentShader:Ue.meshmatcap_frag},points:{uniforms:t.mergeUniforms([te.points,te.fog]),vertexShader:Ue.points_vert,fragmentShader:Ue.points_frag},dashed:{uniforms:t.mergeUniforms([te.common,te.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ue.linedashed_vert,fragmentShader:Ue.linedashed_frag},depth:{uniforms:t.mergeUniforms([te.common,te.displacementmap]),vertexShader:Ue.depth_vert,fragmentShader:Ue.depth_frag},normal:{uniforms:t.mergeUniforms([te.common,te.bumpmap,te.normalmap,te.displacementmap,{opacity:{value:1}}]),vertexShader:Ue.meshnormal_vert,fragmentShader:Ue.meshnormal_frag},sprite:{uniforms:t.mergeUniforms([te.sprite,te.fog]),vertexShader:Ue.sprite_vert,fragmentShader:Ue.sprite_frag},background:{uniforms:{uvTransform:{value:new t.Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ue.background_vert,fragmentShader:Ue.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new t.Matrix3}},vertexShader:Ue.backgroundCube_vert,fragmentShader:Ue.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ue.cube_vert,fragmentShader:Ue.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ue.equirect_vert,fragmentShader:Ue.equirect_frag},distanceRGBA:{uniforms:t.mergeUniforms([te.common,te.displacementmap,{referencePosition:{value:new t.Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ue.distanceRGBA_vert,fragmentShader:Ue.distanceRGBA_frag},shadow:{uniforms:t.mergeUniforms([te.lights,te.fog,{color:{value:new t.Color(0)},opacity:{value:1}}]),vertexShader:Ue.shadow_vert,fragmentShader:Ue.shadow_frag}};ft.physical={uniforms:t.mergeUniforms([ft.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new t.Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new t.Matrix3},clearcoatNormalScale:{value:new t.Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new t.Matrix3},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new t.Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new t.Matrix3},sheen:{value:0},sheenColor:{value:new t.Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new t.Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new t.Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new t.Matrix3},transmissionSamplerSize:{value:new t.Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new t.Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new t.Color(0)},specularColor:{value:new t.Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new t.Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new t.Matrix3},anisotropyVector:{value:new t.Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new t.Matrix3}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag};const Ct={r:0,b:0,g:0},ht=new t.Euler,ua=new t.Matrix4;function da(e,i,n,r,c,s,m){const d=new t.Color(0);let b=s===!0?0:1,T,w,x=null,S=0,R=null;function F(A){let g=A.isScene===!0?A.background:null;return g&&g.isTexture&&(g=(A.backgroundBlurriness>0?n:i).get(g)),g}function D(A){let g=!1;const V=F(A);V===null?a(d,b):V&&V.isColor&&(a(V,1),g=!0);const L=e.xr.getEnvironmentBlendMode();L==="additive"?r.buffers.color.setClear(0,0,0,1,m):L==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,m),(e.autoClear||g)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function f(A,g){const V=F(g);V&&(V.isCubeTexture||V.mapping===t.CubeUVReflectionMapping)?(w===void 0&&(w=new t.Mesh(new t.BoxGeometry(1,1,1),new t.ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:t.cloneUniforms(ft.backgroundCube.uniforms),vertexShader:ft.backgroundCube.vertexShader,fragmentShader:ft.backgroundCube.fragmentShader,side:t.BackSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),w.geometry.deleteAttribute("normal"),w.geometry.deleteAttribute("uv"),w.onBeforeRender=function(L,y,H){this.matrixWorld.copyPosition(H.matrixWorld)},Object.defineProperty(w.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),c.update(w)),ht.copy(g.backgroundRotation),ht.x*=-1,ht.y*=-1,ht.z*=-1,V.isCubeTexture&&V.isRenderTargetTexture===!1&&(ht.y*=-1,ht.z*=-1),w.material.uniforms.envMap.value=V,w.material.uniforms.flipEnvMap.value=V.isCubeTexture&&V.isRenderTargetTexture===!1?-1:1,w.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,w.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,w.material.uniforms.backgroundRotation.value.setFromMatrix4(ua.makeRotationFromEuler(ht)),w.material.toneMapped=t.ColorManagement.getTransfer(V.colorSpace)!==t.SRGBTransfer,(x!==V||S!==V.version||R!==e.toneMapping)&&(w.material.needsUpdate=!0,x=V,S=V.version,R=e.toneMapping),w.layers.enableAll(),A.unshift(w,w.geometry,w.material,0,0,null)):V&&V.isTexture&&(T===void 0&&(T=new t.Mesh(new t.PlaneGeometry(2,2),new t.ShaderMaterial({name:"BackgroundMaterial",uniforms:t.cloneUniforms(ft.background.uniforms),vertexShader:ft.background.vertexShader,fragmentShader:ft.background.fragmentShader,side:t.FrontSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),T.geometry.deleteAttribute("normal"),Object.defineProperty(T.material,"map",{get:function(){return this.uniforms.t2D.value}}),c.update(T)),T.material.uniforms.t2D.value=V,T.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,T.material.toneMapped=t.ColorManagement.getTransfer(V.colorSpace)!==t.SRGBTransfer,V.matrixAutoUpdate===!0&&V.updateMatrix(),T.material.uniforms.uvTransform.value.copy(V.matrix),(x!==V||S!==V.version||R!==e.toneMapping)&&(T.material.needsUpdate=!0,x=V,S=V.version,R=e.toneMapping),T.layers.enableAll(),A.unshift(T,T.geometry,T.material,0,0,null))}function a(A,g){A.getRGB(Ct,t.getUnlitUniformColorSpace(e)),r.buffers.color.setClear(Ct.r,Ct.g,Ct.b,g,m)}function U(){w!==void 0&&(w.geometry.dispose(),w.material.dispose(),w=void 0),T!==void 0&&(T.geometry.dispose(),T.material.dispose(),T=void 0)}return{getClearColor:function(){return d},setClearColor:function(A,g=1){d.set(A),b=g,a(d,b)},getClearAlpha:function(){return b},setClearAlpha:function(A){b=A,a(d,b)},render:D,addToRenderList:f,dispose:U}}function pa(e,i){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},c=S(null);let s=c,m=!1;function d(u,C,K,k,Y){let j=!1;const X=x(k,K,C);s!==X&&(s=X,T(s.object)),j=R(u,k,K,Y),j&&F(u,k,K,Y),Y!==null&&i.update(Y,e.ELEMENT_ARRAY_BUFFER),(j||m)&&(m=!1,g(u,C,K,k),Y!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i.get(Y).buffer))}function b(){return e.createVertexArray()}function T(u){return e.bindVertexArray(u)}function w(u){return e.deleteVertexArray(u)}function x(u,C,K){const k=K.wireframe===!0;let Y=r[u.id];Y===void 0&&(Y={},r[u.id]=Y);let j=Y[C.id];j===void 0&&(j={},Y[C.id]=j);let X=j[k];return X===void 0&&(X=S(b()),j[k]=X),X}function S(u){const C=[],K=[],k=[];for(let Y=0;Y<n;Y++)C[Y]=0,K[Y]=0,k[Y]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:C,enabledAttributes:K,attributeDivisors:k,object:u,attributes:{},index:null}}function R(u,C,K,k){const Y=s.attributes,j=C.attributes;let X=0;const ne=K.getAttributes();for(const B in ne)if(ne[B].location>=0){const Re=Y[B];let Ie=j[B];if(Ie===void 0&&(B==="instanceMatrix"&&u.instanceMatrix&&(Ie=u.instanceMatrix),B==="instanceColor"&&u.instanceColor&&(Ie=u.instanceColor)),Re===void 0||Re.attribute!==Ie||Ie&&Re.data!==Ie.data)return!0;X++}return s.attributesNum!==X||s.index!==k}function F(u,C,K,k){const Y={},j=C.attributes;let X=0;const ne=K.getAttributes();for(const B in ne)if(ne[B].location>=0){let Re=j[B];Re===void 0&&(B==="instanceMatrix"&&u.instanceMatrix&&(Re=u.instanceMatrix),B==="instanceColor"&&u.instanceColor&&(Re=u.instanceColor));const Ie={};Ie.attribute=Re,Re&&Re.data&&(Ie.data=Re.data),Y[B]=Ie,X++}s.attributes=Y,s.attributesNum=X,s.index=k}function D(){const u=s.newAttributes;for(let C=0,K=u.length;C<K;C++)u[C]=0}function f(u){a(u,0)}function a(u,C){const K=s.newAttributes,k=s.enabledAttributes,Y=s.attributeDivisors;K[u]=1,k[u]===0&&(e.enableVertexAttribArray(u),k[u]=1),Y[u]!==C&&(e.vertexAttribDivisor(u,C),Y[u]=C)}function U(){const u=s.newAttributes,C=s.enabledAttributes;for(let K=0,k=C.length;K<k;K++)C[K]!==u[K]&&(e.disableVertexAttribArray(K),C[K]=0)}function A(u,C,K,k,Y,j,X){X===!0?e.vertexAttribIPointer(u,C,K,Y,j):e.vertexAttribPointer(u,C,K,k,Y,j)}function g(u,C,K,k){D();const Y=k.attributes,j=K.getAttributes(),X=C.defaultAttributeValues;for(const ne in j){const B=j[ne];if(B.location>=0){let Se=Y[ne];if(Se===void 0&&(ne==="instanceMatrix"&&u.instanceMatrix&&(Se=u.instanceMatrix),ne==="instanceColor"&&u.instanceColor&&(Se=u.instanceColor)),Se!==void 0){const Re=Se.normalized,Ie=Se.itemSize,He=i.get(Se);if(He===void 0)continue;const Qe=He.buffer,W=He.type,ee=He.bytesPerElement,ge=W===e.INT||W===e.UNSIGNED_INT||Se.gpuType===t.IntType;if(Se.isInterleavedBufferAttribute){const se=Se.data,ve=se.stride,Oe=Se.offset;if(se.isInstancedInterleavedBuffer){for(let Ce=0;Ce<B.locationSize;Ce++)a(B.location+Ce,se.meshPerAttribute);u.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let Ce=0;Ce<B.locationSize;Ce++)f(B.location+Ce);e.bindBuffer(e.ARRAY_BUFFER,Qe);for(let Ce=0;Ce<B.locationSize;Ce++)A(B.location+Ce,Ie/B.locationSize,W,Re,ve*ee,(Oe+Ie/B.locationSize*Ce)*ee,ge)}else{if(Se.isInstancedBufferAttribute){for(let se=0;se<B.locationSize;se++)a(B.location+se,Se.meshPerAttribute);u.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=Se.meshPerAttribute*Se.count)}else for(let se=0;se<B.locationSize;se++)f(B.location+se);e.bindBuffer(e.ARRAY_BUFFER,Qe);for(let se=0;se<B.locationSize;se++)A(B.location+se,Ie/B.locationSize,W,Re,Ie*ee,Ie/B.locationSize*se*ee,ge)}}else if(X!==void 0){const Re=X[ne];if(Re!==void 0)switch(Re.length){case 2:e.vertexAttrib2fv(B.location,Re);break;case 3:e.vertexAttrib3fv(B.location,Re);break;case 4:e.vertexAttrib4fv(B.location,Re);break;default:e.vertexAttrib1fv(B.location,Re)}}}}U()}function V(){H();for(const u in r){const C=r[u];for(const K in C){const k=C[K];for(const Y in k)w(k[Y].object),delete k[Y];delete C[K]}delete r[u]}}function L(u){if(r[u.id]===void 0)return;const C=r[u.id];for(const K in C){const k=C[K];for(const Y in k)w(k[Y].object),delete k[Y];delete C[K]}delete r[u.id]}function y(u){for(const C in r){const K=r[C];if(K[u.id]===void 0)continue;const k=K[u.id];for(const Y in k)w(k[Y].object),delete k[Y];delete K[u.id]}}function H(){h(),m=!0,s!==c&&(s=c,T(s.object))}function h(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:d,reset:H,resetDefaultState:h,dispose:V,releaseStatesOfGeometry:L,releaseStatesOfProgram:y,initAttributes:D,enableAttribute:f,disableUnusedAttributes:U}}function ha(e,i,n){let r;function c(T){r=T}function s(T,w){e.drawArrays(r,T,w),n.update(w,r,1)}function m(T,w,x){x!==0&&(e.drawArraysInstanced(r,T,w,x),n.update(w,r,x))}function d(T,w,x){if(x===0)return;i.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,T,0,w,0,x);let R=0;for(let F=0;F<x;F++)R+=w[F];n.update(R,r,1)}function b(T,w,x,S){if(x===0)return;const R=i.get("WEBGL_multi_draw");if(R===null)for(let F=0;F<T.length;F++)m(T[F],w[F],S[F]);else{R.multiDrawArraysInstancedWEBGL(r,T,0,w,0,S,0,x);let F=0;for(let D=0;D<x;D++)F+=w[D]*S[D];n.update(F,r,1)}}this.setMode=c,this.render=s,this.renderInstances=m,this.renderMultiDraw=d,this.renderMultiDrawInstances=b}function ma(e,i,n,r){let c;function s(){if(c!==void 0)return c;if(i.has("EXT_texture_filter_anisotropic")===!0){const y=i.get("EXT_texture_filter_anisotropic");c=e.getParameter(y.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else c=0;return c}function m(y){return!(y!==t.RGBAFormat&&r.convert(y)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))}function d(y){const H=y===t.HalfFloatType&&(i.has("EXT_color_buffer_half_float")||i.has("EXT_color_buffer_float"));return!(y!==t.UnsignedByteType&&r.convert(y)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&y!==t.FloatType&&!H)}function b(y){if(y==="highp"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";y="mediump"}return y==="mediump"&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let T=n.precision!==void 0?n.precision:"highp";const w=b(T);w!==T&&(console.warn("THREE.WebGLRenderer:",T,"not supported, using",w,"instead."),T=w);const x=n.logarithmicDepthBuffer===!0,S=n.reverseDepthBuffer===!0&&i.has("EXT_clip_control"),R=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),F=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),D=e.getParameter(e.MAX_TEXTURE_SIZE),f=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),a=e.getParameter(e.MAX_VERTEX_ATTRIBS),U=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),A=e.getParameter(e.MAX_VARYING_VECTORS),g=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),V=F>0,L=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:b,textureFormatReadable:m,textureTypeReadable:d,precision:T,logarithmicDepthBuffer:x,reverseDepthBuffer:S,maxTextures:R,maxVertexTextures:F,maxTextureSize:D,maxCubemapSize:f,maxAttributes:a,maxVertexUniforms:U,maxVaryings:A,maxFragmentUniforms:g,vertexTextures:V,maxSamples:L}}function _a(e){const i=this;let n=null,r=0,c=!1,s=!1;const m=new t.Plane,d=new t.Matrix3,b={value:null,needsUpdate:!1};this.uniform=b,this.numPlanes=0,this.numIntersection=0,this.init=function(x,S){const R=x.length!==0||S||r!==0||c;return c=S,r=x.length,R},this.beginShadows=function(){s=!0,w(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(x,S){n=w(x,S,0)},this.setState=function(x,S,R){const F=x.clippingPlanes,D=x.clipIntersection,f=x.clipShadows,a=e.get(x);if(!c||F===null||F.length===0||s&&!f)s?w(null):T();else{const U=s?0:r,A=U*4;let g=a.clippingState||null;b.value=g,g=w(F,S,A,R);for(let V=0;V!==A;++V)g[V]=n[V];a.clippingState=g,this.numIntersection=D?this.numPlanes:0,this.numPlanes+=U}};function T(){b.value!==n&&(b.value=n,b.needsUpdate=r>0),i.numPlanes=r,i.numIntersection=0}function w(x,S,R,F){const D=x!==null?x.length:0;let f=null;if(D!==0){if(f=b.value,F!==!0||f===null){const a=R+D*4,U=S.matrixWorldInverse;d.getNormalMatrix(U),(f===null||f.length<a)&&(f=new Float32Array(a));for(let A=0,g=R;A!==D;++A,g+=4)m.copy(x[A]).applyMatrix4(U,d),m.normal.toArray(f,g),f[g+3]=m.constant}b.value=f,b.needsUpdate=!0}return i.numPlanes=D,i.numIntersection=0,f}}function ga(e){let i=new WeakMap;function n(m,d){return d===t.EquirectangularReflectionMapping?m.mapping=t.CubeReflectionMapping:d===t.EquirectangularRefractionMapping&&(m.mapping=t.CubeRefractionMapping),m}function r(m){if(m&&m.isTexture){const d=m.mapping;if(d===t.EquirectangularReflectionMapping||d===t.EquirectangularRefractionMapping)if(i.has(m)){const b=i.get(m).texture;return n(b,m.mapping)}else{const b=m.image;if(b&&b.height>0){const T=new t.WebGLCubeRenderTarget(b.height);return T.fromEquirectangularTexture(e,m),i.set(m,T),m.addEventListener("dispose",c),n(T.texture,m.mapping)}else return null}}return m}function c(m){const d=m.target;d.removeEventListener("dispose",c);const b=i.get(d);b!==void 0&&(i.delete(d),b.dispose())}function s(){i=new WeakMap}return{get:r,dispose:s}}const Et=4,$t=[.125,.215,.35,.446,.526,.582],gt=20,It=new t.OrthographicCamera,Zt=new t.Color;let Nt=null,yt=0,Ft=0,Ot=!1;const _t=(1+Math.sqrt(5))/2,St=1/_t,Qt=[new t.Vector3(-_t,St,0),new t.Vector3(_t,St,0),new t.Vector3(-St,0,_t),new t.Vector3(St,0,_t),new t.Vector3(0,_t,-St),new t.Vector3(0,_t,St),new t.Vector3(-1,1,-1),new t.Vector3(1,1,-1),new t.Vector3(-1,1,1),new t.Vector3(1,1,1)],va=new t.Vector3;class Gt{constructor(i){this._renderer=i,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(i,n=0,r=.1,c=100,s={}){const{size:m=256,position:d=va}=s;Nt=this._renderer.getRenderTarget(),yt=this._renderer.getActiveCubeFace(),Ft=this._renderer.getActiveMipmapLevel(),Ot=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(m);const b=this._allocateTargets();return b.depthBuffer=!0,this._sceneToCubeUV(i,r,c,b,d),n>0&&this._blur(b,0,0,n),this._applyPMREM(b),this._cleanup(b),b}fromEquirectangular(i,n=null){return this._fromTexture(i,n)}fromCubemap(i,n=null){return this._fromTexture(i,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=en(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=jt(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(i){this._lodMax=Math.floor(Math.log2(i)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let i=0;i<this._lodPlanes.length;i++)this._lodPlanes[i].dispose()}_cleanup(i){this._renderer.setRenderTarget(Nt,yt,Ft),this._renderer.xr.enabled=Ot,i.scissorTest=!1,bt(i,0,0,i.width,i.height)}_fromTexture(i,n){i.mapping===t.CubeReflectionMapping||i.mapping===t.CubeRefractionMapping?this._setSize(i.image.length===0?16:i.image[0].width||i.image[0].image.width):this._setSize(i.image.width/4),Nt=this._renderer.getRenderTarget(),yt=this._renderer.getActiveCubeFace(),Ft=this._renderer.getActiveMipmapLevel(),Ot=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=n||this._allocateTargets();return this._textureToCubeUV(i,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const i=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:t.LinearFilter,minFilter:t.LinearFilter,generateMipmaps:!1,type:t.HalfFloatType,format:t.RGBAFormat,colorSpace:t.LinearSRGBColorSpace,depthBuffer:!1},c=Jt(i,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==i||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Jt(i,n,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Sa(s)),this._blurMaterial=Ea(s,i,n)}return c}_compileMaterial(i){const n=new t.Mesh(this._lodPlanes[0],i);this._renderer.compile(n,It)}_sceneToCubeUV(i,n,r,c,s){const b=new t.PerspectiveCamera(90,1,n,r),T=[1,-1,1,1,1,1],w=[1,1,1,-1,-1,-1],x=this._renderer,S=x.autoClear,R=x.toneMapping;x.getClearColor(Zt),x.toneMapping=t.NoToneMapping,x.autoClear=!1;const F=new t.MeshBasicMaterial({name:"PMREM.Background",side:t.BackSide,depthWrite:!1,depthTest:!1}),D=new t.Mesh(new t.BoxGeometry,F);let f=!1;const a=i.background;a?a.isColor&&(F.color.copy(a),i.background=null,f=!0):(F.color.copy(Zt),f=!0);for(let U=0;U<6;U++){const A=U%3;A===0?(b.up.set(0,T[U],0),b.position.set(s.x,s.y,s.z),b.lookAt(s.x+w[U],s.y,s.z)):A===1?(b.up.set(0,0,T[U]),b.position.set(s.x,s.y,s.z),b.lookAt(s.x,s.y+w[U],s.z)):(b.up.set(0,T[U],0),b.position.set(s.x,s.y,s.z),b.lookAt(s.x,s.y,s.z+w[U]));const g=this._cubeSize;bt(c,A*g,U>2?g:0,g,g),x.setRenderTarget(c),f&&x.render(D,b),x.render(i,b)}D.geometry.dispose(),D.material.dispose(),x.toneMapping=R,x.autoClear=S,i.background=a}_textureToCubeUV(i,n){const r=this._renderer,c=i.mapping===t.CubeReflectionMapping||i.mapping===t.CubeRefractionMapping;c?(this._cubemapMaterial===null&&(this._cubemapMaterial=en()),this._cubemapMaterial.uniforms.flipEnvMap.value=i.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=jt());const s=c?this._cubemapMaterial:this._equirectMaterial,m=new t.Mesh(this._lodPlanes[0],s),d=s.uniforms;d.envMap.value=i;const b=this._cubeSize;bt(n,0,0,3*b,2*b),r.setRenderTarget(n),r.render(m,It)}_applyPMREM(i){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const c=this._lodPlanes.length;for(let s=1;s<c;s++){const m=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),d=Qt[(c-s-1)%Qt.length];this._blur(i,s-1,s,m,d)}n.autoClear=r}_blur(i,n,r,c,s){const m=this._pingPongRenderTarget;this._halfBlur(i,m,n,r,c,"latitudinal",s),this._halfBlur(m,i,r,r,c,"longitudinal",s)}_halfBlur(i,n,r,c,s,m,d){const b=this._renderer,T=this._blurMaterial;m!=="latitudinal"&&m!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const w=3,x=new t.Mesh(this._lodPlanes[c],T),S=T.uniforms,R=this._sizeLods[r]-1,F=isFinite(s)?Math.PI/(2*R):2*Math.PI/(2*gt-1),D=s/F,f=isFinite(s)?1+Math.floor(w*D):gt;f>gt&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${f} samples when the maximum is set to ${gt}`);const a=[];let U=0;for(let y=0;y<gt;++y){const H=y/D,h=Math.exp(-H*H/2);a.push(h),y===0?U+=h:y<f&&(U+=2*h)}for(let y=0;y<a.length;y++)a[y]=a[y]/U;S.envMap.value=i.texture,S.samples.value=f,S.weights.value=a,S.latitudinal.value=m==="latitudinal",d&&(S.poleAxis.value=d);const{_lodMax:A}=this;S.dTheta.value=F,S.mipInt.value=A-r;const g=this._sizeLods[c],V=3*g*(c>A-Et?c-A+Et:0),L=4*(this._cubeSize-g);bt(n,V,L,3*g,2*g),b.setRenderTarget(n),b.render(x,It)}}function Sa(e){const i=[],n=[],r=[];let c=e;const s=e-Et+1+$t.length;for(let m=0;m<s;m++){const d=Math.pow(2,c);n.push(d);let b=1/d;m>e-Et?b=$t[m-e+Et-1]:m===0&&(b=0),r.push(b);const T=1/(d-2),w=-T,x=1+T,S=[w,w,x,w,x,x,w,w,x,x,w,x],R=6,F=6,D=3,f=2,a=1,U=new Float32Array(D*F*R),A=new Float32Array(f*F*R),g=new Float32Array(a*F*R);for(let L=0;L<R;L++){const y=L%3*2/3-1,H=L>2?0:-1,h=[y,H,0,y+2/3,H,0,y+2/3,H+1,0,y,H,0,y+2/3,H+1,0,y,H+1,0];U.set(h,D*F*L),A.set(S,f*F*L);const u=[L,L,L,L,L,L];g.set(u,a*F*L)}const V=new t.BufferGeometry;V.setAttribute("position",new t.BufferAttribute(U,D)),V.setAttribute("uv",new t.BufferAttribute(A,f)),V.setAttribute("faceIndex",new t.BufferAttribute(g,a)),i.push(V),c>Et&&c--}return{lodPlanes:i,sizeLods:n,sigmas:r}}function Jt(e,i,n){const r=new t.WebGLRenderTarget(e,i,n);return r.texture.mapping=t.CubeUVReflectionMapping,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function bt(e,i,n,r,c){e.viewport.set(i,n,r,c),e.scissor.set(i,n,r,c)}function Ea(e,i,n){const r=new Float32Array(gt),c=new t.Vector3(0,1,0);return new t.ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:gt,CUBEUV_TEXEL_WIDTH:1/i,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:c}},vertexShader:Vt(),fragmentShader:`
3532
+
3533
+ precision mediump float;
3534
+ precision mediump int;
3535
+
3536
+ varying vec3 vOutputDirection;
3537
+
3538
+ uniform sampler2D envMap;
3539
+ uniform int samples;
3540
+ uniform float weights[ n ];
3541
+ uniform bool latitudinal;
3542
+ uniform float dTheta;
3543
+ uniform float mipInt;
3544
+ uniform vec3 poleAxis;
3545
+
3546
+ #define ENVMAP_TYPE_CUBE_UV
3547
+ #include <cube_uv_reflection_fragment>
3548
+
3549
+ vec3 getSample( float theta, vec3 axis ) {
3550
+
3551
+ float cosTheta = cos( theta );
3552
+ // Rodrigues' axis-angle rotation
3553
+ vec3 sampleDirection = vOutputDirection * cosTheta
3554
+ + cross( axis, vOutputDirection ) * sin( theta )
3555
+ + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3556
+
3557
+ return bilinearCubeUV( envMap, sampleDirection, mipInt );
3558
+
3559
+ }
3560
+
3561
+ void main() {
3562
+
3563
+ vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3564
+
3565
+ if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3566
+
3567
+ axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3568
+
3569
+ }
3570
+
3571
+ axis = normalize( axis );
3572
+
3573
+ gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3574
+ gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3575
+
3576
+ for ( int i = 1; i < n; i++ ) {
3577
+
3578
+ if ( i >= samples ) {
3579
+
3580
+ break;
3581
+
3582
+ }
3583
+
3584
+ float theta = dTheta * float( i );
3585
+ gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3586
+ gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3587
+
3588
+ }
3589
+
3590
+ }
3591
+ `,blending:t.NoBlending,depthTest:!1,depthWrite:!1})}function jt(){return new t.ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Vt(),fragmentShader:`
3592
+
3593
+ precision mediump float;
3594
+ precision mediump int;
3595
+
3596
+ varying vec3 vOutputDirection;
3597
+
3598
+ uniform sampler2D envMap;
3599
+
3600
+ #include <common>
3601
+
3602
+ void main() {
3603
+
3604
+ vec3 outputDirection = normalize( vOutputDirection );
3605
+ vec2 uv = equirectUv( outputDirection );
3606
+
3607
+ gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3608
+
3609
+ }
3610
+ `,blending:t.NoBlending,depthTest:!1,depthWrite:!1})}function en(){return new t.ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Vt(),fragmentShader:`
3611
+
3612
+ precision mediump float;
3613
+ precision mediump int;
3614
+
3615
+ uniform float flipEnvMap;
3616
+
3617
+ varying vec3 vOutputDirection;
3618
+
3619
+ uniform samplerCube envMap;
3620
+
3621
+ void main() {
3622
+
3623
+ gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3624
+
3625
+ }
3626
+ `,blending:t.NoBlending,depthTest:!1,depthWrite:!1})}function Vt(){return`
3627
+
3628
+ precision mediump float;
3629
+ precision mediump int;
3630
+
3631
+ attribute float faceIndex;
3632
+
3633
+ varying vec3 vOutputDirection;
3634
+
3635
+ // RH coordinate system; PMREM face-indexing convention
3636
+ vec3 getDirection( vec2 uv, float face ) {
3637
+
3638
+ uv = 2.0 * uv - 1.0;
3639
+
3640
+ vec3 direction = vec3( uv, 1.0 );
3641
+
3642
+ if ( face == 0.0 ) {
3643
+
3644
+ direction = direction.zyx; // ( 1, v, u ) pos x
3645
+
3646
+ } else if ( face == 1.0 ) {
3647
+
3648
+ direction = direction.xzy;
3649
+ direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3650
+
3651
+ } else if ( face == 2.0 ) {
3652
+
3653
+ direction.x *= -1.0; // ( -u, v, 1 ) pos z
3654
+
3655
+ } else if ( face == 3.0 ) {
3656
+
3657
+ direction = direction.zyx;
3658
+ direction.xz *= -1.0; // ( -1, v, -u ) neg x
3659
+
3660
+ } else if ( face == 4.0 ) {
3661
+
3662
+ direction = direction.xzy;
3663
+ direction.xy *= -1.0; // ( -u, -1, v ) neg y
3664
+
3665
+ } else if ( face == 5.0 ) {
3666
+
3667
+ direction.z *= -1.0; // ( u, v, -1 ) neg z
3668
+
3669
+ }
3670
+
3671
+ return direction;
3672
+
3673
+ }
3674
+
3675
+ void main() {
3676
+
3677
+ vOutputDirection = getDirection( uv, faceIndex );
3678
+ gl_Position = vec4( position, 1.0 );
3679
+
3680
+ }
3681
+ `}function Ma(e){let i=new WeakMap,n=null;function r(d){if(d&&d.isTexture){const b=d.mapping,T=b===t.EquirectangularReflectionMapping||b===t.EquirectangularRefractionMapping,w=b===t.CubeReflectionMapping||b===t.CubeRefractionMapping;if(T||w){let x=i.get(d);const S=x!==void 0?x.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==S)return n===null&&(n=new Gt(e)),x=T?n.fromEquirectangular(d,x):n.fromCubemap(d,x),x.texture.pmremVersion=d.pmremVersion,i.set(d,x),x.texture;if(x!==void 0)return x.texture;{const R=d.image;return T&&R&&R.height>0||w&&R&&c(R)?(n===null&&(n=new Gt(e)),x=T?n.fromEquirectangular(d):n.fromCubemap(d),x.texture.pmremVersion=d.pmremVersion,i.set(d,x),d.addEventListener("dispose",s),x.texture):null}}}return d}function c(d){let b=0;const T=6;for(let w=0;w<T;w++)d[w]!==void 0&&b++;return b===T}function s(d){const b=d.target;b.removeEventListener("dispose",s);const T=i.get(b);T!==void 0&&(i.delete(b),T.dispose())}function m(){i=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:m}}function Ta(e){const i={};function n(r){if(i[r]!==void 0)return i[r];let c;switch(r){case"WEBGL_depth_texture":c=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":c=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":c=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":c=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:c=e.getExtension(r)}return i[r]=c,c}return{has:function(r){return n(r)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(r){const c=n(r);return c===null&&t.warnOnce("THREE.WebGLRenderer: "+r+" extension not supported."),c}}}function xa(e,i,n,r){const c={},s=new WeakMap;function m(x){const S=x.target;S.index!==null&&i.remove(S.index);for(const F in S.attributes)i.remove(S.attributes[F]);S.removeEventListener("dispose",m),delete c[S.id];const R=s.get(S);R&&(i.remove(R),s.delete(S)),r.releaseStatesOfGeometry(S),S.isInstancedBufferGeometry===!0&&delete S._maxInstanceCount,n.memory.geometries--}function d(x,S){return c[S.id]===!0||(S.addEventListener("dispose",m),c[S.id]=!0,n.memory.geometries++),S}function b(x){const S=x.attributes;for(const R in S)i.update(S[R],e.ARRAY_BUFFER)}function T(x){const S=[],R=x.index,F=x.attributes.position;let D=0;if(R!==null){const U=R.array;D=R.version;for(let A=0,g=U.length;A<g;A+=3){const V=U[A+0],L=U[A+1],y=U[A+2];S.push(V,L,L,y,y,V)}}else if(F!==void 0){const U=F.array;D=F.version;for(let A=0,g=U.length/3-1;A<g;A+=3){const V=A+0,L=A+1,y=A+2;S.push(V,L,L,y,y,V)}}else return;const f=new(t.arrayNeedsUint32(S)?t.Uint32BufferAttribute:t.Uint16BufferAttribute)(S,1);f.version=D;const a=s.get(x);a&&i.remove(a),s.set(x,f)}function w(x){const S=s.get(x);if(S){const R=x.index;R!==null&&S.version<R.version&&T(x)}else T(x);return s.get(x)}return{get:d,update:b,getWireframeAttribute:w}}function Aa(e,i,n){let r;function c(S){r=S}let s,m;function d(S){s=S.type,m=S.bytesPerElement}function b(S,R){e.drawElements(r,R,s,S*m),n.update(R,r,1)}function T(S,R,F){F!==0&&(e.drawElementsInstanced(r,R,s,S*m,F),n.update(R,r,F))}function w(S,R,F){if(F===0)return;i.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,R,0,s,S,0,F);let f=0;for(let a=0;a<F;a++)f+=R[a];n.update(f,r,1)}function x(S,R,F,D){if(F===0)return;const f=i.get("WEBGL_multi_draw");if(f===null)for(let a=0;a<S.length;a++)T(S[a]/m,R[a],D[a]);else{f.multiDrawElementsInstancedWEBGL(r,R,0,s,S,0,D,0,F);let a=0;for(let U=0;U<F;U++)a+=R[U]*D[U];n.update(a,r,1)}}this.setMode=c,this.setIndex=d,this.render=b,this.renderInstances=T,this.renderMultiDraw=w,this.renderMultiDrawInstances=x}function Ra(e){const i={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,m,d){switch(n.calls++,m){case e.TRIANGLES:n.triangles+=d*(s/3);break;case e.LINES:n.lines+=d*(s/2);break;case e.LINE_STRIP:n.lines+=d*(s-1);break;case e.LINE_LOOP:n.lines+=d*s;break;case e.POINTS:n.points+=d*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",m);break}}function c(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:i,render:n,programs:null,autoReset:!0,reset:c,update:r}}function Ca(e,i,n){const r=new WeakMap,c=new t.Vector4;function s(m,d,b){const T=m.morphTargetInfluences,w=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,x=w!==void 0?w.length:0;let S=r.get(d);if(S===void 0||S.count!==x){let h=function(){y.dispose(),r.delete(d),d.removeEventListener("dispose",h)};S!==void 0&&S.texture.dispose();const R=d.morphAttributes.position!==void 0,F=d.morphAttributes.normal!==void 0,D=d.morphAttributes.color!==void 0,f=d.morphAttributes.position||[],a=d.morphAttributes.normal||[],U=d.morphAttributes.color||[];let A=0;R===!0&&(A=1),F===!0&&(A=2),D===!0&&(A=3);let g=d.attributes.position.count*A,V=1;g>i.maxTextureSize&&(V=Math.ceil(g/i.maxTextureSize),g=i.maxTextureSize);const L=new Float32Array(g*V*4*x),y=new t.DataArrayTexture(L,g,V,x);y.type=t.FloatType,y.needsUpdate=!0;const H=A*4;for(let u=0;u<x;u++){const C=f[u],K=a[u],k=U[u],Y=g*V*4*u;for(let j=0;j<C.count;j++){const X=j*H;R===!0&&(c.fromBufferAttribute(C,j),L[Y+X+0]=c.x,L[Y+X+1]=c.y,L[Y+X+2]=c.z,L[Y+X+3]=0),F===!0&&(c.fromBufferAttribute(K,j),L[Y+X+4]=c.x,L[Y+X+5]=c.y,L[Y+X+6]=c.z,L[Y+X+7]=0),D===!0&&(c.fromBufferAttribute(k,j),L[Y+X+8]=c.x,L[Y+X+9]=c.y,L[Y+X+10]=c.z,L[Y+X+11]=k.itemSize===4?c.w:1)}}S={count:x,texture:y,size:new t.Vector2(g,V)},r.set(d,S),d.addEventListener("dispose",h)}if(m.isInstancedMesh===!0&&m.morphTexture!==null)b.getUniforms().setValue(e,"morphTexture",m.morphTexture,n);else{let R=0;for(let D=0;D<T.length;D++)R+=T[D];const F=d.morphTargetsRelative?1:1-R;b.getUniforms().setValue(e,"morphTargetBaseInfluence",F),b.getUniforms().setValue(e,"morphTargetInfluences",T)}b.getUniforms().setValue(e,"morphTargetsTexture",S.texture,n),b.getUniforms().setValue(e,"morphTargetsTextureSize",S.size)}return{update:s}}function ba(e,i,n,r){let c=new WeakMap;function s(b){const T=r.render.frame,w=b.geometry,x=i.get(b,w);if(c.get(x)!==T&&(i.update(x),c.set(x,T)),b.isInstancedMesh&&(b.hasEventListener("dispose",d)===!1&&b.addEventListener("dispose",d),c.get(b)!==T&&(n.update(b.instanceMatrix,e.ARRAY_BUFFER),b.instanceColor!==null&&n.update(b.instanceColor,e.ARRAY_BUFFER),c.set(b,T))),b.isSkinnedMesh){const S=b.skeleton;c.get(S)!==T&&(S.update(),c.set(S,T))}return x}function m(){c=new WeakMap}function d(b){const T=b.target;T.removeEventListener("dispose",d),n.remove(T.instanceMatrix),T.instanceColor!==null&&n.remove(T.instanceColor)}return{update:s,dispose:m}}const En=new t.Texture,tn=new t.DepthTexture(1,1),Mn=new t.DataArrayTexture,Tn=new t.Data3DTexture,xn=new t.CubeTexture,nn=[],rn=[],an=new Float32Array(16),on=new Float32Array(9),sn=new Float32Array(4);function Mt(e,i,n){const r=e[0];if(r<=0||r>0)return e;const c=i*n;let s=nn[c];if(s===void 0&&(s=new Float32Array(c),nn[c]=s),i!==0){r.toArray(s,0);for(let m=1,d=0;m!==i;++m)d+=n,e[m].toArray(s,d)}return s}function et(e,i){if(e.length!==i.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==i[n])return!1;return!0}function tt(e,i){for(let n=0,r=i.length;n<r;n++)e[n]=i[n]}function Dt(e,i){let n=rn[i];n===void 0&&(n=new Int32Array(i),rn[i]=n);for(let r=0;r!==i;++r)n[r]=e.allocateTextureUnit();return n}function Pa(e,i){const n=this.cache;n[0]!==i&&(e.uniform1f(this.addr,i),n[0]=i)}function La(e,i){const n=this.cache;if(i.x!==void 0)(n[0]!==i.x||n[1]!==i.y)&&(e.uniform2f(this.addr,i.x,i.y),n[0]=i.x,n[1]=i.y);else{if(et(n,i))return;e.uniform2fv(this.addr,i),tt(n,i)}}function Da(e,i){const n=this.cache;if(i.x!==void 0)(n[0]!==i.x||n[1]!==i.y||n[2]!==i.z)&&(e.uniform3f(this.addr,i.x,i.y,i.z),n[0]=i.x,n[1]=i.y,n[2]=i.z);else if(i.r!==void 0)(n[0]!==i.r||n[1]!==i.g||n[2]!==i.b)&&(e.uniform3f(this.addr,i.r,i.g,i.b),n[0]=i.r,n[1]=i.g,n[2]=i.b);else{if(et(n,i))return;e.uniform3fv(this.addr,i),tt(n,i)}}function Ua(e,i){const n=this.cache;if(i.x!==void 0)(n[0]!==i.x||n[1]!==i.y||n[2]!==i.z||n[3]!==i.w)&&(e.uniform4f(this.addr,i.x,i.y,i.z,i.w),n[0]=i.x,n[1]=i.y,n[2]=i.z,n[3]=i.w);else{if(et(n,i))return;e.uniform4fv(this.addr,i),tt(n,i)}}function wa(e,i){const n=this.cache,r=i.elements;if(r===void 0){if(et(n,i))return;e.uniformMatrix2fv(this.addr,!1,i),tt(n,i)}else{if(et(n,r))return;sn.set(r),e.uniformMatrix2fv(this.addr,!1,sn),tt(n,r)}}function Ia(e,i){const n=this.cache,r=i.elements;if(r===void 0){if(et(n,i))return;e.uniformMatrix3fv(this.addr,!1,i),tt(n,i)}else{if(et(n,r))return;on.set(r),e.uniformMatrix3fv(this.addr,!1,on),tt(n,r)}}function Na(e,i){const n=this.cache,r=i.elements;if(r===void 0){if(et(n,i))return;e.uniformMatrix4fv(this.addr,!1,i),tt(n,i)}else{if(et(n,r))return;an.set(r),e.uniformMatrix4fv(this.addr,!1,an),tt(n,r)}}function ya(e,i){const n=this.cache;n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i)}function Fa(e,i){const n=this.cache;if(i.x!==void 0)(n[0]!==i.x||n[1]!==i.y)&&(e.uniform2i(this.addr,i.x,i.y),n[0]=i.x,n[1]=i.y);else{if(et(n,i))return;e.uniform2iv(this.addr,i),tt(n,i)}}function Oa(e,i){const n=this.cache;if(i.x!==void 0)(n[0]!==i.x||n[1]!==i.y||n[2]!==i.z)&&(e.uniform3i(this.addr,i.x,i.y,i.z),n[0]=i.x,n[1]=i.y,n[2]=i.z);else{if(et(n,i))return;e.uniform3iv(this.addr,i),tt(n,i)}}function Ba(e,i){const n=this.cache;if(i.x!==void 0)(n[0]!==i.x||n[1]!==i.y||n[2]!==i.z||n[3]!==i.w)&&(e.uniform4i(this.addr,i.x,i.y,i.z,i.w),n[0]=i.x,n[1]=i.y,n[2]=i.z,n[3]=i.w);else{if(et(n,i))return;e.uniform4iv(this.addr,i),tt(n,i)}}function Ga(e,i){const n=this.cache;n[0]!==i&&(e.uniform1ui(this.addr,i),n[0]=i)}function Ha(e,i){const n=this.cache;if(i.x!==void 0)(n[0]!==i.x||n[1]!==i.y)&&(e.uniform2ui(this.addr,i.x,i.y),n[0]=i.x,n[1]=i.y);else{if(et(n,i))return;e.uniform2uiv(this.addr,i),tt(n,i)}}function Va(e,i){const n=this.cache;if(i.x!==void 0)(n[0]!==i.x||n[1]!==i.y||n[2]!==i.z)&&(e.uniform3ui(this.addr,i.x,i.y,i.z),n[0]=i.x,n[1]=i.y,n[2]=i.z);else{if(et(n,i))return;e.uniform3uiv(this.addr,i),tt(n,i)}}function ka(e,i){const n=this.cache;if(i.x!==void 0)(n[0]!==i.x||n[1]!==i.y||n[2]!==i.z||n[3]!==i.w)&&(e.uniform4ui(this.addr,i.x,i.y,i.z,i.w),n[0]=i.x,n[1]=i.y,n[2]=i.z,n[3]=i.w);else{if(et(n,i))return;e.uniform4uiv(this.addr,i),tt(n,i)}}function Wa(e,i,n){const r=this.cache,c=n.allocateTextureUnit();r[0]!==c&&(e.uniform1i(this.addr,c),r[0]=c);let s;this.type===e.SAMPLER_2D_SHADOW?(tn.compareFunction=t.LessEqualCompare,s=tn):s=En,n.setTexture2D(i||s,c)}function za(e,i,n){const r=this.cache,c=n.allocateTextureUnit();r[0]!==c&&(e.uniform1i(this.addr,c),r[0]=c),n.setTexture3D(i||Tn,c)}function Xa(e,i,n){const r=this.cache,c=n.allocateTextureUnit();r[0]!==c&&(e.uniform1i(this.addr,c),r[0]=c),n.setTextureCube(i||xn,c)}function qa(e,i,n){const r=this.cache,c=n.allocateTextureUnit();r[0]!==c&&(e.uniform1i(this.addr,c),r[0]=c),n.setTexture2DArray(i||Mn,c)}function Ya(e){switch(e){case 5126:return Pa;case 35664:return La;case 35665:return Da;case 35666:return Ua;case 35674:return wa;case 35675:return Ia;case 35676:return Na;case 5124:case 35670:return ya;case 35667:case 35671:return Fa;case 35668:case 35672:return Oa;case 35669:case 35673:return Ba;case 5125:return Ga;case 36294:return Ha;case 36295:return Va;case 36296:return ka;case 35678:case 36198:case 36298:case 36306:case 35682:return Wa;case 35679:case 36299:case 36307:return za;case 35680:case 36300:case 36308:case 36293:return Xa;case 36289:case 36303:case 36311:case 36292:return qa}}function Ka(e,i){e.uniform1fv(this.addr,i)}function $a(e,i){const n=Mt(i,this.size,2);e.uniform2fv(this.addr,n)}function Za(e,i){const n=Mt(i,this.size,3);e.uniform3fv(this.addr,n)}function Qa(e,i){const n=Mt(i,this.size,4);e.uniform4fv(this.addr,n)}function Ja(e,i){const n=Mt(i,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function ja(e,i){const n=Mt(i,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function eo(e,i){const n=Mt(i,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function to(e,i){e.uniform1iv(this.addr,i)}function no(e,i){e.uniform2iv(this.addr,i)}function io(e,i){e.uniform3iv(this.addr,i)}function ro(e,i){e.uniform4iv(this.addr,i)}function ao(e,i){e.uniform1uiv(this.addr,i)}function oo(e,i){e.uniform2uiv(this.addr,i)}function so(e,i){e.uniform3uiv(this.addr,i)}function lo(e,i){e.uniform4uiv(this.addr,i)}function co(e,i,n){const r=this.cache,c=i.length,s=Dt(n,c);et(r,s)||(e.uniform1iv(this.addr,s),tt(r,s));for(let m=0;m!==c;++m)n.setTexture2D(i[m]||En,s[m])}function fo(e,i,n){const r=this.cache,c=i.length,s=Dt(n,c);et(r,s)||(e.uniform1iv(this.addr,s),tt(r,s));for(let m=0;m!==c;++m)n.setTexture3D(i[m]||Tn,s[m])}function uo(e,i,n){const r=this.cache,c=i.length,s=Dt(n,c);et(r,s)||(e.uniform1iv(this.addr,s),tt(r,s));for(let m=0;m!==c;++m)n.setTextureCube(i[m]||xn,s[m])}function po(e,i,n){const r=this.cache,c=i.length,s=Dt(n,c);et(r,s)||(e.uniform1iv(this.addr,s),tt(r,s));for(let m=0;m!==c;++m)n.setTexture2DArray(i[m]||Mn,s[m])}function ho(e){switch(e){case 5126:return Ka;case 35664:return $a;case 35665:return Za;case 35666:return Qa;case 35674:return Ja;case 35675:return ja;case 35676:return eo;case 5124:case 35670:return to;case 35667:case 35671:return no;case 35668:case 35672:return io;case 35669:case 35673:return ro;case 5125:return ao;case 36294:return oo;case 36295:return so;case 36296:return lo;case 35678:case 36198:case 36298:case 36306:case 35682:return co;case 35679:case 36299:case 36307:return fo;case 35680:case 36300:case 36308:case 36293:return uo;case 36289:case 36303:case 36311:case 36292:return po}}class mo{constructor(i,n,r){this.id=i,this.addr=r,this.cache=[],this.type=n.type,this.setValue=Ya(n.type)}}class _o{constructor(i,n,r){this.id=i,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=ho(n.type)}}class go{constructor(i){this.id=i,this.seq=[],this.map={}}setValue(i,n,r){const c=this.seq;for(let s=0,m=c.length;s!==m;++s){const d=c[s];d.setValue(i,n[d.id],r)}}}const Bt=/(\w+)(\])?(\[|\.)?/g;function ln(e,i){e.seq.push(i),e.map[i.id]=i}function vo(e,i,n){const r=e.name,c=r.length;for(Bt.lastIndex=0;;){const s=Bt.exec(r),m=Bt.lastIndex;let d=s[1];const b=s[2]==="]",T=s[3];if(b&&(d=d|0),T===void 0||T==="["&&m+2===c){ln(n,T===void 0?new mo(d,e,i):new _o(d,e,i));break}else{let x=n.map[d];x===void 0&&(x=new go(d),ln(n,x)),n=x}}}class Lt{constructor(i,n){this.seq=[],this.map={};const r=i.getProgramParameter(n,i.ACTIVE_UNIFORMS);for(let c=0;c<r;++c){const s=i.getActiveUniform(n,c),m=i.getUniformLocation(n,s.name);vo(s,m,this)}}setValue(i,n,r,c){const s=this.map[n];s!==void 0&&s.setValue(i,r,c)}setOptional(i,n,r){const c=n[r];c!==void 0&&this.setValue(i,r,c)}static upload(i,n,r,c){for(let s=0,m=n.length;s!==m;++s){const d=n[s],b=r[d.id];b.needsUpdate!==!1&&d.setValue(i,b.value,c)}}static seqWithValue(i,n){const r=[];for(let c=0,s=i.length;c!==s;++c){const m=i[c];m.id in n&&r.push(m)}return r}}function cn(e,i,n){const r=e.createShader(i);return e.shaderSource(r,n),e.compileShader(r),r}const So=37297;let Eo=0;function Mo(e,i){const n=e.split(`
3682
+ `),r=[],c=Math.max(i-6,0),s=Math.min(i+6,n.length);for(let m=c;m<s;m++){const d=m+1;r.push(`${d===i?">":" "} ${d}: ${n[m]}`)}return r.join(`
3683
+ `)}const fn=new t.Matrix3;function To(e){t.ColorManagement._getMatrix(fn,t.ColorManagement.workingColorSpace,e);const i=`mat3( ${fn.elements.map(n=>n.toFixed(4))} )`;switch(t.ColorManagement.getTransfer(e)){case t.LinearTransfer:return[i,"LinearTransferOETF"];case t.SRGBTransfer:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",e),[i,"LinearTransferOETF"]}}function un(e,i,n){const r=e.getShaderParameter(i,e.COMPILE_STATUS),c=e.getShaderInfoLog(i).trim();if(r&&c==="")return"";const s=/ERROR: 0:(\d+)/.exec(c);if(s){const m=parseInt(s[1]);return n.toUpperCase()+`
3684
+
3685
+ `+c+`
3686
+
3687
+ `+Mo(e.getShaderSource(i),m)}else return c}function xo(e,i){const n=To(i);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
3688
+ `)}function Ao(e,i){let n;switch(i){case t.LinearToneMapping:n="Linear";break;case t.ReinhardToneMapping:n="Reinhard";break;case t.CineonToneMapping:n="Cineon";break;case t.ACESFilmicToneMapping:n="ACESFilmic";break;case t.AgXToneMapping:n="AgX";break;case t.NeutralToneMapping:n="Neutral";break;case t.CustomToneMapping:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",i),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Pt=new t.Vector3;function Ro(){t.ColorManagement.getLuminanceCoefficients(Pt);const e=Pt.x.toFixed(4),i=Pt.y.toFixed(4),n=Pt.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${e}, ${i}, ${n} );`," return dot( weights, rgb );","}"].join(`
3689
+ `)}function Co(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(xt).join(`
3690
+ `)}function bo(e){const i=[];for(const n in e){const r=e[n];r!==!1&&i.push("#define "+n+" "+r)}return i.join(`
3691
+ `)}function Po(e,i){const n={},r=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let c=0;c<r;c++){const s=e.getActiveAttrib(i,c),m=s.name;let d=1;s.type===e.FLOAT_MAT2&&(d=2),s.type===e.FLOAT_MAT3&&(d=3),s.type===e.FLOAT_MAT4&&(d=4),n[m]={type:s.type,location:e.getAttribLocation(i,m),locationSize:d}}return n}function xt(e){return e!==""}function dn(e,i){const n=i.numSpotLightShadows+i.numSpotLightMaps-i.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,i.numDirLights).replace(/NUM_SPOT_LIGHTS/g,i.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,i.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,i.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,i.numPointLights).replace(/NUM_HEMI_LIGHTS/g,i.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,i.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,i.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,i.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,i.numPointLightShadows)}function pn(e,i){return e.replace(/NUM_CLIPPING_PLANES/g,i.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,i.numClippingPlanes-i.numClipIntersection)}const Lo=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ht(e){return e.replace(Lo,Uo)}const Do=new Map;function Uo(e,i){let n=Ue[i];if(n===void 0){const r=Do.get(i);if(r!==void 0)n=Ue[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',i,r);else throw new Error("Can not resolve #include <"+i+">")}return Ht(n)}const wo=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function hn(e){return e.replace(wo,Io)}function Io(e,i,n,r){let c="";for(let s=parseInt(i);s<parseInt(n);s++)c+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return c}function mn(e){let i=`precision ${e.precision} float;
3692
+ precision ${e.precision} int;
3693
+ precision ${e.precision} sampler2D;
3694
+ precision ${e.precision} samplerCube;
3695
+ precision ${e.precision} sampler3D;
3696
+ precision ${e.precision} sampler2DArray;
3697
+ precision ${e.precision} sampler2DShadow;
3698
+ precision ${e.precision} samplerCubeShadow;
3699
+ precision ${e.precision} sampler2DArrayShadow;
3700
+ precision ${e.precision} isampler2D;
3701
+ precision ${e.precision} isampler3D;
3702
+ precision ${e.precision} isamplerCube;
3703
+ precision ${e.precision} isampler2DArray;
3704
+ precision ${e.precision} usampler2D;
3705
+ precision ${e.precision} usampler3D;
3706
+ precision ${e.precision} usamplerCube;
3707
+ precision ${e.precision} usampler2DArray;
3708
+ `;return e.precision==="highp"?i+=`
3709
+ #define HIGH_PRECISION`:e.precision==="mediump"?i+=`
3710
+ #define MEDIUM_PRECISION`:e.precision==="lowp"&&(i+=`
3711
+ #define LOW_PRECISION`),i}function No(e){let i="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===t.PCFShadowMap?i="SHADOWMAP_TYPE_PCF":e.shadowMapType===t.PCFSoftShadowMap?i="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===t.VSMShadowMap&&(i="SHADOWMAP_TYPE_VSM"),i}function yo(e){let i="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case t.CubeReflectionMapping:case t.CubeRefractionMapping:i="ENVMAP_TYPE_CUBE";break;case t.CubeUVReflectionMapping:i="ENVMAP_TYPE_CUBE_UV";break}return i}function Fo(e){let i="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case t.CubeRefractionMapping:i="ENVMAP_MODE_REFRACTION";break}return i}function Oo(e){let i="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case t.MultiplyOperation:i="ENVMAP_BLENDING_MULTIPLY";break;case t.MixOperation:i="ENVMAP_BLENDING_MIX";break;case t.AddOperation:i="ENVMAP_BLENDING_ADD";break}return i}function Bo(e){const i=e.envMapCubeUVHeight;if(i===null)return null;const n=Math.log2(i)-2,r=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,n),7*16)),texelHeight:r,maxMip:n}}function Go(e,i,n,r){const c=e.getContext(),s=n.defines;let m=n.vertexShader,d=n.fragmentShader;const b=No(n),T=yo(n),w=Fo(n),x=Oo(n),S=Bo(n),R=Co(n),F=bo(s),D=c.createProgram();let f,a,U=n.glslVersion?"#version "+n.glslVersion+`
3712
+ `:"";n.isRawShaderMaterial?(f=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,F].filter(xt).join(`
3713
+ `),f.length>0&&(f+=`
3714
+ `),a=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,F].filter(xt).join(`
3715
+ `),a.length>0&&(a+=`
3716
+ `)):(f=[mn(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,F,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+w:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+b:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
3717
+ `].filter(xt).join(`
3718
+ `),a=[mn(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,F,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+T:"",n.envMap?"#define "+w:"",n.envMap?"#define "+x:"",S?"#define CUBEUV_TEXEL_WIDTH "+S.texelWidth:"",S?"#define CUBEUV_TEXEL_HEIGHT "+S.texelHeight:"",S?"#define CUBEUV_MAX_MIP "+S.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+b:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==t.NoToneMapping?"#define TONE_MAPPING":"",n.toneMapping!==t.NoToneMapping?Ue.tonemapping_pars_fragment:"",n.toneMapping!==t.NoToneMapping?Ao("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ue.colorspace_pars_fragment,xo("linearToOutputTexel",n.outputColorSpace),Ro(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
3719
+ `].filter(xt).join(`
3720
+ `)),m=Ht(m),m=dn(m,n),m=pn(m,n),d=Ht(d),d=dn(d,n),d=pn(d,n),m=hn(m),d=hn(d),n.isRawShaderMaterial!==!0&&(U=`#version 300 es
3721
+ `,f=[R,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3722
+ `)+`
3723
+ `+f,a=["#define varying in",n.glslVersion===t.GLSL3?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===t.GLSL3?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
3724
+ `)+`
3725
+ `+a);const A=U+f+m,g=U+a+d,V=cn(c,c.VERTEX_SHADER,A),L=cn(c,c.FRAGMENT_SHADER,g);c.attachShader(D,V),c.attachShader(D,L),n.index0AttributeName!==void 0?c.bindAttribLocation(D,0,n.index0AttributeName):n.morphTargets===!0&&c.bindAttribLocation(D,0,"position"),c.linkProgram(D);function y(C){if(e.debug.checkShaderErrors){const K=c.getProgramInfoLog(D).trim(),k=c.getShaderInfoLog(V).trim(),Y=c.getShaderInfoLog(L).trim();let j=!0,X=!0;if(c.getProgramParameter(D,c.LINK_STATUS)===!1)if(j=!1,typeof e.debug.onShaderError=="function")e.debug.onShaderError(c,D,V,L);else{const ne=un(c,V,"vertex"),B=un(c,L,"fragment");console.error("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(D,c.VALIDATE_STATUS)+`
3726
+
3727
+ Material Name: `+C.name+`
3728
+ Material Type: `+C.type+`
3729
+
3730
+ Program Info Log: `+K+`
3731
+ `+ne+`
3732
+ `+B)}else K!==""?console.warn("THREE.WebGLProgram: Program Info Log:",K):(k===""||Y==="")&&(X=!1);X&&(C.diagnostics={runnable:j,programLog:K,vertexShader:{log:k,prefix:f},fragmentShader:{log:Y,prefix:a}})}c.deleteShader(V),c.deleteShader(L),H=new Lt(c,D),h=Po(c,D)}let H;this.getUniforms=function(){return H===void 0&&y(this),H};let h;this.getAttributes=function(){return h===void 0&&y(this),h};let u=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return u===!1&&(u=c.getProgramParameter(D,So)),u},this.destroy=function(){r.releaseStatesOfProgram(this),c.deleteProgram(D),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Eo++,this.cacheKey=i,this.usedTimes=1,this.program=D,this.vertexShader=V,this.fragmentShader=L,this}let Ho=0;class Vo{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(i){const n=i.vertexShader,r=i.fragmentShader,c=this._getShaderStage(n),s=this._getShaderStage(r),m=this._getShaderCacheForMaterial(i);return m.has(c)===!1&&(m.add(c),c.usedTimes++),m.has(s)===!1&&(m.add(s),s.usedTimes++),this}remove(i){const n=this.materialCache.get(i);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(i),this}getVertexShaderID(i){return this._getShaderStage(i.vertexShader).id}getFragmentShaderID(i){return this._getShaderStage(i.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(i){const n=this.materialCache;let r=n.get(i);return r===void 0&&(r=new Set,n.set(i,r)),r}_getShaderStage(i){const n=this.shaderCache;let r=n.get(i);return r===void 0&&(r=new ko(i),n.set(i,r)),r}}class ko{constructor(i){this.id=Ho++,this.code=i,this.usedTimes=0}}function Wo(e,i,n,r,c,s,m){const d=new t.Layers,b=new Vo,T=new Set,w=[],x=c.logarithmicDepthBuffer,S=c.vertexTextures;let R=c.precision;const F={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function D(h){return T.add(h),h===0?"uv":`uv${h}`}function f(h,u,C,K,k){const Y=K.fog,j=k.geometry,X=h.isMeshStandardMaterial?K.environment:null,ne=(h.isMeshStandardMaterial?n:i).get(h.envMap||X),B=ne&&ne.mapping===t.CubeUVReflectionMapping?ne.image.height:null,Se=F[h.type];h.precision!==null&&(R=c.getMaxPrecision(h.precision),R!==h.precision&&console.warn("THREE.WebGLProgram.getParameters:",h.precision,"not supported, using",R,"instead."));const Re=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,Ie=Re!==void 0?Re.length:0;let He=0;j.morphAttributes.position!==void 0&&(He=1),j.morphAttributes.normal!==void 0&&(He=2),j.morphAttributes.color!==void 0&&(He=3);let Qe,W,ee,ge;if(Se){const Ve=ft[Se];Qe=Ve.vertexShader,W=Ve.fragmentShader}else Qe=h.vertexShader,W=h.fragmentShader,b.update(h),ee=b.getVertexShaderID(h),ge=b.getFragmentShaderID(h);const se=e.getRenderTarget(),ve=e.state.buffers.depth.getReversed(),Oe=k.isInstancedMesh===!0,Ce=k.isBatchedMesh===!0,Ke=!!h.map,$e=!!h.matcap,Be=!!ne,_=!!h.aoMap,nt=!!h.lightMap,Ge=!!h.bumpMap,ze=!!h.normalMap,he=!!h.displacementMap,ye=!!h.emissiveMap,Me=!!h.metalnessMap,we=!!h.roughnessMap,je=h.anisotropy>0,p=h.clearcoat>0,o=h.dispersion>0,P=h.iridescence>0,G=h.sheen>0,q=h.transmission>0,O=je&&!!h.anisotropyMap,me=p&&!!h.clearcoatMap,re=p&&!!h.clearcoatNormalMap,pe=p&&!!h.clearcoatRoughnessMap,_e=P&&!!h.iridescenceMap,$=P&&!!h.iridescenceThicknessMap,le=G&&!!h.sheenColorMap,Ae=G&&!!h.sheenRoughnessMap,xe=!!h.specularMap,ie=!!h.specularColorMap,Le=!!h.specularIntensityMap,v=q&&!!h.transmissionMap,ae=q&&!!h.thicknessMap,Z=!!h.gradientMap,fe=!!h.alphaMap,Q=h.alphaTest>0,z=!!h.alphaHash,ue=!!h.extensions;let De=t.NoToneMapping;h.toneMapped&&(se===null||se.isXRRenderTarget===!0)&&(De=e.toneMapping);const Xe={shaderID:Se,shaderType:h.type,shaderName:h.name,vertexShader:Qe,fragmentShader:W,defines:h.defines,customVertexShaderID:ee,customFragmentShaderID:ge,isRawShaderMaterial:h.isRawShaderMaterial===!0,glslVersion:h.glslVersion,precision:R,batching:Ce,batchingColor:Ce&&k._colorsTexture!==null,instancing:Oe,instancingColor:Oe&&k.instanceColor!==null,instancingMorph:Oe&&k.morphTexture!==null,supportsVertexTextures:S,outputColorSpace:se===null?e.outputColorSpace:se.isXRRenderTarget===!0?se.texture.colorSpace:t.LinearSRGBColorSpace,alphaToCoverage:!!h.alphaToCoverage,map:Ke,matcap:$e,envMap:Be,envMapMode:Be&&ne.mapping,envMapCubeUVHeight:B,aoMap:_,lightMap:nt,bumpMap:Ge,normalMap:ze,displacementMap:S&&he,emissiveMap:ye,normalMapObjectSpace:ze&&h.normalMapType===t.ObjectSpaceNormalMap,normalMapTangentSpace:ze&&h.normalMapType===t.TangentSpaceNormalMap,metalnessMap:Me,roughnessMap:we,anisotropy:je,anisotropyMap:O,clearcoat:p,clearcoatMap:me,clearcoatNormalMap:re,clearcoatRoughnessMap:pe,dispersion:o,iridescence:P,iridescenceMap:_e,iridescenceThicknessMap:$,sheen:G,sheenColorMap:le,sheenRoughnessMap:Ae,specularMap:xe,specularColorMap:ie,specularIntensityMap:Le,transmission:q,transmissionMap:v,thicknessMap:ae,gradientMap:Z,opaque:h.transparent===!1&&h.blending===t.NormalBlending&&h.alphaToCoverage===!1,alphaMap:fe,alphaTest:Q,alphaHash:z,combine:h.combine,mapUv:Ke&&D(h.map.channel),aoMapUv:_&&D(h.aoMap.channel),lightMapUv:nt&&D(h.lightMap.channel),bumpMapUv:Ge&&D(h.bumpMap.channel),normalMapUv:ze&&D(h.normalMap.channel),displacementMapUv:he&&D(h.displacementMap.channel),emissiveMapUv:ye&&D(h.emissiveMap.channel),metalnessMapUv:Me&&D(h.metalnessMap.channel),roughnessMapUv:we&&D(h.roughnessMap.channel),anisotropyMapUv:O&&D(h.anisotropyMap.channel),clearcoatMapUv:me&&D(h.clearcoatMap.channel),clearcoatNormalMapUv:re&&D(h.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:pe&&D(h.clearcoatRoughnessMap.channel),iridescenceMapUv:_e&&D(h.iridescenceMap.channel),iridescenceThicknessMapUv:$&&D(h.iridescenceThicknessMap.channel),sheenColorMapUv:le&&D(h.sheenColorMap.channel),sheenRoughnessMapUv:Ae&&D(h.sheenRoughnessMap.channel),specularMapUv:xe&&D(h.specularMap.channel),specularColorMapUv:ie&&D(h.specularColorMap.channel),specularIntensityMapUv:Le&&D(h.specularIntensityMap.channel),transmissionMapUv:v&&D(h.transmissionMap.channel),thicknessMapUv:ae&&D(h.thicknessMap.channel),alphaMapUv:fe&&D(h.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(ze||je),vertexColors:h.vertexColors,vertexAlphas:h.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!j.attributes.uv&&(Ke||fe),fog:!!Y,useFog:h.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:h.flatShading===!0&&h.wireframe===!1,sizeAttenuation:h.sizeAttenuation===!0,logarithmicDepthBuffer:x,reverseDepthBuffer:ve,skinning:k.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:Ie,morphTextureStride:He,numDirLights:u.directional.length,numPointLights:u.point.length,numSpotLights:u.spot.length,numSpotLightMaps:u.spotLightMap.length,numRectAreaLights:u.rectArea.length,numHemiLights:u.hemi.length,numDirLightShadows:u.directionalShadowMap.length,numPointLightShadows:u.pointShadowMap.length,numSpotLightShadows:u.spotShadowMap.length,numSpotLightShadowsWithMaps:u.numSpotLightShadowsWithMaps,numLightProbes:u.numLightProbes,numClippingPlanes:m.numPlanes,numClipIntersection:m.numIntersection,dithering:h.dithering,shadowMapEnabled:e.shadowMap.enabled&&C.length>0,shadowMapType:e.shadowMap.type,toneMapping:De,decodeVideoTexture:Ke&&h.map.isVideoTexture===!0&&t.ColorManagement.getTransfer(h.map.colorSpace)===t.SRGBTransfer,decodeVideoTextureEmissive:ye&&h.emissiveMap.isVideoTexture===!0&&t.ColorManagement.getTransfer(h.emissiveMap.colorSpace)===t.SRGBTransfer,premultipliedAlpha:h.premultipliedAlpha,doubleSided:h.side===t.DoubleSide,flipSided:h.side===t.BackSide,useDepthPacking:h.depthPacking>=0,depthPacking:h.depthPacking||0,index0AttributeName:h.index0AttributeName,extensionClipCullDistance:ue&&h.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ue&&h.extensions.multiDraw===!0||Ce)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:h.customProgramCacheKey()};return Xe.vertexUv1s=T.has(1),Xe.vertexUv2s=T.has(2),Xe.vertexUv3s=T.has(3),T.clear(),Xe}function a(h){const u=[];if(h.shaderID?u.push(h.shaderID):(u.push(h.customVertexShaderID),u.push(h.customFragmentShaderID)),h.defines!==void 0)for(const C in h.defines)u.push(C),u.push(h.defines[C]);return h.isRawShaderMaterial===!1&&(U(u,h),A(u,h),u.push(e.outputColorSpace)),u.push(h.customProgramCacheKey),u.join()}function U(h,u){h.push(u.precision),h.push(u.outputColorSpace),h.push(u.envMapMode),h.push(u.envMapCubeUVHeight),h.push(u.mapUv),h.push(u.alphaMapUv),h.push(u.lightMapUv),h.push(u.aoMapUv),h.push(u.bumpMapUv),h.push(u.normalMapUv),h.push(u.displacementMapUv),h.push(u.emissiveMapUv),h.push(u.metalnessMapUv),h.push(u.roughnessMapUv),h.push(u.anisotropyMapUv),h.push(u.clearcoatMapUv),h.push(u.clearcoatNormalMapUv),h.push(u.clearcoatRoughnessMapUv),h.push(u.iridescenceMapUv),h.push(u.iridescenceThicknessMapUv),h.push(u.sheenColorMapUv),h.push(u.sheenRoughnessMapUv),h.push(u.specularMapUv),h.push(u.specularColorMapUv),h.push(u.specularIntensityMapUv),h.push(u.transmissionMapUv),h.push(u.thicknessMapUv),h.push(u.combine),h.push(u.fogExp2),h.push(u.sizeAttenuation),h.push(u.morphTargetsCount),h.push(u.morphAttributeCount),h.push(u.numDirLights),h.push(u.numPointLights),h.push(u.numSpotLights),h.push(u.numSpotLightMaps),h.push(u.numHemiLights),h.push(u.numRectAreaLights),h.push(u.numDirLightShadows),h.push(u.numPointLightShadows),h.push(u.numSpotLightShadows),h.push(u.numSpotLightShadowsWithMaps),h.push(u.numLightProbes),h.push(u.shadowMapType),h.push(u.toneMapping),h.push(u.numClippingPlanes),h.push(u.numClipIntersection),h.push(u.depthPacking)}function A(h,u){d.disableAll(),u.supportsVertexTextures&&d.enable(0),u.instancing&&d.enable(1),u.instancingColor&&d.enable(2),u.instancingMorph&&d.enable(3),u.matcap&&d.enable(4),u.envMap&&d.enable(5),u.normalMapObjectSpace&&d.enable(6),u.normalMapTangentSpace&&d.enable(7),u.clearcoat&&d.enable(8),u.iridescence&&d.enable(9),u.alphaTest&&d.enable(10),u.vertexColors&&d.enable(11),u.vertexAlphas&&d.enable(12),u.vertexUv1s&&d.enable(13),u.vertexUv2s&&d.enable(14),u.vertexUv3s&&d.enable(15),u.vertexTangents&&d.enable(16),u.anisotropy&&d.enable(17),u.alphaHash&&d.enable(18),u.batching&&d.enable(19),u.dispersion&&d.enable(20),u.batchingColor&&d.enable(21),u.gradientMap&&d.enable(22),h.push(d.mask),d.disableAll(),u.fog&&d.enable(0),u.useFog&&d.enable(1),u.flatShading&&d.enable(2),u.logarithmicDepthBuffer&&d.enable(3),u.reverseDepthBuffer&&d.enable(4),u.skinning&&d.enable(5),u.morphTargets&&d.enable(6),u.morphNormals&&d.enable(7),u.morphColors&&d.enable(8),u.premultipliedAlpha&&d.enable(9),u.shadowMapEnabled&&d.enable(10),u.doubleSided&&d.enable(11),u.flipSided&&d.enable(12),u.useDepthPacking&&d.enable(13),u.dithering&&d.enable(14),u.transmission&&d.enable(15),u.sheen&&d.enable(16),u.opaque&&d.enable(17),u.pointsUvs&&d.enable(18),u.decodeVideoTexture&&d.enable(19),u.decodeVideoTextureEmissive&&d.enable(20),u.alphaToCoverage&&d.enable(21),h.push(d.mask)}function g(h){const u=F[h.type];let C;if(u){const K=ft[u];C=t.UniformsUtils.clone(K.uniforms)}else C=h.uniforms;return C}function V(h,u){let C;for(let K=0,k=w.length;K<k;K++){const Y=w[K];if(Y.cacheKey===u){C=Y,++C.usedTimes;break}}return C===void 0&&(C=new Go(e,u,h,s),w.push(C)),C}function L(h){if(--h.usedTimes===0){const u=w.indexOf(h);w[u]=w[w.length-1],w.pop(),h.destroy()}}function y(h){b.remove(h)}function H(){b.dispose()}return{getParameters:f,getProgramCacheKey:a,getUniforms:g,acquireProgram:V,releaseProgram:L,releaseShaderCache:y,programs:w,dispose:H}}function zo(){let e=new WeakMap;function i(m){return e.has(m)}function n(m){let d=e.get(m);return d===void 0&&(d={},e.set(m,d)),d}function r(m){e.delete(m)}function c(m,d,b){e.get(m)[d]=b}function s(){e=new WeakMap}return{has:i,get:n,remove:r,update:c,dispose:s}}function Xo(e,i){return e.groupOrder!==i.groupOrder?e.groupOrder-i.groupOrder:e.renderOrder!==i.renderOrder?e.renderOrder-i.renderOrder:e.material.id!==i.material.id?e.material.id-i.material.id:e.z!==i.z?e.z-i.z:e.id-i.id}function _n(e,i){return e.groupOrder!==i.groupOrder?e.groupOrder-i.groupOrder:e.renderOrder!==i.renderOrder?e.renderOrder-i.renderOrder:e.z!==i.z?i.z-e.z:e.id-i.id}function gn(){const e=[];let i=0;const n=[],r=[],c=[];function s(){i=0,n.length=0,r.length=0,c.length=0}function m(x,S,R,F,D,f){let a=e[i];return a===void 0?(a={id:x.id,object:x,geometry:S,material:R,groupOrder:F,renderOrder:x.renderOrder,z:D,group:f},e[i]=a):(a.id=x.id,a.object=x,a.geometry=S,a.material=R,a.groupOrder=F,a.renderOrder=x.renderOrder,a.z=D,a.group=f),i++,a}function d(x,S,R,F,D,f){const a=m(x,S,R,F,D,f);R.transmission>0?r.push(a):R.transparent===!0?c.push(a):n.push(a)}function b(x,S,R,F,D,f){const a=m(x,S,R,F,D,f);R.transmission>0?r.unshift(a):R.transparent===!0?c.unshift(a):n.unshift(a)}function T(x,S){n.length>1&&n.sort(x||Xo),r.length>1&&r.sort(S||_n),c.length>1&&c.sort(S||_n)}function w(){for(let x=i,S=e.length;x<S;x++){const R=e[x];if(R.id===null)break;R.id=null,R.object=null,R.geometry=null,R.material=null,R.group=null}}return{opaque:n,transmissive:r,transparent:c,init:s,push:d,unshift:b,finish:w,sort:T}}function qo(){let e=new WeakMap;function i(r,c){const s=e.get(r);let m;return s===void 0?(m=new gn,e.set(r,[m])):c>=s.length?(m=new gn,s.push(m)):m=s[c],m}function n(){e=new WeakMap}return{get:i,dispose:n}}function Yo(){const e={};return{get:function(i){if(e[i.id]!==void 0)return e[i.id];let n;switch(i.type){case"DirectionalLight":n={direction:new t.Vector3,color:new t.Color};break;case"SpotLight":n={position:new t.Vector3,direction:new t.Vector3,color:new t.Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new t.Vector3,color:new t.Color,distance:0,decay:0};break;case"HemisphereLight":n={direction:new t.Vector3,skyColor:new t.Color,groundColor:new t.Color};break;case"RectAreaLight":n={color:new t.Color,position:new t.Vector3,halfWidth:new t.Vector3,halfHeight:new t.Vector3};break}return e[i.id]=n,n}}}function Ko(){const e={};return{get:function(i){if(e[i.id]!==void 0)return e[i.id];let n;switch(i.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t.Vector2};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t.Vector2};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t.Vector2,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[i.id]=n,n}}}let $o=0;function Zo(e,i){return(i.castShadow?2:0)-(e.castShadow?2:0)+(i.map?1:0)-(e.map?1:0)}function Qo(e){const i=new Yo,n=Ko(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let T=0;T<9;T++)r.probe.push(new t.Vector3);const c=new t.Vector3,s=new t.Matrix4,m=new t.Matrix4;function d(T){let w=0,x=0,S=0;for(let h=0;h<9;h++)r.probe[h].set(0,0,0);let R=0,F=0,D=0,f=0,a=0,U=0,A=0,g=0,V=0,L=0,y=0;T.sort(Zo);for(let h=0,u=T.length;h<u;h++){const C=T[h],K=C.color,k=C.intensity,Y=C.distance,j=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)w+=K.r*k,x+=K.g*k,S+=K.b*k;else if(C.isLightProbe){for(let X=0;X<9;X++)r.probe[X].addScaledVector(C.sh.coefficients[X],k);y++}else if(C.isDirectionalLight){const X=i.get(C);if(X.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){const ne=C.shadow,B=n.get(C);B.shadowIntensity=ne.intensity,B.shadowBias=ne.bias,B.shadowNormalBias=ne.normalBias,B.shadowRadius=ne.radius,B.shadowMapSize=ne.mapSize,r.directionalShadow[R]=B,r.directionalShadowMap[R]=j,r.directionalShadowMatrix[R]=C.shadow.matrix,U++}r.directional[R]=X,R++}else if(C.isSpotLight){const X=i.get(C);X.position.setFromMatrixPosition(C.matrixWorld),X.color.copy(K).multiplyScalar(k),X.distance=Y,X.coneCos=Math.cos(C.angle),X.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),X.decay=C.decay,r.spot[D]=X;const ne=C.shadow;if(C.map&&(r.spotLightMap[V]=C.map,V++,ne.updateMatrices(C),C.castShadow&&L++),r.spotLightMatrix[D]=ne.matrix,C.castShadow){const B=n.get(C);B.shadowIntensity=ne.intensity,B.shadowBias=ne.bias,B.shadowNormalBias=ne.normalBias,B.shadowRadius=ne.radius,B.shadowMapSize=ne.mapSize,r.spotShadow[D]=B,r.spotShadowMap[D]=j,g++}D++}else if(C.isRectAreaLight){const X=i.get(C);X.color.copy(K).multiplyScalar(k),X.halfWidth.set(C.width*.5,0,0),X.halfHeight.set(0,C.height*.5,0),r.rectArea[f]=X,f++}else if(C.isPointLight){const X=i.get(C);if(X.color.copy(C.color).multiplyScalar(C.intensity),X.distance=C.distance,X.decay=C.decay,C.castShadow){const ne=C.shadow,B=n.get(C);B.shadowIntensity=ne.intensity,B.shadowBias=ne.bias,B.shadowNormalBias=ne.normalBias,B.shadowRadius=ne.radius,B.shadowMapSize=ne.mapSize,B.shadowCameraNear=ne.camera.near,B.shadowCameraFar=ne.camera.far,r.pointShadow[F]=B,r.pointShadowMap[F]=j,r.pointShadowMatrix[F]=C.shadow.matrix,A++}r.point[F]=X,F++}else if(C.isHemisphereLight){const X=i.get(C);X.skyColor.copy(C.color).multiplyScalar(k),X.groundColor.copy(C.groundColor).multiplyScalar(k),r.hemi[a]=X,a++}}f>0&&(e.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=te.LTC_FLOAT_1,r.rectAreaLTC2=te.LTC_FLOAT_2):(r.rectAreaLTC1=te.LTC_HALF_1,r.rectAreaLTC2=te.LTC_HALF_2)),r.ambient[0]=w,r.ambient[1]=x,r.ambient[2]=S;const H=r.hash;(H.directionalLength!==R||H.pointLength!==F||H.spotLength!==D||H.rectAreaLength!==f||H.hemiLength!==a||H.numDirectionalShadows!==U||H.numPointShadows!==A||H.numSpotShadows!==g||H.numSpotMaps!==V||H.numLightProbes!==y)&&(r.directional.length=R,r.spot.length=D,r.rectArea.length=f,r.point.length=F,r.hemi.length=a,r.directionalShadow.length=U,r.directionalShadowMap.length=U,r.pointShadow.length=A,r.pointShadowMap.length=A,r.spotShadow.length=g,r.spotShadowMap.length=g,r.directionalShadowMatrix.length=U,r.pointShadowMatrix.length=A,r.spotLightMatrix.length=g+V-L,r.spotLightMap.length=V,r.numSpotLightShadowsWithMaps=L,r.numLightProbes=y,H.directionalLength=R,H.pointLength=F,H.spotLength=D,H.rectAreaLength=f,H.hemiLength=a,H.numDirectionalShadows=U,H.numPointShadows=A,H.numSpotShadows=g,H.numSpotMaps=V,H.numLightProbes=y,r.version=$o++)}function b(T,w){let x=0,S=0,R=0,F=0,D=0;const f=w.matrixWorldInverse;for(let a=0,U=T.length;a<U;a++){const A=T[a];if(A.isDirectionalLight){const g=r.directional[x];g.direction.setFromMatrixPosition(A.matrixWorld),c.setFromMatrixPosition(A.target.matrixWorld),g.direction.sub(c),g.direction.transformDirection(f),x++}else if(A.isSpotLight){const g=r.spot[R];g.position.setFromMatrixPosition(A.matrixWorld),g.position.applyMatrix4(f),g.direction.setFromMatrixPosition(A.matrixWorld),c.setFromMatrixPosition(A.target.matrixWorld),g.direction.sub(c),g.direction.transformDirection(f),R++}else if(A.isRectAreaLight){const g=r.rectArea[F];g.position.setFromMatrixPosition(A.matrixWorld),g.position.applyMatrix4(f),m.identity(),s.copy(A.matrixWorld),s.premultiply(f),m.extractRotation(s),g.halfWidth.set(A.width*.5,0,0),g.halfHeight.set(0,A.height*.5,0),g.halfWidth.applyMatrix4(m),g.halfHeight.applyMatrix4(m),F++}else if(A.isPointLight){const g=r.point[S];g.position.setFromMatrixPosition(A.matrixWorld),g.position.applyMatrix4(f),S++}else if(A.isHemisphereLight){const g=r.hemi[D];g.direction.setFromMatrixPosition(A.matrixWorld),g.direction.transformDirection(f),D++}}}return{setup:d,setupView:b,state:r}}function vn(e){const i=new Qo(e),n=[],r=[];function c(w){T.camera=w,n.length=0,r.length=0}function s(w){n.push(w)}function m(w){r.push(w)}function d(){i.setup(n)}function b(w){i.setupView(n,w)}const T={lightsArray:n,shadowsArray:r,camera:null,lights:i,transmissionRenderTarget:{}};return{init:c,state:T,setupLights:d,setupLightsView:b,pushLight:s,pushShadow:m}}function Jo(e){let i=new WeakMap;function n(c,s=0){const m=i.get(c);let d;return m===void 0?(d=new vn(e),i.set(c,[d])):s>=m.length?(d=new vn(e),m.push(d)):d=m[s],d}function r(){i=new WeakMap}return{get:n,dispose:r}}const jo=`void main() {
3733
+ gl_Position = vec4( position, 1.0 );
3734
+ }`,es=`uniform sampler2D shadow_pass;
3735
+ uniform vec2 resolution;
3736
+ uniform float radius;
3737
+ #include <packing>
3738
+ void main() {
3739
+ const float samples = float( VSM_SAMPLES );
3740
+ float mean = 0.0;
3741
+ float squared_mean = 0.0;
3742
+ float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3743
+ float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3744
+ for ( float i = 0.0; i < samples; i ++ ) {
3745
+ float uvOffset = uvStart + i * uvStride;
3746
+ #ifdef HORIZONTAL_PASS
3747
+ vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3748
+ mean += distribution.x;
3749
+ squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3750
+ #else
3751
+ float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3752
+ mean += depth;
3753
+ squared_mean += depth * depth;
3754
+ #endif
3755
+ }
3756
+ mean = mean / samples;
3757
+ squared_mean = squared_mean / samples;
3758
+ float std_dev = sqrt( squared_mean - mean * mean );
3759
+ gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3760
+ }`;function ts(e,i,n){let r=new t.Frustum;const c=new t.Vector2,s=new t.Vector2,m=new t.Vector4,d=new t.MeshDepthMaterial({depthPacking:t.RGBADepthPacking}),b=new t.MeshDistanceMaterial,T={},w=n.maxTextureSize,x={[t.FrontSide]:t.BackSide,[t.BackSide]:t.FrontSide,[t.DoubleSide]:t.DoubleSide},S=new t.ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new t.Vector2},radius:{value:4}},vertexShader:jo,fragmentShader:es}),R=S.clone();R.defines.HORIZONTAL_PASS=1;const F=new t.BufferGeometry;F.setAttribute("position",new t.BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const D=new t.Mesh(F,S),f=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=t.PCFShadowMap;let a=this.type;this.render=function(L,y,H){if(f.enabled===!1||f.autoUpdate===!1&&f.needsUpdate===!1||L.length===0)return;const h=e.getRenderTarget(),u=e.getActiveCubeFace(),C=e.getActiveMipmapLevel(),K=e.state;K.setBlending(t.NoBlending),K.buffers.color.setClear(1,1,1,1),K.buffers.depth.setTest(!0),K.setScissorTest(!1);const k=a!==t.VSMShadowMap&&this.type===t.VSMShadowMap,Y=a===t.VSMShadowMap&&this.type!==t.VSMShadowMap;for(let j=0,X=L.length;j<X;j++){const ne=L[j],B=ne.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",ne,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;c.copy(B.mapSize);const Se=B.getFrameExtents();if(c.multiply(Se),s.copy(B.mapSize),(c.x>w||c.y>w)&&(c.x>w&&(s.x=Math.floor(w/Se.x),c.x=s.x*Se.x,B.mapSize.x=s.x),c.y>w&&(s.y=Math.floor(w/Se.y),c.y=s.y*Se.y,B.mapSize.y=s.y)),B.map===null||k===!0||Y===!0){const Ie=this.type!==t.VSMShadowMap?{minFilter:t.NearestFilter,magFilter:t.NearestFilter}:{};B.map!==null&&B.map.dispose(),B.map=new t.WebGLRenderTarget(c.x,c.y,Ie),B.map.texture.name=ne.name+".shadowMap",B.camera.updateProjectionMatrix()}e.setRenderTarget(B.map),e.clear();const Re=B.getViewportCount();for(let Ie=0;Ie<Re;Ie++){const He=B.getViewport(Ie);m.set(s.x*He.x,s.y*He.y,s.x*He.z,s.y*He.w),K.viewport(m),B.updateMatrices(ne,Ie),r=B.getFrustum(),g(y,H,B.camera,ne,this.type)}B.isPointLightShadow!==!0&&this.type===t.VSMShadowMap&&U(B,H),B.needsUpdate=!1}a=this.type,f.needsUpdate=!1,e.setRenderTarget(h,u,C)};function U(L,y){const H=i.update(D);S.defines.VSM_SAMPLES!==L.blurSamples&&(S.defines.VSM_SAMPLES=L.blurSamples,R.defines.VSM_SAMPLES=L.blurSamples,S.needsUpdate=!0,R.needsUpdate=!0),L.mapPass===null&&(L.mapPass=new t.WebGLRenderTarget(c.x,c.y)),S.uniforms.shadow_pass.value=L.map.texture,S.uniforms.resolution.value=L.mapSize,S.uniforms.radius.value=L.radius,e.setRenderTarget(L.mapPass),e.clear(),e.renderBufferDirect(y,null,H,S,D,null),R.uniforms.shadow_pass.value=L.mapPass.texture,R.uniforms.resolution.value=L.mapSize,R.uniforms.radius.value=L.radius,e.setRenderTarget(L.map),e.clear(),e.renderBufferDirect(y,null,H,R,D,null)}function A(L,y,H,h){let u=null;const C=H.isPointLight===!0?L.customDistanceMaterial:L.customDepthMaterial;if(C!==void 0)u=C;else if(u=H.isPointLight===!0?b:d,e.localClippingEnabled&&y.clipShadows===!0&&Array.isArray(y.clippingPlanes)&&y.clippingPlanes.length!==0||y.displacementMap&&y.displacementScale!==0||y.alphaMap&&y.alphaTest>0||y.map&&y.alphaTest>0||y.alphaToCoverage===!0){const K=u.uuid,k=y.uuid;let Y=T[K];Y===void 0&&(Y={},T[K]=Y);let j=Y[k];j===void 0&&(j=u.clone(),Y[k]=j,y.addEventListener("dispose",V)),u=j}if(u.visible=y.visible,u.wireframe=y.wireframe,h===t.VSMShadowMap?u.side=y.shadowSide!==null?y.shadowSide:y.side:u.side=y.shadowSide!==null?y.shadowSide:x[y.side],u.alphaMap=y.alphaMap,u.alphaTest=y.alphaToCoverage===!0?.5:y.alphaTest,u.map=y.map,u.clipShadows=y.clipShadows,u.clippingPlanes=y.clippingPlanes,u.clipIntersection=y.clipIntersection,u.displacementMap=y.displacementMap,u.displacementScale=y.displacementScale,u.displacementBias=y.displacementBias,u.wireframeLinewidth=y.wireframeLinewidth,u.linewidth=y.linewidth,H.isPointLight===!0&&u.isMeshDistanceMaterial===!0){const K=e.properties.get(u);K.light=H}return u}function g(L,y,H,h,u){if(L.visible===!1)return;if(L.layers.test(y.layers)&&(L.isMesh||L.isLine||L.isPoints)&&(L.castShadow||L.receiveShadow&&u===t.VSMShadowMap)&&(!L.frustumCulled||r.intersectsObject(L))){L.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,L.matrixWorld);const k=i.update(L),Y=L.material;if(Array.isArray(Y)){const j=k.groups;for(let X=0,ne=j.length;X<ne;X++){const B=j[X],Se=Y[B.materialIndex];if(Se&&Se.visible){const Re=A(L,Se,h,u);L.onBeforeShadow(e,L,y,H,k,Re,B),e.renderBufferDirect(H,null,k,Re,L,B),L.onAfterShadow(e,L,y,H,k,Re,B)}}}else if(Y.visible){const j=A(L,Y,h,u);L.onBeforeShadow(e,L,y,H,k,j,null),e.renderBufferDirect(H,null,k,j,L,null),L.onAfterShadow(e,L,y,H,k,j,null)}}const K=L.children;for(let k=0,Y=K.length;k<Y;k++)g(K[k],y,H,h,u)}function V(L){L.target.removeEventListener("dispose",V);for(const H in T){const h=T[H],u=L.target.uuid;u in h&&(h[u].dispose(),delete h[u])}}}const ns={[t.NeverDepth]:t.AlwaysDepth,[t.LessDepth]:t.GreaterDepth,[t.EqualDepth]:t.NotEqualDepth,[t.LessEqualDepth]:t.GreaterEqualDepth,[t.AlwaysDepth]:t.NeverDepth,[t.GreaterDepth]:t.LessDepth,[t.NotEqualDepth]:t.EqualDepth,[t.GreaterEqualDepth]:t.LessEqualDepth};function is(e,i){function n(){let v=!1;const ae=new t.Vector4;let Z=null;const fe=new t.Vector4(0,0,0,0);return{setMask:function(Q){Z!==Q&&!v&&(e.colorMask(Q,Q,Q,Q),Z=Q)},setLocked:function(Q){v=Q},setClear:function(Q,z,ue,De,Xe){Xe===!0&&(Q*=De,z*=De,ue*=De),ae.set(Q,z,ue,De),fe.equals(ae)===!1&&(e.clearColor(Q,z,ue,De),fe.copy(ae))},reset:function(){v=!1,Z=null,fe.set(-1,0,0,0)}}}function r(){let v=!1,ae=!1,Z=null,fe=null,Q=null;return{setReversed:function(z){if(ae!==z){const ue=i.get("EXT_clip_control");z?ue.clipControlEXT(ue.LOWER_LEFT_EXT,ue.ZERO_TO_ONE_EXT):ue.clipControlEXT(ue.LOWER_LEFT_EXT,ue.NEGATIVE_ONE_TO_ONE_EXT),ae=z;const De=Q;Q=null,this.setClear(De)}},getReversed:function(){return ae},setTest:function(z){z?se(e.DEPTH_TEST):ve(e.DEPTH_TEST)},setMask:function(z){Z!==z&&!v&&(e.depthMask(z),Z=z)},setFunc:function(z){if(ae&&(z=ns[z]),fe!==z){switch(z){case t.NeverDepth:e.depthFunc(e.NEVER);break;case t.AlwaysDepth:e.depthFunc(e.ALWAYS);break;case t.LessDepth:e.depthFunc(e.LESS);break;case t.LessEqualDepth:e.depthFunc(e.LEQUAL);break;case t.EqualDepth:e.depthFunc(e.EQUAL);break;case t.GreaterEqualDepth:e.depthFunc(e.GEQUAL);break;case t.GreaterDepth:e.depthFunc(e.GREATER);break;case t.NotEqualDepth:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}fe=z}},setLocked:function(z){v=z},setClear:function(z){Q!==z&&(ae&&(z=1-z),e.clearDepth(z),Q=z)},reset:function(){v=!1,Z=null,fe=null,Q=null,ae=!1}}}function c(){let v=!1,ae=null,Z=null,fe=null,Q=null,z=null,ue=null,De=null,Xe=null;return{setTest:function(Ve){v||(Ve?se(e.STENCIL_TEST):ve(e.STENCIL_TEST))},setMask:function(Ve){ae!==Ve&&!v&&(e.stencilMask(Ve),ae=Ve)},setFunc:function(Ve,ct,ut){(Z!==Ve||fe!==ct||Q!==ut)&&(e.stencilFunc(Ve,ct,ut),Z=Ve,fe=ct,Q=ut)},setOp:function(Ve,ct,ut){(z!==Ve||ue!==ct||De!==ut)&&(e.stencilOp(Ve,ct,ut),z=Ve,ue=ct,De=ut)},setLocked:function(Ve){v=Ve},setClear:function(Ve){Xe!==Ve&&(e.clearStencil(Ve),Xe=Ve)},reset:function(){v=!1,ae=null,Z=null,fe=null,Q=null,z=null,ue=null,De=null,Xe=null}}}const s=new n,m=new r,d=new c,b=new WeakMap,T=new WeakMap;let w={},x={},S=new WeakMap,R=[],F=null,D=!1,f=null,a=null,U=null,A=null,g=null,V=null,L=null,y=new t.Color(0,0,0),H=0,h=!1,u=null,C=null,K=null,k=null,Y=null;const j=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,ne=0;const B=e.getParameter(e.VERSION);B.indexOf("WebGL")!==-1?(ne=parseFloat(/^WebGL (\d)/.exec(B)[1]),X=ne>=1):B.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),X=ne>=2);let Se=null,Re={};const Ie=e.getParameter(e.SCISSOR_BOX),He=e.getParameter(e.VIEWPORT),Qe=new t.Vector4().fromArray(Ie),W=new t.Vector4().fromArray(He);function ee(v,ae,Z,fe){const Q=new Uint8Array(4),z=e.createTexture();e.bindTexture(v,z),e.texParameteri(v,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(v,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let ue=0;ue<Z;ue++)v===e.TEXTURE_3D||v===e.TEXTURE_2D_ARRAY?e.texImage3D(ae,0,e.RGBA,1,1,fe,0,e.RGBA,e.UNSIGNED_BYTE,Q):e.texImage2D(ae+ue,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,Q);return z}const ge={};ge[e.TEXTURE_2D]=ee(e.TEXTURE_2D,e.TEXTURE_2D,1),ge[e.TEXTURE_CUBE_MAP]=ee(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),ge[e.TEXTURE_2D_ARRAY]=ee(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),ge[e.TEXTURE_3D]=ee(e.TEXTURE_3D,e.TEXTURE_3D,1,1),s.setClear(0,0,0,1),m.setClear(1),d.setClear(0),se(e.DEPTH_TEST),m.setFunc(t.LessEqualDepth),Ge(!1),ze(t.CullFaceBack),se(e.CULL_FACE),_(t.NoBlending);function se(v){w[v]!==!0&&(e.enable(v),w[v]=!0)}function ve(v){w[v]!==!1&&(e.disable(v),w[v]=!1)}function Oe(v,ae){return x[v]!==ae?(e.bindFramebuffer(v,ae),x[v]=ae,v===e.DRAW_FRAMEBUFFER&&(x[e.FRAMEBUFFER]=ae),v===e.FRAMEBUFFER&&(x[e.DRAW_FRAMEBUFFER]=ae),!0):!1}function Ce(v,ae){let Z=R,fe=!1;if(v){Z=S.get(ae),Z===void 0&&(Z=[],S.set(ae,Z));const Q=v.textures;if(Z.length!==Q.length||Z[0]!==e.COLOR_ATTACHMENT0){for(let z=0,ue=Q.length;z<ue;z++)Z[z]=e.COLOR_ATTACHMENT0+z;Z.length=Q.length,fe=!0}}else Z[0]!==e.BACK&&(Z[0]=e.BACK,fe=!0);fe&&e.drawBuffers(Z)}function Ke(v){return F!==v?(e.useProgram(v),F=v,!0):!1}const $e={[t.AddEquation]:e.FUNC_ADD,[t.SubtractEquation]:e.FUNC_SUBTRACT,[t.ReverseSubtractEquation]:e.FUNC_REVERSE_SUBTRACT};$e[t.MinEquation]=e.MIN,$e[t.MaxEquation]=e.MAX;const Be={[t.ZeroFactor]:e.ZERO,[t.OneFactor]:e.ONE,[t.SrcColorFactor]:e.SRC_COLOR,[t.SrcAlphaFactor]:e.SRC_ALPHA,[t.SrcAlphaSaturateFactor]:e.SRC_ALPHA_SATURATE,[t.DstColorFactor]:e.DST_COLOR,[t.DstAlphaFactor]:e.DST_ALPHA,[t.OneMinusSrcColorFactor]:e.ONE_MINUS_SRC_COLOR,[t.OneMinusSrcAlphaFactor]:e.ONE_MINUS_SRC_ALPHA,[t.OneMinusDstColorFactor]:e.ONE_MINUS_DST_COLOR,[t.OneMinusDstAlphaFactor]:e.ONE_MINUS_DST_ALPHA,[t.ConstantColorFactor]:e.CONSTANT_COLOR,[t.OneMinusConstantColorFactor]:e.ONE_MINUS_CONSTANT_COLOR,[t.ConstantAlphaFactor]:e.CONSTANT_ALPHA,[t.OneMinusConstantAlphaFactor]:e.ONE_MINUS_CONSTANT_ALPHA};function _(v,ae,Z,fe,Q,z,ue,De,Xe,Ve){if(v===t.NoBlending){D===!0&&(ve(e.BLEND),D=!1);return}if(D===!1&&(se(e.BLEND),D=!0),v!==t.CustomBlending){if(v!==f||Ve!==h){if((a!==t.AddEquation||g!==t.AddEquation)&&(e.blendEquation(e.FUNC_ADD),a=t.AddEquation,g=t.AddEquation),Ve)switch(v){case t.NormalBlending:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case t.AdditiveBlending:e.blendFunc(e.ONE,e.ONE);break;case t.SubtractiveBlending:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case t.MultiplyBlending:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",v);break}else switch(v){case t.NormalBlending:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case t.AdditiveBlending:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case t.SubtractiveBlending:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case t.MultiplyBlending:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",v);break}U=null,A=null,V=null,L=null,y.set(0,0,0),H=0,f=v,h=Ve}return}Q=Q||ae,z=z||Z,ue=ue||fe,(ae!==a||Q!==g)&&(e.blendEquationSeparate($e[ae],$e[Q]),a=ae,g=Q),(Z!==U||fe!==A||z!==V||ue!==L)&&(e.blendFuncSeparate(Be[Z],Be[fe],Be[z],Be[ue]),U=Z,A=fe,V=z,L=ue),(De.equals(y)===!1||Xe!==H)&&(e.blendColor(De.r,De.g,De.b,Xe),y.copy(De),H=Xe),f=v,h=!1}function nt(v,ae){v.side===t.DoubleSide?ve(e.CULL_FACE):se(e.CULL_FACE);let Z=v.side===t.BackSide;ae&&(Z=!Z),Ge(Z),v.blending===t.NormalBlending&&v.transparent===!1?_(t.NoBlending):_(v.blending,v.blendEquation,v.blendSrc,v.blendDst,v.blendEquationAlpha,v.blendSrcAlpha,v.blendDstAlpha,v.blendColor,v.blendAlpha,v.premultipliedAlpha),m.setFunc(v.depthFunc),m.setTest(v.depthTest),m.setMask(v.depthWrite),s.setMask(v.colorWrite);const fe=v.stencilWrite;d.setTest(fe),fe&&(d.setMask(v.stencilWriteMask),d.setFunc(v.stencilFunc,v.stencilRef,v.stencilFuncMask),d.setOp(v.stencilFail,v.stencilZFail,v.stencilZPass)),ye(v.polygonOffset,v.polygonOffsetFactor,v.polygonOffsetUnits),v.alphaToCoverage===!0?se(e.SAMPLE_ALPHA_TO_COVERAGE):ve(e.SAMPLE_ALPHA_TO_COVERAGE)}function Ge(v){u!==v&&(v?e.frontFace(e.CW):e.frontFace(e.CCW),u=v)}function ze(v){v!==t.CullFaceNone?(se(e.CULL_FACE),v!==C&&(v===t.CullFaceBack?e.cullFace(e.BACK):v===t.CullFaceFront?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):ve(e.CULL_FACE),C=v}function he(v){v!==K&&(X&&e.lineWidth(v),K=v)}function ye(v,ae,Z){v?(se(e.POLYGON_OFFSET_FILL),(k!==ae||Y!==Z)&&(e.polygonOffset(ae,Z),k=ae,Y=Z)):ve(e.POLYGON_OFFSET_FILL)}function Me(v){v?se(e.SCISSOR_TEST):ve(e.SCISSOR_TEST)}function we(v){v===void 0&&(v=e.TEXTURE0+j-1),Se!==v&&(e.activeTexture(v),Se=v)}function je(v,ae,Z){Z===void 0&&(Se===null?Z=e.TEXTURE0+j-1:Z=Se);let fe=Re[Z];fe===void 0&&(fe={type:void 0,texture:void 0},Re[Z]=fe),(fe.type!==v||fe.texture!==ae)&&(Se!==Z&&(e.activeTexture(Z),Se=Z),e.bindTexture(v,ae||ge[v]),fe.type=v,fe.texture=ae)}function p(){const v=Re[Se];v!==void 0&&v.type!==void 0&&(e.bindTexture(v.type,null),v.type=void 0,v.texture=void 0)}function o(){try{e.compressedTexImage2D(...arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function P(){try{e.compressedTexImage3D(...arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function G(){try{e.texSubImage2D(...arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function q(){try{e.texSubImage3D(...arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function O(){try{e.compressedTexSubImage2D(...arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function me(){try{e.compressedTexSubImage3D(...arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function re(){try{e.texStorage2D(...arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function pe(){try{e.texStorage3D(...arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function _e(){try{e.texImage2D(...arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function $(){try{e.texImage3D(...arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function le(v){Qe.equals(v)===!1&&(e.scissor(v.x,v.y,v.z,v.w),Qe.copy(v))}function Ae(v){W.equals(v)===!1&&(e.viewport(v.x,v.y,v.z,v.w),W.copy(v))}function xe(v,ae){let Z=T.get(ae);Z===void 0&&(Z=new WeakMap,T.set(ae,Z));let fe=Z.get(v);fe===void 0&&(fe=e.getUniformBlockIndex(ae,v.name),Z.set(v,fe))}function ie(v,ae){const fe=T.get(ae).get(v);b.get(ae)!==fe&&(e.uniformBlockBinding(ae,fe,v.__bindingPointIndex),b.set(ae,fe))}function Le(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),m.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),w={},Se=null,Re={},x={},S=new WeakMap,R=[],F=null,D=!1,f=null,a=null,U=null,A=null,g=null,V=null,L=null,y=new t.Color(0,0,0),H=0,h=!1,u=null,C=null,K=null,k=null,Y=null,Qe.set(0,0,e.canvas.width,e.canvas.height),W.set(0,0,e.canvas.width,e.canvas.height),s.reset(),m.reset(),d.reset()}return{buffers:{color:s,depth:m,stencil:d},enable:se,disable:ve,bindFramebuffer:Oe,drawBuffers:Ce,useProgram:Ke,setBlending:_,setMaterial:nt,setFlipSided:Ge,setCullFace:ze,setLineWidth:he,setPolygonOffset:ye,setScissorTest:Me,activeTexture:we,bindTexture:je,unbindTexture:p,compressedTexImage2D:o,compressedTexImage3D:P,texImage2D:_e,texImage3D:$,updateUBOMapping:xe,uniformBlockBinding:ie,texStorage2D:re,texStorage3D:pe,texSubImage2D:G,texSubImage3D:q,compressedTexSubImage2D:O,compressedTexSubImage3D:me,scissor:le,viewport:Ae,reset:Le}}function rs(e,i,n,r,c,s,m){const d=i.has("WEBGL_multisampled_render_to_texture")?i.get("WEBGL_multisampled_render_to_texture"):null,b=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),T=new t.Vector2,w=new WeakMap;let x;const S=new WeakMap;let R=!1;try{R=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function F(p,o){return R?new OffscreenCanvas(p,o):t.createElementNS("canvas")}function D(p,o,P){let G=1;const q=je(p);if((q.width>P||q.height>P)&&(G=P/Math.max(q.width,q.height)),G<1)if(typeof HTMLImageElement<"u"&&p instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&p instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&p instanceof ImageBitmap||typeof VideoFrame<"u"&&p instanceof VideoFrame){const O=Math.floor(G*q.width),me=Math.floor(G*q.height);x===void 0&&(x=F(O,me));const re=o?F(O,me):x;return re.width=O,re.height=me,re.getContext("2d").drawImage(p,0,0,O,me),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+q.width+"x"+q.height+") to ("+O+"x"+me+")."),re}else return"data"in p&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+q.width+"x"+q.height+")."),p;return p}function f(p){return p.generateMipmaps}function a(p){e.generateMipmap(p)}function U(p){return p.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:p.isWebGL3DRenderTarget?e.TEXTURE_3D:p.isWebGLArrayRenderTarget||p.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function A(p,o,P,G,q=!1){if(p!==null){if(e[p]!==void 0)return e[p];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+p+"'")}let O=o;if(o===e.RED&&(P===e.FLOAT&&(O=e.R32F),P===e.HALF_FLOAT&&(O=e.R16F),P===e.UNSIGNED_BYTE&&(O=e.R8)),o===e.RED_INTEGER&&(P===e.UNSIGNED_BYTE&&(O=e.R8UI),P===e.UNSIGNED_SHORT&&(O=e.R16UI),P===e.UNSIGNED_INT&&(O=e.R32UI),P===e.BYTE&&(O=e.R8I),P===e.SHORT&&(O=e.R16I),P===e.INT&&(O=e.R32I)),o===e.RG&&(P===e.FLOAT&&(O=e.RG32F),P===e.HALF_FLOAT&&(O=e.RG16F),P===e.UNSIGNED_BYTE&&(O=e.RG8)),o===e.RG_INTEGER&&(P===e.UNSIGNED_BYTE&&(O=e.RG8UI),P===e.UNSIGNED_SHORT&&(O=e.RG16UI),P===e.UNSIGNED_INT&&(O=e.RG32UI),P===e.BYTE&&(O=e.RG8I),P===e.SHORT&&(O=e.RG16I),P===e.INT&&(O=e.RG32I)),o===e.RGB_INTEGER&&(P===e.UNSIGNED_BYTE&&(O=e.RGB8UI),P===e.UNSIGNED_SHORT&&(O=e.RGB16UI),P===e.UNSIGNED_INT&&(O=e.RGB32UI),P===e.BYTE&&(O=e.RGB8I),P===e.SHORT&&(O=e.RGB16I),P===e.INT&&(O=e.RGB32I)),o===e.RGBA_INTEGER&&(P===e.UNSIGNED_BYTE&&(O=e.RGBA8UI),P===e.UNSIGNED_SHORT&&(O=e.RGBA16UI),P===e.UNSIGNED_INT&&(O=e.RGBA32UI),P===e.BYTE&&(O=e.RGBA8I),P===e.SHORT&&(O=e.RGBA16I),P===e.INT&&(O=e.RGBA32I)),o===e.RGB&&P===e.UNSIGNED_INT_5_9_9_9_REV&&(O=e.RGB9_E5),o===e.RGBA){const me=q?t.LinearTransfer:t.ColorManagement.getTransfer(G);P===e.FLOAT&&(O=e.RGBA32F),P===e.HALF_FLOAT&&(O=e.RGBA16F),P===e.UNSIGNED_BYTE&&(O=me===t.SRGBTransfer?e.SRGB8_ALPHA8:e.RGBA8),P===e.UNSIGNED_SHORT_4_4_4_4&&(O=e.RGBA4),P===e.UNSIGNED_SHORT_5_5_5_1&&(O=e.RGB5_A1)}return(O===e.R16F||O===e.R32F||O===e.RG16F||O===e.RG32F||O===e.RGBA16F||O===e.RGBA32F)&&i.get("EXT_color_buffer_float"),O}function g(p,o){let P;return p?o===null||o===t.UnsignedIntType||o===t.UnsignedInt248Type?P=e.DEPTH24_STENCIL8:o===t.FloatType?P=e.DEPTH32F_STENCIL8:o===t.UnsignedShortType&&(P=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):o===null||o===t.UnsignedIntType||o===t.UnsignedInt248Type?P=e.DEPTH_COMPONENT24:o===t.FloatType?P=e.DEPTH_COMPONENT32F:o===t.UnsignedShortType&&(P=e.DEPTH_COMPONENT16),P}function V(p,o){return f(p)===!0||p.isFramebufferTexture&&p.minFilter!==t.NearestFilter&&p.minFilter!==t.LinearFilter?Math.log2(Math.max(o.width,o.height))+1:p.mipmaps!==void 0&&p.mipmaps.length>0?p.mipmaps.length:p.isCompressedTexture&&Array.isArray(p.image)?o.mipmaps.length:1}function L(p){const o=p.target;o.removeEventListener("dispose",L),H(o),o.isVideoTexture&&w.delete(o)}function y(p){const o=p.target;o.removeEventListener("dispose",y),u(o)}function H(p){const o=r.get(p);if(o.__webglInit===void 0)return;const P=p.source,G=S.get(P);if(G){const q=G[o.__cacheKey];q.usedTimes--,q.usedTimes===0&&h(p),Object.keys(G).length===0&&S.delete(P)}r.remove(p)}function h(p){const o=r.get(p);e.deleteTexture(o.__webglTexture);const P=p.source,G=S.get(P);delete G[o.__cacheKey],m.memory.textures--}function u(p){const o=r.get(p);if(p.depthTexture&&(p.depthTexture.dispose(),r.remove(p.depthTexture)),p.isWebGLCubeRenderTarget)for(let G=0;G<6;G++){if(Array.isArray(o.__webglFramebuffer[G]))for(let q=0;q<o.__webglFramebuffer[G].length;q++)e.deleteFramebuffer(o.__webglFramebuffer[G][q]);else e.deleteFramebuffer(o.__webglFramebuffer[G]);o.__webglDepthbuffer&&e.deleteRenderbuffer(o.__webglDepthbuffer[G])}else{if(Array.isArray(o.__webglFramebuffer))for(let G=0;G<o.__webglFramebuffer.length;G++)e.deleteFramebuffer(o.__webglFramebuffer[G]);else e.deleteFramebuffer(o.__webglFramebuffer);if(o.__webglDepthbuffer&&e.deleteRenderbuffer(o.__webglDepthbuffer),o.__webglMultisampledFramebuffer&&e.deleteFramebuffer(o.__webglMultisampledFramebuffer),o.__webglColorRenderbuffer)for(let G=0;G<o.__webglColorRenderbuffer.length;G++)o.__webglColorRenderbuffer[G]&&e.deleteRenderbuffer(o.__webglColorRenderbuffer[G]);o.__webglDepthRenderbuffer&&e.deleteRenderbuffer(o.__webglDepthRenderbuffer)}const P=p.textures;for(let G=0,q=P.length;G<q;G++){const O=r.get(P[G]);O.__webglTexture&&(e.deleteTexture(O.__webglTexture),m.memory.textures--),r.remove(P[G])}r.remove(p)}let C=0;function K(){C=0}function k(){const p=C;return p>=c.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+p+" texture units while this GPU supports only "+c.maxTextures),C+=1,p}function Y(p){const o=[];return o.push(p.wrapS),o.push(p.wrapT),o.push(p.wrapR||0),o.push(p.magFilter),o.push(p.minFilter),o.push(p.anisotropy),o.push(p.internalFormat),o.push(p.format),o.push(p.type),o.push(p.generateMipmaps),o.push(p.premultiplyAlpha),o.push(p.flipY),o.push(p.unpackAlignment),o.push(p.colorSpace),o.join()}function j(p,o){const P=r.get(p);if(p.isVideoTexture&&Me(p),p.isRenderTargetTexture===!1&&p.version>0&&P.__version!==p.version){const G=p.image;if(G===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(G.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ge(P,p,o);return}}n.bindTexture(e.TEXTURE_2D,P.__webglTexture,e.TEXTURE0+o)}function X(p,o){const P=r.get(p);if(p.version>0&&P.__version!==p.version){ge(P,p,o);return}n.bindTexture(e.TEXTURE_2D_ARRAY,P.__webglTexture,e.TEXTURE0+o)}function ne(p,o){const P=r.get(p);if(p.version>0&&P.__version!==p.version){ge(P,p,o);return}n.bindTexture(e.TEXTURE_3D,P.__webglTexture,e.TEXTURE0+o)}function B(p,o){const P=r.get(p);if(p.version>0&&P.__version!==p.version){se(P,p,o);return}n.bindTexture(e.TEXTURE_CUBE_MAP,P.__webglTexture,e.TEXTURE0+o)}const Se={[t.RepeatWrapping]:e.REPEAT,[t.ClampToEdgeWrapping]:e.CLAMP_TO_EDGE,[t.MirroredRepeatWrapping]:e.MIRRORED_REPEAT},Re={[t.NearestFilter]:e.NEAREST,[t.NearestMipmapNearestFilter]:e.NEAREST_MIPMAP_NEAREST,[t.NearestMipmapLinearFilter]:e.NEAREST_MIPMAP_LINEAR,[t.LinearFilter]:e.LINEAR,[t.LinearMipmapNearestFilter]:e.LINEAR_MIPMAP_NEAREST,[t.LinearMipmapLinearFilter]:e.LINEAR_MIPMAP_LINEAR},Ie={[t.NeverCompare]:e.NEVER,[t.AlwaysCompare]:e.ALWAYS,[t.LessCompare]:e.LESS,[t.LessEqualCompare]:e.LEQUAL,[t.EqualCompare]:e.EQUAL,[t.GreaterEqualCompare]:e.GEQUAL,[t.GreaterCompare]:e.GREATER,[t.NotEqualCompare]:e.NOTEQUAL};function He(p,o){if(o.type===t.FloatType&&i.has("OES_texture_float_linear")===!1&&(o.magFilter===t.LinearFilter||o.magFilter===t.LinearMipmapNearestFilter||o.magFilter===t.NearestMipmapLinearFilter||o.magFilter===t.LinearMipmapLinearFilter||o.minFilter===t.LinearFilter||o.minFilter===t.LinearMipmapNearestFilter||o.minFilter===t.NearestMipmapLinearFilter||o.minFilter===t.LinearMipmapLinearFilter)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(p,e.TEXTURE_WRAP_S,Se[o.wrapS]),e.texParameteri(p,e.TEXTURE_WRAP_T,Se[o.wrapT]),(p===e.TEXTURE_3D||p===e.TEXTURE_2D_ARRAY)&&e.texParameteri(p,e.TEXTURE_WRAP_R,Se[o.wrapR]),e.texParameteri(p,e.TEXTURE_MAG_FILTER,Re[o.magFilter]),e.texParameteri(p,e.TEXTURE_MIN_FILTER,Re[o.minFilter]),o.compareFunction&&(e.texParameteri(p,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(p,e.TEXTURE_COMPARE_FUNC,Ie[o.compareFunction])),i.has("EXT_texture_filter_anisotropic")===!0){if(o.magFilter===t.NearestFilter||o.minFilter!==t.NearestMipmapLinearFilter&&o.minFilter!==t.LinearMipmapLinearFilter||o.type===t.FloatType&&i.has("OES_texture_float_linear")===!1)return;if(o.anisotropy>1||r.get(o).__currentAnisotropy){const P=i.get("EXT_texture_filter_anisotropic");e.texParameterf(p,P.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,c.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy}}}function Qe(p,o){let P=!1;p.__webglInit===void 0&&(p.__webglInit=!0,o.addEventListener("dispose",L));const G=o.source;let q=S.get(G);q===void 0&&(q={},S.set(G,q));const O=Y(o);if(O!==p.__cacheKey){q[O]===void 0&&(q[O]={texture:e.createTexture(),usedTimes:0},m.memory.textures++,P=!0),q[O].usedTimes++;const me=q[p.__cacheKey];me!==void 0&&(q[p.__cacheKey].usedTimes--,me.usedTimes===0&&h(o)),p.__cacheKey=O,p.__webglTexture=q[O].texture}return P}function W(p,o,P){return Math.floor(Math.floor(p/P)/o)}function ee(p,o,P,G){const O=p.updateRanges;if(O.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,o.width,o.height,P,G,o.data);else{O.sort(($,le)=>$.start-le.start);let me=0;for(let $=1;$<O.length;$++){const le=O[me],Ae=O[$],xe=le.start+le.count,ie=W(Ae.start,o.width,4),Le=W(le.start,o.width,4);Ae.start<=xe+1&&ie===Le&&W(Ae.start+Ae.count-1,o.width,4)===ie?le.count=Math.max(le.count,Ae.start+Ae.count-le.start):(++me,O[me]=Ae)}O.length=me+1;const re=e.getParameter(e.UNPACK_ROW_LENGTH),pe=e.getParameter(e.UNPACK_SKIP_PIXELS),_e=e.getParameter(e.UNPACK_SKIP_ROWS);e.pixelStorei(e.UNPACK_ROW_LENGTH,o.width);for(let $=0,le=O.length;$<le;$++){const Ae=O[$],xe=Math.floor(Ae.start/4),ie=Math.ceil(Ae.count/4),Le=xe%o.width,v=Math.floor(xe/o.width),ae=ie,Z=1;e.pixelStorei(e.UNPACK_SKIP_PIXELS,Le),e.pixelStorei(e.UNPACK_SKIP_ROWS,v),n.texSubImage2D(e.TEXTURE_2D,0,Le,v,ae,Z,P,G,o.data)}p.clearUpdateRanges(),e.pixelStorei(e.UNPACK_ROW_LENGTH,re),e.pixelStorei(e.UNPACK_SKIP_PIXELS,pe),e.pixelStorei(e.UNPACK_SKIP_ROWS,_e)}}function ge(p,o,P){let G=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(G=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(G=e.TEXTURE_3D);const q=Qe(p,o),O=o.source;n.bindTexture(G,p.__webglTexture,e.TEXTURE0+P);const me=r.get(O);if(O.version!==me.__version||q===!0){n.activeTexture(e.TEXTURE0+P);const re=t.ColorManagement.getPrimaries(t.ColorManagement.workingColorSpace),pe=o.colorSpace===t.NoColorSpace?null:t.ColorManagement.getPrimaries(o.colorSpace),_e=o.colorSpace===t.NoColorSpace||re===pe?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,_e);let $=D(o.image,!1,c.maxTextureSize);$=we(o,$);const le=s.convert(o.format,o.colorSpace),Ae=s.convert(o.type);let xe=A(o.internalFormat,le,Ae,o.colorSpace,o.isVideoTexture);He(G,o);let ie;const Le=o.mipmaps,v=o.isVideoTexture!==!0,ae=me.__version===void 0||q===!0,Z=O.dataReady,fe=V(o,$);if(o.isDepthTexture)xe=g(o.format===t.DepthStencilFormat,o.type),ae&&(v?n.texStorage2D(e.TEXTURE_2D,1,xe,$.width,$.height):n.texImage2D(e.TEXTURE_2D,0,xe,$.width,$.height,0,le,Ae,null));else if(o.isDataTexture)if(Le.length>0){v&&ae&&n.texStorage2D(e.TEXTURE_2D,fe,xe,Le[0].width,Le[0].height);for(let Q=0,z=Le.length;Q<z;Q++)ie=Le[Q],v?Z&&n.texSubImage2D(e.TEXTURE_2D,Q,0,0,ie.width,ie.height,le,Ae,ie.data):n.texImage2D(e.TEXTURE_2D,Q,xe,ie.width,ie.height,0,le,Ae,ie.data);o.generateMipmaps=!1}else v?(ae&&n.texStorage2D(e.TEXTURE_2D,fe,xe,$.width,$.height),Z&&ee(o,$,le,Ae)):n.texImage2D(e.TEXTURE_2D,0,xe,$.width,$.height,0,le,Ae,$.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){v&&ae&&n.texStorage3D(e.TEXTURE_2D_ARRAY,fe,xe,Le[0].width,Le[0].height,$.depth);for(let Q=0,z=Le.length;Q<z;Q++)if(ie=Le[Q],o.format!==t.RGBAFormat)if(le!==null)if(v){if(Z)if(o.layerUpdates.size>0){const ue=t.getByteLength(ie.width,ie.height,o.format,o.type);for(const De of o.layerUpdates){const Xe=ie.data.subarray(De*ue/ie.data.BYTES_PER_ELEMENT,(De+1)*ue/ie.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,Q,0,0,De,ie.width,ie.height,1,le,Xe)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,Q,0,0,0,ie.width,ie.height,$.depth,le,ie.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,Q,xe,ie.width,ie.height,$.depth,0,ie.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else v?Z&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,Q,0,0,0,ie.width,ie.height,$.depth,le,Ae,ie.data):n.texImage3D(e.TEXTURE_2D_ARRAY,Q,xe,ie.width,ie.height,$.depth,0,le,Ae,ie.data)}else{v&&ae&&n.texStorage2D(e.TEXTURE_2D,fe,xe,Le[0].width,Le[0].height);for(let Q=0,z=Le.length;Q<z;Q++)ie=Le[Q],o.format!==t.RGBAFormat?le!==null?v?Z&&n.compressedTexSubImage2D(e.TEXTURE_2D,Q,0,0,ie.width,ie.height,le,ie.data):n.compressedTexImage2D(e.TEXTURE_2D,Q,xe,ie.width,ie.height,0,ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):v?Z&&n.texSubImage2D(e.TEXTURE_2D,Q,0,0,ie.width,ie.height,le,Ae,ie.data):n.texImage2D(e.TEXTURE_2D,Q,xe,ie.width,ie.height,0,le,Ae,ie.data)}else if(o.isDataArrayTexture)if(v){if(ae&&n.texStorage3D(e.TEXTURE_2D_ARRAY,fe,xe,$.width,$.height,$.depth),Z)if(o.layerUpdates.size>0){const Q=t.getByteLength($.width,$.height,o.format,o.type);for(const z of o.layerUpdates){const ue=$.data.subarray(z*Q/$.data.BYTES_PER_ELEMENT,(z+1)*Q/$.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,z,$.width,$.height,1,le,Ae,ue)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,$.width,$.height,$.depth,le,Ae,$.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,xe,$.width,$.height,$.depth,0,le,Ae,$.data);else if(o.isData3DTexture)v?(ae&&n.texStorage3D(e.TEXTURE_3D,fe,xe,$.width,$.height,$.depth),Z&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,$.width,$.height,$.depth,le,Ae,$.data)):n.texImage3D(e.TEXTURE_3D,0,xe,$.width,$.height,$.depth,0,le,Ae,$.data);else if(o.isFramebufferTexture){if(ae)if(v)n.texStorage2D(e.TEXTURE_2D,fe,xe,$.width,$.height);else{let Q=$.width,z=$.height;for(let ue=0;ue<fe;ue++)n.texImage2D(e.TEXTURE_2D,ue,xe,Q,z,0,le,Ae,null),Q>>=1,z>>=1}}else if(Le.length>0){if(v&&ae){const Q=je(Le[0]);n.texStorage2D(e.TEXTURE_2D,fe,xe,Q.width,Q.height)}for(let Q=0,z=Le.length;Q<z;Q++)ie=Le[Q],v?Z&&n.texSubImage2D(e.TEXTURE_2D,Q,0,0,le,Ae,ie):n.texImage2D(e.TEXTURE_2D,Q,xe,le,Ae,ie);o.generateMipmaps=!1}else if(v){if(ae){const Q=je($);n.texStorage2D(e.TEXTURE_2D,fe,xe,Q.width,Q.height)}Z&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,le,Ae,$)}else n.texImage2D(e.TEXTURE_2D,0,xe,le,Ae,$);f(o)&&a(G),me.__version=O.version,o.onUpdate&&o.onUpdate(o)}p.__version=o.version}function se(p,o,P){if(o.image.length!==6)return;const G=Qe(p,o),q=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,p.__webglTexture,e.TEXTURE0+P);const O=r.get(q);if(q.version!==O.__version||G===!0){n.activeTexture(e.TEXTURE0+P);const me=t.ColorManagement.getPrimaries(t.ColorManagement.workingColorSpace),re=o.colorSpace===t.NoColorSpace?null:t.ColorManagement.getPrimaries(o.colorSpace),pe=o.colorSpace===t.NoColorSpace||me===re?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,pe);const _e=o.isCompressedTexture||o.image[0].isCompressedTexture,$=o.image[0]&&o.image[0].isDataTexture,le=[];for(let z=0;z<6;z++)!_e&&!$?le[z]=D(o.image[z],!0,c.maxCubemapSize):le[z]=$?o.image[z].image:o.image[z],le[z]=we(o,le[z]);const Ae=le[0],xe=s.convert(o.format,o.colorSpace),ie=s.convert(o.type),Le=A(o.internalFormat,xe,ie,o.colorSpace),v=o.isVideoTexture!==!0,ae=O.__version===void 0||G===!0,Z=q.dataReady;let fe=V(o,Ae);He(e.TEXTURE_CUBE_MAP,o);let Q;if(_e){v&&ae&&n.texStorage2D(e.TEXTURE_CUBE_MAP,fe,Le,Ae.width,Ae.height);for(let z=0;z<6;z++){Q=le[z].mipmaps;for(let ue=0;ue<Q.length;ue++){const De=Q[ue];o.format!==t.RGBAFormat?xe!==null?v?Z&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,ue,0,0,De.width,De.height,xe,De.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,ue,Le,De.width,De.height,0,De.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):v?Z&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,ue,0,0,De.width,De.height,xe,ie,De.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,ue,Le,De.width,De.height,0,xe,ie,De.data)}}}else{if(Q=o.mipmaps,v&&ae){Q.length>0&&fe++;const z=je(le[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,fe,Le,z.width,z.height)}for(let z=0;z<6;z++)if($){v?Z&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,0,0,0,le[z].width,le[z].height,xe,ie,le[z].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,0,Le,le[z].width,le[z].height,0,xe,ie,le[z].data);for(let ue=0;ue<Q.length;ue++){const Xe=Q[ue].image[z].image;v?Z&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,ue+1,0,0,Xe.width,Xe.height,xe,ie,Xe.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,ue+1,Le,Xe.width,Xe.height,0,xe,ie,Xe.data)}}else{v?Z&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,0,0,0,xe,ie,le[z]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,0,Le,xe,ie,le[z]);for(let ue=0;ue<Q.length;ue++){const De=Q[ue];v?Z&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,ue+1,0,0,xe,ie,De.image[z]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+z,ue+1,Le,xe,ie,De.image[z])}}}f(o)&&a(e.TEXTURE_CUBE_MAP),O.__version=q.version,o.onUpdate&&o.onUpdate(o)}p.__version=o.version}function ve(p,o,P,G,q,O){const me=s.convert(P.format,P.colorSpace),re=s.convert(P.type),pe=A(P.internalFormat,me,re,P.colorSpace),_e=r.get(o),$=r.get(P);if($.__renderTarget=o,!_e.__hasExternalTextures){const le=Math.max(1,o.width>>O),Ae=Math.max(1,o.height>>O);q===e.TEXTURE_3D||q===e.TEXTURE_2D_ARRAY?n.texImage3D(q,O,pe,le,Ae,o.depth,0,me,re,null):n.texImage2D(q,O,pe,le,Ae,0,me,re,null)}n.bindFramebuffer(e.FRAMEBUFFER,p),ye(o)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,G,q,$.__webglTexture,0,he(o)):(q===e.TEXTURE_2D||q>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&q<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,G,q,$.__webglTexture,O),n.bindFramebuffer(e.FRAMEBUFFER,null)}function Oe(p,o,P){if(e.bindRenderbuffer(e.RENDERBUFFER,p),o.depthBuffer){const G=o.depthTexture,q=G&&G.isDepthTexture?G.type:null,O=g(o.stencilBuffer,q),me=o.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,re=he(o);ye(o)?d.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,re,O,o.width,o.height):P?e.renderbufferStorageMultisample(e.RENDERBUFFER,re,O,o.width,o.height):e.renderbufferStorage(e.RENDERBUFFER,O,o.width,o.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,me,e.RENDERBUFFER,p)}else{const G=o.textures;for(let q=0;q<G.length;q++){const O=G[q],me=s.convert(O.format,O.colorSpace),re=s.convert(O.type),pe=A(O.internalFormat,me,re,O.colorSpace),_e=he(o);P&&ye(o)===!1?e.renderbufferStorageMultisample(e.RENDERBUFFER,_e,pe,o.width,o.height):ye(o)?d.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,_e,pe,o.width,o.height):e.renderbufferStorage(e.RENDERBUFFER,pe,o.width,o.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function Ce(p,o){if(o&&o.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,p),!(o.depthTexture&&o.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const G=r.get(o.depthTexture);G.__renderTarget=o,(!G.__webglTexture||o.depthTexture.image.width!==o.width||o.depthTexture.image.height!==o.height)&&(o.depthTexture.image.width=o.width,o.depthTexture.image.height=o.height,o.depthTexture.needsUpdate=!0),j(o.depthTexture,0);const q=G.__webglTexture,O=he(o);if(o.depthTexture.format===t.DepthFormat)ye(o)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,q,0,O):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,q,0);else if(o.depthTexture.format===t.DepthStencilFormat)ye(o)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,q,0,O):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,q,0);else throw new Error("Unknown depthTexture format")}function Ke(p){const o=r.get(p),P=p.isWebGLCubeRenderTarget===!0;if(o.__boundDepthTexture!==p.depthTexture){const G=p.depthTexture;if(o.__depthDisposeCallback&&o.__depthDisposeCallback(),G){const q=()=>{delete o.__boundDepthTexture,delete o.__depthDisposeCallback,G.removeEventListener("dispose",q)};G.addEventListener("dispose",q),o.__depthDisposeCallback=q}o.__boundDepthTexture=G}if(p.depthTexture&&!o.__autoAllocateDepthBuffer){if(P)throw new Error("target.depthTexture not supported in Cube render targets");const G=p.texture.mipmaps;G&&G.length>0?Ce(o.__webglFramebuffer[0],p):Ce(o.__webglFramebuffer,p)}else if(P){o.__webglDepthbuffer=[];for(let G=0;G<6;G++)if(n.bindFramebuffer(e.FRAMEBUFFER,o.__webglFramebuffer[G]),o.__webglDepthbuffer[G]===void 0)o.__webglDepthbuffer[G]=e.createRenderbuffer(),Oe(o.__webglDepthbuffer[G],p,!1);else{const q=p.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,O=o.__webglDepthbuffer[G];e.bindRenderbuffer(e.RENDERBUFFER,O),e.framebufferRenderbuffer(e.FRAMEBUFFER,q,e.RENDERBUFFER,O)}}else{const G=p.texture.mipmaps;if(G&&G.length>0?n.bindFramebuffer(e.FRAMEBUFFER,o.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,o.__webglFramebuffer),o.__webglDepthbuffer===void 0)o.__webglDepthbuffer=e.createRenderbuffer(),Oe(o.__webglDepthbuffer,p,!1);else{const q=p.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,O=o.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,O),e.framebufferRenderbuffer(e.FRAMEBUFFER,q,e.RENDERBUFFER,O)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function $e(p,o,P){const G=r.get(p);o!==void 0&&ve(G.__webglFramebuffer,p,p.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),P!==void 0&&Ke(p)}function Be(p){const o=p.texture,P=r.get(p),G=r.get(o);p.addEventListener("dispose",y);const q=p.textures,O=p.isWebGLCubeRenderTarget===!0,me=q.length>1;if(me||(G.__webglTexture===void 0&&(G.__webglTexture=e.createTexture()),G.__version=o.version,m.memory.textures++),O){P.__webglFramebuffer=[];for(let re=0;re<6;re++)if(o.mipmaps&&o.mipmaps.length>0){P.__webglFramebuffer[re]=[];for(let pe=0;pe<o.mipmaps.length;pe++)P.__webglFramebuffer[re][pe]=e.createFramebuffer()}else P.__webglFramebuffer[re]=e.createFramebuffer()}else{if(o.mipmaps&&o.mipmaps.length>0){P.__webglFramebuffer=[];for(let re=0;re<o.mipmaps.length;re++)P.__webglFramebuffer[re]=e.createFramebuffer()}else P.__webglFramebuffer=e.createFramebuffer();if(me)for(let re=0,pe=q.length;re<pe;re++){const _e=r.get(q[re]);_e.__webglTexture===void 0&&(_e.__webglTexture=e.createTexture(),m.memory.textures++)}if(p.samples>0&&ye(p)===!1){P.__webglMultisampledFramebuffer=e.createFramebuffer(),P.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,P.__webglMultisampledFramebuffer);for(let re=0;re<q.length;re++){const pe=q[re];P.__webglColorRenderbuffer[re]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,P.__webglColorRenderbuffer[re]);const _e=s.convert(pe.format,pe.colorSpace),$=s.convert(pe.type),le=A(pe.internalFormat,_e,$,pe.colorSpace,p.isXRRenderTarget===!0),Ae=he(p);e.renderbufferStorageMultisample(e.RENDERBUFFER,Ae,le,p.width,p.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+re,e.RENDERBUFFER,P.__webglColorRenderbuffer[re])}e.bindRenderbuffer(e.RENDERBUFFER,null),p.depthBuffer&&(P.__webglDepthRenderbuffer=e.createRenderbuffer(),Oe(P.__webglDepthRenderbuffer,p,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(O){n.bindTexture(e.TEXTURE_CUBE_MAP,G.__webglTexture),He(e.TEXTURE_CUBE_MAP,o);for(let re=0;re<6;re++)if(o.mipmaps&&o.mipmaps.length>0)for(let pe=0;pe<o.mipmaps.length;pe++)ve(P.__webglFramebuffer[re][pe],p,o,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+re,pe);else ve(P.__webglFramebuffer[re],p,o,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+re,0);f(o)&&a(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(me){for(let re=0,pe=q.length;re<pe;re++){const _e=q[re],$=r.get(_e);n.bindTexture(e.TEXTURE_2D,$.__webglTexture),He(e.TEXTURE_2D,_e),ve(P.__webglFramebuffer,p,_e,e.COLOR_ATTACHMENT0+re,e.TEXTURE_2D,0),f(_e)&&a(e.TEXTURE_2D)}n.unbindTexture()}else{let re=e.TEXTURE_2D;if((p.isWebGL3DRenderTarget||p.isWebGLArrayRenderTarget)&&(re=p.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(re,G.__webglTexture),He(re,o),o.mipmaps&&o.mipmaps.length>0)for(let pe=0;pe<o.mipmaps.length;pe++)ve(P.__webglFramebuffer[pe],p,o,e.COLOR_ATTACHMENT0,re,pe);else ve(P.__webglFramebuffer,p,o,e.COLOR_ATTACHMENT0,re,0);f(o)&&a(re),n.unbindTexture()}p.depthBuffer&&Ke(p)}function _(p){const o=p.textures;for(let P=0,G=o.length;P<G;P++){const q=o[P];if(f(q)){const O=U(p),me=r.get(q).__webglTexture;n.bindTexture(O,me),a(O),n.unbindTexture()}}}const nt=[],Ge=[];function ze(p){if(p.samples>0){if(ye(p)===!1){const o=p.textures,P=p.width,G=p.height;let q=e.COLOR_BUFFER_BIT;const O=p.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,me=r.get(p),re=o.length>1;if(re)for(let _e=0;_e<o.length;_e++)n.bindFramebuffer(e.FRAMEBUFFER,me.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+_e,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,me.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+_e,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,me.__webglMultisampledFramebuffer);const pe=p.texture.mipmaps;pe&&pe.length>0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,me.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,me.__webglFramebuffer);for(let _e=0;_e<o.length;_e++){if(p.resolveDepthBuffer&&(p.depthBuffer&&(q|=e.DEPTH_BUFFER_BIT),p.stencilBuffer&&p.resolveStencilBuffer&&(q|=e.STENCIL_BUFFER_BIT)),re){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,me.__webglColorRenderbuffer[_e]);const $=r.get(o[_e]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,$,0)}e.blitFramebuffer(0,0,P,G,0,0,P,G,q,e.NEAREST),b===!0&&(nt.length=0,Ge.length=0,nt.push(e.COLOR_ATTACHMENT0+_e),p.depthBuffer&&p.resolveDepthBuffer===!1&&(nt.push(O),Ge.push(O),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,Ge)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,nt))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),re)for(let _e=0;_e<o.length;_e++){n.bindFramebuffer(e.FRAMEBUFFER,me.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+_e,e.RENDERBUFFER,me.__webglColorRenderbuffer[_e]);const $=r.get(o[_e]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,me.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+_e,e.TEXTURE_2D,$,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,me.__webglMultisampledFramebuffer)}else if(p.depthBuffer&&p.resolveDepthBuffer===!1&&b){const o=p.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[o])}}}function he(p){return Math.min(c.maxSamples,p.samples)}function ye(p){const o=r.get(p);return p.samples>0&&i.has("WEBGL_multisampled_render_to_texture")===!0&&o.__useRenderToTexture!==!1}function Me(p){const o=m.render.frame;w.get(p)!==o&&(w.set(p,o),p.update())}function we(p,o){const P=p.colorSpace,G=p.format,q=p.type;return p.isCompressedTexture===!0||p.isVideoTexture===!0||P!==t.LinearSRGBColorSpace&&P!==t.NoColorSpace&&(t.ColorManagement.getTransfer(P)===t.SRGBTransfer?(G!==t.RGBAFormat||q!==t.UnsignedByteType)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",P)),o}function je(p){return typeof HTMLImageElement<"u"&&p instanceof HTMLImageElement?(T.width=p.naturalWidth||p.width,T.height=p.naturalHeight||p.height):typeof VideoFrame<"u"&&p instanceof VideoFrame?(T.width=p.displayWidth,T.height=p.displayHeight):(T.width=p.width,T.height=p.height),T}this.allocateTextureUnit=k,this.resetTextureUnits=K,this.setTexture2D=j,this.setTexture2DArray=X,this.setTexture3D=ne,this.setTextureCube=B,this.rebindTextures=$e,this.setupRenderTarget=Be,this.updateRenderTargetMipmap=_,this.updateMultisampleRenderTarget=ze,this.setupDepthRenderbuffer=Ke,this.setupFrameBufferTexture=ve,this.useMultisampledRTT=ye}function An(e,i){function n(r,c=t.NoColorSpace){let s;const m=t.ColorManagement.getTransfer(c);if(r===t.UnsignedByteType)return e.UNSIGNED_BYTE;if(r===t.UnsignedShort4444Type)return e.UNSIGNED_SHORT_4_4_4_4;if(r===t.UnsignedShort5551Type)return e.UNSIGNED_SHORT_5_5_5_1;if(r===t.UnsignedInt5999Type)return e.UNSIGNED_INT_5_9_9_9_REV;if(r===t.ByteType)return e.BYTE;if(r===t.ShortType)return e.SHORT;if(r===t.UnsignedShortType)return e.UNSIGNED_SHORT;if(r===t.IntType)return e.INT;if(r===t.UnsignedIntType)return e.UNSIGNED_INT;if(r===t.FloatType)return e.FLOAT;if(r===t.HalfFloatType)return e.HALF_FLOAT;if(r===t.AlphaFormat)return e.ALPHA;if(r===t.RGBFormat)return e.RGB;if(r===t.RGBAFormat)return e.RGBA;if(r===t.DepthFormat)return e.DEPTH_COMPONENT;if(r===t.DepthStencilFormat)return e.DEPTH_STENCIL;if(r===t.RedFormat)return e.RED;if(r===t.RedIntegerFormat)return e.RED_INTEGER;if(r===t.RGFormat)return e.RG;if(r===t.RGIntegerFormat)return e.RG_INTEGER;if(r===t.RGBAIntegerFormat)return e.RGBA_INTEGER;if(r===t.RGB_S3TC_DXT1_Format||r===t.RGBA_S3TC_DXT1_Format||r===t.RGBA_S3TC_DXT3_Format||r===t.RGBA_S3TC_DXT5_Format)if(m===t.SRGBTransfer)if(s=i.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===t.RGB_S3TC_DXT1_Format)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===t.RGBA_S3TC_DXT1_Format)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===t.RGBA_S3TC_DXT3_Format)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===t.RGBA_S3TC_DXT5_Format)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=i.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===t.RGB_S3TC_DXT1_Format)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===t.RGBA_S3TC_DXT1_Format)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===t.RGBA_S3TC_DXT3_Format)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===t.RGBA_S3TC_DXT5_Format)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===t.RGB_PVRTC_4BPPV1_Format||r===t.RGB_PVRTC_2BPPV1_Format||r===t.RGBA_PVRTC_4BPPV1_Format||r===t.RGBA_PVRTC_2BPPV1_Format)if(s=i.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===t.RGB_PVRTC_4BPPV1_Format)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===t.RGB_PVRTC_2BPPV1_Format)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===t.RGBA_PVRTC_4BPPV1_Format)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===t.RGBA_PVRTC_2BPPV1_Format)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===t.RGB_ETC1_Format||r===t.RGB_ETC2_Format||r===t.RGBA_ETC2_EAC_Format)if(s=i.get("WEBGL_compressed_texture_etc"),s!==null){if(r===t.RGB_ETC1_Format||r===t.RGB_ETC2_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===t.RGBA_ETC2_EAC_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===t.RGBA_ASTC_4x4_Format||r===t.RGBA_ASTC_5x4_Format||r===t.RGBA_ASTC_5x5_Format||r===t.RGBA_ASTC_6x5_Format||r===t.RGBA_ASTC_6x6_Format||r===t.RGBA_ASTC_8x5_Format||r===t.RGBA_ASTC_8x6_Format||r===t.RGBA_ASTC_8x8_Format||r===t.RGBA_ASTC_10x5_Format||r===t.RGBA_ASTC_10x6_Format||r===t.RGBA_ASTC_10x8_Format||r===t.RGBA_ASTC_10x10_Format||r===t.RGBA_ASTC_12x10_Format||r===t.RGBA_ASTC_12x12_Format)if(s=i.get("WEBGL_compressed_texture_astc"),s!==null){if(r===t.RGBA_ASTC_4x4_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===t.RGBA_ASTC_5x4_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===t.RGBA_ASTC_5x5_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===t.RGBA_ASTC_6x5_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===t.RGBA_ASTC_6x6_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===t.RGBA_ASTC_8x5_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===t.RGBA_ASTC_8x6_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===t.RGBA_ASTC_8x8_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===t.RGBA_ASTC_10x5_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===t.RGBA_ASTC_10x6_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===t.RGBA_ASTC_10x8_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===t.RGBA_ASTC_10x10_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===t.RGBA_ASTC_12x10_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===t.RGBA_ASTC_12x12_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===t.RGBA_BPTC_Format||r===t.RGB_BPTC_SIGNED_Format||r===t.RGB_BPTC_UNSIGNED_Format)if(s=i.get("EXT_texture_compression_bptc"),s!==null){if(r===t.RGBA_BPTC_Format)return m===t.SRGBTransfer?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===t.RGB_BPTC_SIGNED_Format)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===t.RGB_BPTC_UNSIGNED_Format)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===t.RED_RGTC1_Format||r===t.SIGNED_RED_RGTC1_Format||r===t.RED_GREEN_RGTC2_Format||r===t.SIGNED_RED_GREEN_RGTC2_Format)if(s=i.get("EXT_texture_compression_rgtc"),s!==null){if(r===t.RGBA_BPTC_Format)return s.COMPRESSED_RED_RGTC1_EXT;if(r===t.SIGNED_RED_RGTC1_Format)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===t.RED_GREEN_RGTC2_Format)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===t.SIGNED_RED_GREEN_RGTC2_Format)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===t.UnsignedInt248Type?e.UNSIGNED_INT_24_8:e[r]!==void 0?e[r]:null}return{convert:n}}const as=`
3761
+ void main() {
3762
+
3763
+ gl_Position = vec4( position, 1.0 );
3764
+
3765
+ }`,os=`
3766
+ uniform sampler2DArray depthColor;
3767
+ uniform float depthWidth;
3768
+ uniform float depthHeight;
3769
+
3770
+ void main() {
3771
+
3772
+ vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
3773
+
3774
+ if ( coord.x >= 1.0 ) {
3775
+
3776
+ gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
3777
+
3778
+ } else {
3779
+
3780
+ gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
3781
+
3782
+ }
3783
+
3784
+ }`;class ss{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(i,n,r){if(this.texture===null){const c=new t.Texture,s=i.properties.get(c);s.__webglTexture=n.texture,(n.depthNear!==r.depthNear||n.depthFar!==r.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=c}}getMesh(i){if(this.texture!==null&&this.mesh===null){const n=i.cameras[0].viewport,r=new t.ShaderMaterial({vertexShader:as,fragmentShader:os,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new t.Mesh(new t.PlaneGeometry(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ls extends t.EventDispatcher{constructor(i,n){super();const r=this;let c=null,s=1,m=null,d="local-floor",b=1,T=null,w=null,x=null,S=null,R=null,F=null;const D=new ss,f=n.getContextAttributes();let a=null,U=null;const A=[],g=[],V=new t.Vector2;let L=null;const y=new t.PerspectiveCamera;y.viewport=new t.Vector4;const H=new t.PerspectiveCamera;H.viewport=new t.Vector4;const h=[y,H],u=new t.ArrayCamera;let C=null,K=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(W){let ee=A[W];return ee===void 0&&(ee=new t.WebXRController,A[W]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(W){let ee=A[W];return ee===void 0&&(ee=new t.WebXRController,A[W]=ee),ee.getGripSpace()},this.getHand=function(W){let ee=A[W];return ee===void 0&&(ee=new t.WebXRController,A[W]=ee),ee.getHandSpace()};function k(W){const ee=g.indexOf(W.inputSource);if(ee===-1)return;const ge=A[ee];ge!==void 0&&(ge.update(W.inputSource,W.frame,T||m),ge.dispatchEvent({type:W.type,data:W.inputSource}))}function Y(){c.removeEventListener("select",k),c.removeEventListener("selectstart",k),c.removeEventListener("selectend",k),c.removeEventListener("squeeze",k),c.removeEventListener("squeezestart",k),c.removeEventListener("squeezeend",k),c.removeEventListener("end",Y),c.removeEventListener("inputsourceschange",j);for(let W=0;W<A.length;W++){const ee=g[W];ee!==null&&(g[W]=null,A[W].disconnect(ee))}C=null,K=null,D.reset(),i.setRenderTarget(a),R=null,S=null,x=null,c=null,U=null,Qe.stop(),r.isPresenting=!1,i.setPixelRatio(L),i.setSize(V.width,V.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(W){s=W,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(W){d=W,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return T||m},this.setReferenceSpace=function(W){T=W},this.getBaseLayer=function(){return S!==null?S:R},this.getBinding=function(){return x},this.getFrame=function(){return F},this.getSession=function(){return c},this.setSession=async function(W){if(c=W,c!==null){if(a=i.getRenderTarget(),c.addEventListener("select",k),c.addEventListener("selectstart",k),c.addEventListener("selectend",k),c.addEventListener("squeeze",k),c.addEventListener("squeezestart",k),c.addEventListener("squeezeend",k),c.addEventListener("end",Y),c.addEventListener("inputsourceschange",j),f.xrCompatible!==!0&&await n.makeXRCompatible(),L=i.getPixelRatio(),i.getSize(V),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let ge=null,se=null,ve=null;f.depth&&(ve=f.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,ge=f.stencil?t.DepthStencilFormat:t.DepthFormat,se=f.stencil?t.UnsignedInt248Type:t.UnsignedIntType);const Oe={colorFormat:n.RGBA8,depthFormat:ve,scaleFactor:s};x=new XRWebGLBinding(c,n),S=x.createProjectionLayer(Oe),c.updateRenderState({layers:[S]}),i.setPixelRatio(1),i.setSize(S.textureWidth,S.textureHeight,!1),U=new t.WebGLRenderTarget(S.textureWidth,S.textureHeight,{format:t.RGBAFormat,type:t.UnsignedByteType,depthTexture:new t.DepthTexture(S.textureWidth,S.textureHeight,se,void 0,void 0,void 0,void 0,void 0,void 0,ge),stencilBuffer:f.stencil,colorSpace:i.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:S.ignoreDepthValues===!1,resolveStencilBuffer:S.ignoreDepthValues===!1})}else{const ge={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:s};R=new XRWebGLLayer(c,n,ge),c.updateRenderState({baseLayer:R}),i.setPixelRatio(1),i.setSize(R.framebufferWidth,R.framebufferHeight,!1),U=new t.WebGLRenderTarget(R.framebufferWidth,R.framebufferHeight,{format:t.RGBAFormat,type:t.UnsignedByteType,colorSpace:i.outputColorSpace,stencilBuffer:f.stencil,resolveDepthBuffer:R.ignoreDepthValues===!1,resolveStencilBuffer:R.ignoreDepthValues===!1})}U.isXRRenderTarget=!0,this.setFoveation(b),T=null,m=await c.requestReferenceSpace(d),Qe.setContext(c),Qe.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(c!==null)return c.environmentBlendMode},this.getDepthTexture=function(){return D.getDepthTexture()};function j(W){for(let ee=0;ee<W.removed.length;ee++){const ge=W.removed[ee],se=g.indexOf(ge);se>=0&&(g[se]=null,A[se].disconnect(ge))}for(let ee=0;ee<W.added.length;ee++){const ge=W.added[ee];let se=g.indexOf(ge);if(se===-1){for(let Oe=0;Oe<A.length;Oe++)if(Oe>=g.length){g.push(ge),se=Oe;break}else if(g[Oe]===null){g[Oe]=ge,se=Oe;break}if(se===-1)break}const ve=A[se];ve&&ve.connect(ge)}}const X=new t.Vector3,ne=new t.Vector3;function B(W,ee,ge){X.setFromMatrixPosition(ee.matrixWorld),ne.setFromMatrixPosition(ge.matrixWorld);const se=X.distanceTo(ne),ve=ee.projectionMatrix.elements,Oe=ge.projectionMatrix.elements,Ce=ve[14]/(ve[10]-1),Ke=ve[14]/(ve[10]+1),$e=(ve[9]+1)/ve[5],Be=(ve[9]-1)/ve[5],_=(ve[8]-1)/ve[0],nt=(Oe[8]+1)/Oe[0],Ge=Ce*_,ze=Ce*nt,he=se/(-_+nt),ye=he*-_;if(ee.matrixWorld.decompose(W.position,W.quaternion,W.scale),W.translateX(ye),W.translateZ(he),W.matrixWorld.compose(W.position,W.quaternion,W.scale),W.matrixWorldInverse.copy(W.matrixWorld).invert(),ve[10]===-1)W.projectionMatrix.copy(ee.projectionMatrix),W.projectionMatrixInverse.copy(ee.projectionMatrixInverse);else{const Me=Ce+he,we=Ke+he,je=Ge-ye,p=ze+(se-ye),o=$e*Ke/we*Me,P=Be*Ke/we*Me;W.projectionMatrix.makePerspective(je,p,o,P,Me,we),W.projectionMatrixInverse.copy(W.projectionMatrix).invert()}}function Se(W,ee){ee===null?W.matrixWorld.copy(W.matrix):W.matrixWorld.multiplyMatrices(ee.matrixWorld,W.matrix),W.matrixWorldInverse.copy(W.matrixWorld).invert()}this.updateCamera=function(W){if(c===null)return;let ee=W.near,ge=W.far;D.texture!==null&&(D.depthNear>0&&(ee=D.depthNear),D.depthFar>0&&(ge=D.depthFar)),u.near=H.near=y.near=ee,u.far=H.far=y.far=ge,(C!==u.near||K!==u.far)&&(c.updateRenderState({depthNear:u.near,depthFar:u.far}),C=u.near,K=u.far),y.layers.mask=W.layers.mask|2,H.layers.mask=W.layers.mask|4,u.layers.mask=y.layers.mask|H.layers.mask;const se=W.parent,ve=u.cameras;Se(u,se);for(let Oe=0;Oe<ve.length;Oe++)Se(ve[Oe],se);ve.length===2?B(u,y,H):u.projectionMatrix.copy(y.projectionMatrix),Re(W,u,se)};function Re(W,ee,ge){ge===null?W.matrix.copy(ee.matrixWorld):(W.matrix.copy(ge.matrixWorld),W.matrix.invert(),W.matrix.multiply(ee.matrixWorld)),W.matrix.decompose(W.position,W.quaternion,W.scale),W.updateMatrixWorld(!0),W.projectionMatrix.copy(ee.projectionMatrix),W.projectionMatrixInverse.copy(ee.projectionMatrixInverse),W.isPerspectiveCamera&&(W.fov=t.RAD2DEG*2*Math.atan(1/W.projectionMatrix.elements[5]),W.zoom=1)}this.getCamera=function(){return u},this.getFoveation=function(){if(!(S===null&&R===null))return b},this.setFoveation=function(W){b=W,S!==null&&(S.fixedFoveation=W),R!==null&&R.fixedFoveation!==void 0&&(R.fixedFoveation=W)},this.hasDepthSensing=function(){return D.texture!==null},this.getDepthSensingMesh=function(){return D.getMesh(u)};let Ie=null;function He(W,ee){if(w=ee.getViewerPose(T||m),F=ee,w!==null){const ge=w.views;R!==null&&(i.setRenderTargetFramebuffer(U,R.framebuffer),i.setRenderTarget(U));let se=!1;ge.length!==u.cameras.length&&(u.cameras.length=0,se=!0);for(let Ce=0;Ce<ge.length;Ce++){const Ke=ge[Ce];let $e=null;if(R!==null)$e=R.getViewport(Ke);else{const _=x.getViewSubImage(S,Ke);$e=_.viewport,Ce===0&&(i.setRenderTargetTextures(U,_.colorTexture,_.depthStencilTexture),i.setRenderTarget(U))}let Be=h[Ce];Be===void 0&&(Be=new t.PerspectiveCamera,Be.layers.enable(Ce),Be.viewport=new t.Vector4,h[Ce]=Be),Be.matrix.fromArray(Ke.transform.matrix),Be.matrix.decompose(Be.position,Be.quaternion,Be.scale),Be.projectionMatrix.fromArray(Ke.projectionMatrix),Be.projectionMatrixInverse.copy(Be.projectionMatrix).invert(),Be.viewport.set($e.x,$e.y,$e.width,$e.height),Ce===0&&(u.matrix.copy(Be.matrix),u.matrix.decompose(u.position,u.quaternion,u.scale)),se===!0&&u.cameras.push(Be)}const ve=c.enabledFeatures;if(ve&&ve.includes("depth-sensing")&&c.depthUsage=="gpu-optimized"&&x){const Ce=x.getDepthInformation(ge[0]);Ce&&Ce.isValid&&Ce.texture&&D.init(i,Ce,c.renderState)}}for(let ge=0;ge<A.length;ge++){const se=g[ge],ve=A[ge];se!==null&&ve!==void 0&&ve.update(se,ee,T||m)}Ie&&Ie(W,ee),ee.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:ee}),F=null}const Qe=new Sn;Qe.setAnimationLoop(He),this.setAnimationLoop=function(W){Ie=W},this.dispose=function(){}}}const mt=new t.Euler,cs=new t.Matrix4;function fs(e,i){function n(f,a){f.matrixAutoUpdate===!0&&f.updateMatrix(),a.value.copy(f.matrix)}function r(f,a){a.color.getRGB(f.fogColor.value,t.getUnlitUniformColorSpace(e)),a.isFog?(f.fogNear.value=a.near,f.fogFar.value=a.far):a.isFogExp2&&(f.fogDensity.value=a.density)}function c(f,a,U,A,g){a.isMeshBasicMaterial||a.isMeshLambertMaterial?s(f,a):a.isMeshToonMaterial?(s(f,a),x(f,a)):a.isMeshPhongMaterial?(s(f,a),w(f,a)):a.isMeshStandardMaterial?(s(f,a),S(f,a),a.isMeshPhysicalMaterial&&R(f,a,g)):a.isMeshMatcapMaterial?(s(f,a),F(f,a)):a.isMeshDepthMaterial?s(f,a):a.isMeshDistanceMaterial?(s(f,a),D(f,a)):a.isMeshNormalMaterial?s(f,a):a.isLineBasicMaterial?(m(f,a),a.isLineDashedMaterial&&d(f,a)):a.isPointsMaterial?b(f,a,U,A):a.isSpriteMaterial?T(f,a):a.isShadowMaterial?(f.color.value.copy(a.color),f.opacity.value=a.opacity):a.isShaderMaterial&&(a.uniformsNeedUpdate=!1)}function s(f,a){f.opacity.value=a.opacity,a.color&&f.diffuse.value.copy(a.color),a.emissive&&f.emissive.value.copy(a.emissive).multiplyScalar(a.emissiveIntensity),a.map&&(f.map.value=a.map,n(a.map,f.mapTransform)),a.alphaMap&&(f.alphaMap.value=a.alphaMap,n(a.alphaMap,f.alphaMapTransform)),a.bumpMap&&(f.bumpMap.value=a.bumpMap,n(a.bumpMap,f.bumpMapTransform),f.bumpScale.value=a.bumpScale,a.side===t.BackSide&&(f.bumpScale.value*=-1)),a.normalMap&&(f.normalMap.value=a.normalMap,n(a.normalMap,f.normalMapTransform),f.normalScale.value.copy(a.normalScale),a.side===t.BackSide&&f.normalScale.value.negate()),a.displacementMap&&(f.displacementMap.value=a.displacementMap,n(a.displacementMap,f.displacementMapTransform),f.displacementScale.value=a.displacementScale,f.displacementBias.value=a.displacementBias),a.emissiveMap&&(f.emissiveMap.value=a.emissiveMap,n(a.emissiveMap,f.emissiveMapTransform)),a.specularMap&&(f.specularMap.value=a.specularMap,n(a.specularMap,f.specularMapTransform)),a.alphaTest>0&&(f.alphaTest.value=a.alphaTest);const U=i.get(a),A=U.envMap,g=U.envMapRotation;A&&(f.envMap.value=A,mt.copy(g),mt.x*=-1,mt.y*=-1,mt.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(mt.y*=-1,mt.z*=-1),f.envMapRotation.value.setFromMatrix4(cs.makeRotationFromEuler(mt)),f.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,f.reflectivity.value=a.reflectivity,f.ior.value=a.ior,f.refractionRatio.value=a.refractionRatio),a.lightMap&&(f.lightMap.value=a.lightMap,f.lightMapIntensity.value=a.lightMapIntensity,n(a.lightMap,f.lightMapTransform)),a.aoMap&&(f.aoMap.value=a.aoMap,f.aoMapIntensity.value=a.aoMapIntensity,n(a.aoMap,f.aoMapTransform))}function m(f,a){f.diffuse.value.copy(a.color),f.opacity.value=a.opacity,a.map&&(f.map.value=a.map,n(a.map,f.mapTransform))}function d(f,a){f.dashSize.value=a.dashSize,f.totalSize.value=a.dashSize+a.gapSize,f.scale.value=a.scale}function b(f,a,U,A){f.diffuse.value.copy(a.color),f.opacity.value=a.opacity,f.size.value=a.size*U,f.scale.value=A*.5,a.map&&(f.map.value=a.map,n(a.map,f.uvTransform)),a.alphaMap&&(f.alphaMap.value=a.alphaMap,n(a.alphaMap,f.alphaMapTransform)),a.alphaTest>0&&(f.alphaTest.value=a.alphaTest)}function T(f,a){f.diffuse.value.copy(a.color),f.opacity.value=a.opacity,f.rotation.value=a.rotation,a.map&&(f.map.value=a.map,n(a.map,f.mapTransform)),a.alphaMap&&(f.alphaMap.value=a.alphaMap,n(a.alphaMap,f.alphaMapTransform)),a.alphaTest>0&&(f.alphaTest.value=a.alphaTest)}function w(f,a){f.specular.value.copy(a.specular),f.shininess.value=Math.max(a.shininess,1e-4)}function x(f,a){a.gradientMap&&(f.gradientMap.value=a.gradientMap)}function S(f,a){f.metalness.value=a.metalness,a.metalnessMap&&(f.metalnessMap.value=a.metalnessMap,n(a.metalnessMap,f.metalnessMapTransform)),f.roughness.value=a.roughness,a.roughnessMap&&(f.roughnessMap.value=a.roughnessMap,n(a.roughnessMap,f.roughnessMapTransform)),a.envMap&&(f.envMapIntensity.value=a.envMapIntensity)}function R(f,a,U){f.ior.value=a.ior,a.sheen>0&&(f.sheenColor.value.copy(a.sheenColor).multiplyScalar(a.sheen),f.sheenRoughness.value=a.sheenRoughness,a.sheenColorMap&&(f.sheenColorMap.value=a.sheenColorMap,n(a.sheenColorMap,f.sheenColorMapTransform)),a.sheenRoughnessMap&&(f.sheenRoughnessMap.value=a.sheenRoughnessMap,n(a.sheenRoughnessMap,f.sheenRoughnessMapTransform))),a.clearcoat>0&&(f.clearcoat.value=a.clearcoat,f.clearcoatRoughness.value=a.clearcoatRoughness,a.clearcoatMap&&(f.clearcoatMap.value=a.clearcoatMap,n(a.clearcoatMap,f.clearcoatMapTransform)),a.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=a.clearcoatRoughnessMap,n(a.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),a.clearcoatNormalMap&&(f.clearcoatNormalMap.value=a.clearcoatNormalMap,n(a.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(a.clearcoatNormalScale),a.side===t.BackSide&&f.clearcoatNormalScale.value.negate())),a.dispersion>0&&(f.dispersion.value=a.dispersion),a.iridescence>0&&(f.iridescence.value=a.iridescence,f.iridescenceIOR.value=a.iridescenceIOR,f.iridescenceThicknessMinimum.value=a.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=a.iridescenceThicknessRange[1],a.iridescenceMap&&(f.iridescenceMap.value=a.iridescenceMap,n(a.iridescenceMap,f.iridescenceMapTransform)),a.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=a.iridescenceThicknessMap,n(a.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),a.transmission>0&&(f.transmission.value=a.transmission,f.transmissionSamplerMap.value=U.texture,f.transmissionSamplerSize.value.set(U.width,U.height),a.transmissionMap&&(f.transmissionMap.value=a.transmissionMap,n(a.transmissionMap,f.transmissionMapTransform)),f.thickness.value=a.thickness,a.thicknessMap&&(f.thicknessMap.value=a.thicknessMap,n(a.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=a.attenuationDistance,f.attenuationColor.value.copy(a.attenuationColor)),a.anisotropy>0&&(f.anisotropyVector.value.set(a.anisotropy*Math.cos(a.anisotropyRotation),a.anisotropy*Math.sin(a.anisotropyRotation)),a.anisotropyMap&&(f.anisotropyMap.value=a.anisotropyMap,n(a.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=a.specularIntensity,f.specularColor.value.copy(a.specularColor),a.specularColorMap&&(f.specularColorMap.value=a.specularColorMap,n(a.specularColorMap,f.specularColorMapTransform)),a.specularIntensityMap&&(f.specularIntensityMap.value=a.specularIntensityMap,n(a.specularIntensityMap,f.specularIntensityMapTransform))}function F(f,a){a.matcap&&(f.matcap.value=a.matcap)}function D(f,a){const U=i.get(a).light;f.referencePosition.value.setFromMatrixPosition(U.matrixWorld),f.nearDistance.value=U.shadow.camera.near,f.farDistance.value=U.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:c}}function us(e,i,n,r){let c={},s={},m=[];const d=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function b(U,A){const g=A.program;r.uniformBlockBinding(U,g)}function T(U,A){let g=c[U.id];g===void 0&&(F(U),g=w(U),c[U.id]=g,U.addEventListener("dispose",f));const V=A.program;r.updateUBOMapping(U,V);const L=i.render.frame;s[U.id]!==L&&(S(U),s[U.id]=L)}function w(U){const A=x();U.__bindingPointIndex=A;const g=e.createBuffer(),V=U.__size,L=U.usage;return e.bindBuffer(e.UNIFORM_BUFFER,g),e.bufferData(e.UNIFORM_BUFFER,V,L),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,A,g),g}function x(){for(let U=0;U<d;U++)if(m.indexOf(U)===-1)return m.push(U),U;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function S(U){const A=c[U.id],g=U.uniforms,V=U.__cache;e.bindBuffer(e.UNIFORM_BUFFER,A);for(let L=0,y=g.length;L<y;L++){const H=Array.isArray(g[L])?g[L]:[g[L]];for(let h=0,u=H.length;h<u;h++){const C=H[h];if(R(C,L,h,V)===!0){const K=C.__offset,k=Array.isArray(C.value)?C.value:[C.value];let Y=0;for(let j=0;j<k.length;j++){const X=k[j],ne=D(X);typeof X=="number"||typeof X=="boolean"?(C.__data[0]=X,e.bufferSubData(e.UNIFORM_BUFFER,K+Y,C.__data)):X.isMatrix3?(C.__data[0]=X.elements[0],C.__data[1]=X.elements[1],C.__data[2]=X.elements[2],C.__data[3]=0,C.__data[4]=X.elements[3],C.__data[5]=X.elements[4],C.__data[6]=X.elements[5],C.__data[7]=0,C.__data[8]=X.elements[6],C.__data[9]=X.elements[7],C.__data[10]=X.elements[8],C.__data[11]=0):(X.toArray(C.__data,Y),Y+=ne.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,K,C.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}function R(U,A,g,V){const L=U.value,y=A+"_"+g;if(V[y]===void 0)return typeof L=="number"||typeof L=="boolean"?V[y]=L:V[y]=L.clone(),!0;{const H=V[y];if(typeof L=="number"||typeof L=="boolean"){if(H!==L)return V[y]=L,!0}else if(H.equals(L)===!1)return H.copy(L),!0}return!1}function F(U){const A=U.uniforms;let g=0;const V=16;for(let y=0,H=A.length;y<H;y++){const h=Array.isArray(A[y])?A[y]:[A[y]];for(let u=0,C=h.length;u<C;u++){const K=h[u],k=Array.isArray(K.value)?K.value:[K.value];for(let Y=0,j=k.length;Y<j;Y++){const X=k[Y],ne=D(X),B=g%V,Se=B%ne.boundary,Re=B+Se;g+=Se,Re!==0&&V-Re<ne.storage&&(g+=V-Re),K.__data=new Float32Array(ne.storage/Float32Array.BYTES_PER_ELEMENT),K.__offset=g,g+=ne.storage}}}const L=g%V;return L>0&&(g+=V-L),U.__size=g,U.__cache={},this}function D(U){const A={boundary:0,storage:0};return typeof U=="number"||typeof U=="boolean"?(A.boundary=4,A.storage=4):U.isVector2?(A.boundary=8,A.storage=8):U.isVector3||U.isColor?(A.boundary=16,A.storage=12):U.isVector4?(A.boundary=16,A.storage=16):U.isMatrix3?(A.boundary=48,A.storage=48):U.isMatrix4?(A.boundary=64,A.storage=64):U.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",U),A}function f(U){const A=U.target;A.removeEventListener("dispose",f);const g=m.indexOf(A.__bindingPointIndex);m.splice(g,1),e.deleteBuffer(c[A.id]),delete c[A.id],delete s[A.id]}function a(){for(const U in c)e.deleteBuffer(c[U]);m=[],c={},s={}}return{bind:b,update:T,dispose:a}}class ds{constructor(i={}){const{canvas:n=t.createCanvasElement(),context:r=null,depth:c=!0,stencil:s=!1,alpha:m=!1,antialias:d=!1,premultipliedAlpha:b=!0,preserveDrawingBuffer:T=!1,powerPreference:w="default",failIfMajorPerformanceCaveat:x=!1,reverseDepthBuffer:S=!1}=i;this.isWebGLRenderer=!0;let R;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");R=r.getContextAttributes().alpha}else R=m;const F=new Uint32Array(4),D=new Int32Array(4);let f=null,a=null;const U=[],A=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=t.NoToneMapping,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const g=this;let V=!1;this._outputColorSpace=t.SRGBColorSpace;let L=0,y=0,H=null,h=-1,u=null;const C=new t.Vector4,K=new t.Vector4;let k=null;const Y=new t.Color(0);let j=0,X=n.width,ne=n.height,B=1,Se=null,Re=null;const Ie=new t.Vector4(0,0,X,ne),He=new t.Vector4(0,0,X,ne);let Qe=!1;const W=new t.Frustum;let ee=!1,ge=!1;const se=new t.Matrix4,ve=new t.Matrix4,Oe=new t.Vector3,Ce=new t.Vector4,Ke={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let $e=!1;function Be(){return H===null?B:1}let _=r;function nt(l,E){return n.getContext(l,E)}try{const l={alpha:!0,depth:c,stencil:s,antialias:d,premultipliedAlpha:b,preserveDrawingBuffer:T,powerPreference:w,failIfMajorPerformanceCaveat:x};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${t.REVISION}`),n.addEventListener("webglcontextlost",fe,!1),n.addEventListener("webglcontextrestored",Q,!1),n.addEventListener("webglcontextcreationerror",z,!1),_===null){const E="webgl2";if(_=nt(E,l),_===null)throw nt(E)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(l){throw console.error("THREE.WebGLRenderer: "+l.message),l}let Ge,ze,he,ye,Me,we,je,p,o,P,G,q,O,me,re,pe,_e,$,le,Ae,xe,ie,Le,v;function ae(){Ge=new Ta(_),Ge.init(),ie=new An(_,Ge),ze=new ma(_,Ge,i,ie),he=new is(_,Ge),ze.reverseDepthBuffer&&S&&he.buffers.depth.setReversed(!0),ye=new Ra(_),Me=new zo,we=new rs(_,Ge,he,Me,ze,ie,ye),je=new ga(g),p=new Ma(g),o=new Un(_),Le=new pa(_,o),P=new xa(_,o,ye,Le),G=new ba(_,P,o,ye),le=new Ca(_,ze,we),pe=new _a(Me),q=new Wo(g,je,p,Ge,ze,Le,pe),O=new fs(g,Me),me=new qo,re=new Jo(Ge),$=new da(g,je,p,he,G,R,b),_e=new ts(g,G,ze),v=new us(_,ye,ze,he),Ae=new ha(_,Ge,ye),xe=new Aa(_,Ge,ye),ye.programs=q.programs,g.capabilities=ze,g.extensions=Ge,g.properties=Me,g.renderLists=me,g.shadowMap=_e,g.state=he,g.info=ye}ae();const Z=new ls(g,_);this.xr=Z,this.getContext=function(){return _},this.getContextAttributes=function(){return _.getContextAttributes()},this.forceContextLoss=function(){const l=Ge.get("WEBGL_lose_context");l&&l.loseContext()},this.forceContextRestore=function(){const l=Ge.get("WEBGL_lose_context");l&&l.restoreContext()},this.getPixelRatio=function(){return B},this.setPixelRatio=function(l){l!==void 0&&(B=l,this.setSize(X,ne,!1))},this.getSize=function(l){return l.set(X,ne)},this.setSize=function(l,E,I=!0){if(Z.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}X=l,ne=E,n.width=Math.floor(l*B),n.height=Math.floor(E*B),I===!0&&(n.style.width=l+"px",n.style.height=E+"px"),this.setViewport(0,0,l,E)},this.getDrawingBufferSize=function(l){return l.set(X*B,ne*B).floor()},this.setDrawingBufferSize=function(l,E,I){X=l,ne=E,B=I,n.width=Math.floor(l*I),n.height=Math.floor(E*I),this.setViewport(0,0,l,E)},this.getCurrentViewport=function(l){return l.copy(C)},this.getViewport=function(l){return l.copy(Ie)},this.setViewport=function(l,E,I,N){l.isVector4?Ie.set(l.x,l.y,l.z,l.w):Ie.set(l,E,I,N),he.viewport(C.copy(Ie).multiplyScalar(B).round())},this.getScissor=function(l){return l.copy(He)},this.setScissor=function(l,E,I,N){l.isVector4?He.set(l.x,l.y,l.z,l.w):He.set(l,E,I,N),he.scissor(K.copy(He).multiplyScalar(B).round())},this.getScissorTest=function(){return Qe},this.setScissorTest=function(l){he.setScissorTest(Qe=l)},this.setOpaqueSort=function(l){Se=l},this.setTransparentSort=function(l){Re=l},this.getClearColor=function(l){return l.copy($.getClearColor())},this.setClearColor=function(){$.setClearColor(...arguments)},this.getClearAlpha=function(){return $.getClearAlpha()},this.setClearAlpha=function(){$.setClearAlpha(...arguments)},this.clear=function(l=!0,E=!0,I=!0){let N=0;if(l){let M=!1;if(H!==null){const J=H.texture.format;M=J===t.RGBAIntegerFormat||J===t.RGIntegerFormat||J===t.RedIntegerFormat}if(M){const J=H.texture.type,oe=J===t.UnsignedByteType||J===t.UnsignedIntType||J===t.UnsignedShortType||J===t.UnsignedInt248Type||J===t.UnsignedShort4444Type||J===t.UnsignedShort5551Type,de=$.getClearColor(),ce=$.getClearAlpha(),be=de.r,Pe=de.g,Ee=de.b;oe?(F[0]=be,F[1]=Pe,F[2]=Ee,F[3]=ce,_.clearBufferuiv(_.COLOR,0,F)):(D[0]=be,D[1]=Pe,D[2]=Ee,D[3]=ce,_.clearBufferiv(_.COLOR,0,D))}else N|=_.COLOR_BUFFER_BIT}E&&(N|=_.DEPTH_BUFFER_BIT),I&&(N|=_.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),_.clear(N)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",fe,!1),n.removeEventListener("webglcontextrestored",Q,!1),n.removeEventListener("webglcontextcreationerror",z,!1),$.dispose(),me.dispose(),re.dispose(),Me.dispose(),je.dispose(),p.dispose(),G.dispose(),Le.dispose(),v.dispose(),q.dispose(),Z.dispose(),Z.removeEventListener("sessionstart",kt),Z.removeEventListener("sessionend",Wt),dt.stop()};function fe(l){l.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),V=!0}function Q(){console.log("THREE.WebGLRenderer: Context Restored."),V=!1;const l=ye.autoReset,E=_e.enabled,I=_e.autoUpdate,N=_e.needsUpdate,M=_e.type;ae(),ye.autoReset=l,_e.enabled=E,_e.autoUpdate=I,_e.needsUpdate=N,_e.type=M}function z(l){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",l.statusMessage)}function ue(l){const E=l.target;E.removeEventListener("dispose",ue),De(E)}function De(l){Xe(l),Me.remove(l)}function Xe(l){const E=Me.get(l).programs;E!==void 0&&(E.forEach(function(I){q.releaseProgram(I)}),l.isShaderMaterial&&q.releaseShaderCache(l))}this.renderBufferDirect=function(l,E,I,N,M,J){E===null&&(E=Ke);const oe=M.isMesh&&M.matrixWorld.determinant()<0,de=Rn(l,E,I,N,M);he.setMaterial(N,oe);let ce=I.index,be=1;if(N.wireframe===!0){if(ce=P.getWireframeAttribute(I),ce===void 0)return;be=2}const Pe=I.drawRange,Ee=I.attributes.position;let Ne=Pe.start*be,ke=(Pe.start+Pe.count)*be;J!==null&&(Ne=Math.max(Ne,J.start*be),ke=Math.min(ke,(J.start+J.count)*be)),ce!==null?(Ne=Math.max(Ne,0),ke=Math.min(ke,ce.count)):Ee!=null&&(Ne=Math.max(Ne,0),ke=Math.min(ke,Ee.count));const Je=ke-Ne;if(Je<0||Je===1/0)return;Le.setup(M,N,de,I,ce);let qe,We=Ae;if(ce!==null&&(qe=o.get(ce),We=xe,We.setIndex(qe)),M.isMesh)N.wireframe===!0?(he.setLineWidth(N.wireframeLinewidth*Be()),We.setMode(_.LINES)):We.setMode(_.TRIANGLES);else if(M.isLine){let Te=N.linewidth;Te===void 0&&(Te=1),he.setLineWidth(Te*Be()),M.isLineSegments?We.setMode(_.LINES):M.isLineLoop?We.setMode(_.LINE_LOOP):We.setMode(_.LINE_STRIP)}else M.isPoints?We.setMode(_.POINTS):M.isSprite&&We.setMode(_.TRIANGLES);if(M.isBatchedMesh)if(M._multiDrawInstances!==null)t.warnOnce("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),We.renderMultiDrawInstances(M._multiDrawStarts,M._multiDrawCounts,M._multiDrawCount,M._multiDrawInstances);else if(Ge.get("WEBGL_multi_draw"))We.renderMultiDraw(M._multiDrawStarts,M._multiDrawCounts,M._multiDrawCount);else{const Te=M._multiDrawStarts,Ze=M._multiDrawCounts,Fe=M._multiDrawCount,at=ce?o.get(ce).bytesPerElement:1,vt=Me.get(N).currentProgram.getUniforms();for(let ot=0;ot<Fe;ot++)vt.setValue(_,"_gl_DrawID",ot),We.render(Te[ot]/at,Ze[ot])}else if(M.isInstancedMesh)We.renderInstances(Ne,Je,M.count);else if(I.isInstancedBufferGeometry){const Te=I._maxInstanceCount!==void 0?I._maxInstanceCount:1/0,Ze=Math.min(I.instanceCount,Te);We.renderInstances(Ne,Je,Ze)}else We.render(Ne,Je)};function Ve(l,E,I){l.transparent===!0&&l.side===t.DoubleSide&&l.forceSinglePass===!1?(l.side=t.BackSide,l.needsUpdate=!0,Rt(l,E,I),l.side=t.FrontSide,l.needsUpdate=!0,Rt(l,E,I),l.side=t.DoubleSide):Rt(l,E,I)}this.compile=function(l,E,I=null){I===null&&(I=l),a=re.get(I),a.init(E),A.push(a),I.traverseVisible(function(M){M.isLight&&M.layers.test(E.layers)&&(a.pushLight(M),M.castShadow&&a.pushShadow(M))}),l!==I&&l.traverseVisible(function(M){M.isLight&&M.layers.test(E.layers)&&(a.pushLight(M),M.castShadow&&a.pushShadow(M))}),a.setupLights();const N=new Set;return l.traverse(function(M){if(!(M.isMesh||M.isPoints||M.isLine||M.isSprite))return;const J=M.material;if(J)if(Array.isArray(J))for(let oe=0;oe<J.length;oe++){const de=J[oe];Ve(de,I,M),N.add(de)}else Ve(J,I,M),N.add(J)}),a=A.pop(),N},this.compileAsync=function(l,E,I=null){const N=this.compile(l,E,I);return new Promise(M=>{function J(){if(N.forEach(function(oe){Me.get(oe).currentProgram.isReady()&&N.delete(oe)}),N.size===0){M(l);return}setTimeout(J,10)}Ge.get("KHR_parallel_shader_compile")!==null?J():setTimeout(J,10)})};let ct=null;function ut(l){ct&&ct(l)}function kt(){dt.stop()}function Wt(){dt.start()}const dt=new Sn;dt.setAnimationLoop(ut),typeof self<"u"&&dt.setContext(self),this.setAnimationLoop=function(l){ct=l,Z.setAnimationLoop(l),l===null?dt.stop():dt.start()},Z.addEventListener("sessionstart",kt),Z.addEventListener("sessionend",Wt),this.render=function(l,E){if(E!==void 0&&E.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(V===!0)return;if(l.matrixWorldAutoUpdate===!0&&l.updateMatrixWorld(),E.parent===null&&E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),Z.enabled===!0&&Z.isPresenting===!0&&(Z.cameraAutoUpdate===!0&&Z.updateCamera(E),E=Z.getCamera()),l.isScene===!0&&l.onBeforeRender(g,l,E,H),a=re.get(l,A.length),a.init(E),A.push(a),ve.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse),W.setFromProjectionMatrix(ve),ge=this.localClippingEnabled,ee=pe.init(this.clippingPlanes,ge),f=me.get(l,U.length),f.init(),U.push(f),Z.enabled===!0&&Z.isPresenting===!0){const J=g.xr.getDepthSensingMesh();J!==null&&Ut(J,E,-1/0,g.sortObjects)}Ut(l,E,0,g.sortObjects),f.finish(),g.sortObjects===!0&&f.sort(Se,Re),$e=Z.enabled===!1||Z.isPresenting===!1||Z.hasDepthSensing()===!1,$e&&$.addToRenderList(f,l),this.info.render.frame++,ee===!0&&pe.beginShadows();const I=a.state.shadowsArray;_e.render(I,l,E),ee===!0&&pe.endShadows(),this.info.autoReset===!0&&this.info.reset();const N=f.opaque,M=f.transmissive;if(a.setupLights(),E.isArrayCamera){const J=E.cameras;if(M.length>0)for(let oe=0,de=J.length;oe<de;oe++){const ce=J[oe];Xt(N,M,l,ce)}$e&&$.render(l);for(let oe=0,de=J.length;oe<de;oe++){const ce=J[oe];zt(f,l,ce,ce.viewport)}}else M.length>0&&Xt(N,M,l,E),$e&&$.render(l),zt(f,l,E);H!==null&&y===0&&(we.updateMultisampleRenderTarget(H),we.updateRenderTargetMipmap(H)),l.isScene===!0&&l.onAfterRender(g,l,E),Le.resetDefaultState(),h=-1,u=null,A.pop(),A.length>0?(a=A[A.length-1],ee===!0&&pe.setGlobalState(g.clippingPlanes,a.state.camera)):a=null,U.pop(),U.length>0?f=U[U.length-1]:f=null};function Ut(l,E,I,N){if(l.visible===!1)return;if(l.layers.test(E.layers)){if(l.isGroup)I=l.renderOrder;else if(l.isLOD)l.autoUpdate===!0&&l.update(E);else if(l.isLight)a.pushLight(l),l.castShadow&&a.pushShadow(l);else if(l.isSprite){if(!l.frustumCulled||W.intersectsSprite(l)){N&&Ce.setFromMatrixPosition(l.matrixWorld).applyMatrix4(ve);const oe=G.update(l),de=l.material;de.visible&&f.push(l,oe,de,I,Ce.z,null)}}else if((l.isMesh||l.isLine||l.isPoints)&&(!l.frustumCulled||W.intersectsObject(l))){const oe=G.update(l),de=l.material;if(N&&(l.boundingSphere!==void 0?(l.boundingSphere===null&&l.computeBoundingSphere(),Ce.copy(l.boundingSphere.center)):(oe.boundingSphere===null&&oe.computeBoundingSphere(),Ce.copy(oe.boundingSphere.center)),Ce.applyMatrix4(l.matrixWorld).applyMatrix4(ve)),Array.isArray(de)){const ce=oe.groups;for(let be=0,Pe=ce.length;be<Pe;be++){const Ee=ce[be],Ne=de[Ee.materialIndex];Ne&&Ne.visible&&f.push(l,oe,Ne,I,Ce.z,Ee)}}else de.visible&&f.push(l,oe,de,I,Ce.z,null)}}const J=l.children;for(let oe=0,de=J.length;oe<de;oe++)Ut(J[oe],E,I,N)}function zt(l,E,I,N){const M=l.opaque,J=l.transmissive,oe=l.transparent;a.setupLightsView(I),ee===!0&&pe.setGlobalState(g.clippingPlanes,I),N&&he.viewport(C.copy(N)),M.length>0&&At(M,E,I),J.length>0&&At(J,E,I),oe.length>0&&At(oe,E,I),he.buffers.depth.setTest(!0),he.buffers.depth.setMask(!0),he.buffers.color.setMask(!0),he.setPolygonOffset(!1)}function Xt(l,E,I,N){if((I.isScene===!0?I.overrideMaterial:null)!==null)return;a.state.transmissionRenderTarget[N.id]===void 0&&(a.state.transmissionRenderTarget[N.id]=new t.WebGLRenderTarget(1,1,{generateMipmaps:!0,type:Ge.has("EXT_color_buffer_half_float")||Ge.has("EXT_color_buffer_float")?t.HalfFloatType:t.UnsignedByteType,minFilter:t.LinearMipmapLinearFilter,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:t.ColorManagement.workingColorSpace}));const J=a.state.transmissionRenderTarget[N.id],oe=N.viewport||C;J.setSize(oe.z*g.transmissionResolutionScale,oe.w*g.transmissionResolutionScale);const de=g.getRenderTarget(),ce=g.getActiveCubeFace(),be=g.getActiveMipmapLevel();g.setRenderTarget(J),g.getClearColor(Y),j=g.getClearAlpha(),j<1&&g.setClearColor(16777215,.5),g.clear(),$e&&$.render(I);const Pe=g.toneMapping;g.toneMapping=t.NoToneMapping;const Ee=N.viewport;if(N.viewport!==void 0&&(N.viewport=void 0),a.setupLightsView(N),ee===!0&&pe.setGlobalState(g.clippingPlanes,N),At(l,I,N),we.updateMultisampleRenderTarget(J),we.updateRenderTargetMipmap(J),Ge.has("WEBGL_multisampled_render_to_texture")===!1){let Ne=!1;for(let ke=0,Je=E.length;ke<Je;ke++){const qe=E[ke],We=qe.object,Te=qe.geometry,Ze=qe.material,Fe=qe.group;if(Ze.side===t.DoubleSide&&We.layers.test(N.layers)){const at=Ze.side;Ze.side=t.BackSide,Ze.needsUpdate=!0,qt(We,I,N,Te,Ze,Fe),Ze.side=at,Ze.needsUpdate=!0,Ne=!0}}Ne===!0&&(we.updateMultisampleRenderTarget(J),we.updateRenderTargetMipmap(J))}g.setRenderTarget(de,ce,be),g.setClearColor(Y,j),Ee!==void 0&&(N.viewport=Ee),g.toneMapping=Pe}function At(l,E,I){const N=E.isScene===!0?E.overrideMaterial:null;for(let M=0,J=l.length;M<J;M++){const oe=l[M],de=oe.object,ce=oe.geometry,be=oe.group;let Pe=oe.material;Pe.allowOverride===!0&&N!==null&&(Pe=N),de.layers.test(I.layers)&&qt(de,E,I,ce,Pe,be)}}function qt(l,E,I,N,M,J){l.onBeforeRender(g,E,I,N,M,J),l.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,l.matrixWorld),l.normalMatrix.getNormalMatrix(l.modelViewMatrix),M.onBeforeRender(g,E,I,N,l,J),M.transparent===!0&&M.side===t.DoubleSide&&M.forceSinglePass===!1?(M.side=t.BackSide,M.needsUpdate=!0,g.renderBufferDirect(I,E,N,M,l,J),M.side=t.FrontSide,M.needsUpdate=!0,g.renderBufferDirect(I,E,N,M,l,J),M.side=t.DoubleSide):g.renderBufferDirect(I,E,N,M,l,J),l.onAfterRender(g,E,I,N,M,J)}function Rt(l,E,I){E.isScene!==!0&&(E=Ke);const N=Me.get(l),M=a.state.lights,J=a.state.shadowsArray,oe=M.state.version,de=q.getParameters(l,M.state,J,E,I),ce=q.getProgramCacheKey(de);let be=N.programs;N.environment=l.isMeshStandardMaterial?E.environment:null,N.fog=E.fog,N.envMap=(l.isMeshStandardMaterial?p:je).get(l.envMap||N.environment),N.envMapRotation=N.environment!==null&&l.envMap===null?E.environmentRotation:l.envMapRotation,be===void 0&&(l.addEventListener("dispose",ue),be=new Map,N.programs=be);let Pe=be.get(ce);if(Pe!==void 0){if(N.currentProgram===Pe&&N.lightsStateVersion===oe)return Kt(l,de),Pe}else de.uniforms=q.getUniforms(l),l.onBeforeCompile(de,g),Pe=q.acquireProgram(de,ce),be.set(ce,Pe),N.uniforms=de.uniforms;const Ee=N.uniforms;return(!l.isShaderMaterial&&!l.isRawShaderMaterial||l.clipping===!0)&&(Ee.clippingPlanes=pe.uniform),Kt(l,de),N.needsLights=bn(l),N.lightsStateVersion=oe,N.needsLights&&(Ee.ambientLightColor.value=M.state.ambient,Ee.lightProbe.value=M.state.probe,Ee.directionalLights.value=M.state.directional,Ee.directionalLightShadows.value=M.state.directionalShadow,Ee.spotLights.value=M.state.spot,Ee.spotLightShadows.value=M.state.spotShadow,Ee.rectAreaLights.value=M.state.rectArea,Ee.ltc_1.value=M.state.rectAreaLTC1,Ee.ltc_2.value=M.state.rectAreaLTC2,Ee.pointLights.value=M.state.point,Ee.pointLightShadows.value=M.state.pointShadow,Ee.hemisphereLights.value=M.state.hemi,Ee.directionalShadowMap.value=M.state.directionalShadowMap,Ee.directionalShadowMatrix.value=M.state.directionalShadowMatrix,Ee.spotShadowMap.value=M.state.spotShadowMap,Ee.spotLightMatrix.value=M.state.spotLightMatrix,Ee.spotLightMap.value=M.state.spotLightMap,Ee.pointShadowMap.value=M.state.pointShadowMap,Ee.pointShadowMatrix.value=M.state.pointShadowMatrix),N.currentProgram=Pe,N.uniformsList=null,Pe}function Yt(l){if(l.uniformsList===null){const E=l.currentProgram.getUniforms();l.uniformsList=Lt.seqWithValue(E.seq,l.uniforms)}return l.uniformsList}function Kt(l,E){const I=Me.get(l);I.outputColorSpace=E.outputColorSpace,I.batching=E.batching,I.batchingColor=E.batchingColor,I.instancing=E.instancing,I.instancingColor=E.instancingColor,I.instancingMorph=E.instancingMorph,I.skinning=E.skinning,I.morphTargets=E.morphTargets,I.morphNormals=E.morphNormals,I.morphColors=E.morphColors,I.morphTargetsCount=E.morphTargetsCount,I.numClippingPlanes=E.numClippingPlanes,I.numIntersection=E.numClipIntersection,I.vertexAlphas=E.vertexAlphas,I.vertexTangents=E.vertexTangents,I.toneMapping=E.toneMapping}function Rn(l,E,I,N,M){E.isScene!==!0&&(E=Ke),we.resetTextureUnits();const J=E.fog,oe=N.isMeshStandardMaterial?E.environment:null,de=H===null?g.outputColorSpace:H.isXRRenderTarget===!0?H.texture.colorSpace:t.LinearSRGBColorSpace,ce=(N.isMeshStandardMaterial?p:je).get(N.envMap||oe),be=N.vertexColors===!0&&!!I.attributes.color&&I.attributes.color.itemSize===4,Pe=!!I.attributes.tangent&&(!!N.normalMap||N.anisotropy>0),Ee=!!I.morphAttributes.position,Ne=!!I.morphAttributes.normal,ke=!!I.morphAttributes.color;let Je=t.NoToneMapping;N.toneMapped&&(H===null||H.isXRRenderTarget===!0)&&(Je=g.toneMapping);const qe=I.morphAttributes.position||I.morphAttributes.normal||I.morphAttributes.color,We=qe!==void 0?qe.length:0,Te=Me.get(N),Ze=a.state.lights;if(ee===!0&&(ge===!0||l!==u)){const it=l===u&&N.id===h;pe.setState(N,l,it)}let Fe=!1;N.version===Te.__version?(Te.needsLights&&Te.lightsStateVersion!==Ze.state.version||Te.outputColorSpace!==de||M.isBatchedMesh&&Te.batching===!1||!M.isBatchedMesh&&Te.batching===!0||M.isBatchedMesh&&Te.batchingColor===!0&&M.colorTexture===null||M.isBatchedMesh&&Te.batchingColor===!1&&M.colorTexture!==null||M.isInstancedMesh&&Te.instancing===!1||!M.isInstancedMesh&&Te.instancing===!0||M.isSkinnedMesh&&Te.skinning===!1||!M.isSkinnedMesh&&Te.skinning===!0||M.isInstancedMesh&&Te.instancingColor===!0&&M.instanceColor===null||M.isInstancedMesh&&Te.instancingColor===!1&&M.instanceColor!==null||M.isInstancedMesh&&Te.instancingMorph===!0&&M.morphTexture===null||M.isInstancedMesh&&Te.instancingMorph===!1&&M.morphTexture!==null||Te.envMap!==ce||N.fog===!0&&Te.fog!==J||Te.numClippingPlanes!==void 0&&(Te.numClippingPlanes!==pe.numPlanes||Te.numIntersection!==pe.numIntersection)||Te.vertexAlphas!==be||Te.vertexTangents!==Pe||Te.morphTargets!==Ee||Te.morphNormals!==Ne||Te.morphColors!==ke||Te.toneMapping!==Je||Te.morphTargetsCount!==We)&&(Fe=!0):(Fe=!0,Te.__version=N.version);let at=Te.currentProgram;Fe===!0&&(at=Rt(N,E,M));let vt=!1,ot=!1,Tt=!1;const Ye=at.getUniforms(),st=Te.uniforms;if(he.useProgram(at.program)&&(vt=!0,ot=!0,Tt=!0),N.id!==h&&(h=N.id,ot=!0),vt||u!==l){he.buffers.depth.getReversed()?(se.copy(l.projectionMatrix),t.toNormalizedProjectionMatrix(se),t.toReversedProjectionMatrix(se),Ye.setValue(_,"projectionMatrix",se)):Ye.setValue(_,"projectionMatrix",l.projectionMatrix),Ye.setValue(_,"viewMatrix",l.matrixWorldInverse);const rt=Ye.map.cameraPosition;rt!==void 0&&rt.setValue(_,Oe.setFromMatrixPosition(l.matrixWorld)),ze.logarithmicDepthBuffer&&Ye.setValue(_,"logDepthBufFC",2/(Math.log(l.far+1)/Math.LN2)),(N.isMeshPhongMaterial||N.isMeshToonMaterial||N.isMeshLambertMaterial||N.isMeshBasicMaterial||N.isMeshStandardMaterial||N.isShaderMaterial)&&Ye.setValue(_,"isOrthographic",l.isOrthographicCamera===!0),u!==l&&(u=l,ot=!0,Tt=!0)}if(M.isSkinnedMesh){Ye.setOptional(_,M,"bindMatrix"),Ye.setOptional(_,M,"bindMatrixInverse");const it=M.skeleton;it&&(it.boneTexture===null&&it.computeBoneTexture(),Ye.setValue(_,"boneTexture",it.boneTexture,we))}M.isBatchedMesh&&(Ye.setOptional(_,M,"batchingTexture"),Ye.setValue(_,"batchingTexture",M._matricesTexture,we),Ye.setOptional(_,M,"batchingIdTexture"),Ye.setValue(_,"batchingIdTexture",M._indirectTexture,we),Ye.setOptional(_,M,"batchingColorTexture"),M._colorsTexture!==null&&Ye.setValue(_,"batchingColorTexture",M._colorsTexture,we));const lt=I.morphAttributes;if((lt.position!==void 0||lt.normal!==void 0||lt.color!==void 0)&&le.update(M,I,at),(ot||Te.receiveShadow!==M.receiveShadow)&&(Te.receiveShadow=M.receiveShadow,Ye.setValue(_,"receiveShadow",M.receiveShadow)),N.isMeshGouraudMaterial&&N.envMap!==null&&(st.envMap.value=ce,st.flipEnvMap.value=ce.isCubeTexture&&ce.isRenderTargetTexture===!1?-1:1),N.isMeshStandardMaterial&&N.envMap===null&&E.environment!==null&&(st.envMapIntensity.value=E.environmentIntensity),ot&&(Ye.setValue(_,"toneMappingExposure",g.toneMappingExposure),Te.needsLights&&Cn(st,Tt),J&&N.fog===!0&&O.refreshFogUniforms(st,J),O.refreshMaterialUniforms(st,N,B,ne,a.state.transmissionRenderTarget[l.id]),Lt.upload(_,Yt(Te),st,we)),N.isShaderMaterial&&N.uniformsNeedUpdate===!0&&(Lt.upload(_,Yt(Te),st,we),N.uniformsNeedUpdate=!1),N.isSpriteMaterial&&Ye.setValue(_,"center",M.center),Ye.setValue(_,"modelViewMatrix",M.modelViewMatrix),Ye.setValue(_,"normalMatrix",M.normalMatrix),Ye.setValue(_,"modelMatrix",M.matrixWorld),N.isShaderMaterial||N.isRawShaderMaterial){const it=N.uniformsGroups;for(let rt=0,wt=it.length;rt<wt;rt++){const pt=it[rt];v.update(pt,at),v.bind(pt,at)}}return at}function Cn(l,E){l.ambientLightColor.needsUpdate=E,l.lightProbe.needsUpdate=E,l.directionalLights.needsUpdate=E,l.directionalLightShadows.needsUpdate=E,l.pointLights.needsUpdate=E,l.pointLightShadows.needsUpdate=E,l.spotLights.needsUpdate=E,l.spotLightShadows.needsUpdate=E,l.rectAreaLights.needsUpdate=E,l.hemisphereLights.needsUpdate=E}function bn(l){return l.isMeshLambertMaterial||l.isMeshToonMaterial||l.isMeshPhongMaterial||l.isMeshStandardMaterial||l.isShadowMaterial||l.isShaderMaterial&&l.lights===!0}this.getActiveCubeFace=function(){return L},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return H},this.setRenderTargetTextures=function(l,E,I){const N=Me.get(l);N.__autoAllocateDepthBuffer=l.resolveDepthBuffer===!1,N.__autoAllocateDepthBuffer===!1&&(N.__useRenderToTexture=!1),Me.get(l.texture).__webglTexture=E,Me.get(l.depthTexture).__webglTexture=N.__autoAllocateDepthBuffer?void 0:I,N.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(l,E){const I=Me.get(l);I.__webglFramebuffer=E,I.__useDefaultFramebuffer=E===void 0};const Pn=_.createFramebuffer();this.setRenderTarget=function(l,E=0,I=0){H=l,L=E,y=I;let N=!0,M=null,J=!1,oe=!1;if(l){const ce=Me.get(l);if(ce.__useDefaultFramebuffer!==void 0)he.bindFramebuffer(_.FRAMEBUFFER,null),N=!1;else if(ce.__webglFramebuffer===void 0)we.setupRenderTarget(l);else if(ce.__hasExternalTextures)we.rebindTextures(l,Me.get(l.texture).__webglTexture,Me.get(l.depthTexture).__webglTexture);else if(l.depthBuffer){const Ee=l.depthTexture;if(ce.__boundDepthTexture!==Ee){if(Ee!==null&&Me.has(Ee)&&(l.width!==Ee.image.width||l.height!==Ee.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");we.setupDepthRenderbuffer(l)}}const be=l.texture;(be.isData3DTexture||be.isDataArrayTexture||be.isCompressedArrayTexture)&&(oe=!0);const Pe=Me.get(l).__webglFramebuffer;l.isWebGLCubeRenderTarget?(Array.isArray(Pe[E])?M=Pe[E][I]:M=Pe[E],J=!0):l.samples>0&&we.useMultisampledRTT(l)===!1?M=Me.get(l).__webglMultisampledFramebuffer:Array.isArray(Pe)?M=Pe[I]:M=Pe,C.copy(l.viewport),K.copy(l.scissor),k=l.scissorTest}else C.copy(Ie).multiplyScalar(B).floor(),K.copy(He).multiplyScalar(B).floor(),k=Qe;if(I!==0&&(M=Pn),he.bindFramebuffer(_.FRAMEBUFFER,M)&&N&&he.drawBuffers(l,M),he.viewport(C),he.scissor(K),he.setScissorTest(k),J){const ce=Me.get(l.texture);_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_CUBE_MAP_POSITIVE_X+E,ce.__webglTexture,I)}else if(oe){const ce=Me.get(l.texture),be=E;_.framebufferTextureLayer(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,ce.__webglTexture,I,be)}else if(l!==null&&I!==0){const ce=Me.get(l.texture);_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,ce.__webglTexture,I)}h=-1},this.readRenderTargetPixels=function(l,E,I,N,M,J,oe,de=0){if(!(l&&l.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ce=Me.get(l).__webglFramebuffer;if(l.isWebGLCubeRenderTarget&&oe!==void 0&&(ce=ce[oe]),ce){he.bindFramebuffer(_.FRAMEBUFFER,ce);try{const be=l.textures[de],Pe=be.format,Ee=be.type;if(!ze.textureFormatReadable(Pe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ze.textureTypeReadable(Ee)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}E>=0&&E<=l.width-N&&I>=0&&I<=l.height-M&&(l.textures.length>1&&_.readBuffer(_.COLOR_ATTACHMENT0+de),_.readPixels(E,I,N,M,ie.convert(Pe),ie.convert(Ee),J))}finally{const be=H!==null?Me.get(H).__webglFramebuffer:null;he.bindFramebuffer(_.FRAMEBUFFER,be)}}},this.readRenderTargetPixelsAsync=async function(l,E,I,N,M,J,oe,de=0){if(!(l&&l.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ce=Me.get(l).__webglFramebuffer;if(l.isWebGLCubeRenderTarget&&oe!==void 0&&(ce=ce[oe]),ce)if(E>=0&&E<=l.width-N&&I>=0&&I<=l.height-M){he.bindFramebuffer(_.FRAMEBUFFER,ce);const be=l.textures[de],Pe=be.format,Ee=be.type;if(!ze.textureFormatReadable(Pe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ze.textureTypeReadable(Ee))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ne=_.createBuffer();_.bindBuffer(_.PIXEL_PACK_BUFFER,Ne),_.bufferData(_.PIXEL_PACK_BUFFER,J.byteLength,_.STREAM_READ),l.textures.length>1&&_.readBuffer(_.COLOR_ATTACHMENT0+de),_.readPixels(E,I,N,M,ie.convert(Pe),ie.convert(Ee),0);const ke=H!==null?Me.get(H).__webglFramebuffer:null;he.bindFramebuffer(_.FRAMEBUFFER,ke);const Je=_.fenceSync(_.SYNC_GPU_COMMANDS_COMPLETE,0);return _.flush(),await t.probeAsync(_,Je,4),_.bindBuffer(_.PIXEL_PACK_BUFFER,Ne),_.getBufferSubData(_.PIXEL_PACK_BUFFER,0,J),_.deleteBuffer(Ne),_.deleteSync(Je),J}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(l,E=null,I=0){const N=Math.pow(2,-I),M=Math.floor(l.image.width*N),J=Math.floor(l.image.height*N),oe=E!==null?E.x:0,de=E!==null?E.y:0;we.setTexture2D(l,0),_.copyTexSubImage2D(_.TEXTURE_2D,I,0,0,oe,de,M,J),he.unbindTexture()};const Ln=_.createFramebuffer(),Dn=_.createFramebuffer();this.copyTextureToTexture=function(l,E,I=null,N=null,M=0,J=null){J===null&&(M!==0?(t.warnOnce("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),J=M,M=0):J=0);let oe,de,ce,be,Pe,Ee,Ne,ke,Je;const qe=l.isCompressedTexture?l.mipmaps[J]:l.image;if(I!==null)oe=I.max.x-I.min.x,de=I.max.y-I.min.y,ce=I.isBox3?I.max.z-I.min.z:1,be=I.min.x,Pe=I.min.y,Ee=I.isBox3?I.min.z:0;else{const lt=Math.pow(2,-M);oe=Math.floor(qe.width*lt),de=Math.floor(qe.height*lt),l.isDataArrayTexture?ce=qe.depth:l.isData3DTexture?ce=Math.floor(qe.depth*lt):ce=1,be=0,Pe=0,Ee=0}N!==null?(Ne=N.x,ke=N.y,Je=N.z):(Ne=0,ke=0,Je=0);const We=ie.convert(E.format),Te=ie.convert(E.type);let Ze;E.isData3DTexture?(we.setTexture3D(E,0),Ze=_.TEXTURE_3D):E.isDataArrayTexture||E.isCompressedArrayTexture?(we.setTexture2DArray(E,0),Ze=_.TEXTURE_2D_ARRAY):(we.setTexture2D(E,0),Ze=_.TEXTURE_2D),_.pixelStorei(_.UNPACK_FLIP_Y_WEBGL,E.flipY),_.pixelStorei(_.UNPACK_PREMULTIPLY_ALPHA_WEBGL,E.premultiplyAlpha),_.pixelStorei(_.UNPACK_ALIGNMENT,E.unpackAlignment);const Fe=_.getParameter(_.UNPACK_ROW_LENGTH),at=_.getParameter(_.UNPACK_IMAGE_HEIGHT),vt=_.getParameter(_.UNPACK_SKIP_PIXELS),ot=_.getParameter(_.UNPACK_SKIP_ROWS),Tt=_.getParameter(_.UNPACK_SKIP_IMAGES);_.pixelStorei(_.UNPACK_ROW_LENGTH,qe.width),_.pixelStorei(_.UNPACK_IMAGE_HEIGHT,qe.height),_.pixelStorei(_.UNPACK_SKIP_PIXELS,be),_.pixelStorei(_.UNPACK_SKIP_ROWS,Pe),_.pixelStorei(_.UNPACK_SKIP_IMAGES,Ee);const Ye=l.isDataArrayTexture||l.isData3DTexture,st=E.isDataArrayTexture||E.isData3DTexture;if(l.isDepthTexture){const lt=Me.get(l),it=Me.get(E),rt=Me.get(lt.__renderTarget),wt=Me.get(it.__renderTarget);he.bindFramebuffer(_.READ_FRAMEBUFFER,rt.__webglFramebuffer),he.bindFramebuffer(_.DRAW_FRAMEBUFFER,wt.__webglFramebuffer);for(let pt=0;pt<ce;pt++)Ye&&(_.framebufferTextureLayer(_.READ_FRAMEBUFFER,_.COLOR_ATTACHMENT0,Me.get(l).__webglTexture,M,Ee+pt),_.framebufferTextureLayer(_.DRAW_FRAMEBUFFER,_.COLOR_ATTACHMENT0,Me.get(E).__webglTexture,J,Je+pt)),_.blitFramebuffer(be,Pe,oe,de,Ne,ke,oe,de,_.DEPTH_BUFFER_BIT,_.NEAREST);he.bindFramebuffer(_.READ_FRAMEBUFFER,null),he.bindFramebuffer(_.DRAW_FRAMEBUFFER,null)}else if(M!==0||l.isRenderTargetTexture||Me.has(l)){const lt=Me.get(l),it=Me.get(E);he.bindFramebuffer(_.READ_FRAMEBUFFER,Ln),he.bindFramebuffer(_.DRAW_FRAMEBUFFER,Dn);for(let rt=0;rt<ce;rt++)Ye?_.framebufferTextureLayer(_.READ_FRAMEBUFFER,_.COLOR_ATTACHMENT0,lt.__webglTexture,M,Ee+rt):_.framebufferTexture2D(_.READ_FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,lt.__webglTexture,M),st?_.framebufferTextureLayer(_.DRAW_FRAMEBUFFER,_.COLOR_ATTACHMENT0,it.__webglTexture,J,Je+rt):_.framebufferTexture2D(_.DRAW_FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,it.__webglTexture,J),M!==0?_.blitFramebuffer(be,Pe,oe,de,Ne,ke,oe,de,_.COLOR_BUFFER_BIT,_.NEAREST):st?_.copyTexSubImage3D(Ze,J,Ne,ke,Je+rt,be,Pe,oe,de):_.copyTexSubImage2D(Ze,J,Ne,ke,be,Pe,oe,de);he.bindFramebuffer(_.READ_FRAMEBUFFER,null),he.bindFramebuffer(_.DRAW_FRAMEBUFFER,null)}else st?l.isDataTexture||l.isData3DTexture?_.texSubImage3D(Ze,J,Ne,ke,Je,oe,de,ce,We,Te,qe.data):E.isCompressedArrayTexture?_.compressedTexSubImage3D(Ze,J,Ne,ke,Je,oe,de,ce,We,qe.data):_.texSubImage3D(Ze,J,Ne,ke,Je,oe,de,ce,We,Te,qe):l.isDataTexture?_.texSubImage2D(_.TEXTURE_2D,J,Ne,ke,oe,de,We,Te,qe.data):l.isCompressedTexture?_.compressedTexSubImage2D(_.TEXTURE_2D,J,Ne,ke,qe.width,qe.height,We,qe.data):_.texSubImage2D(_.TEXTURE_2D,J,Ne,ke,oe,de,We,Te,qe);_.pixelStorei(_.UNPACK_ROW_LENGTH,Fe),_.pixelStorei(_.UNPACK_IMAGE_HEIGHT,at),_.pixelStorei(_.UNPACK_SKIP_PIXELS,vt),_.pixelStorei(_.UNPACK_SKIP_ROWS,ot),_.pixelStorei(_.UNPACK_SKIP_IMAGES,Tt),J===0&&E.generateMipmaps&&_.generateMipmap(Ze),he.unbindTexture()},this.copyTextureToTexture3D=function(l,E,I=null,N=null,M=0){return t.warnOnce('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(l,E,I,N,M)},this.initRenderTarget=function(l){Me.get(l).__webglFramebuffer===void 0&&we.setupRenderTarget(l)},this.initTexture=function(l){l.isCubeTexture?we.setTextureCube(l,0):l.isData3DTexture?we.setTexture3D(l,0):l.isDataArrayTexture||l.isCompressedArrayTexture?we.setTexture2DArray(l,0):we.setTexture2D(l,0),he.unbindTexture()},this.resetState=function(){L=0,y=0,H=null,he.reset(),Le.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return t.WebGLCoordinateSystem}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(i){this._outputColorSpace=i;const n=this.getContext();n.drawingBufferColorSpace=t.ColorManagement._getDrawingBufferColorSpace(i),n.unpackColorSpace=t.ColorManagement._getUnpackColorSpace()}}exports.ACESFilmicToneMapping=t.ACESFilmicToneMapping;exports.AddEquation=t.AddEquation;exports.AddOperation=t.AddOperation;exports.AdditiveBlending=t.AdditiveBlending;exports.AgXToneMapping=t.AgXToneMapping;exports.AlphaFormat=t.AlphaFormat;exports.AlwaysCompare=t.AlwaysCompare;exports.AlwaysDepth=t.AlwaysDepth;exports.AlwaysStencilFunc=t.AlwaysStencilFunc;exports.AmbientLight=t.AmbientLight;exports.ArcCurve=t.ArcCurve;exports.ArrayCamera=t.ArrayCamera;exports.BackSide=t.BackSide;exports.BasicDepthPacking=t.BasicDepthPacking;exports.BasicShadowMap=t.BasicShadowMap;exports.Box3=t.Box3;exports.BoxGeometry=t.BoxGeometry;exports.BufferAttribute=t.BufferAttribute;exports.BufferGeometry=t.BufferGeometry;exports.ByteType=t.ByteType;exports.Cache=t.Cache;exports.Camera=t.Camera;exports.CatmullRomCurve3=t.CatmullRomCurve3;exports.CineonToneMapping=t.CineonToneMapping;exports.ClampToEdgeWrapping=t.ClampToEdgeWrapping;exports.Clock=t.Clock;exports.Color=t.Color;exports.ColorManagement=t.ColorManagement;exports.ConeGeometry=t.ConeGeometry;exports.ConstantAlphaFactor=t.ConstantAlphaFactor;exports.ConstantColorFactor=t.ConstantColorFactor;exports.Controls=t.Controls;exports.CubeCamera=t.CubeCamera;exports.CubeReflectionMapping=t.CubeReflectionMapping;exports.CubeRefractionMapping=t.CubeRefractionMapping;exports.CubeTexture=t.CubeTexture;exports.CubeUVReflectionMapping=t.CubeUVReflectionMapping;exports.CubicBezierCurve=t.CubicBezierCurve;exports.CubicBezierCurve3=t.CubicBezierCurve3;exports.CullFaceBack=t.CullFaceBack;exports.CullFaceFront=t.CullFaceFront;exports.CullFaceNone=t.CullFaceNone;exports.Curve=t.Curve;exports.CustomBlending=t.CustomBlending;exports.CustomToneMapping=t.CustomToneMapping;exports.CylinderGeometry=t.CylinderGeometry;exports.Data3DTexture=t.Data3DTexture;exports.DataArrayTexture=t.DataArrayTexture;exports.DataTexture=t.DataTexture;exports.DecrementStencilOp=t.DecrementStencilOp;exports.DecrementWrapStencilOp=t.DecrementWrapStencilOp;exports.DefaultLoadingManager=t.DefaultLoadingManager;exports.DepthFormat=t.DepthFormat;exports.DepthStencilFormat=t.DepthStencilFormat;exports.DepthTexture=t.DepthTexture;exports.DirectionalLight=t.DirectionalLight;exports.DoubleSide=t.DoubleSide;exports.DstAlphaFactor=t.DstAlphaFactor;exports.DstColorFactor=t.DstColorFactor;exports.DynamicDrawUsage=t.DynamicDrawUsage;exports.EllipseCurve=t.EllipseCurve;exports.EqualCompare=t.EqualCompare;exports.EqualDepth=t.EqualDepth;exports.EqualStencilFunc=t.EqualStencilFunc;exports.EquirectangularReflectionMapping=t.EquirectangularReflectionMapping;exports.EquirectangularRefractionMapping=t.EquirectangularRefractionMapping;exports.Euler=t.Euler;exports.EventDispatcher=t.EventDispatcher;exports.Float16BufferAttribute=t.Float16BufferAttribute;exports.Float32BufferAttribute=t.Float32BufferAttribute;exports.FloatType=t.FloatType;exports.FramebufferTexture=t.FramebufferTexture;exports.FrontSide=t.FrontSide;exports.Frustum=t.Frustum;exports.FrustumArray=t.FrustumArray;exports.GLSL3=t.GLSL3;exports.GreaterCompare=t.GreaterCompare;exports.GreaterDepth=t.GreaterDepth;exports.GreaterEqualCompare=t.GreaterEqualCompare;exports.GreaterEqualDepth=t.GreaterEqualDepth;exports.GreaterEqualStencilFunc=t.GreaterEqualStencilFunc;exports.GreaterStencilFunc=t.GreaterStencilFunc;exports.Group=t.Group;exports.HalfFloatType=t.HalfFloatType;exports.HemisphereLight=t.HemisphereLight;exports.ImageLoader=t.ImageLoader;exports.ImageUtils=t.ImageUtils;exports.IncrementStencilOp=t.IncrementStencilOp;exports.IncrementWrapStencilOp=t.IncrementWrapStencilOp;exports.InstancedBufferAttribute=t.InstancedBufferAttribute;exports.InstancedInterleavedBuffer=t.InstancedInterleavedBuffer;exports.IntType=t.IntType;exports.InterleavedBuffer=t.InterleavedBuffer;exports.InterleavedBufferAttribute=t.InterleavedBufferAttribute;exports.InvertStencilOp=t.InvertStencilOp;exports.KeepStencilOp=t.KeepStencilOp;exports.Layers=t.Layers;exports.LessCompare=t.LessCompare;exports.LessDepth=t.LessDepth;exports.LessEqualCompare=t.LessEqualCompare;exports.LessEqualDepth=t.LessEqualDepth;exports.LessEqualStencilFunc=t.LessEqualStencilFunc;exports.LessStencilFunc=t.LessStencilFunc;exports.Light=t.Light;exports.LightProbe=t.LightProbe;exports.Line=t.Line;exports.LineBasicMaterial=t.LineBasicMaterial;exports.LineCurve=t.LineCurve;exports.LineCurve3=t.LineCurve3;exports.LineDashedMaterial=t.LineDashedMaterial;exports.LinearFilter=t.LinearFilter;exports.LinearMipmapLinearFilter=t.LinearMipmapLinearFilter;exports.LinearMipmapNearestFilter=t.LinearMipmapNearestFilter;exports.LinearSRGBColorSpace=t.LinearSRGBColorSpace;exports.LinearToneMapping=t.LinearToneMapping;exports.LinearTransfer=t.LinearTransfer;exports.Loader=t.Loader;exports.LoadingManager=t.LoadingManager;exports.MOUSE=t.MOUSE;exports.Material=t.Material;exports.MathUtils=t.MathUtils;exports.Matrix2=t.Matrix2;exports.Matrix3=t.Matrix3;exports.Matrix4=t.Matrix4;exports.MaxEquation=t.MaxEquation;exports.Mesh=t.Mesh;exports.MeshBasicMaterial=t.MeshBasicMaterial;exports.MeshDepthMaterial=t.MeshDepthMaterial;exports.MeshDistanceMaterial=t.MeshDistanceMaterial;exports.MeshLambertMaterial=t.MeshLambertMaterial;exports.MeshMatcapMaterial=t.MeshMatcapMaterial;exports.MeshNormalMaterial=t.MeshNormalMaterial;exports.MeshPhongMaterial=t.MeshPhongMaterial;exports.MeshPhysicalMaterial=t.MeshPhysicalMaterial;exports.MeshStandardMaterial=t.MeshStandardMaterial;exports.MeshToonMaterial=t.MeshToonMaterial;exports.MinEquation=t.MinEquation;exports.MirroredRepeatWrapping=t.MirroredRepeatWrapping;exports.MixOperation=t.MixOperation;exports.MultiplyBlending=t.MultiplyBlending;exports.MultiplyOperation=t.MultiplyOperation;exports.NearestFilter=t.NearestFilter;exports.NearestMipmapLinearFilter=t.NearestMipmapLinearFilter;exports.NearestMipmapNearestFilter=t.NearestMipmapNearestFilter;exports.NeutralToneMapping=t.NeutralToneMapping;exports.NeverCompare=t.NeverCompare;exports.NeverDepth=t.NeverDepth;exports.NeverStencilFunc=t.NeverStencilFunc;exports.NoBlending=t.NoBlending;exports.NoColorSpace=t.NoColorSpace;exports.NoToneMapping=t.NoToneMapping;exports.NormalBlending=t.NormalBlending;exports.NotEqualCompare=t.NotEqualCompare;exports.NotEqualDepth=t.NotEqualDepth;exports.NotEqualStencilFunc=t.NotEqualStencilFunc;exports.Object3D=t.Object3D;exports.ObjectSpaceNormalMap=t.ObjectSpaceNormalMap;exports.OneFactor=t.OneFactor;exports.OneMinusConstantAlphaFactor=t.OneMinusConstantAlphaFactor;exports.OneMinusConstantColorFactor=t.OneMinusConstantColorFactor;exports.OneMinusDstAlphaFactor=t.OneMinusDstAlphaFactor;exports.OneMinusDstColorFactor=t.OneMinusDstColorFactor;exports.OneMinusSrcAlphaFactor=t.OneMinusSrcAlphaFactor;exports.OneMinusSrcColorFactor=t.OneMinusSrcColorFactor;exports.OrthographicCamera=t.OrthographicCamera;exports.PCFShadowMap=t.PCFShadowMap;exports.PCFSoftShadowMap=t.PCFSoftShadowMap;exports.PerspectiveCamera=t.PerspectiveCamera;exports.Plane=t.Plane;exports.PlaneGeometry=t.PlaneGeometry;exports.PointLight=t.PointLight;exports.PointsMaterial=t.PointsMaterial;exports.QuadraticBezierCurve=t.QuadraticBezierCurve;exports.QuadraticBezierCurve3=t.QuadraticBezierCurve3;exports.Quaternion=t.Quaternion;exports.RED_GREEN_RGTC2_Format=t.RED_GREEN_RGTC2_Format;exports.RED_RGTC1_Format=t.RED_RGTC1_Format;exports.REVISION=t.REVISION;exports.RGBADepthPacking=t.RGBADepthPacking;exports.RGBAFormat=t.RGBAFormat;exports.RGBAIntegerFormat=t.RGBAIntegerFormat;exports.RGBA_ASTC_10x10_Format=t.RGBA_ASTC_10x10_Format;exports.RGBA_ASTC_10x5_Format=t.RGBA_ASTC_10x5_Format;exports.RGBA_ASTC_10x6_Format=t.RGBA_ASTC_10x6_Format;exports.RGBA_ASTC_10x8_Format=t.RGBA_ASTC_10x8_Format;exports.RGBA_ASTC_12x10_Format=t.RGBA_ASTC_12x10_Format;exports.RGBA_ASTC_12x12_Format=t.RGBA_ASTC_12x12_Format;exports.RGBA_ASTC_4x4_Format=t.RGBA_ASTC_4x4_Format;exports.RGBA_ASTC_5x4_Format=t.RGBA_ASTC_5x4_Format;exports.RGBA_ASTC_5x5_Format=t.RGBA_ASTC_5x5_Format;exports.RGBA_ASTC_6x5_Format=t.RGBA_ASTC_6x5_Format;exports.RGBA_ASTC_6x6_Format=t.RGBA_ASTC_6x6_Format;exports.RGBA_ASTC_8x5_Format=t.RGBA_ASTC_8x5_Format;exports.RGBA_ASTC_8x6_Format=t.RGBA_ASTC_8x6_Format;exports.RGBA_ASTC_8x8_Format=t.RGBA_ASTC_8x8_Format;exports.RGBA_BPTC_Format=t.RGBA_BPTC_Format;exports.RGBA_ETC2_EAC_Format=t.RGBA_ETC2_EAC_Format;exports.RGBA_PVRTC_2BPPV1_Format=t.RGBA_PVRTC_2BPPV1_Format;exports.RGBA_PVRTC_4BPPV1_Format=t.RGBA_PVRTC_4BPPV1_Format;exports.RGBA_S3TC_DXT1_Format=t.RGBA_S3TC_DXT1_Format;exports.RGBA_S3TC_DXT3_Format=t.RGBA_S3TC_DXT3_Format;exports.RGBA_S3TC_DXT5_Format=t.RGBA_S3TC_DXT5_Format;exports.RGBFormat=t.RGBFormat;exports.RGBIntegerFormat=t.RGBIntegerFormat;exports.RGB_BPTC_SIGNED_Format=t.RGB_BPTC_SIGNED_Format;exports.RGB_BPTC_UNSIGNED_Format=t.RGB_BPTC_UNSIGNED_Format;exports.RGB_ETC1_Format=t.RGB_ETC1_Format;exports.RGB_ETC2_Format=t.RGB_ETC2_Format;exports.RGB_PVRTC_2BPPV1_Format=t.RGB_PVRTC_2BPPV1_Format;exports.RGB_PVRTC_4BPPV1_Format=t.RGB_PVRTC_4BPPV1_Format;exports.RGB_S3TC_DXT1_Format=t.RGB_S3TC_DXT1_Format;exports.RGFormat=t.RGFormat;exports.RGIntegerFormat=t.RGIntegerFormat;exports.Ray=t.Ray;exports.Raycaster=t.Raycaster;exports.RectAreaLight=t.RectAreaLight;exports.RedFormat=t.RedFormat;exports.RedIntegerFormat=t.RedIntegerFormat;exports.ReinhardToneMapping=t.ReinhardToneMapping;exports.RenderTarget=t.RenderTarget;exports.RepeatWrapping=t.RepeatWrapping;exports.ReplaceStencilOp=t.ReplaceStencilOp;exports.ReverseSubtractEquation=t.ReverseSubtractEquation;exports.SIGNED_RED_GREEN_RGTC2_Format=t.SIGNED_RED_GREEN_RGTC2_Format;exports.SIGNED_RED_RGTC1_Format=t.SIGNED_RED_RGTC1_Format;exports.SRGBColorSpace=t.SRGBColorSpace;exports.SRGBTransfer=t.SRGBTransfer;exports.Scene=t.Scene;exports.ShaderMaterial=t.ShaderMaterial;exports.ShadowMaterial=t.ShadowMaterial;exports.ShortType=t.ShortType;exports.Source=t.Source;exports.Sphere=t.Sphere;exports.SphereGeometry=t.SphereGeometry;exports.Spherical=t.Spherical;exports.SphericalHarmonics3=t.SphericalHarmonics3;exports.SplineCurve=t.SplineCurve;exports.SpotLight=t.SpotLight;exports.SpriteMaterial=t.SpriteMaterial;exports.SrcAlphaFactor=t.SrcAlphaFactor;exports.SrcAlphaSaturateFactor=t.SrcAlphaSaturateFactor;exports.SrcColorFactor=t.SrcColorFactor;exports.StaticDrawUsage=t.StaticDrawUsage;exports.SubtractEquation=t.SubtractEquation;exports.SubtractiveBlending=t.SubtractiveBlending;exports.TOUCH=t.TOUCH;exports.TangentSpaceNormalMap=t.TangentSpaceNormalMap;exports.Texture=t.Texture;exports.TextureLoader=t.TextureLoader;exports.Triangle=t.Triangle;exports.TubeGeometry=t.TubeGeometry;exports.UVMapping=t.UVMapping;exports.Uint16BufferAttribute=t.Uint16BufferAttribute;exports.Uint32BufferAttribute=t.Uint32BufferAttribute;exports.UniformsUtils=t.UniformsUtils;exports.UnsignedByteType=t.UnsignedByteType;exports.UnsignedInt248Type=t.UnsignedInt248Type;exports.UnsignedInt5999Type=t.UnsignedInt5999Type;exports.UnsignedIntType=t.UnsignedIntType;exports.UnsignedShort4444Type=t.UnsignedShort4444Type;exports.UnsignedShort5551Type=t.UnsignedShort5551Type;exports.UnsignedShortType=t.UnsignedShortType;exports.VSMShadowMap=t.VSMShadowMap;exports.Vector2=t.Vector2;exports.Vector3=t.Vector3;exports.Vector4=t.Vector4;exports.WebGLCoordinateSystem=t.WebGLCoordinateSystem;exports.WebGLCubeRenderTarget=t.WebGLCubeRenderTarget;exports.WebGLRenderTarget=t.WebGLRenderTarget;exports.WebGPUCoordinateSystem=t.WebGPUCoordinateSystem;exports.WebXRController=t.WebXRController;exports.ZeroFactor=t.ZeroFactor;exports.ZeroStencilOp=t.ZeroStencilOp;exports.createCanvasElement=t.createCanvasElement;exports.PMREMGenerator=Gt;exports.ShaderChunk=Ue;exports.ShaderLib=ft;exports.UniformsLib=te;exports.WebGLRenderer=ds;exports.WebGLUtils=An;