@xiping/react-components 1.0.19 → 1.0.20

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 (407) 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/react-force-graph-3d/index.d.ts +1 -0
  17. package/dist/cjs/index.js +1 -1
  18. package/dist/cjs/node_modules/.pnpm/3d-force-graph@1.77.0/node_modules/3d-force-graph/dist/3d-force-graph.js +28 -0
  19. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +1 -0
  20. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/construct.js +1 -0
  21. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js +1 -0
  22. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +1 -0
  23. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +1 -0
  24. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +1 -0
  25. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +1 -0
  26. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +1 -0
  27. package/dist/cjs/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +1 -0
  28. package/dist/cjs/node_modules/.pnpm/@tweenjs_tween.js@23.1.3/node_modules/@tweenjs/tween.js/dist/tween.esm.js +1 -0
  29. package/dist/cjs/node_modules/.pnpm/accessor-fn@1.5.3/node_modules/accessor-fn/dist/accessor-fn.js +1 -0
  30. package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/ascending.js +1 -0
  31. package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisect.js +1 -0
  32. package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisector.js +1 -0
  33. package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/max.js +1 -0
  34. package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/min.js +1 -0
  35. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/add.js +1 -0
  36. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/binarytree.js +1 -0
  37. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/cover.js +1 -0
  38. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/data.js +1 -0
  39. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/extent.js +1 -0
  40. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/find.js +1 -0
  41. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/half.js +1 -0
  42. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/remove.js +1 -0
  43. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/root.js +1 -0
  44. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/size.js +1 -0
  45. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/visit.js +1 -0
  46. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/visitAfter.js +1 -0
  47. package/dist/cjs/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/x.js +1 -0
  48. package/dist/cjs/node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js +1 -0
  49. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/center.js +1 -0
  50. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/constant.js +1 -0
  51. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/jiggle.js +1 -0
  52. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/lcg.js +1 -0
  53. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/link.js +1 -0
  54. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/manyBody.js +1 -0
  55. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/radial.js +1 -0
  56. package/dist/cjs/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/simulation.js +1 -0
  57. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/add.js +1 -0
  58. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/cover.js +1 -0
  59. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/data.js +1 -0
  60. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/extent.js +1 -0
  61. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/find.js +1 -0
  62. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/findAll.js +1 -0
  63. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/octant.js +1 -0
  64. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/octree.js +1 -0
  65. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/remove.js +1 -0
  66. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/root.js +1 -0
  67. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/size.js +1 -0
  68. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/visit.js +1 -0
  69. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/visitAfter.js +1 -0
  70. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/x.js +1 -0
  71. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/y.js +1 -0
  72. package/dist/cjs/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/z.js +1 -0
  73. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/add.js +1 -0
  74. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/cover.js +1 -0
  75. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/data.js +1 -0
  76. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/extent.js +1 -0
  77. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/find.js +1 -0
  78. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/quad.js +1 -0
  79. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/quadtree.js +1 -0
  80. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/remove.js +1 -0
  81. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/root.js +1 -0
  82. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/size.js +1 -0
  83. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/visit.js +1 -0
  84. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/visitAfter.js +1 -0
  85. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/x.js +1 -0
  86. package/dist/cjs/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/y.js +1 -0
  87. package/dist/cjs/node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Paired.js +1 -0
  88. package/dist/cjs/node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/colors.js +1 -0
  89. package/dist/cjs/node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/init.js +1 -0
  90. package/dist/cjs/node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js +1 -0
  91. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/array.js +1 -0
  92. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/constant.js +1 -0
  93. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/creator.js +1 -0
  94. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/matcher.js +1 -0
  95. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespace.js +1 -0
  96. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespaces.js +1 -0
  97. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/pointer.js +1 -0
  98. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/select.js +1 -0
  99. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/append.js +1 -0
  100. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/attr.js +1 -0
  101. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/call.js +1 -0
  102. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/classed.js +1 -0
  103. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/clone.js +1 -0
  104. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/data.js +1 -0
  105. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/datum.js +1 -0
  106. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/dispatch.js +1 -0
  107. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/each.js +1 -0
  108. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/empty.js +1 -0
  109. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/enter.js +1 -0
  110. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/exit.js +1 -0
  111. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/filter.js +1 -0
  112. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/html.js +1 -0
  113. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/index.js +1 -0
  114. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/insert.js +1 -0
  115. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/iterator.js +1 -0
  116. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/join.js +1 -0
  117. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/lower.js +1 -0
  118. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/merge.js +1 -0
  119. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/node.js +1 -0
  120. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/nodes.js +1 -0
  121. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/on.js +1 -0
  122. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/order.js +1 -0
  123. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/property.js +1 -0
  124. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/raise.js +1 -0
  125. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/remove.js +1 -0
  126. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/select.js +1 -0
  127. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectAll.js +1 -0
  128. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChild.js +1 -0
  129. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChildren.js +1 -0
  130. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/size.js +1 -0
  131. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sort.js +1 -0
  132. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sparse.js +1 -0
  133. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/style.js +1 -0
  134. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/text.js +1 -0
  135. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selector.js +1 -0
  136. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selectorAll.js +1 -0
  137. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/sourceEvent.js +1 -0
  138. package/dist/cjs/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/window.js +1 -0
  139. package/dist/cjs/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js +1 -0
  140. package/dist/cjs/node_modules/.pnpm/data-bind-mapper@1.0.3/node_modules/data-bind-mapper/dist/data-bind-mapper.js +3 -0
  141. package/dist/cjs/node_modules/.pnpm/float-tooltip@1.7.5/node_modules/float-tooltip/dist/float-tooltip.js +13 -0
  142. package/dist/cjs/node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js +1 -0
  143. package/dist/cjs/node_modules/.pnpm/jerrypick@1.1.2/node_modules/jerrypick/dist/jerrypick.js +3 -0
  144. package/dist/cjs/node_modules/.pnpm/kapsule@1.16.3/node_modules/kapsule/dist/kapsule.js +2 -0
  145. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +1 -0
  146. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +1 -0
  147. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js +1 -0
  148. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +1 -0
  149. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +1 -0
  150. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +1 -0
  151. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +1 -0
  152. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js +1 -0
  153. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js +1 -0
  154. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +1 -0
  155. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js +1 -0
  156. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js +1 -0
  157. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/now.js +1 -0
  158. package/dist/cjs/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js +1 -0
  159. package/dist/cjs/node_modules/.pnpm/ngraph.events@1.2.2/node_modules/ngraph.events/index.js +1 -0
  160. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/index.js +1 -0
  161. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/createPatternBuilder.js +2 -0
  162. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateBounds.js +55 -0
  163. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateBody.js +47 -0
  164. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateDragForce.js +9 -0
  165. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateSpringForce.js +33 -0
  166. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateIntegrator.js +35 -0
  167. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateQuadTree.js +325 -0
  168. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/getVariableName.js +1 -0
  169. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/createPhysicsSimulator.js +1 -0
  170. package/dist/cjs/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/spring.js +1 -0
  171. package/dist/cjs/node_modules/.pnpm/ngraph.graph@20.0.1/node_modules/ngraph.graph/index.js +3 -0
  172. package/dist/cjs/node_modules/.pnpm/ngraph.merge@1.0.0/node_modules/ngraph.merge/index.js +1 -0
  173. package/dist/cjs/node_modules/.pnpm/ngraph.random@1.2.0/node_modules/ngraph.random/index.js +1 -0
  174. package/dist/cjs/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +5 -0
  175. package/dist/cjs/node_modules/.pnpm/polished@4.3.1/node_modules/polished/dist/polished.esm.js +149 -0
  176. package/dist/cjs/node_modules/.pnpm/preact@10.26.9/node_modules/preact/dist/preact.module.js +1 -0
  177. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/checkPropTypes.js +1 -0
  178. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js +1 -0
  179. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js +2 -0
  180. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -0
  181. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js +1 -0
  182. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/has.js +1 -0
  183. package/dist/cjs/node_modules/.pnpm/react-force-graph-3d@1.27.0_react@18.3.1/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +1 -0
  184. package/dist/cjs/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +8 -0
  185. package/dist/cjs/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +8 -0
  186. package/dist/cjs/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +1 -0
  187. package/dist/cjs/node_modules/.pnpm/react-kapsule@2.5.7_react@18.3.1/node_modules/react-kapsule/dist/react-kapsule.js +3 -0
  188. package/dist/cjs/node_modules/.pnpm/three-forcegraph@1.42.13_three@0.171.0/node_modules/three-forcegraph/dist/three-forcegraph.js +3 -0
  189. package/dist/cjs/node_modules/.pnpm/three-render-objects@1.40.2_three@0.171.0/node_modules/three-render-objects/dist/three-render-objects.js +18 -0
  190. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.core.js +44 -0
  191. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.module.js +3789 -0
  192. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.webgpu.js +373 -0
  193. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/DragControls.js +1 -0
  194. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/FlyControls.js +1 -0
  195. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -0
  196. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/TrackballControls.js +1 -0
  197. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/EffectComposer.js +1 -0
  198. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/MaskPass.js +1 -0
  199. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/Pass.js +1 -0
  200. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/RenderPass.js +1 -0
  201. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +1 -0
  202. package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/shaders/CopyShader.js +24 -0
  203. package/dist/cjs/node_modules/.pnpm/tinycolor2@1.6.0/node_modules/tinycolor2/esm/tinycolor.js +1 -0
  204. package/dist/es/_virtual/generateBounds.js +4 -0
  205. package/dist/es/_virtual/generateCreateBody.js +4 -0
  206. package/dist/es/_virtual/generateCreateDragForce.js +4 -0
  207. package/dist/es/_virtual/generateCreateSpringForce.js +4 -0
  208. package/dist/es/_virtual/generateIntegrator.js +4 -0
  209. package/dist/es/_virtual/generateQuadTree.js +4 -0
  210. package/dist/es/_virtual/index.js +7 -0
  211. package/dist/es/_virtual/index2.js +4 -0
  212. package/dist/es/_virtual/index3.js +4 -0
  213. package/dist/es/_virtual/index4.js +7 -0
  214. package/dist/es/_virtual/index5.js +7 -0
  215. package/dist/es/_virtual/index6.js +4 -0
  216. package/dist/es/_virtual/index7.js +4 -0
  217. package/dist/es/_virtual/react-is.development.js +4 -0
  218. package/dist/es/_virtual/react-is.production.min.js +4 -0
  219. package/dist/es/components/react-force-graph-3d/index.d.ts +1 -0
  220. package/dist/es/index.js +12 -10
  221. package/dist/es/node_modules/.pnpm/3d-force-graph@1.77.0/node_modules/3d-force-graph/dist/3d-force-graph.js +398 -0
  222. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +7 -0
  223. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/construct.js +12 -0
  224. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
  225. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +8 -0
  226. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
  227. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +10 -0
  228. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +13 -0
  229. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
  230. package/dist/es/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +29 -0
  231. package/dist/es/node_modules/.pnpm/@tweenjs_tween.js@23.1.3/node_modules/@tweenjs/tween.js/dist/tween.esm.js +379 -0
  232. package/dist/es/node_modules/.pnpm/accessor-fn@1.5.3/node_modules/accessor-fn/dist/accessor-fn.js +10 -0
  233. package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/ascending.js +6 -0
  234. package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisect.js +3 -0
  235. package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisector.js +27 -0
  236. package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/max.js +17 -0
  237. package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/min.js +17 -0
  238. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/add.js +32 -0
  239. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/binarytree.js +48 -0
  240. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/cover.js +22 -0
  241. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/data.js +11 -0
  242. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/extent.js +6 -0
  243. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/find.js +20 -0
  244. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/half.js +6 -0
  245. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/remove.js +20 -0
  246. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/root.js +6 -0
  247. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/size.js +11 -0
  248. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/visit.js +13 -0
  249. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/visitAfter.js +18 -0
  250. package/dist/es/node_modules/.pnpm/d3-binarytree@1.0.2/node_modules/d3-binarytree/src/x.js +10 -0
  251. package/dist/es/node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js +64 -0
  252. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/center.js +25 -0
  253. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/constant.js +8 -0
  254. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/jiggle.js +6 -0
  255. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/lcg.js +7 -0
  256. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/link.js +58 -0
  257. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/manyBody.js +58 -0
  258. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/radial.js +34 -0
  259. package/dist/es/node_modules/.pnpm/d3-force-3d@3.0.6/node_modules/d3-force-3d/src/simulation.js +95 -0
  260. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/add.js +32 -0
  261. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/cover.js +40 -0
  262. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/data.js +11 -0
  263. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/extent.js +6 -0
  264. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/find.js +29 -0
  265. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/findAll.js +15 -0
  266. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/octant.js +6 -0
  267. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/octree.js +54 -0
  268. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/remove.js +20 -0
  269. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/root.js +6 -0
  270. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/size.js +11 -0
  271. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/visit.js +13 -0
  272. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/visitAfter.js +18 -0
  273. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/x.js +10 -0
  274. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/y.js +10 -0
  275. package/dist/es/node_modules/.pnpm/d3-octree@1.1.0/node_modules/d3-octree/src/z.js +10 -0
  276. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/add.js +29 -0
  277. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/cover.js +28 -0
  278. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/data.js +11 -0
  279. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/extent.js +6 -0
  280. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/find.js +25 -0
  281. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/quad.js +6 -0
  282. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/quadtree.js +50 -0
  283. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/remove.js +20 -0
  284. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/root.js +6 -0
  285. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/size.js +11 -0
  286. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/visit.js +13 -0
  287. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/visitAfter.js +18 -0
  288. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/x.js +10 -0
  289. package/dist/es/node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/y.js +10 -0
  290. package/dist/es/node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Paired.js +5 -0
  291. package/dist/es/node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/colors.js +7 -0
  292. package/dist/es/node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/init.js +16 -0
  293. package/dist/es/node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js +31 -0
  294. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/array.js +6 -0
  295. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/constant.js +8 -0
  296. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/creator.js +20 -0
  297. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/matcher.js +14 -0
  298. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespace.js +8 -0
  299. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespaces.js +12 -0
  300. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/pointer.js +18 -0
  301. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/select.js +7 -0
  302. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/append.js +10 -0
  303. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/attr.js +44 -0
  304. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/call.js +7 -0
  305. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/classed.js +54 -0
  306. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/clone.js +14 -0
  307. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/data.js +42 -0
  308. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/datum.js +6 -0
  309. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/dispatch.js +21 -0
  310. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/each.js +9 -0
  311. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/empty.js +6 -0
  312. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/enter.js +27 -0
  313. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/exit.js +8 -0
  314. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/filter.js +12 -0
  315. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/html.js +20 -0
  316. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/index.js +83 -0
  317. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/insert.js +14 -0
  318. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/iterator.js +8 -0
  319. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/join.js +7 -0
  320. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/lower.js +9 -0
  321. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/merge.js +12 -0
  322. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/node.js +11 -0
  323. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/nodes.js +6 -0
  324. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/on.js +52 -0
  325. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/order.js +9 -0
  326. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/property.js +22 -0
  327. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/raise.js +9 -0
  328. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/remove.js +10 -0
  329. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/select.js +12 -0
  330. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectAll.js +18 -0
  331. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChild.js +16 -0
  332. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChildren.js +16 -0
  333. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/size.js +8 -0
  334. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sort.js +19 -0
  335. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sparse.js +6 -0
  336. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/style.js +27 -0
  337. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/text.js +20 -0
  338. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selector.js +10 -0
  339. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selectorAll.js +11 -0
  340. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/sourceEvent.js +8 -0
  341. package/dist/es/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/window.js +6 -0
  342. package/dist/es/node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js +62 -0
  343. package/dist/es/node_modules/.pnpm/data-bind-mapper@1.0.3/node_modules/data-bind-mapper/dist/data-bind-mapper.js +173 -0
  344. package/dist/es/node_modules/.pnpm/float-tooltip@1.7.5/node_modules/float-tooltip/dist/float-tooltip.js +169 -0
  345. package/dist/es/node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js +35 -0
  346. package/dist/es/node_modules/.pnpm/jerrypick@1.1.2/node_modules/jerrypick/dist/jerrypick.js +92 -0
  347. package/dist/es/node_modules/.pnpm/kapsule@1.16.3/node_modules/kapsule/dist/kapsule.js +113 -0
  348. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +5 -0
  349. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +10 -0
  350. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js +8 -0
  351. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +4 -0
  352. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +15 -0
  353. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +7 -0
  354. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +5 -0
  355. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js +9 -0
  356. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js +54 -0
  357. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +7 -0
  358. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js +6 -0
  359. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js +9 -0
  360. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/now.js +7 -0
  361. package/dist/es/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js +22 -0
  362. package/dist/es/node_modules/.pnpm/ngraph.events@1.2.2/node_modules/ngraph.events/index.js +57 -0
  363. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/index.js +239 -0
  364. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/createPatternBuilder.js +22 -0
  365. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateBounds.js +74 -0
  366. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateBody.js +74 -0
  367. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateDragForce.js +28 -0
  368. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateCreateSpringForce.js +53 -0
  369. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateIntegrator.js +55 -0
  370. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/generateQuadTree.js +403 -0
  371. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/codeGenerators/getVariableName.js +9 -0
  372. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/createPhysicsSimulator.js +273 -0
  373. package/dist/es/node_modules/.pnpm/ngraph.forcelayout@3.3.1/node_modules/ngraph.forcelayout/lib/spring.js +12 -0
  374. package/dist/es/node_modules/.pnpm/ngraph.graph@20.0.1/node_modules/ngraph.graph/index.js +319 -0
  375. package/dist/es/node_modules/.pnpm/ngraph.merge@1.0.0/node_modules/ngraph.merge/index.js +20 -0
  376. package/dist/es/node_modules/.pnpm/ngraph.random@1.2.0/node_modules/ngraph.random/index.js +71 -0
  377. package/dist/es/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +54 -0
  378. package/dist/es/node_modules/.pnpm/polished@4.3.1/node_modules/polished/dist/polished.esm.js +717 -0
  379. package/dist/es/node_modules/.pnpm/preact@10.26.9/node_modules/preact/dist/preact.module.js +257 -0
  380. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/checkPropTypes.js +54 -0
  381. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js +52 -0
  382. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js +329 -0
  383. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +17 -0
  384. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js +10 -0
  385. package/dist/es/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/has.js +7 -0
  386. package/dist/es/node_modules/.pnpm/react-force-graph-3d@1.27.0_react@18.3.1/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +145 -0
  387. package/dist/es/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +95 -0
  388. package/dist/es/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +78 -0
  389. package/dist/es/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +10 -0
  390. package/dist/es/node_modules/.pnpm/react-kapsule@2.5.7_react@18.3.1/node_modules/react-kapsule/dist/react-kapsule.js +113 -0
  391. package/dist/es/node_modules/.pnpm/three-forcegraph@1.42.13_three@0.171.0/node_modules/three-forcegraph/dist/three-forcegraph.js +1020 -0
  392. package/dist/es/node_modules/.pnpm/three-render-objects@1.40.2_three@0.171.0/node_modules/three-render-objects/dist/three-render-objects.js +453 -0
  393. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.core.js +6662 -0
  394. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.module.js +9671 -0
  395. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.webgpu.js +13421 -0
  396. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/DragControls.js +109 -0
  397. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/FlyControls.js +182 -0
  398. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/OrbitControls.js +422 -0
  399. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/TrackballControls.js +211 -0
  400. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/EffectComposer.js +77 -0
  401. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/MaskPass.js +24 -0
  402. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/Pass.js +42 -0
  403. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/RenderPass.js +17 -0
  404. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +23 -0
  405. package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/shaders/CopyShader.js +41 -0
  406. package/dist/es/node_modules/.pnpm/tinycolor2@1.6.0/node_modules/tinycolor2/esm/tinycolor.js +711 -0
  407. package/package.json +2 -2
@@ -0,0 +1,3789 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./three.core.js");/**
2
+ * @license
3
+ * Copyright 2010-2024 Three.js Authors
4
+ * SPDX-License-Identifier: MIT
5
+ */function En(){let e=null,i=!1,n=null,r=null;function c(s,_){n(s,_),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 S=d.array,P=d.usage,C=S.byteLength,E=e.createBuffer();e.bindBuffer(b,E),e.bufferData(b,S,P),d.onUploadCallback();let A;if(S instanceof Float32Array)A=e.FLOAT;else if(S instanceof Uint16Array)d.isFloat16BufferAttribute?A=e.HALF_FLOAT:A=e.UNSIGNED_SHORT;else if(S instanceof Int16Array)A=e.SHORT;else if(S instanceof Uint32Array)A=e.UNSIGNED_INT;else if(S instanceof Int32Array)A=e.INT;else if(S instanceof Int8Array)A=e.BYTE;else if(S instanceof Uint8Array)A=e.UNSIGNED_BYTE;else if(S instanceof Uint8ClampedArray)A=e.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+S);return{buffer:E,type:A,bytesPerElement:S.BYTES_PER_ELEMENT,version:d.version,size:C}}function r(d,b,S){const P=b.array,C=b.updateRanges;if(e.bindBuffer(S,d),C.length===0)e.bufferSubData(S,0,P);else{C.sort((A,F)=>A.start-F.start);let E=0;for(let A=1;A<C.length;A++){const F=C[E],L=C[A];L.start<=F.start+F.count+1?F.count=Math.max(F.count,L.start+L.count-F.start):(++E,C[E]=L)}C.length=E+1;for(let A=0,F=C.length;A<F;A++){const L=C[A];e.bufferSubData(S,L.start*P.BYTES_PER_ELEMENT,P,L.start,L.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 _(d,b){if(d.isInterleavedBufferAttribute&&(d=d.data),d.isGLBufferAttribute){const P=i.get(d);(!P||P.version<d.version)&&i.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}const S=i.get(d);if(S===void 0)i.set(d,n(d,b));else if(S.version<d.version){if(S.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(S.buffer,d,b),S.version=d.version}}return{get:c,remove:s,update:_}}var wn=`#ifdef USE_ALPHAHASH
6
+ if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
7
+ #endif`,yn=`#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`,In=`#ifdef USE_ALPHAMAP
43
+ diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
44
+ #endif`,Nn=`#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`,Vn=`#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`,Hn=`#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`,di=`#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`,ui=`#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`,_i=`#ifdef USE_FOG
587
+ vFogDepth = - mvPosition.z;
588
+ #endif`,mi=`#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`,yi=`#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`,Ii=`#if defined( USE_LOGDEPTHBUF )
1347
+ gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1348
+ #endif`,Ni=`#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`,Vi=`#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`,Hi=`#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`,dr=`float roughnessFactor = roughness;
1646
+ #ifdef USE_ROUGHNESSMAP
1647
+ vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1648
+ roughnessFactor *= texelRoughness.g;
1649
+ #endif`,ur=`#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`,_r=`#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`,mr=`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
+
2211
+ vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2212
+ vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2213
+ refractionCoords += 1.0;
2214
+ refractionCoords /= 2.0;
2215
+
2216
+ vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2217
+ transmittedLight[ i ] = transmissionSample[ i ];
2218
+ transmittedLight.a += transmissionSample.a;
2219
+ transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2220
+ }
2221
+ transmittedLight.a /= 3.0;
2222
+
2223
+ #else
2224
+
2225
+ vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2226
+ vec3 refractedRayExit = position + transmissionRay;
2227
+ vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2228
+ vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2229
+ refractionCoords += 1.0;
2230
+ refractionCoords /= 2.0;
2231
+ transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2232
+ transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2233
+
2234
+ #endif
2235
+ vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2236
+ vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2237
+ float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2238
+ return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2239
+ }
2240
+ #endif`,br=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2241
+ varying vec2 vUv;
2242
+ #endif
2243
+ #ifdef USE_MAP
2244
+ varying vec2 vMapUv;
2245
+ #endif
2246
+ #ifdef USE_ALPHAMAP
2247
+ varying vec2 vAlphaMapUv;
2248
+ #endif
2249
+ #ifdef USE_LIGHTMAP
2250
+ varying vec2 vLightMapUv;
2251
+ #endif
2252
+ #ifdef USE_AOMAP
2253
+ varying vec2 vAoMapUv;
2254
+ #endif
2255
+ #ifdef USE_BUMPMAP
2256
+ varying vec2 vBumpMapUv;
2257
+ #endif
2258
+ #ifdef USE_NORMALMAP
2259
+ varying vec2 vNormalMapUv;
2260
+ #endif
2261
+ #ifdef USE_EMISSIVEMAP
2262
+ varying vec2 vEmissiveMapUv;
2263
+ #endif
2264
+ #ifdef USE_METALNESSMAP
2265
+ varying vec2 vMetalnessMapUv;
2266
+ #endif
2267
+ #ifdef USE_ROUGHNESSMAP
2268
+ varying vec2 vRoughnessMapUv;
2269
+ #endif
2270
+ #ifdef USE_ANISOTROPYMAP
2271
+ varying vec2 vAnisotropyMapUv;
2272
+ #endif
2273
+ #ifdef USE_CLEARCOATMAP
2274
+ varying vec2 vClearcoatMapUv;
2275
+ #endif
2276
+ #ifdef USE_CLEARCOAT_NORMALMAP
2277
+ varying vec2 vClearcoatNormalMapUv;
2278
+ #endif
2279
+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP
2280
+ varying vec2 vClearcoatRoughnessMapUv;
2281
+ #endif
2282
+ #ifdef USE_IRIDESCENCEMAP
2283
+ varying vec2 vIridescenceMapUv;
2284
+ #endif
2285
+ #ifdef USE_IRIDESCENCE_THICKNESSMAP
2286
+ varying vec2 vIridescenceThicknessMapUv;
2287
+ #endif
2288
+ #ifdef USE_SHEEN_COLORMAP
2289
+ varying vec2 vSheenColorMapUv;
2290
+ #endif
2291
+ #ifdef USE_SHEEN_ROUGHNESSMAP
2292
+ varying vec2 vSheenRoughnessMapUv;
2293
+ #endif
2294
+ #ifdef USE_SPECULARMAP
2295
+ varying vec2 vSpecularMapUv;
2296
+ #endif
2297
+ #ifdef USE_SPECULAR_COLORMAP
2298
+ varying vec2 vSpecularColorMapUv;
2299
+ #endif
2300
+ #ifdef USE_SPECULAR_INTENSITYMAP
2301
+ varying vec2 vSpecularIntensityMapUv;
2302
+ #endif
2303
+ #ifdef USE_TRANSMISSIONMAP
2304
+ uniform mat3 transmissionMapTransform;
2305
+ varying vec2 vTransmissionMapUv;
2306
+ #endif
2307
+ #ifdef USE_THICKNESSMAP
2308
+ uniform mat3 thicknessMapTransform;
2309
+ varying vec2 vThicknessMapUv;
2310
+ #endif`,Pr=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2311
+ varying vec2 vUv;
2312
+ #endif
2313
+ #ifdef USE_MAP
2314
+ uniform mat3 mapTransform;
2315
+ varying vec2 vMapUv;
2316
+ #endif
2317
+ #ifdef USE_ALPHAMAP
2318
+ uniform mat3 alphaMapTransform;
2319
+ varying vec2 vAlphaMapUv;
2320
+ #endif
2321
+ #ifdef USE_LIGHTMAP
2322
+ uniform mat3 lightMapTransform;
2323
+ varying vec2 vLightMapUv;
2324
+ #endif
2325
+ #ifdef USE_AOMAP
2326
+ uniform mat3 aoMapTransform;
2327
+ varying vec2 vAoMapUv;
2328
+ #endif
2329
+ #ifdef USE_BUMPMAP
2330
+ uniform mat3 bumpMapTransform;
2331
+ varying vec2 vBumpMapUv;
2332
+ #endif
2333
+ #ifdef USE_NORMALMAP
2334
+ uniform mat3 normalMapTransform;
2335
+ varying vec2 vNormalMapUv;
2336
+ #endif
2337
+ #ifdef USE_DISPLACEMENTMAP
2338
+ uniform mat3 displacementMapTransform;
2339
+ varying vec2 vDisplacementMapUv;
2340
+ #endif
2341
+ #ifdef USE_EMISSIVEMAP
2342
+ uniform mat3 emissiveMapTransform;
2343
+ varying vec2 vEmissiveMapUv;
2344
+ #endif
2345
+ #ifdef USE_METALNESSMAP
2346
+ uniform mat3 metalnessMapTransform;
2347
+ varying vec2 vMetalnessMapUv;
2348
+ #endif
2349
+ #ifdef USE_ROUGHNESSMAP
2350
+ uniform mat3 roughnessMapTransform;
2351
+ varying vec2 vRoughnessMapUv;
2352
+ #endif
2353
+ #ifdef USE_ANISOTROPYMAP
2354
+ uniform mat3 anisotropyMapTransform;
2355
+ varying vec2 vAnisotropyMapUv;
2356
+ #endif
2357
+ #ifdef USE_CLEARCOATMAP
2358
+ uniform mat3 clearcoatMapTransform;
2359
+ varying vec2 vClearcoatMapUv;
2360
+ #endif
2361
+ #ifdef USE_CLEARCOAT_NORMALMAP
2362
+ uniform mat3 clearcoatNormalMapTransform;
2363
+ varying vec2 vClearcoatNormalMapUv;
2364
+ #endif
2365
+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP
2366
+ uniform mat3 clearcoatRoughnessMapTransform;
2367
+ varying vec2 vClearcoatRoughnessMapUv;
2368
+ #endif
2369
+ #ifdef USE_SHEEN_COLORMAP
2370
+ uniform mat3 sheenColorMapTransform;
2371
+ varying vec2 vSheenColorMapUv;
2372
+ #endif
2373
+ #ifdef USE_SHEEN_ROUGHNESSMAP
2374
+ uniform mat3 sheenRoughnessMapTransform;
2375
+ varying vec2 vSheenRoughnessMapUv;
2376
+ #endif
2377
+ #ifdef USE_IRIDESCENCEMAP
2378
+ uniform mat3 iridescenceMapTransform;
2379
+ varying vec2 vIridescenceMapUv;
2380
+ #endif
2381
+ #ifdef USE_IRIDESCENCE_THICKNESSMAP
2382
+ uniform mat3 iridescenceThicknessMapTransform;
2383
+ varying vec2 vIridescenceThicknessMapUv;
2384
+ #endif
2385
+ #ifdef USE_SPECULARMAP
2386
+ uniform mat3 specularMapTransform;
2387
+ varying vec2 vSpecularMapUv;
2388
+ #endif
2389
+ #ifdef USE_SPECULAR_COLORMAP
2390
+ uniform mat3 specularColorMapTransform;
2391
+ varying vec2 vSpecularColorMapUv;
2392
+ #endif
2393
+ #ifdef USE_SPECULAR_INTENSITYMAP
2394
+ uniform mat3 specularIntensityMapTransform;
2395
+ varying vec2 vSpecularIntensityMapUv;
2396
+ #endif
2397
+ #ifdef USE_TRANSMISSIONMAP
2398
+ uniform mat3 transmissionMapTransform;
2399
+ varying vec2 vTransmissionMapUv;
2400
+ #endif
2401
+ #ifdef USE_THICKNESSMAP
2402
+ uniform mat3 thicknessMapTransform;
2403
+ varying vec2 vThicknessMapUv;
2404
+ #endif`,Lr=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2405
+ vUv = vec3( uv, 1 ).xy;
2406
+ #endif
2407
+ #ifdef USE_MAP
2408
+ vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2409
+ #endif
2410
+ #ifdef USE_ALPHAMAP
2411
+ vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2412
+ #endif
2413
+ #ifdef USE_LIGHTMAP
2414
+ vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2415
+ #endif
2416
+ #ifdef USE_AOMAP
2417
+ vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2418
+ #endif
2419
+ #ifdef USE_BUMPMAP
2420
+ vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2421
+ #endif
2422
+ #ifdef USE_NORMALMAP
2423
+ vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2424
+ #endif
2425
+ #ifdef USE_DISPLACEMENTMAP
2426
+ vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2427
+ #endif
2428
+ #ifdef USE_EMISSIVEMAP
2429
+ vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2430
+ #endif
2431
+ #ifdef USE_METALNESSMAP
2432
+ vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2433
+ #endif
2434
+ #ifdef USE_ROUGHNESSMAP
2435
+ vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2436
+ #endif
2437
+ #ifdef USE_ANISOTROPYMAP
2438
+ vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2439
+ #endif
2440
+ #ifdef USE_CLEARCOATMAP
2441
+ vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2442
+ #endif
2443
+ #ifdef USE_CLEARCOAT_NORMALMAP
2444
+ vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2445
+ #endif
2446
+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP
2447
+ vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2448
+ #endif
2449
+ #ifdef USE_IRIDESCENCEMAP
2450
+ vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2451
+ #endif
2452
+ #ifdef USE_IRIDESCENCE_THICKNESSMAP
2453
+ vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2454
+ #endif
2455
+ #ifdef USE_SHEEN_COLORMAP
2456
+ vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2457
+ #endif
2458
+ #ifdef USE_SHEEN_ROUGHNESSMAP
2459
+ vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2460
+ #endif
2461
+ #ifdef USE_SPECULARMAP
2462
+ vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2463
+ #endif
2464
+ #ifdef USE_SPECULAR_COLORMAP
2465
+ vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2466
+ #endif
2467
+ #ifdef USE_SPECULAR_INTENSITYMAP
2468
+ vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2469
+ #endif
2470
+ #ifdef USE_TRANSMISSIONMAP
2471
+ vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2472
+ #endif
2473
+ #ifdef USE_THICKNESSMAP
2474
+ vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2475
+ #endif`,Dr=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2476
+ vec4 worldPosition = vec4( transformed, 1.0 );
2477
+ #ifdef USE_BATCHING
2478
+ worldPosition = batchingMatrix * worldPosition;
2479
+ #endif
2480
+ #ifdef USE_INSTANCING
2481
+ worldPosition = instanceMatrix * worldPosition;
2482
+ #endif
2483
+ worldPosition = modelMatrix * worldPosition;
2484
+ #endif`;const Ur=`varying vec2 vUv;
2485
+ uniform mat3 uvTransform;
2486
+ void main() {
2487
+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2488
+ gl_Position = vec4( position.xy, 1.0, 1.0 );
2489
+ }`,wr=`uniform sampler2D t2D;
2490
+ uniform float backgroundIntensity;
2491
+ varying vec2 vUv;
2492
+ void main() {
2493
+ vec4 texColor = texture2D( t2D, vUv );
2494
+ #ifdef DECODE_VIDEO_TEXTURE
2495
+ 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 );
2496
+ #endif
2497
+ texColor.rgb *= backgroundIntensity;
2498
+ gl_FragColor = texColor;
2499
+ #include <tonemapping_fragment>
2500
+ #include <colorspace_fragment>
2501
+ }`,yr=`varying vec3 vWorldDirection;
2502
+ #include <common>
2503
+ void main() {
2504
+ vWorldDirection = transformDirection( position, modelMatrix );
2505
+ #include <begin_vertex>
2506
+ #include <project_vertex>
2507
+ gl_Position.z = gl_Position.w;
2508
+ }`,Ir=`#ifdef ENVMAP_TYPE_CUBE
2509
+ uniform samplerCube envMap;
2510
+ #elif defined( ENVMAP_TYPE_CUBE_UV )
2511
+ uniform sampler2D envMap;
2512
+ #endif
2513
+ uniform float flipEnvMap;
2514
+ uniform float backgroundBlurriness;
2515
+ uniform float backgroundIntensity;
2516
+ uniform mat3 backgroundRotation;
2517
+ varying vec3 vWorldDirection;
2518
+ #include <cube_uv_reflection_fragment>
2519
+ void main() {
2520
+ #ifdef ENVMAP_TYPE_CUBE
2521
+ vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2522
+ #elif defined( ENVMAP_TYPE_CUBE_UV )
2523
+ vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2524
+ #else
2525
+ vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2526
+ #endif
2527
+ texColor.rgb *= backgroundIntensity;
2528
+ gl_FragColor = texColor;
2529
+ #include <tonemapping_fragment>
2530
+ #include <colorspace_fragment>
2531
+ }`,Nr=`varying vec3 vWorldDirection;
2532
+ #include <common>
2533
+ void main() {
2534
+ vWorldDirection = transformDirection( position, modelMatrix );
2535
+ #include <begin_vertex>
2536
+ #include <project_vertex>
2537
+ gl_Position.z = gl_Position.w;
2538
+ }`,Fr=`uniform samplerCube tCube;
2539
+ uniform float tFlip;
2540
+ uniform float opacity;
2541
+ varying vec3 vWorldDirection;
2542
+ void main() {
2543
+ vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2544
+ gl_FragColor = texColor;
2545
+ gl_FragColor.a *= opacity;
2546
+ #include <tonemapping_fragment>
2547
+ #include <colorspace_fragment>
2548
+ }`,Or=`#include <common>
2549
+ #include <batching_pars_vertex>
2550
+ #include <uv_pars_vertex>
2551
+ #include <displacementmap_pars_vertex>
2552
+ #include <morphtarget_pars_vertex>
2553
+ #include <skinning_pars_vertex>
2554
+ #include <logdepthbuf_pars_vertex>
2555
+ #include <clipping_planes_pars_vertex>
2556
+ varying vec2 vHighPrecisionZW;
2557
+ void main() {
2558
+ #include <uv_vertex>
2559
+ #include <batching_vertex>
2560
+ #include <skinbase_vertex>
2561
+ #include <morphinstance_vertex>
2562
+ #ifdef USE_DISPLACEMENTMAP
2563
+ #include <beginnormal_vertex>
2564
+ #include <morphnormal_vertex>
2565
+ #include <skinnormal_vertex>
2566
+ #endif
2567
+ #include <begin_vertex>
2568
+ #include <morphtarget_vertex>
2569
+ #include <skinning_vertex>
2570
+ #include <displacementmap_vertex>
2571
+ #include <project_vertex>
2572
+ #include <logdepthbuf_vertex>
2573
+ #include <clipping_planes_vertex>
2574
+ vHighPrecisionZW = gl_Position.zw;
2575
+ }`,Br=`#if DEPTH_PACKING == 3200
2576
+ uniform float opacity;
2577
+ #endif
2578
+ #include <common>
2579
+ #include <packing>
2580
+ #include <uv_pars_fragment>
2581
+ #include <map_pars_fragment>
2582
+ #include <alphamap_pars_fragment>
2583
+ #include <alphatest_pars_fragment>
2584
+ #include <alphahash_pars_fragment>
2585
+ #include <logdepthbuf_pars_fragment>
2586
+ #include <clipping_planes_pars_fragment>
2587
+ varying vec2 vHighPrecisionZW;
2588
+ void main() {
2589
+ vec4 diffuseColor = vec4( 1.0 );
2590
+ #include <clipping_planes_fragment>
2591
+ #if DEPTH_PACKING == 3200
2592
+ diffuseColor.a = opacity;
2593
+ #endif
2594
+ #include <map_fragment>
2595
+ #include <alphamap_fragment>
2596
+ #include <alphatest_fragment>
2597
+ #include <alphahash_fragment>
2598
+ #include <logdepthbuf_fragment>
2599
+ float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2600
+ #if DEPTH_PACKING == 3200
2601
+ gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2602
+ #elif DEPTH_PACKING == 3201
2603
+ gl_FragColor = packDepthToRGBA( fragCoordZ );
2604
+ #elif DEPTH_PACKING == 3202
2605
+ gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2606
+ #elif DEPTH_PACKING == 3203
2607
+ gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2608
+ #endif
2609
+ }`,Gr=`#define DISTANCE
2610
+ varying vec3 vWorldPosition;
2611
+ #include <common>
2612
+ #include <batching_pars_vertex>
2613
+ #include <uv_pars_vertex>
2614
+ #include <displacementmap_pars_vertex>
2615
+ #include <morphtarget_pars_vertex>
2616
+ #include <skinning_pars_vertex>
2617
+ #include <clipping_planes_pars_vertex>
2618
+ void main() {
2619
+ #include <uv_vertex>
2620
+ #include <batching_vertex>
2621
+ #include <skinbase_vertex>
2622
+ #include <morphinstance_vertex>
2623
+ #ifdef USE_DISPLACEMENTMAP
2624
+ #include <beginnormal_vertex>
2625
+ #include <morphnormal_vertex>
2626
+ #include <skinnormal_vertex>
2627
+ #endif
2628
+ #include <begin_vertex>
2629
+ #include <morphtarget_vertex>
2630
+ #include <skinning_vertex>
2631
+ #include <displacementmap_vertex>
2632
+ #include <project_vertex>
2633
+ #include <worldpos_vertex>
2634
+ #include <clipping_planes_vertex>
2635
+ vWorldPosition = worldPosition.xyz;
2636
+ }`,Vr=`#define DISTANCE
2637
+ uniform vec3 referencePosition;
2638
+ uniform float nearDistance;
2639
+ uniform float farDistance;
2640
+ varying vec3 vWorldPosition;
2641
+ #include <common>
2642
+ #include <packing>
2643
+ #include <uv_pars_fragment>
2644
+ #include <map_pars_fragment>
2645
+ #include <alphamap_pars_fragment>
2646
+ #include <alphatest_pars_fragment>
2647
+ #include <alphahash_pars_fragment>
2648
+ #include <clipping_planes_pars_fragment>
2649
+ void main () {
2650
+ vec4 diffuseColor = vec4( 1.0 );
2651
+ #include <clipping_planes_fragment>
2652
+ #include <map_fragment>
2653
+ #include <alphamap_fragment>
2654
+ #include <alphatest_fragment>
2655
+ #include <alphahash_fragment>
2656
+ float dist = length( vWorldPosition - referencePosition );
2657
+ dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2658
+ dist = saturate( dist );
2659
+ gl_FragColor = packDepthToRGBA( dist );
2660
+ }`,Hr=`varying vec3 vWorldDirection;
2661
+ #include <common>
2662
+ void main() {
2663
+ vWorldDirection = transformDirection( position, modelMatrix );
2664
+ #include <begin_vertex>
2665
+ #include <project_vertex>
2666
+ }`,kr=`uniform sampler2D tEquirect;
2667
+ varying vec3 vWorldDirection;
2668
+ #include <common>
2669
+ void main() {
2670
+ vec3 direction = normalize( vWorldDirection );
2671
+ vec2 sampleUV = equirectUv( direction );
2672
+ gl_FragColor = texture2D( tEquirect, sampleUV );
2673
+ #include <tonemapping_fragment>
2674
+ #include <colorspace_fragment>
2675
+ }`,Wr=`uniform float scale;
2676
+ attribute float lineDistance;
2677
+ varying float vLineDistance;
2678
+ #include <common>
2679
+ #include <uv_pars_vertex>
2680
+ #include <color_pars_vertex>
2681
+ #include <fog_pars_vertex>
2682
+ #include <morphtarget_pars_vertex>
2683
+ #include <logdepthbuf_pars_vertex>
2684
+ #include <clipping_planes_pars_vertex>
2685
+ void main() {
2686
+ vLineDistance = scale * lineDistance;
2687
+ #include <uv_vertex>
2688
+ #include <color_vertex>
2689
+ #include <morphinstance_vertex>
2690
+ #include <morphcolor_vertex>
2691
+ #include <begin_vertex>
2692
+ #include <morphtarget_vertex>
2693
+ #include <project_vertex>
2694
+ #include <logdepthbuf_vertex>
2695
+ #include <clipping_planes_vertex>
2696
+ #include <fog_vertex>
2697
+ }`,zr=`uniform vec3 diffuse;
2698
+ uniform float opacity;
2699
+ uniform float dashSize;
2700
+ uniform float totalSize;
2701
+ varying float vLineDistance;
2702
+ #include <common>
2703
+ #include <color_pars_fragment>
2704
+ #include <uv_pars_fragment>
2705
+ #include <map_pars_fragment>
2706
+ #include <fog_pars_fragment>
2707
+ #include <logdepthbuf_pars_fragment>
2708
+ #include <clipping_planes_pars_fragment>
2709
+ void main() {
2710
+ vec4 diffuseColor = vec4( diffuse, opacity );
2711
+ #include <clipping_planes_fragment>
2712
+ if ( mod( vLineDistance, totalSize ) > dashSize ) {
2713
+ discard;
2714
+ }
2715
+ vec3 outgoingLight = vec3( 0.0 );
2716
+ #include <logdepthbuf_fragment>
2717
+ #include <map_fragment>
2718
+ #include <color_fragment>
2719
+ outgoingLight = diffuseColor.rgb;
2720
+ #include <opaque_fragment>
2721
+ #include <tonemapping_fragment>
2722
+ #include <colorspace_fragment>
2723
+ #include <fog_fragment>
2724
+ #include <premultiplied_alpha_fragment>
2725
+ }`,Xr=`#include <common>
2726
+ #include <batching_pars_vertex>
2727
+ #include <uv_pars_vertex>
2728
+ #include <envmap_pars_vertex>
2729
+ #include <color_pars_vertex>
2730
+ #include <fog_pars_vertex>
2731
+ #include <morphtarget_pars_vertex>
2732
+ #include <skinning_pars_vertex>
2733
+ #include <logdepthbuf_pars_vertex>
2734
+ #include <clipping_planes_pars_vertex>
2735
+ void main() {
2736
+ #include <uv_vertex>
2737
+ #include <color_vertex>
2738
+ #include <morphinstance_vertex>
2739
+ #include <morphcolor_vertex>
2740
+ #include <batching_vertex>
2741
+ #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2742
+ #include <beginnormal_vertex>
2743
+ #include <morphnormal_vertex>
2744
+ #include <skinbase_vertex>
2745
+ #include <skinnormal_vertex>
2746
+ #include <defaultnormal_vertex>
2747
+ #endif
2748
+ #include <begin_vertex>
2749
+ #include <morphtarget_vertex>
2750
+ #include <skinning_vertex>
2751
+ #include <project_vertex>
2752
+ #include <logdepthbuf_vertex>
2753
+ #include <clipping_planes_vertex>
2754
+ #include <worldpos_vertex>
2755
+ #include <envmap_vertex>
2756
+ #include <fog_vertex>
2757
+ }`,qr=`uniform vec3 diffuse;
2758
+ uniform float opacity;
2759
+ #ifndef FLAT_SHADED
2760
+ varying vec3 vNormal;
2761
+ #endif
2762
+ #include <common>
2763
+ #include <dithering_pars_fragment>
2764
+ #include <color_pars_fragment>
2765
+ #include <uv_pars_fragment>
2766
+ #include <map_pars_fragment>
2767
+ #include <alphamap_pars_fragment>
2768
+ #include <alphatest_pars_fragment>
2769
+ #include <alphahash_pars_fragment>
2770
+ #include <aomap_pars_fragment>
2771
+ #include <lightmap_pars_fragment>
2772
+ #include <envmap_common_pars_fragment>
2773
+ #include <envmap_pars_fragment>
2774
+ #include <fog_pars_fragment>
2775
+ #include <specularmap_pars_fragment>
2776
+ #include <logdepthbuf_pars_fragment>
2777
+ #include <clipping_planes_pars_fragment>
2778
+ void main() {
2779
+ vec4 diffuseColor = vec4( diffuse, opacity );
2780
+ #include <clipping_planes_fragment>
2781
+ #include <logdepthbuf_fragment>
2782
+ #include <map_fragment>
2783
+ #include <color_fragment>
2784
+ #include <alphamap_fragment>
2785
+ #include <alphatest_fragment>
2786
+ #include <alphahash_fragment>
2787
+ #include <specularmap_fragment>
2788
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2789
+ #ifdef USE_LIGHTMAP
2790
+ vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2791
+ reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2792
+ #else
2793
+ reflectedLight.indirectDiffuse += vec3( 1.0 );
2794
+ #endif
2795
+ #include <aomap_fragment>
2796
+ reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2797
+ vec3 outgoingLight = reflectedLight.indirectDiffuse;
2798
+ #include <envmap_fragment>
2799
+ #include <opaque_fragment>
2800
+ #include <tonemapping_fragment>
2801
+ #include <colorspace_fragment>
2802
+ #include <fog_fragment>
2803
+ #include <premultiplied_alpha_fragment>
2804
+ #include <dithering_fragment>
2805
+ }`,Yr=`#define LAMBERT
2806
+ varying vec3 vViewPosition;
2807
+ #include <common>
2808
+ #include <batching_pars_vertex>
2809
+ #include <uv_pars_vertex>
2810
+ #include <displacementmap_pars_vertex>
2811
+ #include <envmap_pars_vertex>
2812
+ #include <color_pars_vertex>
2813
+ #include <fog_pars_vertex>
2814
+ #include <normal_pars_vertex>
2815
+ #include <morphtarget_pars_vertex>
2816
+ #include <skinning_pars_vertex>
2817
+ #include <shadowmap_pars_vertex>
2818
+ #include <logdepthbuf_pars_vertex>
2819
+ #include <clipping_planes_pars_vertex>
2820
+ void main() {
2821
+ #include <uv_vertex>
2822
+ #include <color_vertex>
2823
+ #include <morphinstance_vertex>
2824
+ #include <morphcolor_vertex>
2825
+ #include <batching_vertex>
2826
+ #include <beginnormal_vertex>
2827
+ #include <morphnormal_vertex>
2828
+ #include <skinbase_vertex>
2829
+ #include <skinnormal_vertex>
2830
+ #include <defaultnormal_vertex>
2831
+ #include <normal_vertex>
2832
+ #include <begin_vertex>
2833
+ #include <morphtarget_vertex>
2834
+ #include <skinning_vertex>
2835
+ #include <displacementmap_vertex>
2836
+ #include <project_vertex>
2837
+ #include <logdepthbuf_vertex>
2838
+ #include <clipping_planes_vertex>
2839
+ vViewPosition = - mvPosition.xyz;
2840
+ #include <worldpos_vertex>
2841
+ #include <envmap_vertex>
2842
+ #include <shadowmap_vertex>
2843
+ #include <fog_vertex>
2844
+ }`,Kr=`#define LAMBERT
2845
+ uniform vec3 diffuse;
2846
+ uniform vec3 emissive;
2847
+ uniform float opacity;
2848
+ #include <common>
2849
+ #include <packing>
2850
+ #include <dithering_pars_fragment>
2851
+ #include <color_pars_fragment>
2852
+ #include <uv_pars_fragment>
2853
+ #include <map_pars_fragment>
2854
+ #include <alphamap_pars_fragment>
2855
+ #include <alphatest_pars_fragment>
2856
+ #include <alphahash_pars_fragment>
2857
+ #include <aomap_pars_fragment>
2858
+ #include <lightmap_pars_fragment>
2859
+ #include <emissivemap_pars_fragment>
2860
+ #include <envmap_common_pars_fragment>
2861
+ #include <envmap_pars_fragment>
2862
+ #include <fog_pars_fragment>
2863
+ #include <bsdfs>
2864
+ #include <lights_pars_begin>
2865
+ #include <normal_pars_fragment>
2866
+ #include <lights_lambert_pars_fragment>
2867
+ #include <shadowmap_pars_fragment>
2868
+ #include <bumpmap_pars_fragment>
2869
+ #include <normalmap_pars_fragment>
2870
+ #include <specularmap_pars_fragment>
2871
+ #include <logdepthbuf_pars_fragment>
2872
+ #include <clipping_planes_pars_fragment>
2873
+ void main() {
2874
+ vec4 diffuseColor = vec4( diffuse, opacity );
2875
+ #include <clipping_planes_fragment>
2876
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2877
+ vec3 totalEmissiveRadiance = emissive;
2878
+ #include <logdepthbuf_fragment>
2879
+ #include <map_fragment>
2880
+ #include <color_fragment>
2881
+ #include <alphamap_fragment>
2882
+ #include <alphatest_fragment>
2883
+ #include <alphahash_fragment>
2884
+ #include <specularmap_fragment>
2885
+ #include <normal_fragment_begin>
2886
+ #include <normal_fragment_maps>
2887
+ #include <emissivemap_fragment>
2888
+ #include <lights_lambert_fragment>
2889
+ #include <lights_fragment_begin>
2890
+ #include <lights_fragment_maps>
2891
+ #include <lights_fragment_end>
2892
+ #include <aomap_fragment>
2893
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2894
+ #include <envmap_fragment>
2895
+ #include <opaque_fragment>
2896
+ #include <tonemapping_fragment>
2897
+ #include <colorspace_fragment>
2898
+ #include <fog_fragment>
2899
+ #include <premultiplied_alpha_fragment>
2900
+ #include <dithering_fragment>
2901
+ }`,$r=`#define MATCAP
2902
+ varying vec3 vViewPosition;
2903
+ #include <common>
2904
+ #include <batching_pars_vertex>
2905
+ #include <uv_pars_vertex>
2906
+ #include <color_pars_vertex>
2907
+ #include <displacementmap_pars_vertex>
2908
+ #include <fog_pars_vertex>
2909
+ #include <normal_pars_vertex>
2910
+ #include <morphtarget_pars_vertex>
2911
+ #include <skinning_pars_vertex>
2912
+ #include <logdepthbuf_pars_vertex>
2913
+ #include <clipping_planes_pars_vertex>
2914
+ void main() {
2915
+ #include <uv_vertex>
2916
+ #include <color_vertex>
2917
+ #include <morphinstance_vertex>
2918
+ #include <morphcolor_vertex>
2919
+ #include <batching_vertex>
2920
+ #include <beginnormal_vertex>
2921
+ #include <morphnormal_vertex>
2922
+ #include <skinbase_vertex>
2923
+ #include <skinnormal_vertex>
2924
+ #include <defaultnormal_vertex>
2925
+ #include <normal_vertex>
2926
+ #include <begin_vertex>
2927
+ #include <morphtarget_vertex>
2928
+ #include <skinning_vertex>
2929
+ #include <displacementmap_vertex>
2930
+ #include <project_vertex>
2931
+ #include <logdepthbuf_vertex>
2932
+ #include <clipping_planes_vertex>
2933
+ #include <fog_vertex>
2934
+ vViewPosition = - mvPosition.xyz;
2935
+ }`,Zr=`#define MATCAP
2936
+ uniform vec3 diffuse;
2937
+ uniform float opacity;
2938
+ uniform sampler2D matcap;
2939
+ varying vec3 vViewPosition;
2940
+ #include <common>
2941
+ #include <dithering_pars_fragment>
2942
+ #include <color_pars_fragment>
2943
+ #include <uv_pars_fragment>
2944
+ #include <map_pars_fragment>
2945
+ #include <alphamap_pars_fragment>
2946
+ #include <alphatest_pars_fragment>
2947
+ #include <alphahash_pars_fragment>
2948
+ #include <fog_pars_fragment>
2949
+ #include <normal_pars_fragment>
2950
+ #include <bumpmap_pars_fragment>
2951
+ #include <normalmap_pars_fragment>
2952
+ #include <logdepthbuf_pars_fragment>
2953
+ #include <clipping_planes_pars_fragment>
2954
+ void main() {
2955
+ vec4 diffuseColor = vec4( diffuse, opacity );
2956
+ #include <clipping_planes_fragment>
2957
+ #include <logdepthbuf_fragment>
2958
+ #include <map_fragment>
2959
+ #include <color_fragment>
2960
+ #include <alphamap_fragment>
2961
+ #include <alphatest_fragment>
2962
+ #include <alphahash_fragment>
2963
+ #include <normal_fragment_begin>
2964
+ #include <normal_fragment_maps>
2965
+ vec3 viewDir = normalize( vViewPosition );
2966
+ vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
2967
+ vec3 y = cross( viewDir, x );
2968
+ vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
2969
+ #ifdef USE_MATCAP
2970
+ vec4 matcapColor = texture2D( matcap, uv );
2971
+ #else
2972
+ vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
2973
+ #endif
2974
+ vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
2975
+ #include <opaque_fragment>
2976
+ #include <tonemapping_fragment>
2977
+ #include <colorspace_fragment>
2978
+ #include <fog_fragment>
2979
+ #include <premultiplied_alpha_fragment>
2980
+ #include <dithering_fragment>
2981
+ }`,Qr=`#define NORMAL
2982
+ #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
2983
+ varying vec3 vViewPosition;
2984
+ #endif
2985
+ #include <common>
2986
+ #include <batching_pars_vertex>
2987
+ #include <uv_pars_vertex>
2988
+ #include <displacementmap_pars_vertex>
2989
+ #include <normal_pars_vertex>
2990
+ #include <morphtarget_pars_vertex>
2991
+ #include <skinning_pars_vertex>
2992
+ #include <logdepthbuf_pars_vertex>
2993
+ #include <clipping_planes_pars_vertex>
2994
+ void main() {
2995
+ #include <uv_vertex>
2996
+ #include <batching_vertex>
2997
+ #include <beginnormal_vertex>
2998
+ #include <morphinstance_vertex>
2999
+ #include <morphnormal_vertex>
3000
+ #include <skinbase_vertex>
3001
+ #include <skinnormal_vertex>
3002
+ #include <defaultnormal_vertex>
3003
+ #include <normal_vertex>
3004
+ #include <begin_vertex>
3005
+ #include <morphtarget_vertex>
3006
+ #include <skinning_vertex>
3007
+ #include <displacementmap_vertex>
3008
+ #include <project_vertex>
3009
+ #include <logdepthbuf_vertex>
3010
+ #include <clipping_planes_vertex>
3011
+ #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3012
+ vViewPosition = - mvPosition.xyz;
3013
+ #endif
3014
+ }`,Jr=`#define NORMAL
3015
+ uniform float opacity;
3016
+ #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3017
+ varying vec3 vViewPosition;
3018
+ #endif
3019
+ #include <packing>
3020
+ #include <uv_pars_fragment>
3021
+ #include <normal_pars_fragment>
3022
+ #include <bumpmap_pars_fragment>
3023
+ #include <normalmap_pars_fragment>
3024
+ #include <logdepthbuf_pars_fragment>
3025
+ #include <clipping_planes_pars_fragment>
3026
+ void main() {
3027
+ vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3028
+ #include <clipping_planes_fragment>
3029
+ #include <logdepthbuf_fragment>
3030
+ #include <normal_fragment_begin>
3031
+ #include <normal_fragment_maps>
3032
+ gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
3033
+ #ifdef OPAQUE
3034
+ gl_FragColor.a = 1.0;
3035
+ #endif
3036
+ }`,jr=`#define PHONG
3037
+ varying vec3 vViewPosition;
3038
+ #include <common>
3039
+ #include <batching_pars_vertex>
3040
+ #include <uv_pars_vertex>
3041
+ #include <displacementmap_pars_vertex>
3042
+ #include <envmap_pars_vertex>
3043
+ #include <color_pars_vertex>
3044
+ #include <fog_pars_vertex>
3045
+ #include <normal_pars_vertex>
3046
+ #include <morphtarget_pars_vertex>
3047
+ #include <skinning_pars_vertex>
3048
+ #include <shadowmap_pars_vertex>
3049
+ #include <logdepthbuf_pars_vertex>
3050
+ #include <clipping_planes_pars_vertex>
3051
+ void main() {
3052
+ #include <uv_vertex>
3053
+ #include <color_vertex>
3054
+ #include <morphcolor_vertex>
3055
+ #include <batching_vertex>
3056
+ #include <beginnormal_vertex>
3057
+ #include <morphinstance_vertex>
3058
+ #include <morphnormal_vertex>
3059
+ #include <skinbase_vertex>
3060
+ #include <skinnormal_vertex>
3061
+ #include <defaultnormal_vertex>
3062
+ #include <normal_vertex>
3063
+ #include <begin_vertex>
3064
+ #include <morphtarget_vertex>
3065
+ #include <skinning_vertex>
3066
+ #include <displacementmap_vertex>
3067
+ #include <project_vertex>
3068
+ #include <logdepthbuf_vertex>
3069
+ #include <clipping_planes_vertex>
3070
+ vViewPosition = - mvPosition.xyz;
3071
+ #include <worldpos_vertex>
3072
+ #include <envmap_vertex>
3073
+ #include <shadowmap_vertex>
3074
+ #include <fog_vertex>
3075
+ }`,ea=`#define PHONG
3076
+ uniform vec3 diffuse;
3077
+ uniform vec3 emissive;
3078
+ uniform vec3 specular;
3079
+ uniform float shininess;
3080
+ uniform float opacity;
3081
+ #include <common>
3082
+ #include <packing>
3083
+ #include <dithering_pars_fragment>
3084
+ #include <color_pars_fragment>
3085
+ #include <uv_pars_fragment>
3086
+ #include <map_pars_fragment>
3087
+ #include <alphamap_pars_fragment>
3088
+ #include <alphatest_pars_fragment>
3089
+ #include <alphahash_pars_fragment>
3090
+ #include <aomap_pars_fragment>
3091
+ #include <lightmap_pars_fragment>
3092
+ #include <emissivemap_pars_fragment>
3093
+ #include <envmap_common_pars_fragment>
3094
+ #include <envmap_pars_fragment>
3095
+ #include <fog_pars_fragment>
3096
+ #include <bsdfs>
3097
+ #include <lights_pars_begin>
3098
+ #include <normal_pars_fragment>
3099
+ #include <lights_phong_pars_fragment>
3100
+ #include <shadowmap_pars_fragment>
3101
+ #include <bumpmap_pars_fragment>
3102
+ #include <normalmap_pars_fragment>
3103
+ #include <specularmap_pars_fragment>
3104
+ #include <logdepthbuf_pars_fragment>
3105
+ #include <clipping_planes_pars_fragment>
3106
+ void main() {
3107
+ vec4 diffuseColor = vec4( diffuse, opacity );
3108
+ #include <clipping_planes_fragment>
3109
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3110
+ vec3 totalEmissiveRadiance = emissive;
3111
+ #include <logdepthbuf_fragment>
3112
+ #include <map_fragment>
3113
+ #include <color_fragment>
3114
+ #include <alphamap_fragment>
3115
+ #include <alphatest_fragment>
3116
+ #include <alphahash_fragment>
3117
+ #include <specularmap_fragment>
3118
+ #include <normal_fragment_begin>
3119
+ #include <normal_fragment_maps>
3120
+ #include <emissivemap_fragment>
3121
+ #include <lights_phong_fragment>
3122
+ #include <lights_fragment_begin>
3123
+ #include <lights_fragment_maps>
3124
+ #include <lights_fragment_end>
3125
+ #include <aomap_fragment>
3126
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3127
+ #include <envmap_fragment>
3128
+ #include <opaque_fragment>
3129
+ #include <tonemapping_fragment>
3130
+ #include <colorspace_fragment>
3131
+ #include <fog_fragment>
3132
+ #include <premultiplied_alpha_fragment>
3133
+ #include <dithering_fragment>
3134
+ }`,ta=`#define STANDARD
3135
+ varying vec3 vViewPosition;
3136
+ #ifdef USE_TRANSMISSION
3137
+ varying vec3 vWorldPosition;
3138
+ #endif
3139
+ #include <common>
3140
+ #include <batching_pars_vertex>
3141
+ #include <uv_pars_vertex>
3142
+ #include <displacementmap_pars_vertex>
3143
+ #include <color_pars_vertex>
3144
+ #include <fog_pars_vertex>
3145
+ #include <normal_pars_vertex>
3146
+ #include <morphtarget_pars_vertex>
3147
+ #include <skinning_pars_vertex>
3148
+ #include <shadowmap_pars_vertex>
3149
+ #include <logdepthbuf_pars_vertex>
3150
+ #include <clipping_planes_pars_vertex>
3151
+ void main() {
3152
+ #include <uv_vertex>
3153
+ #include <color_vertex>
3154
+ #include <morphinstance_vertex>
3155
+ #include <morphcolor_vertex>
3156
+ #include <batching_vertex>
3157
+ #include <beginnormal_vertex>
3158
+ #include <morphnormal_vertex>
3159
+ #include <skinbase_vertex>
3160
+ #include <skinnormal_vertex>
3161
+ #include <defaultnormal_vertex>
3162
+ #include <normal_vertex>
3163
+ #include <begin_vertex>
3164
+ #include <morphtarget_vertex>
3165
+ #include <skinning_vertex>
3166
+ #include <displacementmap_vertex>
3167
+ #include <project_vertex>
3168
+ #include <logdepthbuf_vertex>
3169
+ #include <clipping_planes_vertex>
3170
+ vViewPosition = - mvPosition.xyz;
3171
+ #include <worldpos_vertex>
3172
+ #include <shadowmap_vertex>
3173
+ #include <fog_vertex>
3174
+ #ifdef USE_TRANSMISSION
3175
+ vWorldPosition = worldPosition.xyz;
3176
+ #endif
3177
+ }`,na=`#define STANDARD
3178
+ #ifdef PHYSICAL
3179
+ #define IOR
3180
+ #define USE_SPECULAR
3181
+ #endif
3182
+ uniform vec3 diffuse;
3183
+ uniform vec3 emissive;
3184
+ uniform float roughness;
3185
+ uniform float metalness;
3186
+ uniform float opacity;
3187
+ #ifdef IOR
3188
+ uniform float ior;
3189
+ #endif
3190
+ #ifdef USE_SPECULAR
3191
+ uniform float specularIntensity;
3192
+ uniform vec3 specularColor;
3193
+ #ifdef USE_SPECULAR_COLORMAP
3194
+ uniform sampler2D specularColorMap;
3195
+ #endif
3196
+ #ifdef USE_SPECULAR_INTENSITYMAP
3197
+ uniform sampler2D specularIntensityMap;
3198
+ #endif
3199
+ #endif
3200
+ #ifdef USE_CLEARCOAT
3201
+ uniform float clearcoat;
3202
+ uniform float clearcoatRoughness;
3203
+ #endif
3204
+ #ifdef USE_DISPERSION
3205
+ uniform float dispersion;
3206
+ #endif
3207
+ #ifdef USE_IRIDESCENCE
3208
+ uniform float iridescence;
3209
+ uniform float iridescenceIOR;
3210
+ uniform float iridescenceThicknessMinimum;
3211
+ uniform float iridescenceThicknessMaximum;
3212
+ #endif
3213
+ #ifdef USE_SHEEN
3214
+ uniform vec3 sheenColor;
3215
+ uniform float sheenRoughness;
3216
+ #ifdef USE_SHEEN_COLORMAP
3217
+ uniform sampler2D sheenColorMap;
3218
+ #endif
3219
+ #ifdef USE_SHEEN_ROUGHNESSMAP
3220
+ uniform sampler2D sheenRoughnessMap;
3221
+ #endif
3222
+ #endif
3223
+ #ifdef USE_ANISOTROPY
3224
+ uniform vec2 anisotropyVector;
3225
+ #ifdef USE_ANISOTROPYMAP
3226
+ uniform sampler2D anisotropyMap;
3227
+ #endif
3228
+ #endif
3229
+ varying vec3 vViewPosition;
3230
+ #include <common>
3231
+ #include <packing>
3232
+ #include <dithering_pars_fragment>
3233
+ #include <color_pars_fragment>
3234
+ #include <uv_pars_fragment>
3235
+ #include <map_pars_fragment>
3236
+ #include <alphamap_pars_fragment>
3237
+ #include <alphatest_pars_fragment>
3238
+ #include <alphahash_pars_fragment>
3239
+ #include <aomap_pars_fragment>
3240
+ #include <lightmap_pars_fragment>
3241
+ #include <emissivemap_pars_fragment>
3242
+ #include <iridescence_fragment>
3243
+ #include <cube_uv_reflection_fragment>
3244
+ #include <envmap_common_pars_fragment>
3245
+ #include <envmap_physical_pars_fragment>
3246
+ #include <fog_pars_fragment>
3247
+ #include <lights_pars_begin>
3248
+ #include <normal_pars_fragment>
3249
+ #include <lights_physical_pars_fragment>
3250
+ #include <transmission_pars_fragment>
3251
+ #include <shadowmap_pars_fragment>
3252
+ #include <bumpmap_pars_fragment>
3253
+ #include <normalmap_pars_fragment>
3254
+ #include <clearcoat_pars_fragment>
3255
+ #include <iridescence_pars_fragment>
3256
+ #include <roughnessmap_pars_fragment>
3257
+ #include <metalnessmap_pars_fragment>
3258
+ #include <logdepthbuf_pars_fragment>
3259
+ #include <clipping_planes_pars_fragment>
3260
+ void main() {
3261
+ vec4 diffuseColor = vec4( diffuse, opacity );
3262
+ #include <clipping_planes_fragment>
3263
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3264
+ vec3 totalEmissiveRadiance = emissive;
3265
+ #include <logdepthbuf_fragment>
3266
+ #include <map_fragment>
3267
+ #include <color_fragment>
3268
+ #include <alphamap_fragment>
3269
+ #include <alphatest_fragment>
3270
+ #include <alphahash_fragment>
3271
+ #include <roughnessmap_fragment>
3272
+ #include <metalnessmap_fragment>
3273
+ #include <normal_fragment_begin>
3274
+ #include <normal_fragment_maps>
3275
+ #include <clearcoat_normal_fragment_begin>
3276
+ #include <clearcoat_normal_fragment_maps>
3277
+ #include <emissivemap_fragment>
3278
+ #include <lights_physical_fragment>
3279
+ #include <lights_fragment_begin>
3280
+ #include <lights_fragment_maps>
3281
+ #include <lights_fragment_end>
3282
+ #include <aomap_fragment>
3283
+ vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3284
+ vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3285
+ #include <transmission_fragment>
3286
+ vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3287
+ #ifdef USE_SHEEN
3288
+ float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
3289
+ outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
3290
+ #endif
3291
+ #ifdef USE_CLEARCOAT
3292
+ float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3293
+ vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3294
+ outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3295
+ #endif
3296
+ #include <opaque_fragment>
3297
+ #include <tonemapping_fragment>
3298
+ #include <colorspace_fragment>
3299
+ #include <fog_fragment>
3300
+ #include <premultiplied_alpha_fragment>
3301
+ #include <dithering_fragment>
3302
+ }`,ia=`#define TOON
3303
+ varying vec3 vViewPosition;
3304
+ #include <common>
3305
+ #include <batching_pars_vertex>
3306
+ #include <uv_pars_vertex>
3307
+ #include <displacementmap_pars_vertex>
3308
+ #include <color_pars_vertex>
3309
+ #include <fog_pars_vertex>
3310
+ #include <normal_pars_vertex>
3311
+ #include <morphtarget_pars_vertex>
3312
+ #include <skinning_pars_vertex>
3313
+ #include <shadowmap_pars_vertex>
3314
+ #include <logdepthbuf_pars_vertex>
3315
+ #include <clipping_planes_pars_vertex>
3316
+ void main() {
3317
+ #include <uv_vertex>
3318
+ #include <color_vertex>
3319
+ #include <morphinstance_vertex>
3320
+ #include <morphcolor_vertex>
3321
+ #include <batching_vertex>
3322
+ #include <beginnormal_vertex>
3323
+ #include <morphnormal_vertex>
3324
+ #include <skinbase_vertex>
3325
+ #include <skinnormal_vertex>
3326
+ #include <defaultnormal_vertex>
3327
+ #include <normal_vertex>
3328
+ #include <begin_vertex>
3329
+ #include <morphtarget_vertex>
3330
+ #include <skinning_vertex>
3331
+ #include <displacementmap_vertex>
3332
+ #include <project_vertex>
3333
+ #include <logdepthbuf_vertex>
3334
+ #include <clipping_planes_vertex>
3335
+ vViewPosition = - mvPosition.xyz;
3336
+ #include <worldpos_vertex>
3337
+ #include <shadowmap_vertex>
3338
+ #include <fog_vertex>
3339
+ }`,ra=`#define TOON
3340
+ uniform vec3 diffuse;
3341
+ uniform vec3 emissive;
3342
+ uniform float opacity;
3343
+ #include <common>
3344
+ #include <packing>
3345
+ #include <dithering_pars_fragment>
3346
+ #include <color_pars_fragment>
3347
+ #include <uv_pars_fragment>
3348
+ #include <map_pars_fragment>
3349
+ #include <alphamap_pars_fragment>
3350
+ #include <alphatest_pars_fragment>
3351
+ #include <alphahash_pars_fragment>
3352
+ #include <aomap_pars_fragment>
3353
+ #include <lightmap_pars_fragment>
3354
+ #include <emissivemap_pars_fragment>
3355
+ #include <gradientmap_pars_fragment>
3356
+ #include <fog_pars_fragment>
3357
+ #include <bsdfs>
3358
+ #include <lights_pars_begin>
3359
+ #include <normal_pars_fragment>
3360
+ #include <lights_toon_pars_fragment>
3361
+ #include <shadowmap_pars_fragment>
3362
+ #include <bumpmap_pars_fragment>
3363
+ #include <normalmap_pars_fragment>
3364
+ #include <logdepthbuf_pars_fragment>
3365
+ #include <clipping_planes_pars_fragment>
3366
+ void main() {
3367
+ vec4 diffuseColor = vec4( diffuse, opacity );
3368
+ #include <clipping_planes_fragment>
3369
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3370
+ vec3 totalEmissiveRadiance = emissive;
3371
+ #include <logdepthbuf_fragment>
3372
+ #include <map_fragment>
3373
+ #include <color_fragment>
3374
+ #include <alphamap_fragment>
3375
+ #include <alphatest_fragment>
3376
+ #include <alphahash_fragment>
3377
+ #include <normal_fragment_begin>
3378
+ #include <normal_fragment_maps>
3379
+ #include <emissivemap_fragment>
3380
+ #include <lights_toon_fragment>
3381
+ #include <lights_fragment_begin>
3382
+ #include <lights_fragment_maps>
3383
+ #include <lights_fragment_end>
3384
+ #include <aomap_fragment>
3385
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3386
+ #include <opaque_fragment>
3387
+ #include <tonemapping_fragment>
3388
+ #include <colorspace_fragment>
3389
+ #include <fog_fragment>
3390
+ #include <premultiplied_alpha_fragment>
3391
+ #include <dithering_fragment>
3392
+ }`,aa=`uniform float size;
3393
+ uniform float scale;
3394
+ #include <common>
3395
+ #include <color_pars_vertex>
3396
+ #include <fog_pars_vertex>
3397
+ #include <morphtarget_pars_vertex>
3398
+ #include <logdepthbuf_pars_vertex>
3399
+ #include <clipping_planes_pars_vertex>
3400
+ #ifdef USE_POINTS_UV
3401
+ varying vec2 vUv;
3402
+ uniform mat3 uvTransform;
3403
+ #endif
3404
+ void main() {
3405
+ #ifdef USE_POINTS_UV
3406
+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3407
+ #endif
3408
+ #include <color_vertex>
3409
+ #include <morphinstance_vertex>
3410
+ #include <morphcolor_vertex>
3411
+ #include <begin_vertex>
3412
+ #include <morphtarget_vertex>
3413
+ #include <project_vertex>
3414
+ gl_PointSize = size;
3415
+ #ifdef USE_SIZEATTENUATION
3416
+ bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3417
+ if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3418
+ #endif
3419
+ #include <logdepthbuf_vertex>
3420
+ #include <clipping_planes_vertex>
3421
+ #include <worldpos_vertex>
3422
+ #include <fog_vertex>
3423
+ }`,oa=`uniform vec3 diffuse;
3424
+ uniform float opacity;
3425
+ #include <common>
3426
+ #include <color_pars_fragment>
3427
+ #include <map_particle_pars_fragment>
3428
+ #include <alphatest_pars_fragment>
3429
+ #include <alphahash_pars_fragment>
3430
+ #include <fog_pars_fragment>
3431
+ #include <logdepthbuf_pars_fragment>
3432
+ #include <clipping_planes_pars_fragment>
3433
+ void main() {
3434
+ vec4 diffuseColor = vec4( diffuse, opacity );
3435
+ #include <clipping_planes_fragment>
3436
+ vec3 outgoingLight = vec3( 0.0 );
3437
+ #include <logdepthbuf_fragment>
3438
+ #include <map_particle_fragment>
3439
+ #include <color_fragment>
3440
+ #include <alphatest_fragment>
3441
+ #include <alphahash_fragment>
3442
+ outgoingLight = diffuseColor.rgb;
3443
+ #include <opaque_fragment>
3444
+ #include <tonemapping_fragment>
3445
+ #include <colorspace_fragment>
3446
+ #include <fog_fragment>
3447
+ #include <premultiplied_alpha_fragment>
3448
+ }`,sa=`#include <common>
3449
+ #include <batching_pars_vertex>
3450
+ #include <fog_pars_vertex>
3451
+ #include <morphtarget_pars_vertex>
3452
+ #include <skinning_pars_vertex>
3453
+ #include <logdepthbuf_pars_vertex>
3454
+ #include <shadowmap_pars_vertex>
3455
+ void main() {
3456
+ #include <batching_vertex>
3457
+ #include <beginnormal_vertex>
3458
+ #include <morphinstance_vertex>
3459
+ #include <morphnormal_vertex>
3460
+ #include <skinbase_vertex>
3461
+ #include <skinnormal_vertex>
3462
+ #include <defaultnormal_vertex>
3463
+ #include <begin_vertex>
3464
+ #include <morphtarget_vertex>
3465
+ #include <skinning_vertex>
3466
+ #include <project_vertex>
3467
+ #include <logdepthbuf_vertex>
3468
+ #include <worldpos_vertex>
3469
+ #include <shadowmap_vertex>
3470
+ #include <fog_vertex>
3471
+ }`,la=`uniform vec3 color;
3472
+ uniform float opacity;
3473
+ #include <common>
3474
+ #include <packing>
3475
+ #include <fog_pars_fragment>
3476
+ #include <bsdfs>
3477
+ #include <lights_pars_begin>
3478
+ #include <logdepthbuf_pars_fragment>
3479
+ #include <shadowmap_pars_fragment>
3480
+ #include <shadowmask_pars_fragment>
3481
+ void main() {
3482
+ #include <logdepthbuf_fragment>
3483
+ gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3484
+ #include <tonemapping_fragment>
3485
+ #include <colorspace_fragment>
3486
+ #include <fog_fragment>
3487
+ }`,ca=`uniform float rotation;
3488
+ uniform vec2 center;
3489
+ #include <common>
3490
+ #include <uv_pars_vertex>
3491
+ #include <fog_pars_vertex>
3492
+ #include <logdepthbuf_pars_vertex>
3493
+ #include <clipping_planes_pars_vertex>
3494
+ void main() {
3495
+ #include <uv_vertex>
3496
+ vec4 mvPosition = modelViewMatrix[ 3 ];
3497
+ vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3498
+ #ifndef USE_SIZEATTENUATION
3499
+ bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3500
+ if ( isPerspective ) scale *= - mvPosition.z;
3501
+ #endif
3502
+ vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3503
+ vec2 rotatedPosition;
3504
+ rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3505
+ rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3506
+ mvPosition.xy += rotatedPosition;
3507
+ gl_Position = projectionMatrix * mvPosition;
3508
+ #include <logdepthbuf_vertex>
3509
+ #include <clipping_planes_vertex>
3510
+ #include <fog_vertex>
3511
+ }`,fa=`uniform vec3 diffuse;
3512
+ uniform float opacity;
3513
+ #include <common>
3514
+ #include <uv_pars_fragment>
3515
+ #include <map_pars_fragment>
3516
+ #include <alphamap_pars_fragment>
3517
+ #include <alphatest_pars_fragment>
3518
+ #include <alphahash_pars_fragment>
3519
+ #include <fog_pars_fragment>
3520
+ #include <logdepthbuf_pars_fragment>
3521
+ #include <clipping_planes_pars_fragment>
3522
+ void main() {
3523
+ vec4 diffuseColor = vec4( diffuse, opacity );
3524
+ #include <clipping_planes_fragment>
3525
+ vec3 outgoingLight = vec3( 0.0 );
3526
+ #include <logdepthbuf_fragment>
3527
+ #include <map_fragment>
3528
+ #include <alphamap_fragment>
3529
+ #include <alphatest_fragment>
3530
+ #include <alphahash_fragment>
3531
+ outgoingLight = diffuseColor.rgb;
3532
+ #include <opaque_fragment>
3533
+ #include <tonemapping_fragment>
3534
+ #include <colorspace_fragment>
3535
+ #include <fog_fragment>
3536
+ }`,Pe={alphahash_fragment:wn,alphahash_pars_fragment:yn,alphamap_fragment:In,alphamap_pars_fragment:Nn,alphatest_fragment:Fn,alphatest_pars_fragment:On,aomap_fragment:Bn,aomap_pars_fragment:Gn,batching_pars_vertex:Vn,batching_vertex:Hn,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:di,envmap_pars_fragment:ui,envmap_pars_vertex:pi,envmap_physical_pars_fragment:Ai,envmap_vertex:hi,fog_vertex:_i,fog_pars_vertex:mi,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:yi,logdepthbuf_fragment:Ii,logdepthbuf_pars_fragment:Ni,logdepthbuf_pars_vertex:Fi,logdepthbuf_vertex:Oi,map_fragment:Bi,map_pars_fragment:Gi,map_particle_fragment:Vi,map_particle_pars_fragment:Hi,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:dr,roughnessmap_pars_fragment:ur,shadowmap_pars_fragment:pr,shadowmap_pars_vertex:hr,shadowmap_vertex:_r,shadowmask_pars_fragment:mr,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:yr,backgroundCube_frag:Ir,cube_vert:Nr,cube_frag:Fr,depth_vert:Or,depth_frag:Br,distanceRGBA_vert:Gr,distanceRGBA_frag:Vr,equirect_vert:Hr,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},ee={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([ee.common,ee.specularmap,ee.envmap,ee.aomap,ee.lightmap,ee.fog]),vertexShader:Pe.meshbasic_vert,fragmentShader:Pe.meshbasic_frag},lambert:{uniforms:t.mergeUniforms([ee.common,ee.specularmap,ee.envmap,ee.aomap,ee.lightmap,ee.emissivemap,ee.bumpmap,ee.normalmap,ee.displacementmap,ee.fog,ee.lights,{emissive:{value:new t.Color(0)}}]),vertexShader:Pe.meshlambert_vert,fragmentShader:Pe.meshlambert_frag},phong:{uniforms:t.mergeUniforms([ee.common,ee.specularmap,ee.envmap,ee.aomap,ee.lightmap,ee.emissivemap,ee.bumpmap,ee.normalmap,ee.displacementmap,ee.fog,ee.lights,{emissive:{value:new t.Color(0)},specular:{value:new t.Color(1118481)},shininess:{value:30}}]),vertexShader:Pe.meshphong_vert,fragmentShader:Pe.meshphong_frag},standard:{uniforms:t.mergeUniforms([ee.common,ee.envmap,ee.aomap,ee.lightmap,ee.emissivemap,ee.bumpmap,ee.normalmap,ee.displacementmap,ee.roughnessmap,ee.metalnessmap,ee.fog,ee.lights,{emissive:{value:new t.Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Pe.meshphysical_vert,fragmentShader:Pe.meshphysical_frag},toon:{uniforms:t.mergeUniforms([ee.common,ee.aomap,ee.lightmap,ee.emissivemap,ee.bumpmap,ee.normalmap,ee.displacementmap,ee.gradientmap,ee.fog,ee.lights,{emissive:{value:new t.Color(0)}}]),vertexShader:Pe.meshtoon_vert,fragmentShader:Pe.meshtoon_frag},matcap:{uniforms:t.mergeUniforms([ee.common,ee.bumpmap,ee.normalmap,ee.displacementmap,ee.fog,{matcap:{value:null}}]),vertexShader:Pe.meshmatcap_vert,fragmentShader:Pe.meshmatcap_frag},points:{uniforms:t.mergeUniforms([ee.points,ee.fog]),vertexShader:Pe.points_vert,fragmentShader:Pe.points_frag},dashed:{uniforms:t.mergeUniforms([ee.common,ee.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Pe.linedashed_vert,fragmentShader:Pe.linedashed_frag},depth:{uniforms:t.mergeUniforms([ee.common,ee.displacementmap]),vertexShader:Pe.depth_vert,fragmentShader:Pe.depth_frag},normal:{uniforms:t.mergeUniforms([ee.common,ee.bumpmap,ee.normalmap,ee.displacementmap,{opacity:{value:1}}]),vertexShader:Pe.meshnormal_vert,fragmentShader:Pe.meshnormal_frag},sprite:{uniforms:t.mergeUniforms([ee.sprite,ee.fog]),vertexShader:Pe.sprite_vert,fragmentShader:Pe.sprite_frag},background:{uniforms:{uvTransform:{value:new t.Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Pe.background_vert,fragmentShader:Pe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new t.Matrix3}},vertexShader:Pe.backgroundCube_vert,fragmentShader:Pe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Pe.cube_vert,fragmentShader:Pe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Pe.equirect_vert,fragmentShader:Pe.equirect_frag},distanceRGBA:{uniforms:t.mergeUniforms([ee.common,ee.displacementmap,{referencePosition:{value:new t.Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Pe.distanceRGBA_vert,fragmentShader:Pe.distanceRGBA_frag},shadow:{uniforms:t.mergeUniforms([ee.lights,ee.fog,{color:{value:new t.Color(0)},opacity:{value:1}}]),vertexShader:Pe.shadow_vert,fragmentShader:Pe.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:Pe.meshphysical_vert,fragmentShader:Pe.meshphysical_frag};const Ct={r:0,b:0,g:0},ht=new t.Euler,da=new t.Matrix4;function ua(e,i,n,r,c,s,_){const d=new t.Color(0);let b=s===!0?0:1,S,P,C=null,E=0,A=null;function F(x){let g=x.isScene===!0?x.background:null;return g&&g.isTexture&&(g=(x.backgroundBlurriness>0?n:i).get(g)),g}function L(x){let g=!1;const H=F(x);H===null?a(d,b):H&&H.isColor&&(a(H,1),g=!0);const U=e.xr.getEnvironmentBlendMode();U==="additive"?r.buffers.color.setClear(0,0,0,1,_):U==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,_),(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(x,g){const H=F(g);H&&(H.isCubeTexture||H.mapping===t.CubeUVReflectionMapping)?(P===void 0&&(P=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})),P.geometry.deleteAttribute("normal"),P.geometry.deleteAttribute("uv"),P.onBeforeRender=function(U,N,G){this.matrixWorld.copyPosition(G.matrixWorld)},Object.defineProperty(P.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),c.update(P)),ht.copy(g.backgroundRotation),ht.x*=-1,ht.y*=-1,ht.z*=-1,H.isCubeTexture&&H.isRenderTargetTexture===!1&&(ht.y*=-1,ht.z*=-1),P.material.uniforms.envMap.value=H,P.material.uniforms.flipEnvMap.value=H.isCubeTexture&&H.isRenderTargetTexture===!1?-1:1,P.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,P.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,P.material.uniforms.backgroundRotation.value.setFromMatrix4(da.makeRotationFromEuler(ht)),P.material.toneMapped=t.ColorManagement.getTransfer(H.colorSpace)!==t.SRGBTransfer,(C!==H||E!==H.version||A!==e.toneMapping)&&(P.material.needsUpdate=!0,C=H,E=H.version,A=e.toneMapping),P.layers.enableAll(),x.unshift(P,P.geometry,P.material,0,0,null)):H&&H.isTexture&&(S===void 0&&(S=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})),S.geometry.deleteAttribute("normal"),Object.defineProperty(S.material,"map",{get:function(){return this.uniforms.t2D.value}}),c.update(S)),S.material.uniforms.t2D.value=H,S.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,S.material.toneMapped=t.ColorManagement.getTransfer(H.colorSpace)!==t.SRGBTransfer,H.matrixAutoUpdate===!0&&H.updateMatrix(),S.material.uniforms.uvTransform.value.copy(H.matrix),(C!==H||E!==H.version||A!==e.toneMapping)&&(S.material.needsUpdate=!0,C=H,E=H.version,A=e.toneMapping),S.layers.enableAll(),x.unshift(S,S.geometry,S.material,0,0,null))}function a(x,g){x.getRGB(Ct,t.getUnlitUniformColorSpace(e)),r.buffers.color.setClear(Ct.r,Ct.g,Ct.b,g,_)}function I(){P!==void 0&&(P.geometry.dispose(),P.material.dispose()),S!==void 0&&(S.geometry.dispose(),S.material.dispose())}return{getClearColor:function(){return d},setClearColor:function(x,g=1){d.set(x),b=g,a(d,b)},getClearAlpha:function(){return b},setClearAlpha:function(x){b=x,a(d,b)},render:L,addToRenderList:f,dispose:I}}function pa(e,i){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},c=E(null);let s=c,_=!1;function d(u,R,K,k,Y){let J=!1;const z=C(k,K,R);s!==z&&(s=z,S(s.object)),J=A(u,k,K,Y),J&&F(u,k,K,Y),Y!==null&&i.update(Y,e.ELEMENT_ARRAY_BUFFER),(J||_)&&(_=!1,g(u,R,K,k),Y!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i.get(Y).buffer))}function b(){return e.createVertexArray()}function S(u){return e.bindVertexArray(u)}function P(u){return e.deleteVertexArray(u)}function C(u,R,K){const k=K.wireframe===!0;let Y=r[u.id];Y===void 0&&(Y={},r[u.id]=Y);let J=Y[R.id];J===void 0&&(J={},Y[R.id]=J);let z=J[k];return z===void 0&&(z=E(b()),J[k]=z),z}function E(u){const R=[],K=[],k=[];for(let Y=0;Y<n;Y++)R[Y]=0,K[Y]=0,k[Y]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:R,enabledAttributes:K,attributeDivisors:k,object:u,attributes:{},index:null}}function A(u,R,K,k){const Y=s.attributes,J=R.attributes;let z=0;const te=K.getAttributes();for(const B in te)if(te[B].location>=0){const Me=Y[B];let De=J[B];if(De===void 0&&(B==="instanceMatrix"&&u.instanceMatrix&&(De=u.instanceMatrix),B==="instanceColor"&&u.instanceColor&&(De=u.instanceColor)),Me===void 0||Me.attribute!==De||De&&Me.data!==De.data)return!0;z++}return s.attributesNum!==z||s.index!==k}function F(u,R,K,k){const Y={},J=R.attributes;let z=0;const te=K.getAttributes();for(const B in te)if(te[B].location>=0){let Me=J[B];Me===void 0&&(B==="instanceMatrix"&&u.instanceMatrix&&(Me=u.instanceMatrix),B==="instanceColor"&&u.instanceColor&&(Me=u.instanceColor));const De={};De.attribute=Me,Me&&Me.data&&(De.data=Me.data),Y[B]=De,z++}s.attributes=Y,s.attributesNum=z,s.index=k}function L(){const u=s.newAttributes;for(let R=0,K=u.length;R<K;R++)u[R]=0}function f(u){a(u,0)}function a(u,R){const K=s.newAttributes,k=s.enabledAttributes,Y=s.attributeDivisors;K[u]=1,k[u]===0&&(e.enableVertexAttribArray(u),k[u]=1),Y[u]!==R&&(e.vertexAttribDivisor(u,R),Y[u]=R)}function I(){const u=s.newAttributes,R=s.enabledAttributes;for(let K=0,k=R.length;K<k;K++)R[K]!==u[K]&&(e.disableVertexAttribArray(K),R[K]=0)}function x(u,R,K,k,Y,J,z){z===!0?e.vertexAttribIPointer(u,R,K,Y,J):e.vertexAttribPointer(u,R,K,k,Y,J)}function g(u,R,K,k){L();const Y=k.attributes,J=K.getAttributes(),z=R.defaultAttributeValues;for(const te in J){const B=J[te];if(B.location>=0){let _e=Y[te];if(_e===void 0&&(te==="instanceMatrix"&&u.instanceMatrix&&(_e=u.instanceMatrix),te==="instanceColor"&&u.instanceColor&&(_e=u.instanceColor)),_e!==void 0){const Me=_e.normalized,De=_e.itemSize,Ge=i.get(_e);if(Ge===void 0)continue;const Ye=Ge.buffer,W=Ge.type,j=Ge.bytesPerElement,pe=W===e.INT||W===e.UNSIGNED_INT||_e.gpuType===t.IntType;if(_e.isInterleavedBufferAttribute){const re=_e.data,Te=re.stride,Ce=_e.offset;if(re.isInstancedInterleavedBuffer){for(let Ue=0;Ue<B.locationSize;Ue++)a(B.location+Ue,re.meshPerAttribute);u.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Ue=0;Ue<B.locationSize;Ue++)f(B.location+Ue);e.bindBuffer(e.ARRAY_BUFFER,Ye);for(let Ue=0;Ue<B.locationSize;Ue++)x(B.location+Ue,De/B.locationSize,W,Me,Te*j,(Ce+De/B.locationSize*Ue)*j,pe)}else{if(_e.isInstancedBufferAttribute){for(let re=0;re<B.locationSize;re++)a(B.location+re,_e.meshPerAttribute);u.isInstancedMesh!==!0&&k._maxInstanceCount===void 0&&(k._maxInstanceCount=_e.meshPerAttribute*_e.count)}else for(let re=0;re<B.locationSize;re++)f(B.location+re);e.bindBuffer(e.ARRAY_BUFFER,Ye);for(let re=0;re<B.locationSize;re++)x(B.location+re,De/B.locationSize,W,Me,De*j,De/B.locationSize*re*j,pe)}}else if(z!==void 0){const Me=z[te];if(Me!==void 0)switch(Me.length){case 2:e.vertexAttrib2fv(B.location,Me);break;case 3:e.vertexAttrib3fv(B.location,Me);break;case 4:e.vertexAttrib4fv(B.location,Me);break;default:e.vertexAttrib1fv(B.location,Me)}}}}I()}function H(){G();for(const u in r){const R=r[u];for(const K in R){const k=R[K];for(const Y in k)P(k[Y].object),delete k[Y];delete R[K]}delete r[u]}}function U(u){if(r[u.id]===void 0)return;const R=r[u.id];for(const K in R){const k=R[K];for(const Y in k)P(k[Y].object),delete k[Y];delete R[K]}delete r[u.id]}function N(u){for(const R in r){const K=r[R];if(K[u.id]===void 0)continue;const k=K[u.id];for(const Y in k)P(k[Y].object),delete k[Y];delete K[u.id]}}function G(){h(),_=!0,s!==c&&(s=c,S(s.object))}function h(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:d,reset:G,resetDefaultState:h,dispose:H,releaseStatesOfGeometry:U,releaseStatesOfProgram:N,initAttributes:L,enableAttribute:f,disableUnusedAttributes:I}}function ha(e,i,n){let r;function c(S){r=S}function s(S,P){e.drawArrays(r,S,P),n.update(P,r,1)}function _(S,P,C){C!==0&&(e.drawArraysInstanced(r,S,P,C),n.update(P,r,C))}function d(S,P,C){if(C===0)return;i.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,S,0,P,0,C);let A=0;for(let F=0;F<C;F++)A+=P[F];n.update(A,r,1)}function b(S,P,C,E){if(C===0)return;const A=i.get("WEBGL_multi_draw");if(A===null)for(let F=0;F<S.length;F++)_(S[F],P[F],E[F]);else{A.multiDrawArraysInstancedWEBGL(r,S,0,P,0,E,0,C);let F=0;for(let L=0;L<C;L++)F+=P[L]*E[L];n.update(F,r,1)}}this.setMode=c,this.render=s,this.renderInstances=_,this.renderMultiDraw=d,this.renderMultiDrawInstances=b}function _a(e,i,n,r){let c;function s(){if(c!==void 0)return c;if(i.has("EXT_texture_filter_anisotropic")===!0){const N=i.get("EXT_texture_filter_anisotropic");c=e.getParameter(N.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else c=0;return c}function _(N){return!(N!==t.RGBAFormat&&r.convert(N)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))}function d(N){const G=N===t.HalfFloatType&&(i.has("EXT_color_buffer_half_float")||i.has("EXT_color_buffer_float"));return!(N!==t.UnsignedByteType&&r.convert(N)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&N!==t.FloatType&&!G)}function b(N){if(N==="highp"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";N="mediump"}return N==="mediump"&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let S=n.precision!==void 0?n.precision:"highp";const P=b(S);P!==S&&(console.warn("THREE.WebGLRenderer:",S,"not supported, using",P,"instead."),S=P);const C=n.logarithmicDepthBuffer===!0,E=n.reverseDepthBuffer===!0&&i.has("EXT_clip_control"),A=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),F=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),L=e.getParameter(e.MAX_TEXTURE_SIZE),f=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),a=e.getParameter(e.MAX_VERTEX_ATTRIBS),I=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),x=e.getParameter(e.MAX_VARYING_VECTORS),g=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),H=F>0,U=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:b,textureFormatReadable:_,textureTypeReadable:d,precision:S,logarithmicDepthBuffer:C,reverseDepthBuffer:E,maxTextures:A,maxVertexTextures:F,maxTextureSize:L,maxCubemapSize:f,maxAttributes:a,maxVertexUniforms:I,maxVaryings:x,maxFragmentUniforms:g,vertexTextures:H,maxSamples:U}}function ma(e){const i=this;let n=null,r=0,c=!1,s=!1;const _=new t.Plane,d=new t.Matrix3,b={value:null,needsUpdate:!1};this.uniform=b,this.numPlanes=0,this.numIntersection=0,this.init=function(C,E){const A=C.length!==0||E||r!==0||c;return c=E,r=C.length,A},this.beginShadows=function(){s=!0,P(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(C,E){n=P(C,E,0)},this.setState=function(C,E,A){const F=C.clippingPlanes,L=C.clipIntersection,f=C.clipShadows,a=e.get(C);if(!c||F===null||F.length===0||s&&!f)s?P(null):S();else{const I=s?0:r,x=I*4;let g=a.clippingState||null;b.value=g,g=P(F,E,x,A);for(let H=0;H!==x;++H)g[H]=n[H];a.clippingState=g,this.numIntersection=L?this.numPlanes:0,this.numPlanes+=I}};function S(){b.value!==n&&(b.value=n,b.needsUpdate=r>0),i.numPlanes=r,i.numIntersection=0}function P(C,E,A,F){const L=C!==null?C.length:0;let f=null;if(L!==0){if(f=b.value,F!==!0||f===null){const a=A+L*4,I=E.matrixWorldInverse;d.getNormalMatrix(I),(f===null||f.length<a)&&(f=new Float32Array(a));for(let x=0,g=A;x!==L;++x,g+=4)_.copy(C[x]).applyMatrix4(I,d),_.normal.toArray(f,g),f[g+3]=_.constant}b.value=f,b.needsUpdate=!0}return i.numPlanes=L,i.numIntersection=0,f}}function ga(e){let i=new WeakMap;function n(_,d){return d===t.EquirectangularReflectionMapping?_.mapping=t.CubeReflectionMapping:d===t.EquirectangularRefractionMapping&&(_.mapping=t.CubeRefractionMapping),_}function r(_){if(_&&_.isTexture){const d=_.mapping;if(d===t.EquirectangularReflectionMapping||d===t.EquirectangularRefractionMapping)if(i.has(_)){const b=i.get(_).texture;return n(b,_.mapping)}else{const b=_.image;if(b&&b.height>0){const S=new t.WebGLCubeRenderTarget(b.height);return S.fromEquirectangularTexture(e,_),i.set(_,S),_.addEventListener("dispose",c),n(S.texture,_.mapping)}else return null}}return _}function c(_){const d=_.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,Zt=[.125,.215,.35,.446,.526,.582],gt=20,yt=new t.OrthographicCamera,Qt=new t.Color;let It=null,Nt=0,Ft=0,Ot=!1;const mt=(1+Math.sqrt(5))/2,St=1/mt,Jt=[new t.Vector3(-mt,St,0),new t.Vector3(mt,St,0),new t.Vector3(-St,0,mt),new t.Vector3(St,0,mt),new t.Vector3(0,mt,-St),new t.Vector3(0,mt,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)];class Vt{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){It=this._renderer.getRenderTarget(),Nt=this._renderer.getActiveCubeFace(),Ft=this._renderer.getActiveMipmapLevel(),Ot=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(i,r,c,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(i,n=null){return this._fromTexture(i,n)}fromCubemap(i,n=null){return this._fromTexture(i,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=tn(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=en(),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(It,Nt,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),It=this._renderer.getRenderTarget(),Nt=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}=va(s)),this._blurMaterial=Sa(s,i,n)}return c}_compileMaterial(i){const n=new t.Mesh(this._lodPlanes[0],i);this._renderer.compile(n,yt)}_sceneToCubeUV(i,n,r,c){const d=new t.PerspectiveCamera(90,1,n,r),b=[1,-1,1,1,1,1],S=[1,1,1,-1,-1,-1],P=this._renderer,C=P.autoClear,E=P.toneMapping;P.getClearColor(Qt),P.toneMapping=t.NoToneMapping,P.autoClear=!1;const A=new t.MeshBasicMaterial({name:"PMREM.Background",side:t.BackSide,depthWrite:!1,depthTest:!1}),F=new t.Mesh(new t.BoxGeometry,A);let L=!1;const f=i.background;f?f.isColor&&(A.color.copy(f),i.background=null,L=!0):(A.color.copy(Qt),L=!0);for(let a=0;a<6;a++){const I=a%3;I===0?(d.up.set(0,b[a],0),d.lookAt(S[a],0,0)):I===1?(d.up.set(0,0,b[a]),d.lookAt(0,S[a],0)):(d.up.set(0,b[a],0),d.lookAt(0,0,S[a]));const x=this._cubeSize;bt(c,I*x,a>2?x:0,x,x),P.setRenderTarget(c),L&&P.render(F,d),P.render(i,d)}F.geometry.dispose(),F.material.dispose(),P.toneMapping=E,P.autoClear=C,i.background=f}_textureToCubeUV(i,n){const r=this._renderer,c=i.mapping===t.CubeReflectionMapping||i.mapping===t.CubeRefractionMapping;c?(this._cubemapMaterial===null&&(this._cubemapMaterial=tn()),this._cubemapMaterial.uniforms.flipEnvMap.value=i.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=en());const s=c?this._cubemapMaterial:this._equirectMaterial,_=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(_,yt)}_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 _=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),d=Jt[(c-s-1)%Jt.length];this._blur(i,s-1,s,_,d)}n.autoClear=r}_blur(i,n,r,c,s){const _=this._pingPongRenderTarget;this._halfBlur(i,_,n,r,c,"latitudinal",s),this._halfBlur(_,i,r,r,c,"longitudinal",s)}_halfBlur(i,n,r,c,s,_,d){const b=this._renderer,S=this._blurMaterial;_!=="latitudinal"&&_!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const P=3,C=new t.Mesh(this._lodPlanes[c],S),E=S.uniforms,A=this._sizeLods[r]-1,F=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*gt-1),L=s/F,f=isFinite(s)?1+Math.floor(P*L):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 I=0;for(let N=0;N<gt;++N){const G=N/L,h=Math.exp(-G*G/2);a.push(h),N===0?I+=h:N<f&&(I+=2*h)}for(let N=0;N<a.length;N++)a[N]=a[N]/I;E.envMap.value=i.texture,E.samples.value=f,E.weights.value=a,E.latitudinal.value=_==="latitudinal",d&&(E.poleAxis.value=d);const{_lodMax:x}=this;E.dTheta.value=F,E.mipInt.value=x-r;const g=this._sizeLods[c],H=3*g*(c>x-Et?c-x+Et:0),U=4*(this._cubeSize-g);bt(n,H,U,3*g,2*g),b.setRenderTarget(n),b.render(C,yt)}}function va(e){const i=[],n=[],r=[];let c=e;const s=e-Et+1+Zt.length;for(let _=0;_<s;_++){const d=Math.pow(2,c);n.push(d);let b=1/d;_>e-Et?b=Zt[_-e+Et-1]:_===0&&(b=0),r.push(b);const S=1/(d-2),P=-S,C=1+S,E=[P,P,C,P,C,C,P,P,C,C,P,C],A=6,F=6,L=3,f=2,a=1,I=new Float32Array(L*F*A),x=new Float32Array(f*F*A),g=new Float32Array(a*F*A);for(let U=0;U<A;U++){const N=U%3*2/3-1,G=U>2?0:-1,h=[N,G,0,N+2/3,G,0,N+2/3,G+1,0,N,G,0,N+2/3,G+1,0,N,G+1,0];I.set(h,L*F*U),x.set(E,f*F*U);const u=[U,U,U,U,U,U];g.set(u,a*F*U)}const H=new t.BufferGeometry;H.setAttribute("position",new t.BufferAttribute(I,L)),H.setAttribute("uv",new t.BufferAttribute(x,f)),H.setAttribute("faceIndex",new t.BufferAttribute(g,a)),i.push(H),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 Sa(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:kt(),fragmentShader:`
3537
+
3538
+ precision mediump float;
3539
+ precision mediump int;
3540
+
3541
+ varying vec3 vOutputDirection;
3542
+
3543
+ uniform sampler2D envMap;
3544
+ uniform int samples;
3545
+ uniform float weights[ n ];
3546
+ uniform bool latitudinal;
3547
+ uniform float dTheta;
3548
+ uniform float mipInt;
3549
+ uniform vec3 poleAxis;
3550
+
3551
+ #define ENVMAP_TYPE_CUBE_UV
3552
+ #include <cube_uv_reflection_fragment>
3553
+
3554
+ vec3 getSample( float theta, vec3 axis ) {
3555
+
3556
+ float cosTheta = cos( theta );
3557
+ // Rodrigues' axis-angle rotation
3558
+ vec3 sampleDirection = vOutputDirection * cosTheta
3559
+ + cross( axis, vOutputDirection ) * sin( theta )
3560
+ + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3561
+
3562
+ return bilinearCubeUV( envMap, sampleDirection, mipInt );
3563
+
3564
+ }
3565
+
3566
+ void main() {
3567
+
3568
+ vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3569
+
3570
+ if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3571
+
3572
+ axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3573
+
3574
+ }
3575
+
3576
+ axis = normalize( axis );
3577
+
3578
+ gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3579
+ gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3580
+
3581
+ for ( int i = 1; i < n; i++ ) {
3582
+
3583
+ if ( i >= samples ) {
3584
+
3585
+ break;
3586
+
3587
+ }
3588
+
3589
+ float theta = dTheta * float( i );
3590
+ gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3591
+ gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3592
+
3593
+ }
3594
+
3595
+ }
3596
+ `,blending:t.NoBlending,depthTest:!1,depthWrite:!1})}function en(){return new t.ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:kt(),fragmentShader:`
3597
+
3598
+ precision mediump float;
3599
+ precision mediump int;
3600
+
3601
+ varying vec3 vOutputDirection;
3602
+
3603
+ uniform sampler2D envMap;
3604
+
3605
+ #include <common>
3606
+
3607
+ void main() {
3608
+
3609
+ vec3 outputDirection = normalize( vOutputDirection );
3610
+ vec2 uv = equirectUv( outputDirection );
3611
+
3612
+ gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3613
+
3614
+ }
3615
+ `,blending:t.NoBlending,depthTest:!1,depthWrite:!1})}function tn(){return new t.ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:kt(),fragmentShader:`
3616
+
3617
+ precision mediump float;
3618
+ precision mediump int;
3619
+
3620
+ uniform float flipEnvMap;
3621
+
3622
+ varying vec3 vOutputDirection;
3623
+
3624
+ uniform samplerCube envMap;
3625
+
3626
+ void main() {
3627
+
3628
+ gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3629
+
3630
+ }
3631
+ `,blending:t.NoBlending,depthTest:!1,depthWrite:!1})}function kt(){return`
3632
+
3633
+ precision mediump float;
3634
+ precision mediump int;
3635
+
3636
+ attribute float faceIndex;
3637
+
3638
+ varying vec3 vOutputDirection;
3639
+
3640
+ // RH coordinate system; PMREM face-indexing convention
3641
+ vec3 getDirection( vec2 uv, float face ) {
3642
+
3643
+ uv = 2.0 * uv - 1.0;
3644
+
3645
+ vec3 direction = vec3( uv, 1.0 );
3646
+
3647
+ if ( face == 0.0 ) {
3648
+
3649
+ direction = direction.zyx; // ( 1, v, u ) pos x
3650
+
3651
+ } else if ( face == 1.0 ) {
3652
+
3653
+ direction = direction.xzy;
3654
+ direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3655
+
3656
+ } else if ( face == 2.0 ) {
3657
+
3658
+ direction.x *= -1.0; // ( -u, v, 1 ) pos z
3659
+
3660
+ } else if ( face == 3.0 ) {
3661
+
3662
+ direction = direction.zyx;
3663
+ direction.xz *= -1.0; // ( -1, v, -u ) neg x
3664
+
3665
+ } else if ( face == 4.0 ) {
3666
+
3667
+ direction = direction.xzy;
3668
+ direction.xy *= -1.0; // ( -u, -1, v ) neg y
3669
+
3670
+ } else if ( face == 5.0 ) {
3671
+
3672
+ direction.z *= -1.0; // ( u, v, -1 ) neg z
3673
+
3674
+ }
3675
+
3676
+ return direction;
3677
+
3678
+ }
3679
+
3680
+ void main() {
3681
+
3682
+ vOutputDirection = getDirection( uv, faceIndex );
3683
+ gl_Position = vec4( position, 1.0 );
3684
+
3685
+ }
3686
+ `}function Ea(e){let i=new WeakMap,n=null;function r(d){if(d&&d.isTexture){const b=d.mapping,S=b===t.EquirectangularReflectionMapping||b===t.EquirectangularRefractionMapping,P=b===t.CubeReflectionMapping||b===t.CubeRefractionMapping;if(S||P){let C=i.get(d);const E=C!==void 0?C.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==E)return n===null&&(n=new Vt(e)),C=S?n.fromEquirectangular(d,C):n.fromCubemap(d,C),C.texture.pmremVersion=d.pmremVersion,i.set(d,C),C.texture;if(C!==void 0)return C.texture;{const A=d.image;return S&&A&&A.height>0||P&&A&&c(A)?(n===null&&(n=new Vt(e)),C=S?n.fromEquirectangular(d):n.fromCubemap(d),C.texture.pmremVersion=d.pmremVersion,i.set(d,C),d.addEventListener("dispose",s),C.texture):null}}}return d}function c(d){let b=0;const S=6;for(let P=0;P<S;P++)d[P]!==void 0&&b++;return b===S}function s(d){const b=d.target;b.removeEventListener("dispose",s);const S=i.get(b);S!==void 0&&(i.delete(b),S.dispose())}function _(){i=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:_}}function Ma(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 Ta(e,i,n,r){const c={},s=new WeakMap;function _(C){const E=C.target;E.index!==null&&i.remove(E.index);for(const F in E.attributes)i.remove(E.attributes[F]);E.removeEventListener("dispose",_),delete c[E.id];const A=s.get(E);A&&(i.remove(A),s.delete(E)),r.releaseStatesOfGeometry(E),E.isInstancedBufferGeometry===!0&&delete E._maxInstanceCount,n.memory.geometries--}function d(C,E){return c[E.id]===!0||(E.addEventListener("dispose",_),c[E.id]=!0,n.memory.geometries++),E}function b(C){const E=C.attributes;for(const A in E)i.update(E[A],e.ARRAY_BUFFER)}function S(C){const E=[],A=C.index,F=C.attributes.position;let L=0;if(A!==null){const I=A.array;L=A.version;for(let x=0,g=I.length;x<g;x+=3){const H=I[x+0],U=I[x+1],N=I[x+2];E.push(H,U,U,N,N,H)}}else if(F!==void 0){const I=F.array;L=F.version;for(let x=0,g=I.length/3-1;x<g;x+=3){const H=x+0,U=x+1,N=x+2;E.push(H,U,U,N,N,H)}}else return;const f=new(t.arrayNeedsUint32(E)?t.Uint32BufferAttribute:t.Uint16BufferAttribute)(E,1);f.version=L;const a=s.get(C);a&&i.remove(a),s.set(C,f)}function P(C){const E=s.get(C);if(E){const A=C.index;A!==null&&E.version<A.version&&S(C)}else S(C);return s.get(C)}return{get:d,update:b,getWireframeAttribute:P}}function xa(e,i,n){let r;function c(E){r=E}let s,_;function d(E){s=E.type,_=E.bytesPerElement}function b(E,A){e.drawElements(r,A,s,E*_),n.update(A,r,1)}function S(E,A,F){F!==0&&(e.drawElementsInstanced(r,A,s,E*_,F),n.update(A,r,F))}function P(E,A,F){if(F===0)return;i.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,A,0,s,E,0,F);let f=0;for(let a=0;a<F;a++)f+=A[a];n.update(f,r,1)}function C(E,A,F,L){if(F===0)return;const f=i.get("WEBGL_multi_draw");if(f===null)for(let a=0;a<E.length;a++)S(E[a]/_,A[a],L[a]);else{f.multiDrawElementsInstancedWEBGL(r,A,0,s,E,0,L,0,F);let a=0;for(let I=0;I<F;I++)a+=A[I]*L[I];n.update(a,r,1)}}this.setMode=c,this.setIndex=d,this.render=b,this.renderInstances=S,this.renderMultiDraw=P,this.renderMultiDrawInstances=C}function Aa(e){const i={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,_,d){switch(n.calls++,_){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:",_);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 Ra(e,i,n){const r=new WeakMap,c=new t.Vector4;function s(_,d,b){const S=_.morphTargetInfluences,P=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,C=P!==void 0?P.length:0;let E=r.get(d);if(E===void 0||E.count!==C){let h=function(){N.dispose(),r.delete(d),d.removeEventListener("dispose",h)};E!==void 0&&E.texture.dispose();const A=d.morphAttributes.position!==void 0,F=d.morphAttributes.normal!==void 0,L=d.morphAttributes.color!==void 0,f=d.morphAttributes.position||[],a=d.morphAttributes.normal||[],I=d.morphAttributes.color||[];let x=0;A===!0&&(x=1),F===!0&&(x=2),L===!0&&(x=3);let g=d.attributes.position.count*x,H=1;g>i.maxTextureSize&&(H=Math.ceil(g/i.maxTextureSize),g=i.maxTextureSize);const U=new Float32Array(g*H*4*C),N=new t.DataArrayTexture(U,g,H,C);N.type=t.FloatType,N.needsUpdate=!0;const G=x*4;for(let u=0;u<C;u++){const R=f[u],K=a[u],k=I[u],Y=g*H*4*u;for(let J=0;J<R.count;J++){const z=J*G;A===!0&&(c.fromBufferAttribute(R,J),U[Y+z+0]=c.x,U[Y+z+1]=c.y,U[Y+z+2]=c.z,U[Y+z+3]=0),F===!0&&(c.fromBufferAttribute(K,J),U[Y+z+4]=c.x,U[Y+z+5]=c.y,U[Y+z+6]=c.z,U[Y+z+7]=0),L===!0&&(c.fromBufferAttribute(k,J),U[Y+z+8]=c.x,U[Y+z+9]=c.y,U[Y+z+10]=c.z,U[Y+z+11]=k.itemSize===4?c.w:1)}}E={count:C,texture:N,size:new t.Vector2(g,H)},r.set(d,E),d.addEventListener("dispose",h)}if(_.isInstancedMesh===!0&&_.morphTexture!==null)b.getUniforms().setValue(e,"morphTexture",_.morphTexture,n);else{let A=0;for(let L=0;L<S.length;L++)A+=S[L];const F=d.morphTargetsRelative?1:1-A;b.getUniforms().setValue(e,"morphTargetBaseInfluence",F),b.getUniforms().setValue(e,"morphTargetInfluences",S)}b.getUniforms().setValue(e,"morphTargetsTexture",E.texture,n),b.getUniforms().setValue(e,"morphTargetsTextureSize",E.size)}return{update:s}}function Ca(e,i,n,r){let c=new WeakMap;function s(b){const S=r.render.frame,P=b.geometry,C=i.get(b,P);if(c.get(C)!==S&&(i.update(C),c.set(C,S)),b.isInstancedMesh&&(b.hasEventListener("dispose",d)===!1&&b.addEventListener("dispose",d),c.get(b)!==S&&(n.update(b.instanceMatrix,e.ARRAY_BUFFER),b.instanceColor!==null&&n.update(b.instanceColor,e.ARRAY_BUFFER),c.set(b,S))),b.isSkinnedMesh){const E=b.skeleton;c.get(E)!==S&&(E.update(),c.set(E,S))}return C}function _(){c=new WeakMap}function d(b){const S=b.target;S.removeEventListener("dispose",d),n.remove(S.instanceMatrix),S.instanceColor!==null&&n.remove(S.instanceColor)}return{update:s,dispose:_}}const Mn=new t.Texture,nn=new t.DepthTexture(1,1),Tn=new t.DataArrayTexture,xn=new t.Data3DTexture,An=new t.CubeTexture,rn=[],an=[],on=new Float32Array(16),sn=new Float32Array(9),ln=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=rn[c];if(s===void 0&&(s=new Float32Array(c),rn[c]=s),i!==0){r.toArray(s,0);for(let _=1,d=0;_!==i;++_)d+=n,e[_].toArray(s,d)}return s}function Je(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 je(e,i){for(let n=0,r=i.length;n<r;n++)e[n]=i[n]}function Dt(e,i){let n=an[i];n===void 0&&(n=new Int32Array(i),an[i]=n);for(let r=0;r!==i;++r)n[r]=e.allocateTextureUnit();return n}function ba(e,i){const n=this.cache;n[0]!==i&&(e.uniform1f(this.addr,i),n[0]=i)}function Pa(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(Je(n,i))return;e.uniform2fv(this.addr,i),je(n,i)}}function La(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(Je(n,i))return;e.uniform3fv(this.addr,i),je(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||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(Je(n,i))return;e.uniform4fv(this.addr,i),je(n,i)}}function Ua(e,i){const n=this.cache,r=i.elements;if(r===void 0){if(Je(n,i))return;e.uniformMatrix2fv(this.addr,!1,i),je(n,i)}else{if(Je(n,r))return;ln.set(r),e.uniformMatrix2fv(this.addr,!1,ln),je(n,r)}}function wa(e,i){const n=this.cache,r=i.elements;if(r===void 0){if(Je(n,i))return;e.uniformMatrix3fv(this.addr,!1,i),je(n,i)}else{if(Je(n,r))return;sn.set(r),e.uniformMatrix3fv(this.addr,!1,sn),je(n,r)}}function ya(e,i){const n=this.cache,r=i.elements;if(r===void 0){if(Je(n,i))return;e.uniformMatrix4fv(this.addr,!1,i),je(n,i)}else{if(Je(n,r))return;on.set(r),e.uniformMatrix4fv(this.addr,!1,on),je(n,r)}}function Ia(e,i){const n=this.cache;n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i)}function Na(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(Je(n,i))return;e.uniform2iv(this.addr,i),je(n,i)}}function Fa(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(Je(n,i))return;e.uniform3iv(this.addr,i),je(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||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(Je(n,i))return;e.uniform4iv(this.addr,i),je(n,i)}}function Ba(e,i){const n=this.cache;n[0]!==i&&(e.uniform1ui(this.addr,i),n[0]=i)}function Ga(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(Je(n,i))return;e.uniform2uiv(this.addr,i),je(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(Je(n,i))return;e.uniform3uiv(this.addr,i),je(n,i)}}function Ha(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(Je(n,i))return;e.uniform4uiv(this.addr,i),je(n,i)}}function ka(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?(nn.compareFunction=t.LessEqualCompare,s=nn):s=Mn,n.setTexture2D(i||s,c)}function Wa(e,i,n){const r=this.cache,c=n.allocateTextureUnit();r[0]!==c&&(e.uniform1i(this.addr,c),r[0]=c),n.setTexture3D(i||xn,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.setTextureCube(i||An,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.setTexture2DArray(i||Tn,c)}function qa(e){switch(e){case 5126:return ba;case 35664:return Pa;case 35665:return La;case 35666:return Da;case 35674:return Ua;case 35675:return wa;case 35676:return ya;case 5124:case 35670:return Ia;case 35667:case 35671:return Na;case 35668:case 35672:return Fa;case 35669:case 35673:return Oa;case 5125:return Ba;case 36294:return Ga;case 36295:return Va;case 36296:return Ha;case 35678:case 36198:case 36298:case 36306:case 35682:return ka;case 35679:case 36299:case 36307:return Wa;case 35680:case 36300:case 36308:case 36293:return za;case 36289:case 36303:case 36311:case 36292:return Xa}}function Ya(e,i){e.uniform1fv(this.addr,i)}function Ka(e,i){const n=Mt(i,this.size,2);e.uniform2fv(this.addr,n)}function $a(e,i){const n=Mt(i,this.size,3);e.uniform3fv(this.addr,n)}function Za(e,i){const n=Mt(i,this.size,4);e.uniform4fv(this.addr,n)}function Qa(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 ja(e,i){const n=Mt(i,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function eo(e,i){e.uniform1iv(this.addr,i)}function to(e,i){e.uniform2iv(this.addr,i)}function no(e,i){e.uniform3iv(this.addr,i)}function io(e,i){e.uniform4iv(this.addr,i)}function ro(e,i){e.uniform1uiv(this.addr,i)}function ao(e,i){e.uniform2uiv(this.addr,i)}function oo(e,i){e.uniform3uiv(this.addr,i)}function so(e,i){e.uniform4uiv(this.addr,i)}function lo(e,i,n){const r=this.cache,c=i.length,s=Dt(n,c);Je(r,s)||(e.uniform1iv(this.addr,s),je(r,s));for(let _=0;_!==c;++_)n.setTexture2D(i[_]||Mn,s[_])}function co(e,i,n){const r=this.cache,c=i.length,s=Dt(n,c);Je(r,s)||(e.uniform1iv(this.addr,s),je(r,s));for(let _=0;_!==c;++_)n.setTexture3D(i[_]||xn,s[_])}function fo(e,i,n){const r=this.cache,c=i.length,s=Dt(n,c);Je(r,s)||(e.uniform1iv(this.addr,s),je(r,s));for(let _=0;_!==c;++_)n.setTextureCube(i[_]||An,s[_])}function uo(e,i,n){const r=this.cache,c=i.length,s=Dt(n,c);Je(r,s)||(e.uniform1iv(this.addr,s),je(r,s));for(let _=0;_!==c;++_)n.setTexture2DArray(i[_]||Tn,s[_])}function po(e){switch(e){case 5126:return Ya;case 35664:return Ka;case 35665:return $a;case 35666:return Za;case 35674:return Qa;case 35675:return Ja;case 35676:return ja;case 5124:case 35670:return eo;case 35667:case 35671:return to;case 35668:case 35672:return no;case 35669:case 35673:return io;case 5125:return ro;case 36294:return ao;case 36295:return oo;case 36296:return so;case 35678:case 36198:case 36298:case 36306:case 35682:return lo;case 35679:case 36299:case 36307:return co;case 35680:case 36300:case 36308:case 36293:return fo;case 36289:case 36303:case 36311:case 36292:return uo}}class ho{constructor(i,n,r){this.id=i,this.addr=r,this.cache=[],this.type=n.type,this.setValue=qa(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=po(n.type)}}class mo{constructor(i){this.id=i,this.seq=[],this.map={}}setValue(i,n,r){const c=this.seq;for(let s=0,_=c.length;s!==_;++s){const d=c[s];d.setValue(i,n[d.id],r)}}}const Bt=/(\w+)(\])?(\[|\.)?/g;function cn(e,i){e.seq.push(i),e.map[i.id]=i}function go(e,i,n){const r=e.name,c=r.length;for(Bt.lastIndex=0;;){const s=Bt.exec(r),_=Bt.lastIndex;let d=s[1];const b=s[2]==="]",S=s[3];if(b&&(d=d|0),S===void 0||S==="["&&_+2===c){cn(n,S===void 0?new ho(d,e,i):new _o(d,e,i));break}else{let C=n.map[d];C===void 0&&(C=new mo(d),cn(n,C)),n=C}}}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),_=i.getUniformLocation(n,s.name);go(s,_,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,_=n.length;s!==_;++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 _=i[c];_.id in n&&r.push(_)}return r}}function fn(e,i,n){const r=e.createShader(i);return e.shaderSource(r,n),e.compileShader(r),r}const vo=37297;let So=0;function Eo(e,i){const n=e.split(`
3687
+ `),r=[],c=Math.max(i-6,0),s=Math.min(i+6,n.length);for(let _=c;_<s;_++){const d=_+1;r.push(`${d===i?">":" "} ${d}: ${n[_]}`)}return r.join(`
3688
+ `)}const dn=new t.Matrix3;function Mo(e){t.ColorManagement._getMatrix(dn,t.ColorManagement.workingColorSpace,e);const i=`mat3( ${dn.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 _=parseInt(s[1]);return n.toUpperCase()+`
3689
+
3690
+ `+c+`
3691
+
3692
+ `+Eo(e.getShaderSource(i),_)}else return c}function To(e,i){const n=Mo(i);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
3693
+ `)}function xo(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 Ao(){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(`
3694
+ `)}function Ro(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(xt).join(`
3695
+ `)}function Co(e){const i=[];for(const n in e){const r=e[n];r!==!1&&i.push("#define "+n+" "+r)}return i.join(`
3696
+ `)}function bo(e,i){const n={},r=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let c=0;c<r;c++){const s=e.getActiveAttrib(i,c),_=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[_]={type:s.type,location:e.getAttribLocation(i,_),locationSize:d}}return n}function xt(e){return e!==""}function pn(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 hn(e,i){return e.replace(/NUM_CLIPPING_PLANES/g,i.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,i.numClippingPlanes-i.numClipIntersection)}const Po=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ht(e){return e.replace(Po,Do)}const Lo=new Map;function Do(e,i){let n=Pe[i];if(n===void 0){const r=Lo.get(i);if(r!==void 0)n=Pe[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 Uo=/#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 _n(e){return e.replace(Uo,wo)}function wo(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;
3697
+ precision ${e.precision} int;
3698
+ precision ${e.precision} sampler2D;
3699
+ precision ${e.precision} samplerCube;
3700
+ precision ${e.precision} sampler3D;
3701
+ precision ${e.precision} sampler2DArray;
3702
+ precision ${e.precision} sampler2DShadow;
3703
+ precision ${e.precision} samplerCubeShadow;
3704
+ precision ${e.precision} sampler2DArrayShadow;
3705
+ precision ${e.precision} isampler2D;
3706
+ precision ${e.precision} isampler3D;
3707
+ precision ${e.precision} isamplerCube;
3708
+ precision ${e.precision} isampler2DArray;
3709
+ precision ${e.precision} usampler2D;
3710
+ precision ${e.precision} usampler3D;
3711
+ precision ${e.precision} usamplerCube;
3712
+ precision ${e.precision} usampler2DArray;
3713
+ `;return e.precision==="highp"?i+=`
3714
+ #define HIGH_PRECISION`:e.precision==="mediump"?i+=`
3715
+ #define MEDIUM_PRECISION`:e.precision==="lowp"&&(i+=`
3716
+ #define LOW_PRECISION`),i}function yo(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 Io(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 No(e){let i="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case t.CubeRefractionMapping:i="ENVMAP_MODE_REFRACTION";break}return i}function Fo(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 Oo(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 Bo(e,i,n,r){const c=e.getContext(),s=n.defines;let _=n.vertexShader,d=n.fragmentShader;const b=yo(n),S=Io(n),P=No(n),C=Fo(n),E=Oo(n),A=Ro(n),F=Co(s),L=c.createProgram();let f,a,I=n.glslVersion?"#version "+n.glslVersion+`
3717
+ `:"";n.isRawShaderMaterial?(f=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,F].filter(xt).join(`
3718
+ `),f.length>0&&(f+=`
3719
+ `),a=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,F].filter(xt).join(`
3720
+ `),a.length>0&&(a+=`
3721
+ `)):(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 "+P:"",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",`
3722
+ `].filter(xt).join(`
3723
+ `),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 "+S:"",n.envMap?"#define "+P:"",n.envMap?"#define "+C:"",E?"#define CUBEUV_TEXEL_WIDTH "+E.texelWidth:"",E?"#define CUBEUV_TEXEL_HEIGHT "+E.texelHeight:"",E?"#define CUBEUV_MAX_MIP "+E.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?Pe.tonemapping_pars_fragment:"",n.toneMapping!==t.NoToneMapping?xo("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Pe.colorspace_pars_fragment,To("linearToOutputTexel",n.outputColorSpace),Ao(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
3724
+ `].filter(xt).join(`
3725
+ `)),_=Ht(_),_=pn(_,n),_=hn(_,n),d=Ht(d),d=pn(d,n),d=hn(d,n),_=_n(_),d=_n(d),n.isRawShaderMaterial!==!0&&(I=`#version 300 es
3726
+ `,f=[A,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3727
+ `)+`
3728
+ `+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(`
3729
+ `)+`
3730
+ `+a);const x=I+f+_,g=I+a+d,H=fn(c,c.VERTEX_SHADER,x),U=fn(c,c.FRAGMENT_SHADER,g);c.attachShader(L,H),c.attachShader(L,U),n.index0AttributeName!==void 0?c.bindAttribLocation(L,0,n.index0AttributeName):n.morphTargets===!0&&c.bindAttribLocation(L,0,"position"),c.linkProgram(L);function N(R){if(e.debug.checkShaderErrors){const K=c.getProgramInfoLog(L).trim(),k=c.getShaderInfoLog(H).trim(),Y=c.getShaderInfoLog(U).trim();let J=!0,z=!0;if(c.getProgramParameter(L,c.LINK_STATUS)===!1)if(J=!1,typeof e.debug.onShaderError=="function")e.debug.onShaderError(c,L,H,U);else{const te=un(c,H,"vertex"),B=un(c,U,"fragment");console.error("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(L,c.VALIDATE_STATUS)+`
3731
+
3732
+ Material Name: `+R.name+`
3733
+ Material Type: `+R.type+`
3734
+
3735
+ Program Info Log: `+K+`
3736
+ `+te+`
3737
+ `+B)}else K!==""?console.warn("THREE.WebGLProgram: Program Info Log:",K):(k===""||Y==="")&&(z=!1);z&&(R.diagnostics={runnable:J,programLog:K,vertexShader:{log:k,prefix:f},fragmentShader:{log:Y,prefix:a}})}c.deleteShader(H),c.deleteShader(U),G=new Lt(c,L),h=bo(c,L)}let G;this.getUniforms=function(){return G===void 0&&N(this),G};let h;this.getAttributes=function(){return h===void 0&&N(this),h};let u=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return u===!1&&(u=c.getProgramParameter(L,vo)),u},this.destroy=function(){r.releaseStatesOfProgram(this),c.deleteProgram(L),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=So++,this.cacheKey=i,this.usedTimes=1,this.program=L,this.vertexShader=H,this.fragmentShader=U,this}let Go=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),_=this._getShaderCacheForMaterial(i);return _.has(c)===!1&&(_.add(c),c.usedTimes++),_.has(s)===!1&&(_.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 Ho(i),n.set(i,r)),r}}class Ho{constructor(i){this.id=Go++,this.code=i,this.usedTimes=0}}function ko(e,i,n,r,c,s,_){const d=new t.Layers,b=new Vo,S=new Set,P=[],C=c.logarithmicDepthBuffer,E=c.vertexTextures;let A=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 L(h){return S.add(h),h===0?"uv":`uv${h}`}function f(h,u,R,K,k){const Y=K.fog,J=k.geometry,z=h.isMeshStandardMaterial?K.environment:null,te=(h.isMeshStandardMaterial?n:i).get(h.envMap||z),B=te&&te.mapping===t.CubeUVReflectionMapping?te.image.height:null,_e=F[h.type];h.precision!==null&&(A=c.getMaxPrecision(h.precision),A!==h.precision&&console.warn("THREE.WebGLProgram.getParameters:",h.precision,"not supported, using",A,"instead."));const Me=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,De=Me!==void 0?Me.length:0;let Ge=0;J.morphAttributes.position!==void 0&&(Ge=1),J.morphAttributes.normal!==void 0&&(Ge=2),J.morphAttributes.color!==void 0&&(Ge=3);let Ye,W,j,pe;if(_e){const ke=ft[_e];Ye=ke.vertexShader,W=ke.fragmentShader}else Ye=h.vertexShader,W=h.fragmentShader,b.update(h),j=b.getVertexShaderID(h),pe=b.getFragmentShaderID(h);const re=e.getRenderTarget(),Te=e.state.buffers.depth.getReversed(),Ce=k.isInstancedMesh===!0,Ue=k.isBatchedMesh===!0,qe=!!h.map,Ne=!!h.matcap,Ze=!!te,m=!!h.aoMap,at=!!h.lightMap,we=!!h.bumpMap,ye=!!h.normalMap,me=!!h.displacementMap,ze=!!h.emissiveMap,ge=!!h.metalnessMap,p=!!h.roughnessMap,o=h.anisotropy>0,D=h.clearcoat>0,X=h.dispersion>0,$=h.iridescence>0,V=h.sheen>0,he=h.transmission>0,ae=o&&!!h.anisotropyMap,ce=D&&!!h.clearcoatMap,Fe=D&&!!h.clearcoatNormalMap,Q=D&&!!h.clearcoatRoughnessMap,fe=$&&!!h.iridescenceMap,Ee=$&&!!h.iridescenceThicknessMap,xe=V&&!!h.sheenColorMap,de=V&&!!h.sheenRoughnessMap,Ie=!!h.specularMap,Le=!!h.specularColorMap,We=!!h.specularIntensityMap,v=he&&!!h.transmissionMap,ne=he&&!!h.thicknessMap,O=!!h.gradientMap,q=!!h.alphaMap,se=h.alphaTest>0,oe=!!h.alphaHash,be=!!h.extensions;let Ke=t.NoToneMapping;h.toneMapped&&(re===null||re.isXRRenderTarget===!0)&&(Ke=e.toneMapping);const tt={shaderID:_e,shaderType:h.type,shaderName:h.name,vertexShader:Ye,fragmentShader:W,defines:h.defines,customVertexShaderID:j,customFragmentShaderID:pe,isRawShaderMaterial:h.isRawShaderMaterial===!0,glslVersion:h.glslVersion,precision:A,batching:Ue,batchingColor:Ue&&k._colorsTexture!==null,instancing:Ce,instancingColor:Ce&&k.instanceColor!==null,instancingMorph:Ce&&k.morphTexture!==null,supportsVertexTextures:E,outputColorSpace:re===null?e.outputColorSpace:re.isXRRenderTarget===!0?re.texture.colorSpace:t.LinearSRGBColorSpace,alphaToCoverage:!!h.alphaToCoverage,map:qe,matcap:Ne,envMap:Ze,envMapMode:Ze&&te.mapping,envMapCubeUVHeight:B,aoMap:m,lightMap:at,bumpMap:we,normalMap:ye,displacementMap:E&&me,emissiveMap:ze,normalMapObjectSpace:ye&&h.normalMapType===t.ObjectSpaceNormalMap,normalMapTangentSpace:ye&&h.normalMapType===t.TangentSpaceNormalMap,metalnessMap:ge,roughnessMap:p,anisotropy:o,anisotropyMap:ae,clearcoat:D,clearcoatMap:ce,clearcoatNormalMap:Fe,clearcoatRoughnessMap:Q,dispersion:X,iridescence:$,iridescenceMap:fe,iridescenceThicknessMap:Ee,sheen:V,sheenColorMap:xe,sheenRoughnessMap:de,specularMap:Ie,specularColorMap:Le,specularIntensityMap:We,transmission:he,transmissionMap:v,thicknessMap:ne,gradientMap:O,opaque:h.transparent===!1&&h.blending===t.NormalBlending&&h.alphaToCoverage===!1,alphaMap:q,alphaTest:se,alphaHash:oe,combine:h.combine,mapUv:qe&&L(h.map.channel),aoMapUv:m&&L(h.aoMap.channel),lightMapUv:at&&L(h.lightMap.channel),bumpMapUv:we&&L(h.bumpMap.channel),normalMapUv:ye&&L(h.normalMap.channel),displacementMapUv:me&&L(h.displacementMap.channel),emissiveMapUv:ze&&L(h.emissiveMap.channel),metalnessMapUv:ge&&L(h.metalnessMap.channel),roughnessMapUv:p&&L(h.roughnessMap.channel),anisotropyMapUv:ae&&L(h.anisotropyMap.channel),clearcoatMapUv:ce&&L(h.clearcoatMap.channel),clearcoatNormalMapUv:Fe&&L(h.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Q&&L(h.clearcoatRoughnessMap.channel),iridescenceMapUv:fe&&L(h.iridescenceMap.channel),iridescenceThicknessMapUv:Ee&&L(h.iridescenceThicknessMap.channel),sheenColorMapUv:xe&&L(h.sheenColorMap.channel),sheenRoughnessMapUv:de&&L(h.sheenRoughnessMap.channel),specularMapUv:Ie&&L(h.specularMap.channel),specularColorMapUv:Le&&L(h.specularColorMap.channel),specularIntensityMapUv:We&&L(h.specularIntensityMap.channel),transmissionMapUv:v&&L(h.transmissionMap.channel),thicknessMapUv:ne&&L(h.thicknessMap.channel),alphaMapUv:q&&L(h.alphaMap.channel),vertexTangents:!!J.attributes.tangent&&(ye||o),vertexColors:h.vertexColors,vertexAlphas:h.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!J.attributes.uv&&(qe||q),fog:!!Y,useFog:h.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:h.flatShading===!0,sizeAttenuation:h.sizeAttenuation===!0,logarithmicDepthBuffer:C,reverseDepthBuffer:Te,skinning:k.isSkinnedMesh===!0,morphTargets:J.morphAttributes.position!==void 0,morphNormals:J.morphAttributes.normal!==void 0,morphColors:J.morphAttributes.color!==void 0,morphTargetsCount:De,morphTextureStride:Ge,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:_.numPlanes,numClipIntersection:_.numIntersection,dithering:h.dithering,shadowMapEnabled:e.shadowMap.enabled&&R.length>0,shadowMapType:e.shadowMap.type,toneMapping:Ke,decodeVideoTexture:qe&&h.map.isVideoTexture===!0&&t.ColorManagement.getTransfer(h.map.colorSpace)===t.SRGBTransfer,decodeVideoTextureEmissive:ze&&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:be&&h.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(be&&h.extensions.multiDraw===!0||Ue)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:h.customProgramCacheKey()};return tt.vertexUv1s=S.has(1),tt.vertexUv2s=S.has(2),tt.vertexUv3s=S.has(3),S.clear(),tt}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 R in h.defines)u.push(R),u.push(h.defines[R]);return h.isRawShaderMaterial===!1&&(I(u,h),x(u,h),u.push(e.outputColorSpace)),u.push(h.customProgramCacheKey),u.join()}function I(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 x(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),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 R;if(u){const K=ft[u];R=t.UniformsUtils.clone(K.uniforms)}else R=h.uniforms;return R}function H(h,u){let R;for(let K=0,k=P.length;K<k;K++){const Y=P[K];if(Y.cacheKey===u){R=Y,++R.usedTimes;break}}return R===void 0&&(R=new Bo(e,u,h,s),P.push(R)),R}function U(h){if(--h.usedTimes===0){const u=P.indexOf(h);P[u]=P[P.length-1],P.pop(),h.destroy()}}function N(h){b.remove(h)}function G(){b.dispose()}return{getParameters:f,getProgramCacheKey:a,getUniforms:g,acquireProgram:H,releaseProgram:U,releaseShaderCache:N,programs:P,dispose:G}}function Wo(){let e=new WeakMap;function i(_){return e.has(_)}function n(_){let d=e.get(_);return d===void 0&&(d={},e.set(_,d)),d}function r(_){e.delete(_)}function c(_,d,b){e.get(_)[d]=b}function s(){e=new WeakMap}return{has:i,get:n,remove:r,update:c,dispose:s}}function zo(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 gn(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 vn(){const e=[];let i=0;const n=[],r=[],c=[];function s(){i=0,n.length=0,r.length=0,c.length=0}function _(C,E,A,F,L,f){let a=e[i];return a===void 0?(a={id:C.id,object:C,geometry:E,material:A,groupOrder:F,renderOrder:C.renderOrder,z:L,group:f},e[i]=a):(a.id=C.id,a.object=C,a.geometry=E,a.material=A,a.groupOrder=F,a.renderOrder=C.renderOrder,a.z=L,a.group=f),i++,a}function d(C,E,A,F,L,f){const a=_(C,E,A,F,L,f);A.transmission>0?r.push(a):A.transparent===!0?c.push(a):n.push(a)}function b(C,E,A,F,L,f){const a=_(C,E,A,F,L,f);A.transmission>0?r.unshift(a):A.transparent===!0?c.unshift(a):n.unshift(a)}function S(C,E){n.length>1&&n.sort(C||zo),r.length>1&&r.sort(E||gn),c.length>1&&c.sort(E||gn)}function P(){for(let C=i,E=e.length;C<E;C++){const A=e[C];if(A.id===null)break;A.id=null,A.object=null,A.geometry=null,A.material=null,A.group=null}}return{opaque:n,transmissive:r,transparent:c,init:s,push:d,unshift:b,finish:P,sort:S}}function Xo(){let e=new WeakMap;function i(r,c){const s=e.get(r);let _;return s===void 0?(_=new vn,e.set(r,[_])):c>=s.length?(_=new vn,s.push(_)):_=s[c],_}function n(){e=new WeakMap}return{get:i,dispose:n}}function qo(){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 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={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 Ko=0;function $o(e,i){return(i.castShadow?2:0)-(e.castShadow?2:0)+(i.map?1:0)-(e.map?1:0)}function Zo(e){const i=new qo,n=Yo(),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 S=0;S<9;S++)r.probe.push(new t.Vector3);const c=new t.Vector3,s=new t.Matrix4,_=new t.Matrix4;function d(S){let P=0,C=0,E=0;for(let h=0;h<9;h++)r.probe[h].set(0,0,0);let A=0,F=0,L=0,f=0,a=0,I=0,x=0,g=0,H=0,U=0,N=0;S.sort($o);for(let h=0,u=S.length;h<u;h++){const R=S[h],K=R.color,k=R.intensity,Y=R.distance,J=R.shadow&&R.shadow.map?R.shadow.map.texture:null;if(R.isAmbientLight)P+=K.r*k,C+=K.g*k,E+=K.b*k;else if(R.isLightProbe){for(let z=0;z<9;z++)r.probe[z].addScaledVector(R.sh.coefficients[z],k);N++}else if(R.isDirectionalLight){const z=i.get(R);if(z.color.copy(R.color).multiplyScalar(R.intensity),R.castShadow){const te=R.shadow,B=n.get(R);B.shadowIntensity=te.intensity,B.shadowBias=te.bias,B.shadowNormalBias=te.normalBias,B.shadowRadius=te.radius,B.shadowMapSize=te.mapSize,r.directionalShadow[A]=B,r.directionalShadowMap[A]=J,r.directionalShadowMatrix[A]=R.shadow.matrix,I++}r.directional[A]=z,A++}else if(R.isSpotLight){const z=i.get(R);z.position.setFromMatrixPosition(R.matrixWorld),z.color.copy(K).multiplyScalar(k),z.distance=Y,z.coneCos=Math.cos(R.angle),z.penumbraCos=Math.cos(R.angle*(1-R.penumbra)),z.decay=R.decay,r.spot[L]=z;const te=R.shadow;if(R.map&&(r.spotLightMap[H]=R.map,H++,te.updateMatrices(R),R.castShadow&&U++),r.spotLightMatrix[L]=te.matrix,R.castShadow){const B=n.get(R);B.shadowIntensity=te.intensity,B.shadowBias=te.bias,B.shadowNormalBias=te.normalBias,B.shadowRadius=te.radius,B.shadowMapSize=te.mapSize,r.spotShadow[L]=B,r.spotShadowMap[L]=J,g++}L++}else if(R.isRectAreaLight){const z=i.get(R);z.color.copy(K).multiplyScalar(k),z.halfWidth.set(R.width*.5,0,0),z.halfHeight.set(0,R.height*.5,0),r.rectArea[f]=z,f++}else if(R.isPointLight){const z=i.get(R);if(z.color.copy(R.color).multiplyScalar(R.intensity),z.distance=R.distance,z.decay=R.decay,R.castShadow){const te=R.shadow,B=n.get(R);B.shadowIntensity=te.intensity,B.shadowBias=te.bias,B.shadowNormalBias=te.normalBias,B.shadowRadius=te.radius,B.shadowMapSize=te.mapSize,B.shadowCameraNear=te.camera.near,B.shadowCameraFar=te.camera.far,r.pointShadow[F]=B,r.pointShadowMap[F]=J,r.pointShadowMatrix[F]=R.shadow.matrix,x++}r.point[F]=z,F++}else if(R.isHemisphereLight){const z=i.get(R);z.skyColor.copy(R.color).multiplyScalar(k),z.groundColor.copy(R.groundColor).multiplyScalar(k),r.hemi[a]=z,a++}}f>0&&(e.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ee.LTC_FLOAT_1,r.rectAreaLTC2=ee.LTC_FLOAT_2):(r.rectAreaLTC1=ee.LTC_HALF_1,r.rectAreaLTC2=ee.LTC_HALF_2)),r.ambient[0]=P,r.ambient[1]=C,r.ambient[2]=E;const G=r.hash;(G.directionalLength!==A||G.pointLength!==F||G.spotLength!==L||G.rectAreaLength!==f||G.hemiLength!==a||G.numDirectionalShadows!==I||G.numPointShadows!==x||G.numSpotShadows!==g||G.numSpotMaps!==H||G.numLightProbes!==N)&&(r.directional.length=A,r.spot.length=L,r.rectArea.length=f,r.point.length=F,r.hemi.length=a,r.directionalShadow.length=I,r.directionalShadowMap.length=I,r.pointShadow.length=x,r.pointShadowMap.length=x,r.spotShadow.length=g,r.spotShadowMap.length=g,r.directionalShadowMatrix.length=I,r.pointShadowMatrix.length=x,r.spotLightMatrix.length=g+H-U,r.spotLightMap.length=H,r.numSpotLightShadowsWithMaps=U,r.numLightProbes=N,G.directionalLength=A,G.pointLength=F,G.spotLength=L,G.rectAreaLength=f,G.hemiLength=a,G.numDirectionalShadows=I,G.numPointShadows=x,G.numSpotShadows=g,G.numSpotMaps=H,G.numLightProbes=N,r.version=Ko++)}function b(S,P){let C=0,E=0,A=0,F=0,L=0;const f=P.matrixWorldInverse;for(let a=0,I=S.length;a<I;a++){const x=S[a];if(x.isDirectionalLight){const g=r.directional[C];g.direction.setFromMatrixPosition(x.matrixWorld),c.setFromMatrixPosition(x.target.matrixWorld),g.direction.sub(c),g.direction.transformDirection(f),C++}else if(x.isSpotLight){const g=r.spot[A];g.position.setFromMatrixPosition(x.matrixWorld),g.position.applyMatrix4(f),g.direction.setFromMatrixPosition(x.matrixWorld),c.setFromMatrixPosition(x.target.matrixWorld),g.direction.sub(c),g.direction.transformDirection(f),A++}else if(x.isRectAreaLight){const g=r.rectArea[F];g.position.setFromMatrixPosition(x.matrixWorld),g.position.applyMatrix4(f),_.identity(),s.copy(x.matrixWorld),s.premultiply(f),_.extractRotation(s),g.halfWidth.set(x.width*.5,0,0),g.halfHeight.set(0,x.height*.5,0),g.halfWidth.applyMatrix4(_),g.halfHeight.applyMatrix4(_),F++}else if(x.isPointLight){const g=r.point[E];g.position.setFromMatrixPosition(x.matrixWorld),g.position.applyMatrix4(f),E++}else if(x.isHemisphereLight){const g=r.hemi[L];g.direction.setFromMatrixPosition(x.matrixWorld),g.direction.transformDirection(f),L++}}}return{setup:d,setupView:b,state:r}}function Sn(e){const i=new Zo(e),n=[],r=[];function c(P){S.camera=P,n.length=0,r.length=0}function s(P){n.push(P)}function _(P){r.push(P)}function d(){i.setup(n)}function b(P){i.setupView(n,P)}const S={lightsArray:n,shadowsArray:r,camera:null,lights:i,transmissionRenderTarget:{}};return{init:c,state:S,setupLights:d,setupLightsView:b,pushLight:s,pushShadow:_}}function Qo(e){let i=new WeakMap;function n(c,s=0){const _=i.get(c);let d;return _===void 0?(d=new Sn(e),i.set(c,[d])):s>=_.length?(d=new Sn(e),_.push(d)):d=_[s],d}function r(){i=new WeakMap}return{get:n,dispose:r}}const Jo=`void main() {
3738
+ gl_Position = vec4( position, 1.0 );
3739
+ }`,jo=`uniform sampler2D shadow_pass;
3740
+ uniform vec2 resolution;
3741
+ uniform float radius;
3742
+ #include <packing>
3743
+ void main() {
3744
+ const float samples = float( VSM_SAMPLES );
3745
+ float mean = 0.0;
3746
+ float squared_mean = 0.0;
3747
+ float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3748
+ float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3749
+ for ( float i = 0.0; i < samples; i ++ ) {
3750
+ float uvOffset = uvStart + i * uvStride;
3751
+ #ifdef HORIZONTAL_PASS
3752
+ vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3753
+ mean += distribution.x;
3754
+ squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3755
+ #else
3756
+ float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3757
+ mean += depth;
3758
+ squared_mean += depth * depth;
3759
+ #endif
3760
+ }
3761
+ mean = mean / samples;
3762
+ squared_mean = squared_mean / samples;
3763
+ float std_dev = sqrt( squared_mean - mean * mean );
3764
+ gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3765
+ }`;function es(e,i,n){let r=new t.Frustum;const c=new t.Vector2,s=new t.Vector2,_=new t.Vector4,d=new t.MeshDepthMaterial({depthPacking:t.RGBADepthPacking}),b=new t.MeshDistanceMaterial,S={},P=n.maxTextureSize,C={[t.FrontSide]:t.BackSide,[t.BackSide]:t.FrontSide,[t.DoubleSide]:t.DoubleSide},E=new t.ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new t.Vector2},radius:{value:4}},vertexShader:Jo,fragmentShader:jo}),A=E.clone();A.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 L=new t.Mesh(F,E),f=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=t.PCFShadowMap;let a=this.type;this.render=function(U,N,G){if(f.enabled===!1||f.autoUpdate===!1&&f.needsUpdate===!1||U.length===0)return;const h=e.getRenderTarget(),u=e.getActiveCubeFace(),R=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,z=U.length;J<z;J++){const te=U[J],B=te.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",te,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;c.copy(B.mapSize);const _e=B.getFrameExtents();if(c.multiply(_e),s.copy(B.mapSize),(c.x>P||c.y>P)&&(c.x>P&&(s.x=Math.floor(P/_e.x),c.x=s.x*_e.x,B.mapSize.x=s.x),c.y>P&&(s.y=Math.floor(P/_e.y),c.y=s.y*_e.y,B.mapSize.y=s.y)),B.map===null||k===!0||Y===!0){const De=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,De),B.map.texture.name=te.name+".shadowMap",B.camera.updateProjectionMatrix()}e.setRenderTarget(B.map),e.clear();const Me=B.getViewportCount();for(let De=0;De<Me;De++){const Ge=B.getViewport(De);_.set(s.x*Ge.x,s.y*Ge.y,s.x*Ge.z,s.y*Ge.w),K.viewport(_),B.updateMatrices(te,De),r=B.getFrustum(),g(N,G,B.camera,te,this.type)}B.isPointLightShadow!==!0&&this.type===t.VSMShadowMap&&I(B,G),B.needsUpdate=!1}a=this.type,f.needsUpdate=!1,e.setRenderTarget(h,u,R)};function I(U,N){const G=i.update(L);E.defines.VSM_SAMPLES!==U.blurSamples&&(E.defines.VSM_SAMPLES=U.blurSamples,A.defines.VSM_SAMPLES=U.blurSamples,E.needsUpdate=!0,A.needsUpdate=!0),U.mapPass===null&&(U.mapPass=new t.WebGLRenderTarget(c.x,c.y)),E.uniforms.shadow_pass.value=U.map.texture,E.uniforms.resolution.value=U.mapSize,E.uniforms.radius.value=U.radius,e.setRenderTarget(U.mapPass),e.clear(),e.renderBufferDirect(N,null,G,E,L,null),A.uniforms.shadow_pass.value=U.mapPass.texture,A.uniforms.resolution.value=U.mapSize,A.uniforms.radius.value=U.radius,e.setRenderTarget(U.map),e.clear(),e.renderBufferDirect(N,null,G,A,L,null)}function x(U,N,G,h){let u=null;const R=G.isPointLight===!0?U.customDistanceMaterial:U.customDepthMaterial;if(R!==void 0)u=R;else if(u=G.isPointLight===!0?b:d,e.localClippingEnabled&&N.clipShadows===!0&&Array.isArray(N.clippingPlanes)&&N.clippingPlanes.length!==0||N.displacementMap&&N.displacementScale!==0||N.alphaMap&&N.alphaTest>0||N.map&&N.alphaTest>0){const K=u.uuid,k=N.uuid;let Y=S[K];Y===void 0&&(Y={},S[K]=Y);let J=Y[k];J===void 0&&(J=u.clone(),Y[k]=J,N.addEventListener("dispose",H)),u=J}if(u.visible=N.visible,u.wireframe=N.wireframe,h===t.VSMShadowMap?u.side=N.shadowSide!==null?N.shadowSide:N.side:u.side=N.shadowSide!==null?N.shadowSide:C[N.side],u.alphaMap=N.alphaMap,u.alphaTest=N.alphaTest,u.map=N.map,u.clipShadows=N.clipShadows,u.clippingPlanes=N.clippingPlanes,u.clipIntersection=N.clipIntersection,u.displacementMap=N.displacementMap,u.displacementScale=N.displacementScale,u.displacementBias=N.displacementBias,u.wireframeLinewidth=N.wireframeLinewidth,u.linewidth=N.linewidth,G.isPointLight===!0&&u.isMeshDistanceMaterial===!0){const K=e.properties.get(u);K.light=G}return u}function g(U,N,G,h,u){if(U.visible===!1)return;if(U.layers.test(N.layers)&&(U.isMesh||U.isLine||U.isPoints)&&(U.castShadow||U.receiveShadow&&u===t.VSMShadowMap)&&(!U.frustumCulled||r.intersectsObject(U))){U.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,U.matrixWorld);const k=i.update(U),Y=U.material;if(Array.isArray(Y)){const J=k.groups;for(let z=0,te=J.length;z<te;z++){const B=J[z],_e=Y[B.materialIndex];if(_e&&_e.visible){const Me=x(U,_e,h,u);U.onBeforeShadow(e,U,N,G,k,Me,B),e.renderBufferDirect(G,null,k,Me,U,B),U.onAfterShadow(e,U,N,G,k,Me,B)}}}else if(Y.visible){const J=x(U,Y,h,u);U.onBeforeShadow(e,U,N,G,k,J,null),e.renderBufferDirect(G,null,k,J,U,null),U.onAfterShadow(e,U,N,G,k,J,null)}}const K=U.children;for(let k=0,Y=K.length;k<Y;k++)g(K[k],N,G,h,u)}function H(U){U.target.removeEventListener("dispose",H);for(const G in S){const h=S[G],u=U.target.uuid;u in h&&(h[u].dispose(),delete h[u])}}}const ts={[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 ns(e,i){function n(){let v=!1;const ne=new t.Vector4;let O=null;const q=new t.Vector4(0,0,0,0);return{setMask:function(se){O!==se&&!v&&(e.colorMask(se,se,se,se),O=se)},setLocked:function(se){v=se},setClear:function(se,oe,be,Ke,tt){tt===!0&&(se*=Ke,oe*=Ke,be*=Ke),ne.set(se,oe,be,Ke),q.equals(ne)===!1&&(e.clearColor(se,oe,be,Ke),q.copy(ne))},reset:function(){v=!1,O=null,q.set(-1,0,0,0)}}}function r(){let v=!1,ne=!1,O=null,q=null,se=null;return{setReversed:function(oe){if(ne!==oe){const be=i.get("EXT_clip_control");ne?be.clipControlEXT(be.LOWER_LEFT_EXT,be.ZERO_TO_ONE_EXT):be.clipControlEXT(be.LOWER_LEFT_EXT,be.NEGATIVE_ONE_TO_ONE_EXT);const Ke=se;se=null,this.setClear(Ke)}ne=oe},getReversed:function(){return ne},setTest:function(oe){oe?re(e.DEPTH_TEST):Te(e.DEPTH_TEST)},setMask:function(oe){O!==oe&&!v&&(e.depthMask(oe),O=oe)},setFunc:function(oe){if(ne&&(oe=ts[oe]),q!==oe){switch(oe){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)}q=oe}},setLocked:function(oe){v=oe},setClear:function(oe){se!==oe&&(ne&&(oe=1-oe),e.clearDepth(oe),se=oe)},reset:function(){v=!1,O=null,q=null,se=null,ne=!1}}}function c(){let v=!1,ne=null,O=null,q=null,se=null,oe=null,be=null,Ke=null,tt=null;return{setTest:function(ke){v||(ke?re(e.STENCIL_TEST):Te(e.STENCIL_TEST))},setMask:function(ke){ne!==ke&&!v&&(e.stencilMask(ke),ne=ke)},setFunc:function(ke,lt,dt){(O!==ke||q!==lt||se!==dt)&&(e.stencilFunc(ke,lt,dt),O=ke,q=lt,se=dt)},setOp:function(ke,lt,dt){(oe!==ke||be!==lt||Ke!==dt)&&(e.stencilOp(ke,lt,dt),oe=ke,be=lt,Ke=dt)},setLocked:function(ke){v=ke},setClear:function(ke){tt!==ke&&(e.clearStencil(ke),tt=ke)},reset:function(){v=!1,ne=null,O=null,q=null,se=null,oe=null,be=null,Ke=null,tt=null}}}const s=new n,_=new r,d=new c,b=new WeakMap,S=new WeakMap;let P={},C={},E=new WeakMap,A=[],F=null,L=!1,f=null,a=null,I=null,x=null,g=null,H=null,U=null,N=new t.Color(0,0,0),G=0,h=!1,u=null,R=null,K=null,k=null,Y=null;const J=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let z=!1,te=0;const B=e.getParameter(e.VERSION);B.indexOf("WebGL")!==-1?(te=parseFloat(/^WebGL (\d)/.exec(B)[1]),z=te>=1):B.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),z=te>=2);let _e=null,Me={};const De=e.getParameter(e.SCISSOR_BOX),Ge=e.getParameter(e.VIEWPORT),Ye=new t.Vector4().fromArray(De),W=new t.Vector4().fromArray(Ge);function j(v,ne,O,q){const se=new Uint8Array(4),oe=e.createTexture();e.bindTexture(v,oe),e.texParameteri(v,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(v,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let be=0;be<O;be++)v===e.TEXTURE_3D||v===e.TEXTURE_2D_ARRAY?e.texImage3D(ne,0,e.RGBA,1,1,q,0,e.RGBA,e.UNSIGNED_BYTE,se):e.texImage2D(ne+be,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,se);return oe}const pe={};pe[e.TEXTURE_2D]=j(e.TEXTURE_2D,e.TEXTURE_2D,1),pe[e.TEXTURE_CUBE_MAP]=j(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),pe[e.TEXTURE_2D_ARRAY]=j(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),pe[e.TEXTURE_3D]=j(e.TEXTURE_3D,e.TEXTURE_3D,1,1),s.setClear(0,0,0,1),_.setClear(1),d.setClear(0),re(e.DEPTH_TEST),_.setFunc(t.LessEqualDepth),we(!1),ye(t.CullFaceBack),re(e.CULL_FACE),m(t.NoBlending);function re(v){P[v]!==!0&&(e.enable(v),P[v]=!0)}function Te(v){P[v]!==!1&&(e.disable(v),P[v]=!1)}function Ce(v,ne){return C[v]!==ne?(e.bindFramebuffer(v,ne),C[v]=ne,v===e.DRAW_FRAMEBUFFER&&(C[e.FRAMEBUFFER]=ne),v===e.FRAMEBUFFER&&(C[e.DRAW_FRAMEBUFFER]=ne),!0):!1}function Ue(v,ne){let O=A,q=!1;if(v){O=E.get(ne),O===void 0&&(O=[],E.set(ne,O));const se=v.textures;if(O.length!==se.length||O[0]!==e.COLOR_ATTACHMENT0){for(let oe=0,be=se.length;oe<be;oe++)O[oe]=e.COLOR_ATTACHMENT0+oe;O.length=se.length,q=!0}}else O[0]!==e.BACK&&(O[0]=e.BACK,q=!0);q&&e.drawBuffers(O)}function qe(v){return F!==v?(e.useProgram(v),F=v,!0):!1}const Ne={[t.AddEquation]:e.FUNC_ADD,[t.SubtractEquation]:e.FUNC_SUBTRACT,[t.ReverseSubtractEquation]:e.FUNC_REVERSE_SUBTRACT};Ne[t.MinEquation]=e.MIN,Ne[t.MaxEquation]=e.MAX;const Ze={[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 m(v,ne,O,q,se,oe,be,Ke,tt,ke){if(v===t.NoBlending){L===!0&&(Te(e.BLEND),L=!1);return}if(L===!1&&(re(e.BLEND),L=!0),v!==t.CustomBlending){if(v!==f||ke!==h){if((a!==t.AddEquation||g!==t.AddEquation)&&(e.blendEquation(e.FUNC_ADD),a=t.AddEquation,g=t.AddEquation),ke)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.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);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.blendFunc(e.SRC_ALPHA,e.ONE);break;case t.SubtractiveBlending:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case t.MultiplyBlending:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",v);break}I=null,x=null,H=null,U=null,N.set(0,0,0),G=0,f=v,h=ke}return}se=se||ne,oe=oe||O,be=be||q,(ne!==a||se!==g)&&(e.blendEquationSeparate(Ne[ne],Ne[se]),a=ne,g=se),(O!==I||q!==x||oe!==H||be!==U)&&(e.blendFuncSeparate(Ze[O],Ze[q],Ze[oe],Ze[be]),I=O,x=q,H=oe,U=be),(Ke.equals(N)===!1||tt!==G)&&(e.blendColor(Ke.r,Ke.g,Ke.b,tt),N.copy(Ke),G=tt),f=v,h=!1}function at(v,ne){v.side===t.DoubleSide?Te(e.CULL_FACE):re(e.CULL_FACE);let O=v.side===t.BackSide;ne&&(O=!O),we(O),v.blending===t.NormalBlending&&v.transparent===!1?m(t.NoBlending):m(v.blending,v.blendEquation,v.blendSrc,v.blendDst,v.blendEquationAlpha,v.blendSrcAlpha,v.blendDstAlpha,v.blendColor,v.blendAlpha,v.premultipliedAlpha),_.setFunc(v.depthFunc),_.setTest(v.depthTest),_.setMask(v.depthWrite),s.setMask(v.colorWrite);const q=v.stencilWrite;d.setTest(q),q&&(d.setMask(v.stencilWriteMask),d.setFunc(v.stencilFunc,v.stencilRef,v.stencilFuncMask),d.setOp(v.stencilFail,v.stencilZFail,v.stencilZPass)),ze(v.polygonOffset,v.polygonOffsetFactor,v.polygonOffsetUnits),v.alphaToCoverage===!0?re(e.SAMPLE_ALPHA_TO_COVERAGE):Te(e.SAMPLE_ALPHA_TO_COVERAGE)}function we(v){u!==v&&(v?e.frontFace(e.CW):e.frontFace(e.CCW),u=v)}function ye(v){v!==t.CullFaceNone?(re(e.CULL_FACE),v!==R&&(v===t.CullFaceBack?e.cullFace(e.BACK):v===t.CullFaceFront?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):Te(e.CULL_FACE),R=v}function me(v){v!==K&&(z&&e.lineWidth(v),K=v)}function ze(v,ne,O){v?(re(e.POLYGON_OFFSET_FILL),(k!==ne||Y!==O)&&(e.polygonOffset(ne,O),k=ne,Y=O)):Te(e.POLYGON_OFFSET_FILL)}function ge(v){v?re(e.SCISSOR_TEST):Te(e.SCISSOR_TEST)}function p(v){v===void 0&&(v=e.TEXTURE0+J-1),_e!==v&&(e.activeTexture(v),_e=v)}function o(v,ne,O){O===void 0&&(_e===null?O=e.TEXTURE0+J-1:O=_e);let q=Me[O];q===void 0&&(q={type:void 0,texture:void 0},Me[O]=q),(q.type!==v||q.texture!==ne)&&(_e!==O&&(e.activeTexture(O),_e=O),e.bindTexture(v,ne||pe[v]),q.type=v,q.texture=ne)}function D(){const v=Me[_e];v!==void 0&&v.type!==void 0&&(e.bindTexture(v.type,null),v.type=void 0,v.texture=void 0)}function X(){try{e.compressedTexImage2D.apply(e,arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function $(){try{e.compressedTexImage3D.apply(e,arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function V(){try{e.texSubImage2D.apply(e,arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function he(){try{e.texSubImage3D.apply(e,arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function ae(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function ce(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function Fe(){try{e.texStorage2D.apply(e,arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function Q(){try{e.texStorage3D.apply(e,arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function fe(){try{e.texImage2D.apply(e,arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function Ee(){try{e.texImage3D.apply(e,arguments)}catch(v){console.error("THREE.WebGLState:",v)}}function xe(v){Ye.equals(v)===!1&&(e.scissor(v.x,v.y,v.z,v.w),Ye.copy(v))}function de(v){W.equals(v)===!1&&(e.viewport(v.x,v.y,v.z,v.w),W.copy(v))}function Ie(v,ne){let O=S.get(ne);O===void 0&&(O=new WeakMap,S.set(ne,O));let q=O.get(v);q===void 0&&(q=e.getUniformBlockIndex(ne,v.name),O.set(v,q))}function Le(v,ne){const q=S.get(ne).get(v);b.get(ne)!==q&&(e.uniformBlockBinding(ne,q,v.__bindingPointIndex),b.set(ne,q))}function We(){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),_.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),P={},_e=null,Me={},C={},E=new WeakMap,A=[],F=null,L=!1,f=null,a=null,I=null,x=null,g=null,H=null,U=null,N=new t.Color(0,0,0),G=0,h=!1,u=null,R=null,K=null,k=null,Y=null,Ye.set(0,0,e.canvas.width,e.canvas.height),W.set(0,0,e.canvas.width,e.canvas.height),s.reset(),_.reset(),d.reset()}return{buffers:{color:s,depth:_,stencil:d},enable:re,disable:Te,bindFramebuffer:Ce,drawBuffers:Ue,useProgram:qe,setBlending:m,setMaterial:at,setFlipSided:we,setCullFace:ye,setLineWidth:me,setPolygonOffset:ze,setScissorTest:ge,activeTexture:p,bindTexture:o,unbindTexture:D,compressedTexImage2D:X,compressedTexImage3D:$,texImage2D:fe,texImage3D:Ee,updateUBOMapping:Ie,uniformBlockBinding:Le,texStorage2D:Fe,texStorage3D:Q,texSubImage2D:V,texSubImage3D:he,compressedTexSubImage2D:ae,compressedTexSubImage3D:ce,scissor:xe,viewport:de,reset:We}}function is(e,i,n,r,c,s,_){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),S=new t.Vector2,P=new WeakMap;let C;const E=new WeakMap;let A=!1;try{A=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function F(p,o){return A?new OffscreenCanvas(p,o):t.createElementNS("canvas")}function L(p,o,D){let X=1;const $=ge(p);if(($.width>D||$.height>D)&&(X=D/Math.max($.width,$.height)),X<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 V=Math.floor(X*$.width),he=Math.floor(X*$.height);C===void 0&&(C=F(V,he));const ae=o?F(V,he):C;return ae.width=V,ae.height=he,ae.getContext("2d").drawImage(p,0,0,V,he),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+V+"x"+he+")."),ae}else return"data"in p&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),p;return p}function f(p){return p.generateMipmaps}function a(p){e.generateMipmap(p)}function I(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 x(p,o,D,X,$=!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 V=o;if(o===e.RED&&(D===e.FLOAT&&(V=e.R32F),D===e.HALF_FLOAT&&(V=e.R16F),D===e.UNSIGNED_BYTE&&(V=e.R8)),o===e.RED_INTEGER&&(D===e.UNSIGNED_BYTE&&(V=e.R8UI),D===e.UNSIGNED_SHORT&&(V=e.R16UI),D===e.UNSIGNED_INT&&(V=e.R32UI),D===e.BYTE&&(V=e.R8I),D===e.SHORT&&(V=e.R16I),D===e.INT&&(V=e.R32I)),o===e.RG&&(D===e.FLOAT&&(V=e.RG32F),D===e.HALF_FLOAT&&(V=e.RG16F),D===e.UNSIGNED_BYTE&&(V=e.RG8)),o===e.RG_INTEGER&&(D===e.UNSIGNED_BYTE&&(V=e.RG8UI),D===e.UNSIGNED_SHORT&&(V=e.RG16UI),D===e.UNSIGNED_INT&&(V=e.RG32UI),D===e.BYTE&&(V=e.RG8I),D===e.SHORT&&(V=e.RG16I),D===e.INT&&(V=e.RG32I)),o===e.RGB_INTEGER&&(D===e.UNSIGNED_BYTE&&(V=e.RGB8UI),D===e.UNSIGNED_SHORT&&(V=e.RGB16UI),D===e.UNSIGNED_INT&&(V=e.RGB32UI),D===e.BYTE&&(V=e.RGB8I),D===e.SHORT&&(V=e.RGB16I),D===e.INT&&(V=e.RGB32I)),o===e.RGBA_INTEGER&&(D===e.UNSIGNED_BYTE&&(V=e.RGBA8UI),D===e.UNSIGNED_SHORT&&(V=e.RGBA16UI),D===e.UNSIGNED_INT&&(V=e.RGBA32UI),D===e.BYTE&&(V=e.RGBA8I),D===e.SHORT&&(V=e.RGBA16I),D===e.INT&&(V=e.RGBA32I)),o===e.RGB&&D===e.UNSIGNED_INT_5_9_9_9_REV&&(V=e.RGB9_E5),o===e.RGBA){const he=$?t.LinearTransfer:t.ColorManagement.getTransfer(X);D===e.FLOAT&&(V=e.RGBA32F),D===e.HALF_FLOAT&&(V=e.RGBA16F),D===e.UNSIGNED_BYTE&&(V=he===t.SRGBTransfer?e.SRGB8_ALPHA8:e.RGBA8),D===e.UNSIGNED_SHORT_4_4_4_4&&(V=e.RGBA4),D===e.UNSIGNED_SHORT_5_5_5_1&&(V=e.RGB5_A1)}return(V===e.R16F||V===e.R32F||V===e.RG16F||V===e.RG32F||V===e.RGBA16F||V===e.RGBA32F)&&i.get("EXT_color_buffer_float"),V}function g(p,o){let D;return p?o===null||o===t.UnsignedIntType||o===t.UnsignedInt248Type?D=e.DEPTH24_STENCIL8:o===t.FloatType?D=e.DEPTH32F_STENCIL8:o===t.UnsignedShortType&&(D=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?D=e.DEPTH_COMPONENT24:o===t.FloatType?D=e.DEPTH_COMPONENT32F:o===t.UnsignedShortType&&(D=e.DEPTH_COMPONENT16),D}function H(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 U(p){const o=p.target;o.removeEventListener("dispose",U),G(o),o.isVideoTexture&&P.delete(o)}function N(p){const o=p.target;o.removeEventListener("dispose",N),u(o)}function G(p){const o=r.get(p);if(o.__webglInit===void 0)return;const D=p.source,X=E.get(D);if(X){const $=X[o.__cacheKey];$.usedTimes--,$.usedTimes===0&&h(p),Object.keys(X).length===0&&E.delete(D)}r.remove(p)}function h(p){const o=r.get(p);e.deleteTexture(o.__webglTexture);const D=p.source,X=E.get(D);delete X[o.__cacheKey],_.memory.textures--}function u(p){const o=r.get(p);if(p.depthTexture&&(p.depthTexture.dispose(),r.remove(p.depthTexture)),p.isWebGLCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(o.__webglFramebuffer[X]))for(let $=0;$<o.__webglFramebuffer[X].length;$++)e.deleteFramebuffer(o.__webglFramebuffer[X][$]);else e.deleteFramebuffer(o.__webglFramebuffer[X]);o.__webglDepthbuffer&&e.deleteRenderbuffer(o.__webglDepthbuffer[X])}else{if(Array.isArray(o.__webglFramebuffer))for(let X=0;X<o.__webglFramebuffer.length;X++)e.deleteFramebuffer(o.__webglFramebuffer[X]);else e.deleteFramebuffer(o.__webglFramebuffer);if(o.__webglDepthbuffer&&e.deleteRenderbuffer(o.__webglDepthbuffer),o.__webglMultisampledFramebuffer&&e.deleteFramebuffer(o.__webglMultisampledFramebuffer),o.__webglColorRenderbuffer)for(let X=0;X<o.__webglColorRenderbuffer.length;X++)o.__webglColorRenderbuffer[X]&&e.deleteRenderbuffer(o.__webglColorRenderbuffer[X]);o.__webglDepthRenderbuffer&&e.deleteRenderbuffer(o.__webglDepthRenderbuffer)}const D=p.textures;for(let X=0,$=D.length;X<$;X++){const V=r.get(D[X]);V.__webglTexture&&(e.deleteTexture(V.__webglTexture),_.memory.textures--),r.remove(D[X])}r.remove(p)}let R=0;function K(){R=0}function k(){const p=R;return p>=c.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+p+" texture units while this GPU supports only "+c.maxTextures),R+=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 D=r.get(p);if(p.isVideoTexture&&me(p),p.isRenderTargetTexture===!1&&p.version>0&&D.__version!==p.version){const X=p.image;if(X===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(X.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{W(D,p,o);return}}n.bindTexture(e.TEXTURE_2D,D.__webglTexture,e.TEXTURE0+o)}function z(p,o){const D=r.get(p);if(p.version>0&&D.__version!==p.version){W(D,p,o);return}n.bindTexture(e.TEXTURE_2D_ARRAY,D.__webglTexture,e.TEXTURE0+o)}function te(p,o){const D=r.get(p);if(p.version>0&&D.__version!==p.version){W(D,p,o);return}n.bindTexture(e.TEXTURE_3D,D.__webglTexture,e.TEXTURE0+o)}function B(p,o){const D=r.get(p);if(p.version>0&&D.__version!==p.version){j(D,p,o);return}n.bindTexture(e.TEXTURE_CUBE_MAP,D.__webglTexture,e.TEXTURE0+o)}const _e={[t.RepeatWrapping]:e.REPEAT,[t.ClampToEdgeWrapping]:e.CLAMP_TO_EDGE,[t.MirroredRepeatWrapping]:e.MIRRORED_REPEAT},Me={[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},De={[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 Ge(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,_e[o.wrapS]),e.texParameteri(p,e.TEXTURE_WRAP_T,_e[o.wrapT]),(p===e.TEXTURE_3D||p===e.TEXTURE_2D_ARRAY)&&e.texParameteri(p,e.TEXTURE_WRAP_R,_e[o.wrapR]),e.texParameteri(p,e.TEXTURE_MAG_FILTER,Me[o.magFilter]),e.texParameteri(p,e.TEXTURE_MIN_FILTER,Me[o.minFilter]),o.compareFunction&&(e.texParameteri(p,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(p,e.TEXTURE_COMPARE_FUNC,De[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 D=i.get("EXT_texture_filter_anisotropic");e.texParameterf(p,D.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,c.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy}}}function Ye(p,o){let D=!1;p.__webglInit===void 0&&(p.__webglInit=!0,o.addEventListener("dispose",U));const X=o.source;let $=E.get(X);$===void 0&&($={},E.set(X,$));const V=Y(o);if(V!==p.__cacheKey){$[V]===void 0&&($[V]={texture:e.createTexture(),usedTimes:0},_.memory.textures++,D=!0),$[V].usedTimes++;const he=$[p.__cacheKey];he!==void 0&&($[p.__cacheKey].usedTimes--,he.usedTimes===0&&h(o)),p.__cacheKey=V,p.__webglTexture=$[V].texture}return D}function W(p,o,D){let X=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(X=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(X=e.TEXTURE_3D);const $=Ye(p,o),V=o.source;n.bindTexture(X,p.__webglTexture,e.TEXTURE0+D);const he=r.get(V);if(V.version!==he.__version||$===!0){n.activeTexture(e.TEXTURE0+D);const ae=t.ColorManagement.getPrimaries(t.ColorManagement.workingColorSpace),ce=o.colorSpace===t.NoColorSpace?null:t.ColorManagement.getPrimaries(o.colorSpace),Fe=o.colorSpace===t.NoColorSpace||ae===ce?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,Fe);let Q=L(o.image,!1,c.maxTextureSize);Q=ze(o,Q);const fe=s.convert(o.format,o.colorSpace),Ee=s.convert(o.type);let xe=x(o.internalFormat,fe,Ee,o.colorSpace,o.isVideoTexture);Ge(X,o);let de;const Ie=o.mipmaps,Le=o.isVideoTexture!==!0,We=he.__version===void 0||$===!0,v=V.dataReady,ne=H(o,Q);if(o.isDepthTexture)xe=g(o.format===t.DepthStencilFormat,o.type),We&&(Le?n.texStorage2D(e.TEXTURE_2D,1,xe,Q.width,Q.height):n.texImage2D(e.TEXTURE_2D,0,xe,Q.width,Q.height,0,fe,Ee,null));else if(o.isDataTexture)if(Ie.length>0){Le&&We&&n.texStorage2D(e.TEXTURE_2D,ne,xe,Ie[0].width,Ie[0].height);for(let O=0,q=Ie.length;O<q;O++)de=Ie[O],Le?v&&n.texSubImage2D(e.TEXTURE_2D,O,0,0,de.width,de.height,fe,Ee,de.data):n.texImage2D(e.TEXTURE_2D,O,xe,de.width,de.height,0,fe,Ee,de.data);o.generateMipmaps=!1}else Le?(We&&n.texStorage2D(e.TEXTURE_2D,ne,xe,Q.width,Q.height),v&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,Q.width,Q.height,fe,Ee,Q.data)):n.texImage2D(e.TEXTURE_2D,0,xe,Q.width,Q.height,0,fe,Ee,Q.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){Le&&We&&n.texStorage3D(e.TEXTURE_2D_ARRAY,ne,xe,Ie[0].width,Ie[0].height,Q.depth);for(let O=0,q=Ie.length;O<q;O++)if(de=Ie[O],o.format!==t.RGBAFormat)if(fe!==null)if(Le){if(v)if(o.layerUpdates.size>0){const se=t.getByteLength(de.width,de.height,o.format,o.type);for(const oe of o.layerUpdates){const be=de.data.subarray(oe*se/de.data.BYTES_PER_ELEMENT,(oe+1)*se/de.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,O,0,0,oe,de.width,de.height,1,fe,be)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,O,0,0,0,de.width,de.height,Q.depth,fe,de.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,O,xe,de.width,de.height,Q.depth,0,de.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Le?v&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,O,0,0,0,de.width,de.height,Q.depth,fe,Ee,de.data):n.texImage3D(e.TEXTURE_2D_ARRAY,O,xe,de.width,de.height,Q.depth,0,fe,Ee,de.data)}else{Le&&We&&n.texStorage2D(e.TEXTURE_2D,ne,xe,Ie[0].width,Ie[0].height);for(let O=0,q=Ie.length;O<q;O++)de=Ie[O],o.format!==t.RGBAFormat?fe!==null?Le?v&&n.compressedTexSubImage2D(e.TEXTURE_2D,O,0,0,de.width,de.height,fe,de.data):n.compressedTexImage2D(e.TEXTURE_2D,O,xe,de.width,de.height,0,de.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Le?v&&n.texSubImage2D(e.TEXTURE_2D,O,0,0,de.width,de.height,fe,Ee,de.data):n.texImage2D(e.TEXTURE_2D,O,xe,de.width,de.height,0,fe,Ee,de.data)}else if(o.isDataArrayTexture)if(Le){if(We&&n.texStorage3D(e.TEXTURE_2D_ARRAY,ne,xe,Q.width,Q.height,Q.depth),v)if(o.layerUpdates.size>0){const O=t.getByteLength(Q.width,Q.height,o.format,o.type);for(const q of o.layerUpdates){const se=Q.data.subarray(q*O/Q.data.BYTES_PER_ELEMENT,(q+1)*O/Q.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,q,Q.width,Q.height,1,fe,Ee,se)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,fe,Ee,Q.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,xe,Q.width,Q.height,Q.depth,0,fe,Ee,Q.data);else if(o.isData3DTexture)Le?(We&&n.texStorage3D(e.TEXTURE_3D,ne,xe,Q.width,Q.height,Q.depth),v&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,fe,Ee,Q.data)):n.texImage3D(e.TEXTURE_3D,0,xe,Q.width,Q.height,Q.depth,0,fe,Ee,Q.data);else if(o.isFramebufferTexture){if(We)if(Le)n.texStorage2D(e.TEXTURE_2D,ne,xe,Q.width,Q.height);else{let O=Q.width,q=Q.height;for(let se=0;se<ne;se++)n.texImage2D(e.TEXTURE_2D,se,xe,O,q,0,fe,Ee,null),O>>=1,q>>=1}}else if(Ie.length>0){if(Le&&We){const O=ge(Ie[0]);n.texStorage2D(e.TEXTURE_2D,ne,xe,O.width,O.height)}for(let O=0,q=Ie.length;O<q;O++)de=Ie[O],Le?v&&n.texSubImage2D(e.TEXTURE_2D,O,0,0,fe,Ee,de):n.texImage2D(e.TEXTURE_2D,O,xe,fe,Ee,de);o.generateMipmaps=!1}else if(Le){if(We){const O=ge(Q);n.texStorage2D(e.TEXTURE_2D,ne,xe,O.width,O.height)}v&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,fe,Ee,Q)}else n.texImage2D(e.TEXTURE_2D,0,xe,fe,Ee,Q);f(o)&&a(X),he.__version=V.version,o.onUpdate&&o.onUpdate(o)}p.__version=o.version}function j(p,o,D){if(o.image.length!==6)return;const X=Ye(p,o),$=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,p.__webglTexture,e.TEXTURE0+D);const V=r.get($);if($.version!==V.__version||X===!0){n.activeTexture(e.TEXTURE0+D);const he=t.ColorManagement.getPrimaries(t.ColorManagement.workingColorSpace),ae=o.colorSpace===t.NoColorSpace?null:t.ColorManagement.getPrimaries(o.colorSpace),ce=o.colorSpace===t.NoColorSpace||he===ae?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,ce);const Fe=o.isCompressedTexture||o.image[0].isCompressedTexture,Q=o.image[0]&&o.image[0].isDataTexture,fe=[];for(let q=0;q<6;q++)!Fe&&!Q?fe[q]=L(o.image[q],!0,c.maxCubemapSize):fe[q]=Q?o.image[q].image:o.image[q],fe[q]=ze(o,fe[q]);const Ee=fe[0],xe=s.convert(o.format,o.colorSpace),de=s.convert(o.type),Ie=x(o.internalFormat,xe,de,o.colorSpace),Le=o.isVideoTexture!==!0,We=V.__version===void 0||X===!0,v=$.dataReady;let ne=H(o,Ee);Ge(e.TEXTURE_CUBE_MAP,o);let O;if(Fe){Le&&We&&n.texStorage2D(e.TEXTURE_CUBE_MAP,ne,Ie,Ee.width,Ee.height);for(let q=0;q<6;q++){O=fe[q].mipmaps;for(let se=0;se<O.length;se++){const oe=O[se];o.format!==t.RGBAFormat?xe!==null?Le?v&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,se,0,0,oe.width,oe.height,xe,oe.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,se,Ie,oe.width,oe.height,0,oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Le?v&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,se,0,0,oe.width,oe.height,xe,de,oe.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,se,Ie,oe.width,oe.height,0,xe,de,oe.data)}}}else{if(O=o.mipmaps,Le&&We){O.length>0&&ne++;const q=ge(fe[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,ne,Ie,q.width,q.height)}for(let q=0;q<6;q++)if(Q){Le?v&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,0,0,fe[q].width,fe[q].height,xe,de,fe[q].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,Ie,fe[q].width,fe[q].height,0,xe,de,fe[q].data);for(let se=0;se<O.length;se++){const be=O[se].image[q].image;Le?v&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,se+1,0,0,be.width,be.height,xe,de,be.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,se+1,Ie,be.width,be.height,0,xe,de,be.data)}}else{Le?v&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,0,0,xe,de,fe[q]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,Ie,xe,de,fe[q]);for(let se=0;se<O.length;se++){const oe=O[se];Le?v&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,se+1,0,0,xe,de,oe.image[q]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+q,se+1,Ie,xe,de,oe.image[q])}}}f(o)&&a(e.TEXTURE_CUBE_MAP),V.__version=$.version,o.onUpdate&&o.onUpdate(o)}p.__version=o.version}function pe(p,o,D,X,$,V){const he=s.convert(D.format,D.colorSpace),ae=s.convert(D.type),ce=x(D.internalFormat,he,ae,D.colorSpace),Fe=r.get(o),Q=r.get(D);if(Q.__renderTarget=o,!Fe.__hasExternalTextures){const fe=Math.max(1,o.width>>V),Ee=Math.max(1,o.height>>V);$===e.TEXTURE_3D||$===e.TEXTURE_2D_ARRAY?n.texImage3D($,V,ce,fe,Ee,o.depth,0,he,ae,null):n.texImage2D($,V,ce,fe,Ee,0,he,ae,null)}n.bindFramebuffer(e.FRAMEBUFFER,p),ye(o)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,X,$,Q.__webglTexture,0,we(o)):($===e.TEXTURE_2D||$>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,X,$,Q.__webglTexture,V),n.bindFramebuffer(e.FRAMEBUFFER,null)}function re(p,o,D){if(e.bindRenderbuffer(e.RENDERBUFFER,p),o.depthBuffer){const X=o.depthTexture,$=X&&X.isDepthTexture?X.type:null,V=g(o.stencilBuffer,$),he=o.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ae=we(o);ye(o)?d.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ae,V,o.width,o.height):D?e.renderbufferStorageMultisample(e.RENDERBUFFER,ae,V,o.width,o.height):e.renderbufferStorage(e.RENDERBUFFER,V,o.width,o.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,he,e.RENDERBUFFER,p)}else{const X=o.textures;for(let $=0;$<X.length;$++){const V=X[$],he=s.convert(V.format,V.colorSpace),ae=s.convert(V.type),ce=x(V.internalFormat,he,ae,V.colorSpace),Fe=we(o);D&&ye(o)===!1?e.renderbufferStorageMultisample(e.RENDERBUFFER,Fe,ce,o.width,o.height):ye(o)?d.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Fe,ce,o.width,o.height):e.renderbufferStorage(e.RENDERBUFFER,ce,o.width,o.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function Te(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 X=r.get(o.depthTexture);X.__renderTarget=o,(!X.__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 $=X.__webglTexture,V=we(o);if(o.depthTexture.format===t.DepthFormat)ye(o)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,$,0,V):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,$,0);else if(o.depthTexture.format===t.DepthStencilFormat)ye(o)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,$,0,V):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,$,0);else throw new Error("Unknown depthTexture format")}function Ce(p){const o=r.get(p),D=p.isWebGLCubeRenderTarget===!0;if(o.__boundDepthTexture!==p.depthTexture){const X=p.depthTexture;if(o.__depthDisposeCallback&&o.__depthDisposeCallback(),X){const $=()=>{delete o.__boundDepthTexture,delete o.__depthDisposeCallback,X.removeEventListener("dispose",$)};X.addEventListener("dispose",$),o.__depthDisposeCallback=$}o.__boundDepthTexture=X}if(p.depthTexture&&!o.__autoAllocateDepthBuffer){if(D)throw new Error("target.depthTexture not supported in Cube render targets");Te(o.__webglFramebuffer,p)}else if(D){o.__webglDepthbuffer=[];for(let X=0;X<6;X++)if(n.bindFramebuffer(e.FRAMEBUFFER,o.__webglFramebuffer[X]),o.__webglDepthbuffer[X]===void 0)o.__webglDepthbuffer[X]=e.createRenderbuffer(),re(o.__webglDepthbuffer[X],p,!1);else{const $=p.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,V=o.__webglDepthbuffer[X];e.bindRenderbuffer(e.RENDERBUFFER,V),e.framebufferRenderbuffer(e.FRAMEBUFFER,$,e.RENDERBUFFER,V)}}else if(n.bindFramebuffer(e.FRAMEBUFFER,o.__webglFramebuffer),o.__webglDepthbuffer===void 0)o.__webglDepthbuffer=e.createRenderbuffer(),re(o.__webglDepthbuffer,p,!1);else{const X=p.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,$=o.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,$),e.framebufferRenderbuffer(e.FRAMEBUFFER,X,e.RENDERBUFFER,$)}n.bindFramebuffer(e.FRAMEBUFFER,null)}function Ue(p,o,D){const X=r.get(p);o!==void 0&&pe(X.__webglFramebuffer,p,p.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),D!==void 0&&Ce(p)}function qe(p){const o=p.texture,D=r.get(p),X=r.get(o);p.addEventListener("dispose",N);const $=p.textures,V=p.isWebGLCubeRenderTarget===!0,he=$.length>1;if(he||(X.__webglTexture===void 0&&(X.__webglTexture=e.createTexture()),X.__version=o.version,_.memory.textures++),V){D.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(o.mipmaps&&o.mipmaps.length>0){D.__webglFramebuffer[ae]=[];for(let ce=0;ce<o.mipmaps.length;ce++)D.__webglFramebuffer[ae][ce]=e.createFramebuffer()}else D.__webglFramebuffer[ae]=e.createFramebuffer()}else{if(o.mipmaps&&o.mipmaps.length>0){D.__webglFramebuffer=[];for(let ae=0;ae<o.mipmaps.length;ae++)D.__webglFramebuffer[ae]=e.createFramebuffer()}else D.__webglFramebuffer=e.createFramebuffer();if(he)for(let ae=0,ce=$.length;ae<ce;ae++){const Fe=r.get($[ae]);Fe.__webglTexture===void 0&&(Fe.__webglTexture=e.createTexture(),_.memory.textures++)}if(p.samples>0&&ye(p)===!1){D.__webglMultisampledFramebuffer=e.createFramebuffer(),D.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,D.__webglMultisampledFramebuffer);for(let ae=0;ae<$.length;ae++){const ce=$[ae];D.__webglColorRenderbuffer[ae]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,D.__webglColorRenderbuffer[ae]);const Fe=s.convert(ce.format,ce.colorSpace),Q=s.convert(ce.type),fe=x(ce.internalFormat,Fe,Q,ce.colorSpace,p.isXRRenderTarget===!0),Ee=we(p);e.renderbufferStorageMultisample(e.RENDERBUFFER,Ee,fe,p.width,p.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+ae,e.RENDERBUFFER,D.__webglColorRenderbuffer[ae])}e.bindRenderbuffer(e.RENDERBUFFER,null),p.depthBuffer&&(D.__webglDepthRenderbuffer=e.createRenderbuffer(),re(D.__webglDepthRenderbuffer,p,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(V){n.bindTexture(e.TEXTURE_CUBE_MAP,X.__webglTexture),Ge(e.TEXTURE_CUBE_MAP,o);for(let ae=0;ae<6;ae++)if(o.mipmaps&&o.mipmaps.length>0)for(let ce=0;ce<o.mipmaps.length;ce++)pe(D.__webglFramebuffer[ae][ce],p,o,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+ae,ce);else pe(D.__webglFramebuffer[ae],p,o,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);f(o)&&a(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(he){for(let ae=0,ce=$.length;ae<ce;ae++){const Fe=$[ae],Q=r.get(Fe);n.bindTexture(e.TEXTURE_2D,Q.__webglTexture),Ge(e.TEXTURE_2D,Fe),pe(D.__webglFramebuffer,p,Fe,e.COLOR_ATTACHMENT0+ae,e.TEXTURE_2D,0),f(Fe)&&a(e.TEXTURE_2D)}n.unbindTexture()}else{let ae=e.TEXTURE_2D;if((p.isWebGL3DRenderTarget||p.isWebGLArrayRenderTarget)&&(ae=p.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(ae,X.__webglTexture),Ge(ae,o),o.mipmaps&&o.mipmaps.length>0)for(let ce=0;ce<o.mipmaps.length;ce++)pe(D.__webglFramebuffer[ce],p,o,e.COLOR_ATTACHMENT0,ae,ce);else pe(D.__webglFramebuffer,p,o,e.COLOR_ATTACHMENT0,ae,0);f(o)&&a(ae),n.unbindTexture()}p.depthBuffer&&Ce(p)}function Ne(p){const o=p.textures;for(let D=0,X=o.length;D<X;D++){const $=o[D];if(f($)){const V=I(p),he=r.get($).__webglTexture;n.bindTexture(V,he),a(V),n.unbindTexture()}}}const Ze=[],m=[];function at(p){if(p.samples>0){if(ye(p)===!1){const o=p.textures,D=p.width,X=p.height;let $=e.COLOR_BUFFER_BIT;const V=p.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,he=r.get(p),ae=o.length>1;if(ae)for(let ce=0;ce<o.length;ce++)n.bindFramebuffer(e.FRAMEBUFFER,he.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+ce,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,he.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+ce,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,he.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,he.__webglFramebuffer);for(let ce=0;ce<o.length;ce++){if(p.resolveDepthBuffer&&(p.depthBuffer&&($|=e.DEPTH_BUFFER_BIT),p.stencilBuffer&&p.resolveStencilBuffer&&($|=e.STENCIL_BUFFER_BIT)),ae){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,he.__webglColorRenderbuffer[ce]);const Fe=r.get(o[ce]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,Fe,0)}e.blitFramebuffer(0,0,D,X,0,0,D,X,$,e.NEAREST),b===!0&&(Ze.length=0,m.length=0,Ze.push(e.COLOR_ATTACHMENT0+ce),p.depthBuffer&&p.resolveDepthBuffer===!1&&(Ze.push(V),m.push(V),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,m)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,Ze))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),ae)for(let ce=0;ce<o.length;ce++){n.bindFramebuffer(e.FRAMEBUFFER,he.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+ce,e.RENDERBUFFER,he.__webglColorRenderbuffer[ce]);const Fe=r.get(o[ce]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,he.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+ce,e.TEXTURE_2D,Fe,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,he.__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 we(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=_.render.frame;P.get(p)!==o&&(P.set(p,o),p.update())}function ze(p,o){const D=p.colorSpace,X=p.format,$=p.type;return p.isCompressedTexture===!0||p.isVideoTexture===!0||D!==t.LinearSRGBColorSpace&&D!==t.NoColorSpace&&(t.ColorManagement.getTransfer(D)===t.SRGBTransfer?(X!==t.RGBAFormat||$!==t.UnsignedByteType)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",D)),o}function ge(p){return typeof HTMLImageElement<"u"&&p instanceof HTMLImageElement?(S.width=p.naturalWidth||p.width,S.height=p.naturalHeight||p.height):typeof VideoFrame<"u"&&p instanceof VideoFrame?(S.width=p.displayWidth,S.height=p.displayHeight):(S.width=p.width,S.height=p.height),S}this.allocateTextureUnit=k,this.resetTextureUnits=K,this.setTexture2D=J,this.setTexture2DArray=z,this.setTexture3D=te,this.setTextureCube=B,this.rebindTextures=Ue,this.setupRenderTarget=qe,this.updateRenderTargetMipmap=Ne,this.updateMultisampleRenderTarget=at,this.setupDepthRenderbuffer=Ce,this.setupFrameBufferTexture=pe,this.useMultisampledRTT=ye}function Rn(e,i){function n(r,c=t.NoColorSpace){let s;const _=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.LuminanceFormat)return e.LUMINANCE;if(r===t.LuminanceAlphaFormat)return e.LUMINANCE_ALPHA;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(_===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 _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===t.RGBA_ETC2_EAC_Format)return _===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 _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===t.RGBA_ASTC_5x4_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===t.RGBA_ASTC_5x5_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===t.RGBA_ASTC_6x5_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===t.RGBA_ASTC_6x6_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===t.RGBA_ASTC_8x5_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===t.RGBA_ASTC_8x6_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===t.RGBA_ASTC_8x8_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===t.RGBA_ASTC_10x5_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===t.RGBA_ASTC_10x6_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===t.RGBA_ASTC_10x8_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===t.RGBA_ASTC_10x10_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===t.RGBA_ASTC_12x10_Format)return _===t.SRGBTransfer?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===t.RGBA_ASTC_12x12_Format)return _===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 _===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 rs={type:"move"};class Gt{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new t.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new t.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new t.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new t.Vector3),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new t.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new t.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new t.Vector3),this._grip}dispatchEvent(i){return this._targetRay!==null&&this._targetRay.dispatchEvent(i),this._grip!==null&&this._grip.dispatchEvent(i),this._hand!==null&&this._hand.dispatchEvent(i),this}connect(i){if(i&&i.hand){const n=this._hand;if(n)for(const r of i.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:i}),this}disconnect(i){return this.dispatchEvent({type:"disconnected",data:i}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(i,n,r){let c=null,s=null,_=null;const d=this._targetRay,b=this._grip,S=this._hand;if(i&&n.session.visibilityState!=="visible-blurred"){if(S&&i.hand){_=!0;for(const L of i.hand.values()){const f=n.getJointPose(L,r),a=this._getHandJoint(S,L);f!==null&&(a.matrix.fromArray(f.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,a.jointRadius=f.radius),a.visible=f!==null}const P=S.joints["index-finger-tip"],C=S.joints["thumb-tip"],E=P.position.distanceTo(C.position),A=.02,F=.005;S.inputState.pinching&&E>A+F?(S.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:i.handedness,target:this})):!S.inputState.pinching&&E<=A-F&&(S.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:i.handedness,target:this}))}else b!==null&&i.gripSpace&&(s=n.getPose(i.gripSpace,r),s!==null&&(b.matrix.fromArray(s.transform.matrix),b.matrix.decompose(b.position,b.rotation,b.scale),b.matrixWorldNeedsUpdate=!0,s.linearVelocity?(b.hasLinearVelocity=!0,b.linearVelocity.copy(s.linearVelocity)):b.hasLinearVelocity=!1,s.angularVelocity?(b.hasAngularVelocity=!0,b.angularVelocity.copy(s.angularVelocity)):b.hasAngularVelocity=!1));d!==null&&(c=n.getPose(i.targetRaySpace,r),c===null&&s!==null&&(c=s),c!==null&&(d.matrix.fromArray(c.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,c.linearVelocity?(d.hasLinearVelocity=!0,d.linearVelocity.copy(c.linearVelocity)):d.hasLinearVelocity=!1,c.angularVelocity?(d.hasAngularVelocity=!0,d.angularVelocity.copy(c.angularVelocity)):d.hasAngularVelocity=!1,this.dispatchEvent(rs)))}return d!==null&&(d.visible=c!==null),b!==null&&(b.visible=s!==null),S!==null&&(S.visible=_!==null),this}_getHandJoint(i,n){if(i.joints[n.jointName]===void 0){const r=new t.Group;r.matrixAutoUpdate=!1,r.visible=!1,i.joints[n.jointName]=r,i.add(r)}return i.joints[n.jointName]}}const as=`
3766
+ void main() {
3767
+
3768
+ gl_Position = vec4( position, 1.0 );
3769
+
3770
+ }`,os=`
3771
+ uniform sampler2DArray depthColor;
3772
+ uniform float depthWidth;
3773
+ uniform float depthHeight;
3774
+
3775
+ void main() {
3776
+
3777
+ vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
3778
+
3779
+ if ( coord.x >= 1.0 ) {
3780
+
3781
+ gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
3782
+
3783
+ } else {
3784
+
3785
+ gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
3786
+
3787
+ }
3788
+
3789
+ }`;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,_=null,d="local-floor",b=1,S=null,P=null,C=null,E=null,A=null,F=null;const L=new ss,f=n.getContextAttributes();let a=null,I=null;const x=[],g=[],H=new t.Vector2;let U=null;const N=new t.PerspectiveCamera;N.viewport=new t.Vector4;const G=new t.PerspectiveCamera;G.viewport=new t.Vector4;const h=[N,G],u=new t.ArrayCamera;let R=null,K=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(W){let j=x[W];return j===void 0&&(j=new Gt,x[W]=j),j.getTargetRaySpace()},this.getControllerGrip=function(W){let j=x[W];return j===void 0&&(j=new Gt,x[W]=j),j.getGripSpace()},this.getHand=function(W){let j=x[W];return j===void 0&&(j=new Gt,x[W]=j),j.getHandSpace()};function k(W){const j=g.indexOf(W.inputSource);if(j===-1)return;const pe=x[j];pe!==void 0&&(pe.update(W.inputSource,W.frame,S||_),pe.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<x.length;W++){const j=g[W];j!==null&&(g[W]=null,x[W].disconnect(j))}R=null,K=null,L.reset(),i.setRenderTarget(a),A=null,E=null,C=null,c=null,I=null,Ye.stop(),r.isPresenting=!1,i.setPixelRatio(U),i.setSize(H.width,H.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 S||_},this.setReferenceSpace=function(W){S=W},this.getBaseLayer=function(){return E!==null?E:A},this.getBinding=function(){return C},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(),U=i.getPixelRatio(),i.getSize(H),c.renderState.layers===void 0){const j={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:s};A=new XRWebGLLayer(c,n,j),c.updateRenderState({baseLayer:A}),i.setPixelRatio(1),i.setSize(A.framebufferWidth,A.framebufferHeight,!1),I=new t.WebGLRenderTarget(A.framebufferWidth,A.framebufferHeight,{format:t.RGBAFormat,type:t.UnsignedByteType,colorSpace:i.outputColorSpace,stencilBuffer:f.stencil})}else{let j=null,pe=null,re=null;f.depth&&(re=f.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,j=f.stencil?t.DepthStencilFormat:t.DepthFormat,pe=f.stencil?t.UnsignedInt248Type:t.UnsignedIntType);const Te={colorFormat:n.RGBA8,depthFormat:re,scaleFactor:s};C=new XRWebGLBinding(c,n),E=C.createProjectionLayer(Te),c.updateRenderState({layers:[E]}),i.setPixelRatio(1),i.setSize(E.textureWidth,E.textureHeight,!1),I=new t.WebGLRenderTarget(E.textureWidth,E.textureHeight,{format:t.RGBAFormat,type:t.UnsignedByteType,depthTexture:new t.DepthTexture(E.textureWidth,E.textureHeight,pe,void 0,void 0,void 0,void 0,void 0,void 0,j),stencilBuffer:f.stencil,colorSpace:i.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:E.ignoreDepthValues===!1})}I.isXRRenderTarget=!0,this.setFoveation(b),S=null,_=await c.requestReferenceSpace(d),Ye.setContext(c),Ye.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(c!==null)return c.environmentBlendMode},this.getDepthTexture=function(){return L.getDepthTexture()};function J(W){for(let j=0;j<W.removed.length;j++){const pe=W.removed[j],re=g.indexOf(pe);re>=0&&(g[re]=null,x[re].disconnect(pe))}for(let j=0;j<W.added.length;j++){const pe=W.added[j];let re=g.indexOf(pe);if(re===-1){for(let Ce=0;Ce<x.length;Ce++)if(Ce>=g.length){g.push(pe),re=Ce;break}else if(g[Ce]===null){g[Ce]=pe,re=Ce;break}if(re===-1)break}const Te=x[re];Te&&Te.connect(pe)}}const z=new t.Vector3,te=new t.Vector3;function B(W,j,pe){z.setFromMatrixPosition(j.matrixWorld),te.setFromMatrixPosition(pe.matrixWorld);const re=z.distanceTo(te),Te=j.projectionMatrix.elements,Ce=pe.projectionMatrix.elements,Ue=Te[14]/(Te[10]-1),qe=Te[14]/(Te[10]+1),Ne=(Te[9]+1)/Te[5],Ze=(Te[9]-1)/Te[5],m=(Te[8]-1)/Te[0],at=(Ce[8]+1)/Ce[0],we=Ue*m,ye=Ue*at,me=re/(-m+at),ze=me*-m;if(j.matrixWorld.decompose(W.position,W.quaternion,W.scale),W.translateX(ze),W.translateZ(me),W.matrixWorld.compose(W.position,W.quaternion,W.scale),W.matrixWorldInverse.copy(W.matrixWorld).invert(),Te[10]===-1)W.projectionMatrix.copy(j.projectionMatrix),W.projectionMatrixInverse.copy(j.projectionMatrixInverse);else{const ge=Ue+me,p=qe+me,o=we-ze,D=ye+(re-ze),X=Ne*qe/p*ge,$=Ze*qe/p*ge;W.projectionMatrix.makePerspective(o,D,X,$,ge,p),W.projectionMatrixInverse.copy(W.projectionMatrix).invert()}}function _e(W,j){j===null?W.matrixWorld.copy(W.matrix):W.matrixWorld.multiplyMatrices(j.matrixWorld,W.matrix),W.matrixWorldInverse.copy(W.matrixWorld).invert()}this.updateCamera=function(W){if(c===null)return;let j=W.near,pe=W.far;L.texture!==null&&(L.depthNear>0&&(j=L.depthNear),L.depthFar>0&&(pe=L.depthFar)),u.near=G.near=N.near=j,u.far=G.far=N.far=pe,(R!==u.near||K!==u.far)&&(c.updateRenderState({depthNear:u.near,depthFar:u.far}),R=u.near,K=u.far),N.layers.mask=W.layers.mask|2,G.layers.mask=W.layers.mask|4,u.layers.mask=N.layers.mask|G.layers.mask;const re=W.parent,Te=u.cameras;_e(u,re);for(let Ce=0;Ce<Te.length;Ce++)_e(Te[Ce],re);Te.length===2?B(u,N,G):u.projectionMatrix.copy(N.projectionMatrix),Me(W,u,re)};function Me(W,j,pe){pe===null?W.matrix.copy(j.matrixWorld):(W.matrix.copy(pe.matrixWorld),W.matrix.invert(),W.matrix.multiply(j.matrixWorld)),W.matrix.decompose(W.position,W.quaternion,W.scale),W.updateMatrixWorld(!0),W.projectionMatrix.copy(j.projectionMatrix),W.projectionMatrixInverse.copy(j.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(!(E===null&&A===null))return b},this.setFoveation=function(W){b=W,E!==null&&(E.fixedFoveation=W),A!==null&&A.fixedFoveation!==void 0&&(A.fixedFoveation=W)},this.hasDepthSensing=function(){return L.texture!==null},this.getDepthSensingMesh=function(){return L.getMesh(u)};let De=null;function Ge(W,j){if(P=j.getViewerPose(S||_),F=j,P!==null){const pe=P.views;A!==null&&(i.setRenderTargetFramebuffer(I,A.framebuffer),i.setRenderTarget(I));let re=!1;pe.length!==u.cameras.length&&(u.cameras.length=0,re=!0);for(let Ce=0;Ce<pe.length;Ce++){const Ue=pe[Ce];let qe=null;if(A!==null)qe=A.getViewport(Ue);else{const Ze=C.getViewSubImage(E,Ue);qe=Ze.viewport,Ce===0&&(i.setRenderTargetTextures(I,Ze.colorTexture,E.ignoreDepthValues?void 0:Ze.depthStencilTexture),i.setRenderTarget(I))}let Ne=h[Ce];Ne===void 0&&(Ne=new t.PerspectiveCamera,Ne.layers.enable(Ce),Ne.viewport=new t.Vector4,h[Ce]=Ne),Ne.matrix.fromArray(Ue.transform.matrix),Ne.matrix.decompose(Ne.position,Ne.quaternion,Ne.scale),Ne.projectionMatrix.fromArray(Ue.projectionMatrix),Ne.projectionMatrixInverse.copy(Ne.projectionMatrix).invert(),Ne.viewport.set(qe.x,qe.y,qe.width,qe.height),Ce===0&&(u.matrix.copy(Ne.matrix),u.matrix.decompose(u.position,u.quaternion,u.scale)),re===!0&&u.cameras.push(Ne)}const Te=c.enabledFeatures;if(Te&&Te.includes("depth-sensing")){const Ce=C.getDepthInformation(pe[0]);Ce&&Ce.isValid&&Ce.texture&&L.init(i,Ce,c.renderState)}}for(let pe=0;pe<x.length;pe++){const re=g[pe],Te=x[pe];re!==null&&Te!==void 0&&Te.update(re,j,S||_)}De&&De(W,j),j.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:j}),F=null}const Ye=new En;Ye.setAnimationLoop(Ge),this.setAnimationLoop=function(W){De=W},this.dispose=function(){}}}const _t=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,I,x,g){a.isMeshBasicMaterial||a.isMeshLambertMaterial?s(f,a):a.isMeshToonMaterial?(s(f,a),C(f,a)):a.isMeshPhongMaterial?(s(f,a),P(f,a)):a.isMeshStandardMaterial?(s(f,a),E(f,a),a.isMeshPhysicalMaterial&&A(f,a,g)):a.isMeshMatcapMaterial?(s(f,a),F(f,a)):a.isMeshDepthMaterial?s(f,a):a.isMeshDistanceMaterial?(s(f,a),L(f,a)):a.isMeshNormalMaterial?s(f,a):a.isLineBasicMaterial?(_(f,a),a.isLineDashedMaterial&&d(f,a)):a.isPointsMaterial?b(f,a,I,x):a.isSpriteMaterial?S(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 I=i.get(a),x=I.envMap,g=I.envMapRotation;x&&(f.envMap.value=x,_t.copy(g),_t.x*=-1,_t.y*=-1,_t.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(_t.y*=-1,_t.z*=-1),f.envMapRotation.value.setFromMatrix4(cs.makeRotationFromEuler(_t)),f.flipEnvMap.value=x.isCubeTexture&&x.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 _(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,I,x){f.diffuse.value.copy(a.color),f.opacity.value=a.opacity,f.size.value=a.size*I,f.scale.value=x*.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 S(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 P(f,a){f.specular.value.copy(a.specular),f.shininess.value=Math.max(a.shininess,1e-4)}function C(f,a){a.gradientMap&&(f.gradientMap.value=a.gradientMap)}function E(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 A(f,a,I){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=I.texture,f.transmissionSamplerSize.value.set(I.width,I.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 L(f,a){const I=i.get(a).light;f.referencePosition.value.setFromMatrixPosition(I.matrixWorld),f.nearDistance.value=I.shadow.camera.near,f.farDistance.value=I.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:c}}function ds(e,i,n,r){let c={},s={},_=[];const d=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function b(I,x){const g=x.program;r.uniformBlockBinding(I,g)}function S(I,x){let g=c[I.id];g===void 0&&(F(I),g=P(I),c[I.id]=g,I.addEventListener("dispose",f));const H=x.program;r.updateUBOMapping(I,H);const U=i.render.frame;s[I.id]!==U&&(E(I),s[I.id]=U)}function P(I){const x=C();I.__bindingPointIndex=x;const g=e.createBuffer(),H=I.__size,U=I.usage;return e.bindBuffer(e.UNIFORM_BUFFER,g),e.bufferData(e.UNIFORM_BUFFER,H,U),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,x,g),g}function C(){for(let I=0;I<d;I++)if(_.indexOf(I)===-1)return _.push(I),I;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function E(I){const x=c[I.id],g=I.uniforms,H=I.__cache;e.bindBuffer(e.UNIFORM_BUFFER,x);for(let U=0,N=g.length;U<N;U++){const G=Array.isArray(g[U])?g[U]:[g[U]];for(let h=0,u=G.length;h<u;h++){const R=G[h];if(A(R,U,h,H)===!0){const K=R.__offset,k=Array.isArray(R.value)?R.value:[R.value];let Y=0;for(let J=0;J<k.length;J++){const z=k[J],te=L(z);typeof z=="number"||typeof z=="boolean"?(R.__data[0]=z,e.bufferSubData(e.UNIFORM_BUFFER,K+Y,R.__data)):z.isMatrix3?(R.__data[0]=z.elements[0],R.__data[1]=z.elements[1],R.__data[2]=z.elements[2],R.__data[3]=0,R.__data[4]=z.elements[3],R.__data[5]=z.elements[4],R.__data[6]=z.elements[5],R.__data[7]=0,R.__data[8]=z.elements[6],R.__data[9]=z.elements[7],R.__data[10]=z.elements[8],R.__data[11]=0):(z.toArray(R.__data,Y),Y+=te.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,K,R.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}function A(I,x,g,H){const U=I.value,N=x+"_"+g;if(H[N]===void 0)return typeof U=="number"||typeof U=="boolean"?H[N]=U:H[N]=U.clone(),!0;{const G=H[N];if(typeof U=="number"||typeof U=="boolean"){if(G!==U)return H[N]=U,!0}else if(G.equals(U)===!1)return G.copy(U),!0}return!1}function F(I){const x=I.uniforms;let g=0;const H=16;for(let N=0,G=x.length;N<G;N++){const h=Array.isArray(x[N])?x[N]:[x[N]];for(let u=0,R=h.length;u<R;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 z=k[Y],te=L(z),B=g%H,_e=B%te.boundary,Me=B+_e;g+=_e,Me!==0&&H-Me<te.storage&&(g+=H-Me),K.__data=new Float32Array(te.storage/Float32Array.BYTES_PER_ELEMENT),K.__offset=g,g+=te.storage}}}const U=g%H;return U>0&&(g+=H-U),I.__size=g,I.__cache={},this}function L(I){const x={boundary:0,storage:0};return typeof I=="number"||typeof I=="boolean"?(x.boundary=4,x.storage=4):I.isVector2?(x.boundary=8,x.storage=8):I.isVector3||I.isColor?(x.boundary=16,x.storage=12):I.isVector4?(x.boundary=16,x.storage=16):I.isMatrix3?(x.boundary=48,x.storage=48):I.isMatrix4?(x.boundary=64,x.storage=64):I.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",I),x}function f(I){const x=I.target;x.removeEventListener("dispose",f);const g=_.indexOf(x.__bindingPointIndex);_.splice(g,1),e.deleteBuffer(c[x.id]),delete c[x.id],delete s[x.id]}function a(){for(const I in c)e.deleteBuffer(c[I]);_=[],c={},s={}}return{bind:b,update:S,dispose:a}}class us{constructor(i={}){const{canvas:n=t.createCanvasElement(),context:r=null,depth:c=!0,stencil:s=!1,alpha:_=!1,antialias:d=!1,premultipliedAlpha:b=!0,preserveDrawingBuffer:S=!1,powerPreference:P="default",failIfMajorPerformanceCaveat:C=!1,reverseDepthBuffer:E=!1}=i;this.isWebGLRenderer=!0;let A;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");A=r.getContextAttributes().alpha}else A=_;const F=new Uint32Array(4),L=new Int32Array(4);let f=null,a=null;const I=[],x=[];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._outputColorSpace=t.SRGBColorSpace,this.toneMapping=t.NoToneMapping,this.toneMappingExposure=1;const g=this;let H=!1,U=0,N=0,G=null,h=-1,u=null;const R=new t.Vector4,K=new t.Vector4;let k=null;const Y=new t.Color(0);let J=0,z=n.width,te=n.height,B=1,_e=null,Me=null;const De=new t.Vector4(0,0,z,te),Ge=new t.Vector4(0,0,z,te);let Ye=!1;const W=new t.Frustum;let j=!1,pe=!1;const re=new t.Matrix4,Te=new t.Matrix4,Ce=new t.Vector3,Ue=new t.Vector4,qe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ne=!1;function Ze(){return G===null?B:1}let m=r;function at(l,M){return n.getContext(l,M)}try{const l={alpha:!0,depth:c,stencil:s,antialias:d,premultipliedAlpha:b,preserveDrawingBuffer:S,powerPreference:P,failIfMajorPerformanceCaveat:C};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${t.REVISION}`),n.addEventListener("webglcontextlost",q,!1),n.addEventListener("webglcontextrestored",se,!1),n.addEventListener("webglcontextcreationerror",oe,!1),m===null){const M="webgl2";if(m=at(M,l),m===null)throw at(M)?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 we,ye,me,ze,ge,p,o,D,X,$,V,he,ae,ce,Fe,Q,fe,Ee,xe,de,Ie,Le,We,v;function ne(){we=new Ma(m),we.init(),Le=new Rn(m,we),ye=new _a(m,we,i,Le),me=new ns(m,we),ye.reverseDepthBuffer&&E&&me.buffers.depth.setReversed(!0),ze=new Aa(m),ge=new Wo,p=new is(m,we,me,ge,ye,Le,ze),o=new ga(g),D=new Ea(g),X=new Un(m),We=new pa(m,X),$=new Ta(m,X,ze,We),V=new Ca(m,$,X,ze),xe=new Ra(m,ye,p),Q=new ma(ge),he=new ko(g,o,D,we,ye,We,Q),ae=new fs(g,ge),ce=new Xo,Fe=new Qo(we),Ee=new ua(g,o,D,me,V,A,b),fe=new es(g,V,ye),v=new ds(m,ze,ye,me),de=new ha(m,we,ze),Ie=new xa(m,we,ze),ze.programs=he.programs,g.capabilities=ye,g.extensions=we,g.properties=ge,g.renderLists=ce,g.shadowMap=fe,g.state=me,g.info=ze}ne();const O=new ls(g,m);this.xr=O,this.getContext=function(){return m},this.getContextAttributes=function(){return m.getContextAttributes()},this.forceContextLoss=function(){const l=we.get("WEBGL_lose_context");l&&l.loseContext()},this.forceContextRestore=function(){const l=we.get("WEBGL_lose_context");l&&l.restoreContext()},this.getPixelRatio=function(){return B},this.setPixelRatio=function(l){l!==void 0&&(B=l,this.setSize(z,te,!1))},this.getSize=function(l){return l.set(z,te)},this.setSize=function(l,M,w=!0){if(O.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}z=l,te=M,n.width=Math.floor(l*B),n.height=Math.floor(M*B),w===!0&&(n.style.width=l+"px",n.style.height=M+"px"),this.setViewport(0,0,l,M)},this.getDrawingBufferSize=function(l){return l.set(z*B,te*B).floor()},this.setDrawingBufferSize=function(l,M,w){z=l,te=M,B=w,n.width=Math.floor(l*w),n.height=Math.floor(M*w),this.setViewport(0,0,l,M)},this.getCurrentViewport=function(l){return l.copy(R)},this.getViewport=function(l){return l.copy(De)},this.setViewport=function(l,M,w,y){l.isVector4?De.set(l.x,l.y,l.z,l.w):De.set(l,M,w,y),me.viewport(R.copy(De).multiplyScalar(B).round())},this.getScissor=function(l){return l.copy(Ge)},this.setScissor=function(l,M,w,y){l.isVector4?Ge.set(l.x,l.y,l.z,l.w):Ge.set(l,M,w,y),me.scissor(K.copy(Ge).multiplyScalar(B).round())},this.getScissorTest=function(){return Ye},this.setScissorTest=function(l){me.setScissorTest(Ye=l)},this.setOpaqueSort=function(l){_e=l},this.setTransparentSort=function(l){Me=l},this.getClearColor=function(l){return l.copy(Ee.getClearColor())},this.setClearColor=function(){Ee.setClearColor.apply(Ee,arguments)},this.getClearAlpha=function(){return Ee.getClearAlpha()},this.setClearAlpha=function(){Ee.setClearAlpha.apply(Ee,arguments)},this.clear=function(l=!0,M=!0,w=!0){let y=0;if(l){let T=!1;if(G!==null){const Z=G.texture.format;T=Z===t.RGBAIntegerFormat||Z===t.RGIntegerFormat||Z===t.RedIntegerFormat}if(T){const Z=G.texture.type,ie=Z===t.UnsignedByteType||Z===t.UnsignedIntType||Z===t.UnsignedShortType||Z===t.UnsignedInt248Type||Z===t.UnsignedShort4444Type||Z===t.UnsignedShort5551Type,le=Ee.getClearColor(),ue=Ee.getClearAlpha(),Ae=le.r,Re=le.g,ve=le.b;ie?(F[0]=Ae,F[1]=Re,F[2]=ve,F[3]=ue,m.clearBufferuiv(m.COLOR,0,F)):(L[0]=Ae,L[1]=Re,L[2]=ve,L[3]=ue,m.clearBufferiv(m.COLOR,0,L))}else y|=m.COLOR_BUFFER_BIT}M&&(y|=m.DEPTH_BUFFER_BIT),w&&(y|=m.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),m.clear(y)},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",q,!1),n.removeEventListener("webglcontextrestored",se,!1),n.removeEventListener("webglcontextcreationerror",oe,!1),Ee.dispose(),ce.dispose(),Fe.dispose(),ge.dispose(),o.dispose(),D.dispose(),V.dispose(),We.dispose(),v.dispose(),he.dispose(),O.dispose(),O.removeEventListener("sessionstart",Wt),O.removeEventListener("sessionend",zt),ut.stop()};function q(l){l.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),H=!0}function se(){console.log("THREE.WebGLRenderer: Context Restored."),H=!1;const l=ze.autoReset,M=fe.enabled,w=fe.autoUpdate,y=fe.needsUpdate,T=fe.type;ne(),ze.autoReset=l,fe.enabled=M,fe.autoUpdate=w,fe.needsUpdate=y,fe.type=T}function oe(l){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",l.statusMessage)}function be(l){const M=l.target;M.removeEventListener("dispose",be),Ke(M)}function Ke(l){tt(l),ge.remove(l)}function tt(l){const M=ge.get(l).programs;M!==void 0&&(M.forEach(function(w){he.releaseProgram(w)}),l.isShaderMaterial&&he.releaseShaderCache(l))}this.renderBufferDirect=function(l,M,w,y,T,Z){M===null&&(M=qe);const ie=T.isMesh&&T.matrixWorld.determinant()<0,le=Cn(l,M,w,y,T);me.setMaterial(y,ie);let ue=w.index,Ae=1;if(y.wireframe===!0){if(ue=$.getWireframeAttribute(w),ue===void 0)return;Ae=2}const Re=w.drawRange,ve=w.attributes.position;let Oe=Re.start*Ae,Ve=(Re.start+Re.count)*Ae;Z!==null&&(Oe=Math.max(Oe,Z.start*Ae),Ve=Math.min(Ve,(Z.start+Z.count)*Ae)),ue!==null?(Oe=Math.max(Oe,0),Ve=Math.min(Ve,ue.count)):ve!=null&&(Oe=Math.max(Oe,0),Ve=Math.min(Ve,ve.count));const Qe=Ve-Oe;if(Qe<0||Qe===1/0)return;We.setup(T,y,le,w,ue);let $e,Be=de;if(ue!==null&&($e=X.get(ue),Be=Ie,Be.setIndex($e)),T.isMesh)y.wireframe===!0?(me.setLineWidth(y.wireframeLinewidth*Ze()),Be.setMode(m.LINES)):Be.setMode(m.TRIANGLES);else if(T.isLine){let Se=y.linewidth;Se===void 0&&(Se=1),me.setLineWidth(Se*Ze()),T.isLineSegments?Be.setMode(m.LINES):T.isLineLoop?Be.setMode(m.LINE_LOOP):Be.setMode(m.LINE_STRIP)}else T.isPoints?Be.setMode(m.POINTS):T.isSprite&&Be.setMode(m.TRIANGLES);if(T.isBatchedMesh)if(T._multiDrawInstances!==null)Be.renderMultiDrawInstances(T._multiDrawStarts,T._multiDrawCounts,T._multiDrawCount,T._multiDrawInstances);else if(we.get("WEBGL_multi_draw"))Be.renderMultiDraw(T._multiDrawStarts,T._multiDrawCounts,T._multiDrawCount);else{const Se=T._multiDrawStarts,et=T._multiDrawCounts,He=T._multiDrawCount,ct=ue?X.get(ue).bytesPerElement:1,vt=ge.get(y).currentProgram.getUniforms();for(let rt=0;rt<He;rt++)vt.setValue(m,"_gl_DrawID",rt),Be.render(Se[rt]/ct,et[rt])}else if(T.isInstancedMesh)Be.renderInstances(Oe,Qe,T.count);else if(w.isInstancedBufferGeometry){const Se=w._maxInstanceCount!==void 0?w._maxInstanceCount:1/0,et=Math.min(w.instanceCount,Se);Be.renderInstances(Oe,Qe,et)}else Be.render(Oe,Qe)};function ke(l,M,w){l.transparent===!0&&l.side===t.DoubleSide&&l.forceSinglePass===!1?(l.side=t.BackSide,l.needsUpdate=!0,Rt(l,M,w),l.side=t.FrontSide,l.needsUpdate=!0,Rt(l,M,w),l.side=t.DoubleSide):Rt(l,M,w)}this.compile=function(l,M,w=null){w===null&&(w=l),a=Fe.get(w),a.init(M),x.push(a),w.traverseVisible(function(T){T.isLight&&T.layers.test(M.layers)&&(a.pushLight(T),T.castShadow&&a.pushShadow(T))}),l!==w&&l.traverseVisible(function(T){T.isLight&&T.layers.test(M.layers)&&(a.pushLight(T),T.castShadow&&a.pushShadow(T))}),a.setupLights();const y=new Set;return l.traverse(function(T){if(!(T.isMesh||T.isPoints||T.isLine||T.isSprite))return;const Z=T.material;if(Z)if(Array.isArray(Z))for(let ie=0;ie<Z.length;ie++){const le=Z[ie];ke(le,w,T),y.add(le)}else ke(Z,w,T),y.add(Z)}),x.pop(),a=null,y},this.compileAsync=function(l,M,w=null){const y=this.compile(l,M,w);return new Promise(T=>{function Z(){if(y.forEach(function(ie){ge.get(ie).currentProgram.isReady()&&y.delete(ie)}),y.size===0){T(l);return}setTimeout(Z,10)}we.get("KHR_parallel_shader_compile")!==null?Z():setTimeout(Z,10)})};let lt=null;function dt(l){lt&&lt(l)}function Wt(){ut.stop()}function zt(){ut.start()}const ut=new En;ut.setAnimationLoop(dt),typeof self<"u"&&ut.setContext(self),this.setAnimationLoop=function(l){lt=l,O.setAnimationLoop(l),l===null?ut.stop():ut.start()},O.addEventListener("sessionstart",Wt),O.addEventListener("sessionend",zt),this.render=function(l,M){if(M!==void 0&&M.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(H===!0)return;if(l.matrixWorldAutoUpdate===!0&&l.updateMatrixWorld(),M.parent===null&&M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),O.enabled===!0&&O.isPresenting===!0&&(O.cameraAutoUpdate===!0&&O.updateCamera(M),M=O.getCamera()),l.isScene===!0&&l.onBeforeRender(g,l,M,G),a=Fe.get(l,x.length),a.init(M),x.push(a),Te.multiplyMatrices(M.projectionMatrix,M.matrixWorldInverse),W.setFromProjectionMatrix(Te),pe=this.localClippingEnabled,j=Q.init(this.clippingPlanes,pe),f=ce.get(l,I.length),f.init(),I.push(f),O.enabled===!0&&O.isPresenting===!0){const Z=g.xr.getDepthSensingMesh();Z!==null&&Ut(Z,M,-1/0,g.sortObjects)}Ut(l,M,0,g.sortObjects),f.finish(),g.sortObjects===!0&&f.sort(_e,Me),Ne=O.enabled===!1||O.isPresenting===!1||O.hasDepthSensing()===!1,Ne&&Ee.addToRenderList(f,l),this.info.render.frame++,j===!0&&Q.beginShadows();const w=a.state.shadowsArray;fe.render(w,l,M),j===!0&&Q.endShadows(),this.info.autoReset===!0&&this.info.reset();const y=f.opaque,T=f.transmissive;if(a.setupLights(),M.isArrayCamera){const Z=M.cameras;if(T.length>0)for(let ie=0,le=Z.length;ie<le;ie++){const ue=Z[ie];qt(y,T,l,ue)}Ne&&Ee.render(l);for(let ie=0,le=Z.length;ie<le;ie++){const ue=Z[ie];Xt(f,l,ue,ue.viewport)}}else T.length>0&&qt(y,T,l,M),Ne&&Ee.render(l),Xt(f,l,M);G!==null&&(p.updateMultisampleRenderTarget(G),p.updateRenderTargetMipmap(G)),l.isScene===!0&&l.onAfterRender(g,l,M),We.resetDefaultState(),h=-1,u=null,x.pop(),x.length>0?(a=x[x.length-1],j===!0&&Q.setGlobalState(g.clippingPlanes,a.state.camera)):a=null,I.pop(),I.length>0?f=I[I.length-1]:f=null};function Ut(l,M,w,y){if(l.visible===!1)return;if(l.layers.test(M.layers)){if(l.isGroup)w=l.renderOrder;else if(l.isLOD)l.autoUpdate===!0&&l.update(M);else if(l.isLight)a.pushLight(l),l.castShadow&&a.pushShadow(l);else if(l.isSprite){if(!l.frustumCulled||W.intersectsSprite(l)){y&&Ue.setFromMatrixPosition(l.matrixWorld).applyMatrix4(Te);const ie=V.update(l),le=l.material;le.visible&&f.push(l,ie,le,w,Ue.z,null)}}else if((l.isMesh||l.isLine||l.isPoints)&&(!l.frustumCulled||W.intersectsObject(l))){const ie=V.update(l),le=l.material;if(y&&(l.boundingSphere!==void 0?(l.boundingSphere===null&&l.computeBoundingSphere(),Ue.copy(l.boundingSphere.center)):(ie.boundingSphere===null&&ie.computeBoundingSphere(),Ue.copy(ie.boundingSphere.center)),Ue.applyMatrix4(l.matrixWorld).applyMatrix4(Te)),Array.isArray(le)){const ue=ie.groups;for(let Ae=0,Re=ue.length;Ae<Re;Ae++){const ve=ue[Ae],Oe=le[ve.materialIndex];Oe&&Oe.visible&&f.push(l,ie,Oe,w,Ue.z,ve)}}else le.visible&&f.push(l,ie,le,w,Ue.z,null)}}const Z=l.children;for(let ie=0,le=Z.length;ie<le;ie++)Ut(Z[ie],M,w,y)}function Xt(l,M,w,y){const T=l.opaque,Z=l.transmissive,ie=l.transparent;a.setupLightsView(w),j===!0&&Q.setGlobalState(g.clippingPlanes,w),y&&me.viewport(R.copy(y)),T.length>0&&At(T,M,w),Z.length>0&&At(Z,M,w),ie.length>0&&At(ie,M,w),me.buffers.depth.setTest(!0),me.buffers.depth.setMask(!0),me.buffers.color.setMask(!0),me.setPolygonOffset(!1)}function qt(l,M,w,y){if((w.isScene===!0?w.overrideMaterial:null)!==null)return;a.state.transmissionRenderTarget[y.id]===void 0&&(a.state.transmissionRenderTarget[y.id]=new t.WebGLRenderTarget(1,1,{generateMipmaps:!0,type:we.has("EXT_color_buffer_half_float")||we.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 Z=a.state.transmissionRenderTarget[y.id],ie=y.viewport||R;Z.setSize(ie.z,ie.w);const le=g.getRenderTarget();g.setRenderTarget(Z),g.getClearColor(Y),J=g.getClearAlpha(),J<1&&g.setClearColor(16777215,.5),g.clear(),Ne&&Ee.render(w);const ue=g.toneMapping;g.toneMapping=t.NoToneMapping;const Ae=y.viewport;if(y.viewport!==void 0&&(y.viewport=void 0),a.setupLightsView(y),j===!0&&Q.setGlobalState(g.clippingPlanes,y),At(l,w,y),p.updateMultisampleRenderTarget(Z),p.updateRenderTargetMipmap(Z),we.has("WEBGL_multisampled_render_to_texture")===!1){let Re=!1;for(let ve=0,Oe=M.length;ve<Oe;ve++){const Ve=M[ve],Qe=Ve.object,$e=Ve.geometry,Be=Ve.material,Se=Ve.group;if(Be.side===t.DoubleSide&&Qe.layers.test(y.layers)){const et=Be.side;Be.side=t.BackSide,Be.needsUpdate=!0,Yt(Qe,w,y,$e,Be,Se),Be.side=et,Be.needsUpdate=!0,Re=!0}}Re===!0&&(p.updateMultisampleRenderTarget(Z),p.updateRenderTargetMipmap(Z))}g.setRenderTarget(le),g.setClearColor(Y,J),Ae!==void 0&&(y.viewport=Ae),g.toneMapping=ue}function At(l,M,w){const y=M.isScene===!0?M.overrideMaterial:null;for(let T=0,Z=l.length;T<Z;T++){const ie=l[T],le=ie.object,ue=ie.geometry,Ae=y===null?ie.material:y,Re=ie.group;le.layers.test(w.layers)&&Yt(le,M,w,ue,Ae,Re)}}function Yt(l,M,w,y,T,Z){l.onBeforeRender(g,M,w,y,T,Z),l.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,l.matrixWorld),l.normalMatrix.getNormalMatrix(l.modelViewMatrix),T.onBeforeRender(g,M,w,y,l,Z),T.transparent===!0&&T.side===t.DoubleSide&&T.forceSinglePass===!1?(T.side=t.BackSide,T.needsUpdate=!0,g.renderBufferDirect(w,M,y,T,l,Z),T.side=t.FrontSide,T.needsUpdate=!0,g.renderBufferDirect(w,M,y,T,l,Z),T.side=t.DoubleSide):g.renderBufferDirect(w,M,y,T,l,Z),l.onAfterRender(g,M,w,y,T,Z)}function Rt(l,M,w){M.isScene!==!0&&(M=qe);const y=ge.get(l),T=a.state.lights,Z=a.state.shadowsArray,ie=T.state.version,le=he.getParameters(l,T.state,Z,M,w),ue=he.getProgramCacheKey(le);let Ae=y.programs;y.environment=l.isMeshStandardMaterial?M.environment:null,y.fog=M.fog,y.envMap=(l.isMeshStandardMaterial?D:o).get(l.envMap||y.environment),y.envMapRotation=y.environment!==null&&l.envMap===null?M.environmentRotation:l.envMapRotation,Ae===void 0&&(l.addEventListener("dispose",be),Ae=new Map,y.programs=Ae);let Re=Ae.get(ue);if(Re!==void 0){if(y.currentProgram===Re&&y.lightsStateVersion===ie)return $t(l,le),Re}else le.uniforms=he.getUniforms(l),l.onBeforeCompile(le,g),Re=he.acquireProgram(le,ue),Ae.set(ue,Re),y.uniforms=le.uniforms;const ve=y.uniforms;return(!l.isShaderMaterial&&!l.isRawShaderMaterial||l.clipping===!0)&&(ve.clippingPlanes=Q.uniform),$t(l,le),y.needsLights=Pn(l),y.lightsStateVersion=ie,y.needsLights&&(ve.ambientLightColor.value=T.state.ambient,ve.lightProbe.value=T.state.probe,ve.directionalLights.value=T.state.directional,ve.directionalLightShadows.value=T.state.directionalShadow,ve.spotLights.value=T.state.spot,ve.spotLightShadows.value=T.state.spotShadow,ve.rectAreaLights.value=T.state.rectArea,ve.ltc_1.value=T.state.rectAreaLTC1,ve.ltc_2.value=T.state.rectAreaLTC2,ve.pointLights.value=T.state.point,ve.pointLightShadows.value=T.state.pointShadow,ve.hemisphereLights.value=T.state.hemi,ve.directionalShadowMap.value=T.state.directionalShadowMap,ve.directionalShadowMatrix.value=T.state.directionalShadowMatrix,ve.spotShadowMap.value=T.state.spotShadowMap,ve.spotLightMatrix.value=T.state.spotLightMatrix,ve.spotLightMap.value=T.state.spotLightMap,ve.pointShadowMap.value=T.state.pointShadowMap,ve.pointShadowMatrix.value=T.state.pointShadowMatrix),y.currentProgram=Re,y.uniformsList=null,Re}function Kt(l){if(l.uniformsList===null){const M=l.currentProgram.getUniforms();l.uniformsList=Lt.seqWithValue(M.seq,l.uniforms)}return l.uniformsList}function $t(l,M){const w=ge.get(l);w.outputColorSpace=M.outputColorSpace,w.batching=M.batching,w.batchingColor=M.batchingColor,w.instancing=M.instancing,w.instancingColor=M.instancingColor,w.instancingMorph=M.instancingMorph,w.skinning=M.skinning,w.morphTargets=M.morphTargets,w.morphNormals=M.morphNormals,w.morphColors=M.morphColors,w.morphTargetsCount=M.morphTargetsCount,w.numClippingPlanes=M.numClippingPlanes,w.numIntersection=M.numClipIntersection,w.vertexAlphas=M.vertexAlphas,w.vertexTangents=M.vertexTangents,w.toneMapping=M.toneMapping}function Cn(l,M,w,y,T){M.isScene!==!0&&(M=qe),p.resetTextureUnits();const Z=M.fog,ie=y.isMeshStandardMaterial?M.environment:null,le=G===null?g.outputColorSpace:G.isXRRenderTarget===!0?G.texture.colorSpace:t.LinearSRGBColorSpace,ue=(y.isMeshStandardMaterial?D:o).get(y.envMap||ie),Ae=y.vertexColors===!0&&!!w.attributes.color&&w.attributes.color.itemSize===4,Re=!!w.attributes.tangent&&(!!y.normalMap||y.anisotropy>0),ve=!!w.morphAttributes.position,Oe=!!w.morphAttributes.normal,Ve=!!w.morphAttributes.color;let Qe=t.NoToneMapping;y.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&(Qe=g.toneMapping);const $e=w.morphAttributes.position||w.morphAttributes.normal||w.morphAttributes.color,Be=$e!==void 0?$e.length:0,Se=ge.get(y),et=a.state.lights;if(j===!0&&(pe===!0||l!==u)){const nt=l===u&&y.id===h;Q.setState(y,l,nt)}let He=!1;y.version===Se.__version?(Se.needsLights&&Se.lightsStateVersion!==et.state.version||Se.outputColorSpace!==le||T.isBatchedMesh&&Se.batching===!1||!T.isBatchedMesh&&Se.batching===!0||T.isBatchedMesh&&Se.batchingColor===!0&&T.colorTexture===null||T.isBatchedMesh&&Se.batchingColor===!1&&T.colorTexture!==null||T.isInstancedMesh&&Se.instancing===!1||!T.isInstancedMesh&&Se.instancing===!0||T.isSkinnedMesh&&Se.skinning===!1||!T.isSkinnedMesh&&Se.skinning===!0||T.isInstancedMesh&&Se.instancingColor===!0&&T.instanceColor===null||T.isInstancedMesh&&Se.instancingColor===!1&&T.instanceColor!==null||T.isInstancedMesh&&Se.instancingMorph===!0&&T.morphTexture===null||T.isInstancedMesh&&Se.instancingMorph===!1&&T.morphTexture!==null||Se.envMap!==ue||y.fog===!0&&Se.fog!==Z||Se.numClippingPlanes!==void 0&&(Se.numClippingPlanes!==Q.numPlanes||Se.numIntersection!==Q.numIntersection)||Se.vertexAlphas!==Ae||Se.vertexTangents!==Re||Se.morphTargets!==ve||Se.morphNormals!==Oe||Se.morphColors!==Ve||Se.toneMapping!==Qe||Se.morphTargetsCount!==Be)&&(He=!0):(He=!0,Se.__version=y.version);let ct=Se.currentProgram;He===!0&&(ct=Rt(y,M,T));let vt=!1,rt=!1,Tt=!1;const Xe=ct.getUniforms(),ot=Se.uniforms;if(me.useProgram(ct.program)&&(vt=!0,rt=!0,Tt=!0),y.id!==h&&(h=y.id,rt=!0),vt||u!==l){me.buffers.depth.getReversed()?(re.copy(l.projectionMatrix),t.toNormalizedProjectionMatrix(re),t.toReversedProjectionMatrix(re),Xe.setValue(m,"projectionMatrix",re)):Xe.setValue(m,"projectionMatrix",l.projectionMatrix),Xe.setValue(m,"viewMatrix",l.matrixWorldInverse);const it=Xe.map.cameraPosition;it!==void 0&&it.setValue(m,Ce.setFromMatrixPosition(l.matrixWorld)),ye.logarithmicDepthBuffer&&Xe.setValue(m,"logDepthBufFC",2/(Math.log(l.far+1)/Math.LN2)),(y.isMeshPhongMaterial||y.isMeshToonMaterial||y.isMeshLambertMaterial||y.isMeshBasicMaterial||y.isMeshStandardMaterial||y.isShaderMaterial)&&Xe.setValue(m,"isOrthographic",l.isOrthographicCamera===!0),u!==l&&(u=l,rt=!0,Tt=!0)}if(T.isSkinnedMesh){Xe.setOptional(m,T,"bindMatrix"),Xe.setOptional(m,T,"bindMatrixInverse");const nt=T.skeleton;nt&&(nt.boneTexture===null&&nt.computeBoneTexture(),Xe.setValue(m,"boneTexture",nt.boneTexture,p))}T.isBatchedMesh&&(Xe.setOptional(m,T,"batchingTexture"),Xe.setValue(m,"batchingTexture",T._matricesTexture,p),Xe.setOptional(m,T,"batchingIdTexture"),Xe.setValue(m,"batchingIdTexture",T._indirectTexture,p),Xe.setOptional(m,T,"batchingColorTexture"),T._colorsTexture!==null&&Xe.setValue(m,"batchingColorTexture",T._colorsTexture,p));const st=w.morphAttributes;if((st.position!==void 0||st.normal!==void 0||st.color!==void 0)&&xe.update(T,w,ct),(rt||Se.receiveShadow!==T.receiveShadow)&&(Se.receiveShadow=T.receiveShadow,Xe.setValue(m,"receiveShadow",T.receiveShadow)),y.isMeshGouraudMaterial&&y.envMap!==null&&(ot.envMap.value=ue,ot.flipEnvMap.value=ue.isCubeTexture&&ue.isRenderTargetTexture===!1?-1:1),y.isMeshStandardMaterial&&y.envMap===null&&M.environment!==null&&(ot.envMapIntensity.value=M.environmentIntensity),rt&&(Xe.setValue(m,"toneMappingExposure",g.toneMappingExposure),Se.needsLights&&bn(ot,Tt),Z&&y.fog===!0&&ae.refreshFogUniforms(ot,Z),ae.refreshMaterialUniforms(ot,y,B,te,a.state.transmissionRenderTarget[l.id]),Lt.upload(m,Kt(Se),ot,p)),y.isShaderMaterial&&y.uniformsNeedUpdate===!0&&(Lt.upload(m,Kt(Se),ot,p),y.uniformsNeedUpdate=!1),y.isSpriteMaterial&&Xe.setValue(m,"center",T.center),Xe.setValue(m,"modelViewMatrix",T.modelViewMatrix),Xe.setValue(m,"normalMatrix",T.normalMatrix),Xe.setValue(m,"modelMatrix",T.matrixWorld),y.isShaderMaterial||y.isRawShaderMaterial){const nt=y.uniformsGroups;for(let it=0,wt=nt.length;it<wt;it++){const pt=nt[it];v.update(pt,ct),v.bind(pt,ct)}}return ct}function bn(l,M){l.ambientLightColor.needsUpdate=M,l.lightProbe.needsUpdate=M,l.directionalLights.needsUpdate=M,l.directionalLightShadows.needsUpdate=M,l.pointLights.needsUpdate=M,l.pointLightShadows.needsUpdate=M,l.spotLights.needsUpdate=M,l.spotLightShadows.needsUpdate=M,l.rectAreaLights.needsUpdate=M,l.hemisphereLights.needsUpdate=M}function Pn(l){return l.isMeshLambertMaterial||l.isMeshToonMaterial||l.isMeshPhongMaterial||l.isMeshStandardMaterial||l.isShadowMaterial||l.isShaderMaterial&&l.lights===!0}this.getActiveCubeFace=function(){return U},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return G},this.setRenderTargetTextures=function(l,M,w){ge.get(l.texture).__webglTexture=M,ge.get(l.depthTexture).__webglTexture=w;const y=ge.get(l);y.__hasExternalTextures=!0,y.__autoAllocateDepthBuffer=w===void 0,y.__autoAllocateDepthBuffer||we.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),y.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(l,M){const w=ge.get(l);w.__webglFramebuffer=M,w.__useDefaultFramebuffer=M===void 0},this.setRenderTarget=function(l,M=0,w=0){G=l,U=M,N=w;let y=!0,T=null,Z=!1,ie=!1;if(l){const ue=ge.get(l);if(ue.__useDefaultFramebuffer!==void 0)me.bindFramebuffer(m.FRAMEBUFFER,null),y=!1;else if(ue.__webglFramebuffer===void 0)p.setupRenderTarget(l);else if(ue.__hasExternalTextures)p.rebindTextures(l,ge.get(l.texture).__webglTexture,ge.get(l.depthTexture).__webglTexture);else if(l.depthBuffer){const ve=l.depthTexture;if(ue.__boundDepthTexture!==ve){if(ve!==null&&ge.has(ve)&&(l.width!==ve.image.width||l.height!==ve.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");p.setupDepthRenderbuffer(l)}}const Ae=l.texture;(Ae.isData3DTexture||Ae.isDataArrayTexture||Ae.isCompressedArrayTexture)&&(ie=!0);const Re=ge.get(l).__webglFramebuffer;l.isWebGLCubeRenderTarget?(Array.isArray(Re[M])?T=Re[M][w]:T=Re[M],Z=!0):l.samples>0&&p.useMultisampledRTT(l)===!1?T=ge.get(l).__webglMultisampledFramebuffer:Array.isArray(Re)?T=Re[w]:T=Re,R.copy(l.viewport),K.copy(l.scissor),k=l.scissorTest}else R.copy(De).multiplyScalar(B).floor(),K.copy(Ge).multiplyScalar(B).floor(),k=Ye;if(me.bindFramebuffer(m.FRAMEBUFFER,T)&&y&&me.drawBuffers(l,T),me.viewport(R),me.scissor(K),me.setScissorTest(k),Z){const ue=ge.get(l.texture);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+M,ue.__webglTexture,w)}else if(ie){const ue=ge.get(l.texture),Ae=M||0;m.framebufferTextureLayer(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,ue.__webglTexture,w||0,Ae)}h=-1},this.readRenderTargetPixels=function(l,M,w,y,T,Z,ie){if(!(l&&l.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let le=ge.get(l).__webglFramebuffer;if(l.isWebGLCubeRenderTarget&&ie!==void 0&&(le=le[ie]),le){me.bindFramebuffer(m.FRAMEBUFFER,le);try{const ue=l.texture,Ae=ue.format,Re=ue.type;if(!ye.textureFormatReadable(Ae)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ye.textureTypeReadable(Re)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}M>=0&&M<=l.width-y&&w>=0&&w<=l.height-T&&m.readPixels(M,w,y,T,Le.convert(Ae),Le.convert(Re),Z)}finally{const ue=G!==null?ge.get(G).__webglFramebuffer:null;me.bindFramebuffer(m.FRAMEBUFFER,ue)}}},this.readRenderTargetPixelsAsync=async function(l,M,w,y,T,Z,ie){if(!(l&&l.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let le=ge.get(l).__webglFramebuffer;if(l.isWebGLCubeRenderTarget&&ie!==void 0&&(le=le[ie]),le){const ue=l.texture,Ae=ue.format,Re=ue.type;if(!ye.textureFormatReadable(Ae))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ye.textureTypeReadable(Re))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(M>=0&&M<=l.width-y&&w>=0&&w<=l.height-T){me.bindFramebuffer(m.FRAMEBUFFER,le);const ve=m.createBuffer();m.bindBuffer(m.PIXEL_PACK_BUFFER,ve),m.bufferData(m.PIXEL_PACK_BUFFER,Z.byteLength,m.STREAM_READ),m.readPixels(M,w,y,T,Le.convert(Ae),Le.convert(Re),0);const Oe=G!==null?ge.get(G).__webglFramebuffer:null;me.bindFramebuffer(m.FRAMEBUFFER,Oe);const Ve=m.fenceSync(m.SYNC_GPU_COMMANDS_COMPLETE,0);return m.flush(),await t.probeAsync(m,Ve,4),m.bindBuffer(m.PIXEL_PACK_BUFFER,ve),m.getBufferSubData(m.PIXEL_PACK_BUFFER,0,Z),m.deleteBuffer(ve),m.deleteSync(Ve),Z}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(l,M=null,w=0){l.isTexture!==!0&&(t.warnOnce("WebGLRenderer: copyFramebufferToTexture function signature has changed."),M=arguments[0]||null,l=arguments[1]);const y=Math.pow(2,-w),T=Math.floor(l.image.width*y),Z=Math.floor(l.image.height*y),ie=M!==null?M.x:0,le=M!==null?M.y:0;p.setTexture2D(l,0),m.copyTexSubImage2D(m.TEXTURE_2D,w,0,0,ie,le,T,Z),me.unbindTexture()};const Ln=m.createFramebuffer(),Dn=m.createFramebuffer();this.copyTextureToTexture=function(l,M,w=null,y=null,T=0,Z=null){l.isTexture!==!0&&(t.warnOnce("WebGLRenderer: copyTextureToTexture function signature has changed."),y=arguments[0]||null,l=arguments[1],M=arguments[2],Z=arguments[3]||0,w=null),Z===null&&(T!==0?(t.warnOnce("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Z=T,T=0):Z=0);let ie,le,ue,Ae,Re,ve,Oe,Ve,Qe;const $e=l.isCompressedTexture?l.mipmaps[Z]:l.image;if(w!==null)ie=w.max.x-w.min.x,le=w.max.y-w.min.y,ue=w.isBox3?w.max.z-w.min.z:1,Ae=w.min.x,Re=w.min.y,ve=w.isBox3?w.min.z:0;else{const st=Math.pow(2,-T);ie=Math.floor($e.width*st),le=Math.floor($e.height*st),l.isDataArrayTexture?ue=$e.depth:l.isData3DTexture?ue=Math.floor($e.depth*st):ue=1,Ae=0,Re=0,ve=0}y!==null?(Oe=y.x,Ve=y.y,Qe=y.z):(Oe=0,Ve=0,Qe=0);const Be=Le.convert(M.format),Se=Le.convert(M.type);let et;M.isData3DTexture?(p.setTexture3D(M,0),et=m.TEXTURE_3D):M.isDataArrayTexture||M.isCompressedArrayTexture?(p.setTexture2DArray(M,0),et=m.TEXTURE_2D_ARRAY):(p.setTexture2D(M,0),et=m.TEXTURE_2D),m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,M.flipY),m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),m.pixelStorei(m.UNPACK_ALIGNMENT,M.unpackAlignment);const He=m.getParameter(m.UNPACK_ROW_LENGTH),ct=m.getParameter(m.UNPACK_IMAGE_HEIGHT),vt=m.getParameter(m.UNPACK_SKIP_PIXELS),rt=m.getParameter(m.UNPACK_SKIP_ROWS),Tt=m.getParameter(m.UNPACK_SKIP_IMAGES);m.pixelStorei(m.UNPACK_ROW_LENGTH,$e.width),m.pixelStorei(m.UNPACK_IMAGE_HEIGHT,$e.height),m.pixelStorei(m.UNPACK_SKIP_PIXELS,Ae),m.pixelStorei(m.UNPACK_SKIP_ROWS,Re),m.pixelStorei(m.UNPACK_SKIP_IMAGES,ve);const Xe=l.isDataArrayTexture||l.isData3DTexture,ot=M.isDataArrayTexture||M.isData3DTexture;if(l.isDepthTexture){const st=ge.get(l),nt=ge.get(M),it=ge.get(st.__renderTarget),wt=ge.get(nt.__renderTarget);me.bindFramebuffer(m.READ_FRAMEBUFFER,it.__webglFramebuffer),me.bindFramebuffer(m.DRAW_FRAMEBUFFER,wt.__webglFramebuffer);for(let pt=0;pt<ue;pt++)Xe&&(m.framebufferTextureLayer(m.READ_FRAMEBUFFER,m.COLOR_ATTACHMENT0,ge.get(l).__webglTexture,T,ve+pt),m.framebufferTextureLayer(m.DRAW_FRAMEBUFFER,m.COLOR_ATTACHMENT0,ge.get(M).__webglTexture,Z,Qe+pt)),m.blitFramebuffer(Ae,Re,ie,le,Oe,Ve,ie,le,m.DEPTH_BUFFER_BIT,m.NEAREST);me.bindFramebuffer(m.READ_FRAMEBUFFER,null),me.bindFramebuffer(m.DRAW_FRAMEBUFFER,null)}else if(T!==0||l.isRenderTargetTexture||ge.has(l)){const st=ge.get(l),nt=ge.get(M);me.bindFramebuffer(m.READ_FRAMEBUFFER,Ln),me.bindFramebuffer(m.DRAW_FRAMEBUFFER,Dn);for(let it=0;it<ue;it++)Xe?m.framebufferTextureLayer(m.READ_FRAMEBUFFER,m.COLOR_ATTACHMENT0,st.__webglTexture,T,ve+it):m.framebufferTexture2D(m.READ_FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,st.__webglTexture,T),ot?m.framebufferTextureLayer(m.DRAW_FRAMEBUFFER,m.COLOR_ATTACHMENT0,nt.__webglTexture,Z,Qe+it):m.framebufferTexture2D(m.DRAW_FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,nt.__webglTexture,Z),T!==0?m.blitFramebuffer(Ae,Re,ie,le,Oe,Ve,ie,le,m.COLOR_BUFFER_BIT,m.NEAREST):ot?m.copyTexSubImage3D(et,Z,Oe,Ve,Qe+it,Ae,Re,ie,le):m.copyTexSubImage2D(et,Z,Oe,Ve,Ae,Re,ie,le);me.bindFramebuffer(m.READ_FRAMEBUFFER,null),me.bindFramebuffer(m.DRAW_FRAMEBUFFER,null)}else ot?l.isDataTexture||l.isData3DTexture?m.texSubImage3D(et,Z,Oe,Ve,Qe,ie,le,ue,Be,Se,$e.data):M.isCompressedArrayTexture?m.compressedTexSubImage3D(et,Z,Oe,Ve,Qe,ie,le,ue,Be,$e.data):m.texSubImage3D(et,Z,Oe,Ve,Qe,ie,le,ue,Be,Se,$e):l.isDataTexture?m.texSubImage2D(m.TEXTURE_2D,Z,Oe,Ve,ie,le,Be,Se,$e.data):l.isCompressedTexture?m.compressedTexSubImage2D(m.TEXTURE_2D,Z,Oe,Ve,$e.width,$e.height,Be,$e.data):m.texSubImage2D(m.TEXTURE_2D,Z,Oe,Ve,ie,le,Be,Se,$e);m.pixelStorei(m.UNPACK_ROW_LENGTH,He),m.pixelStorei(m.UNPACK_IMAGE_HEIGHT,ct),m.pixelStorei(m.UNPACK_SKIP_PIXELS,vt),m.pixelStorei(m.UNPACK_SKIP_ROWS,rt),m.pixelStorei(m.UNPACK_SKIP_IMAGES,Tt),Z===0&&M.generateMipmaps&&m.generateMipmap(et),me.unbindTexture()},this.copyTextureToTexture3D=function(l,M,w=null,y=null,T=0){return l.isTexture!==!0&&(t.warnOnce("WebGLRenderer: copyTextureToTexture3D function signature has changed."),w=arguments[0]||null,y=arguments[1]||null,l=arguments[2],M=arguments[3],T=arguments[4]||0),t.warnOnce('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(l,M,w,y,T)},this.initRenderTarget=function(l){ge.get(l).__webglFramebuffer===void 0&&p.setupRenderTarget(l)},this.initTexture=function(l){l.isCubeTexture?p.setTextureCube(l,0):l.isData3DTexture?p.setTexture3D(l,0):l.isDataArrayTexture||l.isCompressedArrayTexture?p.setTexture2DArray(l,0):p.setTexture2D(l,0),me.unbindTexture()},this.resetState=function(){U=0,N=0,G=null,me.reset(),We.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.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.LuminanceAlphaFormat=t.LuminanceAlphaFormat;exports.LuminanceFormat=t.LuminanceFormat;exports.MOUSE=t.MOUSE;exports.Material=t.Material;exports.MathUtils=t.MathUtils;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.ZeroFactor=t.ZeroFactor;exports.ZeroStencilOp=t.ZeroStencilOp;exports.createCanvasElement=t.createCanvasElement;exports.PMREMGenerator=Vt;exports.ShaderChunk=Pe;exports.ShaderLib=ft;exports.UniformsLib=ee;exports.WebGLRenderer=us;exports.WebGLUtils=Rn;