ela 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (300) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.gitlab-ci.yml +23 -0
  4. data/Gemfile +7 -0
  5. data/Gemfile.lock +139 -0
  6. data/Guardfile +25 -0
  7. data/LICENSE.txt +205 -0
  8. data/README.de.md +195 -0
  9. data/README.md +66 -0
  10. data/Rakefile +96 -0
  11. data/app/css/screen.styl +425 -0
  12. data/app/css/vendor/stackedit.styl +140 -0
  13. data/app/fonts/Roboto-Italic-webfont.eot +0 -0
  14. data/app/fonts/Roboto-Italic-webfont.svg +642 -0
  15. data/app/fonts/Roboto-Italic-webfont.ttf +0 -0
  16. data/app/fonts/Roboto-Italic-webfont.woff +0 -0
  17. data/app/fonts/Roboto-Light-webfont.eot +0 -0
  18. data/app/fonts/Roboto-Light-webfont.svg +641 -0
  19. data/app/fonts/Roboto-Light-webfont.ttf +0 -0
  20. data/app/fonts/Roboto-Light-webfont.woff +0 -0
  21. data/app/fonts/Roboto-LightItalic-webfont.eot +0 -0
  22. data/app/fonts/Roboto-LightItalic-webfont.svg +641 -0
  23. data/app/fonts/Roboto-LightItalic-webfont.ttf +0 -0
  24. data/app/fonts/Roboto-LightItalic-webfont.woff +0 -0
  25. data/app/fonts/Roboto-Medium-webfont.eot +0 -0
  26. data/app/fonts/Roboto-Medium-webfont.svg +593 -0
  27. data/app/fonts/Roboto-Medium-webfont.ttf +0 -0
  28. data/app/fonts/Roboto-Medium-webfont.woff +0 -0
  29. data/app/fonts/Roboto-MediumItalic-webfont.eot +0 -0
  30. data/app/fonts/Roboto-MediumItalic-webfont.svg +642 -0
  31. data/app/fonts/Roboto-MediumItalic-webfont.ttf +0 -0
  32. data/app/fonts/Roboto-MediumItalic-webfont.woff +0 -0
  33. data/app/fonts/Roboto-Regular-webfont.eot +0 -0
  34. data/app/fonts/Roboto-Regular-webfont.svg +621 -0
  35. data/app/fonts/Roboto-Regular-webfont.ttf +0 -0
  36. data/app/fonts/Roboto-Regular-webfont.woff +0 -0
  37. data/app/fonts/Roboto-Thin-webfont.eot +0 -0
  38. data/app/fonts/Roboto-Thin-webfont.svg +631 -0
  39. data/app/fonts/Roboto-Thin-webfont.ttf +0 -0
  40. data/app/fonts/Roboto-Thin-webfont.woff +0 -0
  41. data/app/fonts/Roboto-ThinItalic-webfont.eot +0 -0
  42. data/app/fonts/Roboto-ThinItalic-webfont.svg +631 -0
  43. data/app/fonts/Roboto-ThinItalic-webfont.ttf +0 -0
  44. data/app/fonts/Roboto-ThinItalic-webfont.woff +0 -0
  45. data/app/fonts/droid_sans_regular.typeface.svg +1 -0
  46. data/app/fonts/fontawesome-webfont.eot +0 -0
  47. data/app/fonts/fontawesome-webfont.svg +2671 -0
  48. data/app/fonts/fontawesome-webfont.ttf +0 -0
  49. data/app/fonts/fontawesome-webfont.woff +0 -0
  50. data/app/fonts/fontawesome-webfont.woff2 +0 -0
  51. data/app/js/lib/application.coffee +83 -0
  52. data/app/js/lib/bootstrap_data.coffee +70 -0
  53. data/app/js/lib/collections/00_limited_collection.coffee +85 -0
  54. data/app/js/lib/collections/curves.coffee +3 -0
  55. data/app/js/lib/collections/named_object_collection.coffee +7 -0
  56. data/app/js/lib/mathjaxConfig.coffee +241 -0
  57. data/app/js/lib/models/app.coffee +58 -0
  58. data/app/js/lib/models/base_app.coffee +62 -0
  59. data/app/js/lib/models/base_app_model.coffee +61 -0
  60. data/app/js/lib/models/base_calculator.coffee +212 -0
  61. data/app/js/lib/models/base_subapp_container.coffee +35 -0
  62. data/app/js/lib/models/curve.coffee +179 -0
  63. data/app/js/lib/router.coffee +26 -0
  64. data/app/js/lib/views/app.coffee +56 -0
  65. data/app/js/lib/views/base_app.coffee +274 -0
  66. data/app/js/lib/views/base_aside.coffee +9 -0
  67. data/app/js/lib/views/base_graph.coffee +477 -0
  68. data/app/js/lib/views/base_subapp_container.coffee +44 -0
  69. data/app/js/lib/views/canvas.coffee +73 -0
  70. data/app/js/lib/views/curve_graph.coffee +163 -0
  71. data/app/js/lib/views/curves_aside.coffee +21 -0
  72. data/app/js/lib/views/curves_list_item.coffee +8 -0
  73. data/app/js/lib/views/grouped_parameters_aside.coffee +14 -0
  74. data/app/js/lib/views/headup.coffee +15 -0
  75. data/app/js/lib/views/help.coffee +86 -0
  76. data/app/js/lib/views/interpolated_graph.coffee +281 -0
  77. data/app/js/lib/views/legend.coffee +138 -0
  78. data/app/js/lib/views/legend_handler.coffee +51 -0
  79. data/app/js/lib/views/overview.coffee +85 -0
  80. data/app/js/lib/views/overview_tile.coffee +18 -0
  81. data/app/js/lib/views/parameters_aside.coffee +12 -0
  82. data/app/js/lib/views/three_graph.coffee +92 -0
  83. data/app/js/vendor/Markdown.Converter.js +1519 -0
  84. data/app/js/vendor/Markdown.Extra.js +874 -0
  85. data/app/js/vendor/Markdown.Toc.coffee +79 -0
  86. data/app/js/vendor/backbone-1.3.3.min.js +2 -0
  87. data/app/js/vendor/backbone-validation-0.11.5.js +8 -0
  88. data/app/js/vendor/backbone.poised/form.coffee +156 -0
  89. data/app/js/vendor/backbone.poised/form/anchor.coffee +26 -0
  90. data/app/js/vendor/backbone.poised/form/base_control.coffee +42 -0
  91. data/app/js/vendor/backbone.poised/form/linked_control.coffee +79 -0
  92. data/app/js/vendor/backbone.poised/form/linked_number_control.coffee +27 -0
  93. data/app/js/vendor/backbone.poised/form/linked_range_control.coffee +53 -0
  94. data/app/js/vendor/backbone.poised/form/linked_select_control.coffee +18 -0
  95. data/app/js/vendor/backbone.poised/form/linked_string_control.coffee +27 -0
  96. data/app/js/vendor/backbone.poised/form/number_control.coffee +25 -0
  97. data/app/js/vendor/backbone.poised/form/range_control.coffee +48 -0
  98. data/app/js/vendor/backbone.poised/form/select_control.coffee +16 -0
  99. data/app/js/vendor/backbone.poised/form/selectbox.coffee +78 -0
  100. data/app/js/vendor/backbone.poised/form/slider.coffee +109 -0
  101. data/app/js/vendor/backbone.poised/form/string_control.coffee +23 -0
  102. data/app/js/vendor/backbone.poised/form/submit_control.coffee +39 -0
  103. data/app/js/vendor/backbone.poised/form/textarea.coffee +36 -0
  104. data/app/js/vendor/backbone.poised/form/textfield.coffee +86 -0
  105. data/app/js/vendor/backbone.poised/form/value.coffee +33 -0
  106. data/app/js/vendor/backbone.poised/form/value_control.coffee +15 -0
  107. data/app/js/vendor/backbone.poised/linked_form.coffee +43 -0
  108. data/app/js/vendor/backbone.poised/list.coffee +97 -0
  109. data/app/js/vendor/backbone.poised/list/add_button.coffee +16 -0
  110. data/app/js/vendor/backbone.poised/list/anchor.coffee +32 -0
  111. data/app/js/vendor/backbone.poised/list/item.coffee +68 -0
  112. data/app/js/vendor/backbone.poised/list/searchfield.coffee +26 -0
  113. data/app/js/vendor/backbone.poised/list/selectable_item.coffee +65 -0
  114. data/app/js/vendor/backbone.poised/patches.coffee +6 -0
  115. data/app/js/vendor/backbone.poised/string_mixin.coffee +23 -0
  116. data/app/js/vendor/backbone.poised/underscore_ext.coffee +2 -0
  117. data/app/js/vendor/backbone.poised/view.coffee +59 -0
  118. data/app/js/vendor/gaussianElimination.coffee +40 -0
  119. data/app/js/vendor/hammer-2.0.8.min.js +7 -0
  120. data/app/js/vendor/jquery-3.1.1.min.js +4 -0
  121. data/app/js/vendor/jquery.after-transition.coffee +20 -0
  122. data/app/js/vendor/jquery.backbone-hammer.coffee +28 -0
  123. data/app/js/vendor/jquery.keyboard-modifiers.coffee +22 -0
  124. data/app/js/vendor/jquery.mark-5.2.3.min.js +7 -0
  125. data/app/js/vendor/jquery.scrollTo-2.1.2.min.js +7 -0
  126. data/app/js/vendor/js-yaml-3.4.3.min.js +3 -0
  127. data/app/js/vendor/markup_text.coffee +95 -0
  128. data/app/js/vendor/mathjax/MathJax.js +19 -0
  129. data/app/js/vendor/mathjax/extensions/MathEvents.js +19 -0
  130. data/app/js/vendor/mathjax/extensions/tex2jax.js +19 -0
  131. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_AMS-Regular.eot +0 -0
  132. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Caligraphic-Bold.eot +0 -0
  133. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Caligraphic-Regular.eot +0 -0
  134. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Fraktur-Bold.eot +0 -0
  135. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Fraktur-Regular.eot +0 -0
  136. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Bold.eot +0 -0
  137. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Italic.eot +0 -0
  138. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Regular.eot +0 -0
  139. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-BoldItalic.eot +0 -0
  140. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-Italic.eot +0 -0
  141. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-Regular.eot +0 -0
  142. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Bold.eot +0 -0
  143. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Italic.eot +0 -0
  144. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Regular.eot +0 -0
  145. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Script-Regular.eot +0 -0
  146. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size1-Regular.eot +0 -0
  147. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size2-Regular.eot +0 -0
  148. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size3-Regular.eot +0 -0
  149. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size4-Regular.eot +0 -0
  150. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Typewriter-Regular.eot +0 -0
  151. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_WinIE6-Regular.eot +0 -0
  152. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_AMS-Regular.otf +0 -0
  153. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Caligraphic-Bold.otf +0 -0
  154. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Caligraphic-Regular.otf +0 -0
  155. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Fraktur-Bold.otf +0 -0
  156. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Fraktur-Regular.otf +0 -0
  157. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Bold.otf +0 -0
  158. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Italic.otf +0 -0
  159. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Regular.otf +0 -0
  160. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-BoldItalic.otf +0 -0
  161. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-Italic.otf +0 -0
  162. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-Regular.otf +0 -0
  163. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Bold.otf +0 -0
  164. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Italic.otf +0 -0
  165. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Regular.otf +0 -0
  166. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Script-Regular.otf +0 -0
  167. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size1-Regular.otf +0 -0
  168. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size2-Regular.otf +0 -0
  169. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size3-Regular.otf +0 -0
  170. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size4-Regular.otf +0 -0
  171. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Typewriter-Regular.otf +0 -0
  172. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_WinChrome-Regular.otf +0 -0
  173. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_WinIE6-Regular.otf +0 -0
  174. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_AMS-Regular.svg +765 -0
  175. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Caligraphic-Bold.svg +136 -0
  176. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Caligraphic-Regular.svg +134 -0
  177. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Fraktur-Bold.svg +319 -0
  178. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Fraktur-Regular.svg +309 -0
  179. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Bold.svg +656 -0
  180. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Italic.svg +374 -0
  181. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Regular.svg +659 -0
  182. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-BoldItalic.svg +331 -0
  183. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-Italic.svg +331 -0
  184. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-Regular.svg +330 -0
  185. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Bold.svg +280 -0
  186. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Italic.svg +245 -0
  187. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Regular.svg +211 -0
  188. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Script-Regular.svg +160 -0
  189. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size1-Regular.svg +110 -0
  190. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size2-Regular.svg +109 -0
  191. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size3-Regular.svg +49 -0
  192. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size4-Regular.svg +102 -0
  193. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Typewriter-Regular.svg +322 -0
  194. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_WinChrome-Regular.svg +39 -0
  195. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_AMS-Regular.woff +0 -0
  196. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Bold.woff +0 -0
  197. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Regular.woff +0 -0
  198. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Bold.woff +0 -0
  199. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Regular.woff +0 -0
  200. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Bold.woff +0 -0
  201. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Italic.woff +0 -0
  202. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff +0 -0
  203. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-BoldItalic.woff +0 -0
  204. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Italic.woff +0 -0
  205. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Regular.woff +0 -0
  206. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Bold.woff +0 -0
  207. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Italic.woff +0 -0
  208. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Regular.woff +0 -0
  209. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Script-Regular.woff +0 -0
  210. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size1-Regular.woff +0 -0
  211. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size2-Regular.woff +0 -0
  212. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size3-Regular.woff +0 -0
  213. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size4-Regular.woff +0 -0
  214. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Typewriter-Regular.woff +0 -0
  215. data/app/js/vendor/mathjax/jax/element/mml/jax.js +19 -0
  216. data/app/js/vendor/mathjax/jax/element/mml/optable/Arrows.js +19 -0
  217. data/app/js/vendor/mathjax/jax/element/mml/optable/BasicLatin.js +19 -0
  218. data/app/js/vendor/mathjax/jax/element/mml/optable/CombDiacritMarks.js +19 -0
  219. data/app/js/vendor/mathjax/jax/element/mml/optable/CombDiactForSymbols.js +19 -0
  220. data/app/js/vendor/mathjax/jax/element/mml/optable/Dingbats.js +19 -0
  221. data/app/js/vendor/mathjax/jax/element/mml/optable/GeneralPunctuation.js +19 -0
  222. data/app/js/vendor/mathjax/jax/element/mml/optable/GeometricShapes.js +19 -0
  223. data/app/js/vendor/mathjax/jax/element/mml/optable/GreekAndCoptic.js +19 -0
  224. data/app/js/vendor/mathjax/jax/element/mml/optable/Latin1Supplement.js +19 -0
  225. data/app/js/vendor/mathjax/jax/element/mml/optable/LetterlikeSymbols.js +19 -0
  226. data/app/js/vendor/mathjax/jax/element/mml/optable/MathOperators.js +19 -0
  227. data/app/js/vendor/mathjax/jax/element/mml/optable/MiscMathSymbolsA.js +19 -0
  228. data/app/js/vendor/mathjax/jax/element/mml/optable/MiscMathSymbolsB.js +19 -0
  229. data/app/js/vendor/mathjax/jax/element/mml/optable/MiscSymbolsAndArrows.js +19 -0
  230. data/app/js/vendor/mathjax/jax/element/mml/optable/MiscTechnical.js +19 -0
  231. data/app/js/vendor/mathjax/jax/element/mml/optable/SpacingModLetters.js +19 -0
  232. data/app/js/vendor/mathjax/jax/element/mml/optable/SuppMathOperators.js +19 -0
  233. data/app/js/vendor/mathjax/jax/element/mml/optable/SupplementalArrowsA.js +19 -0
  234. data/app/js/vendor/mathjax/jax/element/mml/optable/SupplementalArrowsB.js +19 -0
  235. data/app/js/vendor/mathjax/jax/input/TeX/config.js +19 -0
  236. data/app/js/vendor/mathjax/jax/input/TeX/jax.js +19 -0
  237. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/annotation-xml.js +19 -0
  238. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/maction.js +19 -0
  239. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/menclose.js +19 -0
  240. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mglyph.js +19 -0
  241. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mmultiscripts.js +19 -0
  242. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/ms.js +19 -0
  243. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mtable.js +19 -0
  244. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/multiline.js +19 -0
  245. data/app/js/vendor/mathjax/jax/output/CommonHTML/config.js +19 -0
  246. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/AMS-Regular.js +19 -0
  247. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Caligraphic-Bold.js +19 -0
  248. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Bold.js +19 -0
  249. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Regular.js +19 -0
  250. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Main-Bold.js +19 -0
  251. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Math-BoldItalic.js +19 -0
  252. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Bold.js +19 -0
  253. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Italic.js +19 -0
  254. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Regular.js +19 -0
  255. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Script-Regular.js +19 -0
  256. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Typewriter-Regular.js +19 -0
  257. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata-extra.js +19 -0
  258. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata.js +19 -0
  259. data/app/js/vendor/mathjax/jax/output/CommonHTML/jax.js +19 -0
  260. data/app/js/vendor/modernizr-custom-3.3.1.min.js +3 -0
  261. data/app/js/vendor/persistjs-git.js +1136 -0
  262. data/app/js/vendor/poised/poised.general.coffee +21 -0
  263. data/app/js/vendor/poised/poised.tabs.coffee +31 -0
  264. data/app/js/vendor/poised/utils.coffee +11 -0
  265. data/app/js/vendor/request_animation_frame.coffee +19 -0
  266. data/app/js/vendor/three-82.min.js +15 -0
  267. data/app/js/vendor/three-CanvasRenderer-82.js +1118 -0
  268. data/app/js/vendor/three-Projector-82.js +929 -0
  269. data/app/js/vendor/underscore-1.8.3.min.js +6 -0
  270. data/app/js/vendor/webfontloader-1.6.26.min.js +33 -0
  271. data/app/views/aliasing/legend.jst.hamlc +6 -0
  272. data/app/views/composites/composites_list_item_label.jst.hamlc +3 -0
  273. data/app/views/composites/import_composites_aside.jst.hamlc +6 -0
  274. data/app/views/composites/mix_preset_list_item_label.jst.hamlc +8 -0
  275. data/app/views/composites/share_aside.jst.hamlc +7 -0
  276. data/app/views/doc/airplanes_list_item_label.jst.hamlc +3 -0
  277. data/app/views/doc/import_airplanes_aside.jst.hamlc +6 -0
  278. data/app/views/doc/share_aside.jst.hamlc +7 -0
  279. data/app/views/general/app.jst.hamlc +42 -0
  280. data/app/views/general/curves_list_item_label.jst.hamlc +5 -0
  281. data/app/views/general/help.jst.hamlc +7 -0
  282. data/app/views/general/tabs.jst.hamlc +6 -0
  283. data/app/views/index.haml +24 -0
  284. data/app/views/overview/app.jst.hamlc +7 -0
  285. data/app/views/overview/tile.jst.hamlc +4 -0
  286. data/bin/console +14 -0
  287. data/bin/setup +8 -0
  288. data/ela.gemspec +50 -0
  289. data/exe/ela +59 -0
  290. data/lib/ela.rb +8 -0
  291. data/lib/ela/jasmine.rb +87 -0
  292. data/lib/ela/server.rb +136 -0
  293. data/lib/ela/utils.rb +131 -0
  294. data/lib/ela/version.rb +3 -0
  295. data/package-lock.json +899 -0
  296. data/package.json +11 -0
  297. data/support/project/Guardfile +64 -0
  298. data/support/project/jasmine.yml +3 -0
  299. data/support/server.ru +5 -0
  300. metadata +4365 -0
@@ -0,0 +1,21 @@
1
+ $(document).ready ->
2
+ touchOriginX = touchOriginY = 0
3
+ $('body').on 'touchstart', (e) ->
4
+ touchOriginX = e.originalEvent.touches[0].clientX
5
+ touchOriginY = e.originalEvent.touches[0].clientY
6
+
7
+ $('body').on 'touchmove', (e) ->
8
+ directionX = e.originalEvent.touches[0].clientX - touchOriginX # <0 = left, >0 = right
9
+ directionY = e.originalEvent.touches[0].clientY - touchOriginY # <0 = up, >0 = down
10
+
11
+ $target = $(e.target)
12
+ scrollables = $target.closest('.scroll, .scroll-y, .scroll-x')
13
+ isTouchable = $target.closest('.touch').length
14
+ isScrollable = scrollables.length and
15
+ # Remove iOS rubber band effect - vertical
16
+ ((not (directionY > 0 and scrollables.scrollTop() <= 0) and
17
+ not (directionY < 0 and (scrollables.scrollTop() + scrollables.innerHeight()) >= scrollables[0].scrollHeight)) or
18
+ # horizontal
19
+ (not (directionX > 0 and scrollables.scrollLeft() <= 0) and
20
+ not (directionX < 0 and (scrollables.scrollLeft() + scrollables.innerWidth()) >= scrollables[0].scrollWidth)))
21
+ e.preventDefault() if isTouchable or !isScrollable
@@ -0,0 +1,31 @@
1
+ $.poised = {}
2
+ $.poised.tabs = (element, options) ->
3
+ plugin = this
4
+ plugin.settings = {}
5
+ $element = $(element)
6
+ element = element
7
+
8
+ plugin.init = ->
9
+ $header = $element.find('header ')
10
+ $headerTabs = $header.find('.tab')
11
+
12
+ updateActiveTab = (active) ->
13
+ active ||= $element.find('.tab-content.active').attr('data-tab') || $element.find('.tab-content').first().attr('data-tab')
14
+ $element.find('.tab, .tab-content').each (elem) ->
15
+ $el = $(this)
16
+ id = $el.attr('data-tab-view') || $el.attr('data-tab')
17
+ $el.toggleClass('active', id == active)
18
+ $activeTab = $header.find("[data-tab-view=#{active}]")
19
+
20
+ $headerTabs.on 'tap', (e) ->
21
+ updateActiveTab($(e.target).attr('data-tab-view'))
22
+ updateActiveTab()
23
+
24
+ plugin.init()
25
+
26
+ $.fn.poisedTabs = (options = {}) ->
27
+ this.each ->
28
+ $this = $(this)
29
+ unless $this.data('poised.tabs')
30
+ plugin = new $.poised.tabs(this, options)
31
+ $this.data('poised.tabs', plugin)
@@ -0,0 +1,11 @@
1
+ $.ematch = (val, expr) ->
2
+ if typeof expr is 'boolean'
3
+ expr
4
+ else if expr?.constructor.name is 'RegExp'
5
+ expr.test(val)
6
+ else if $.isArray(expr)
7
+ $.inArray(val, expr) > -1
8
+ else if typeof expr is 'function'
9
+ expr.call(val, val)
10
+ else
11
+ false
@@ -0,0 +1,19 @@
1
+ lastTime = 0
2
+ vendors = ['webkit', 'moz']
3
+
4
+ for vendor in vendors when !window.requestAnimationFrame
5
+ window.requestAnimationFrame = window["#{vendor}RequestAnimationFrame"]
6
+ window.cancelAnimationFrame = window["#{vendor}CancelAnimationFrame"] || window["#{vendor}CancelRequestAnimationFrame"];
7
+
8
+ unless window.requestAnimationFrame
9
+ window.requestAnimationFrame = (callback, element) ->
10
+ currTime = Date.now()
11
+ timeToCall = Math.max(0, 16 - (currTime - lastTime))
12
+ id = setTimeout ->
13
+ callback(currTime + timeToCall)
14
+ , timeToCall
15
+ lastTime = currTime + timeToCall
16
+ id
17
+
18
+ unless window.cancelAnimationFrame
19
+ window.cancelAnimationFrame = window.clearTimeout
@@ -0,0 +1,15 @@
1
+ // threejs.org/license
2
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.THREE=t.THREE||{})}(this,function(t){"use strict";function e(){}function i(t,e){this.x=t||0,this.y=e||0}function n(t,e,a,o,s,c,h,l,u,p){Object.defineProperty(this,"id",{value:r()}),this.uuid=Fo.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==t?t:n.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:n.DEFAULT_MAPPING,this.wrapS=void 0!==a?a:Ra,this.wrapT=void 0!==o?o:Ra,this.magFilter=void 0!==s?s:Da,this.minFilter=void 0!==c?c:Fa,this.anisotropy=void 0!==u?u:1,this.format=void 0!==h?h:$a,this.type=void 0!==l?l:za,this.offset=new i(0,0),this.repeat=new i(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==p?p:Ao,this.version=0,this.onUpdate=null}function r(){return Bo++}function a(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function o(t,e,i){this.uuid=Fo.generateUUID(),this.width=t,this.height=e,this.scissor=new a(0,0,t,e),this.scissorTest=!1,this.viewport=new a(0,0,t,e),i=i||{},void 0===i.minFilter&&(i.minFilter=Da),this.texture=new n(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function s(t,e,i){o.call(this,t,e,i),this.activeCubeFace=0,this.activeMipMapLevel=0}function c(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}function h(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function l(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function u(t,e,i,r,a,o,s,c,h,l){t=void 0!==t?t:[],e=void 0!==e?e:_a,n.call(this,t,e,i,r,a,o,s,c,h,l),this.flipY=!1}function p(){this.seq=[],this.map={}}function d(t,e,i){var n=t[0];if(n<=0||n>0)return t;var r=e*i,a=Ho[r];if(void 0===a&&(a=new Float32Array(r),Ho[r]=a),0!==e){n.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=i,t[o].toArray(a,s)}return a}function f(t,e){var i=Vo[e];void 0===i&&(i=new Int32Array(e),Vo[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocTextureUnit();return i}function m(t,e){t.uniform1f(this.addr,e)}function v(t,e){t.uniform1i(this.addr,e)}function g(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function y(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function x(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function _(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function b(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function w(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function M(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTexture2D(e||zo,n)}function E(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTextureCube(e||Go,n)}function T(t,e){t.uniform2iv(this.addr,e)}function S(t,e){t.uniform3iv(this.addr,e)}function A(t,e){t.uniform4iv(this.addr,e)}function L(t){switch(t){case 5126:return m;case 35664:return g;case 35665:return y;case 35666:return x;case 35674:return _;case 35675:return b;case 35676:return w;case 35678:return M;case 35680:return E;case 5124:case 35670:return v;case 35667:case 35671:return T;case 35668:case 35672:return S;case 35669:case 35673:return A}}function R(t,e){t.uniform1fv(this.addr,e)}function P(t,e){t.uniform1iv(this.addr,e)}function C(t,e){t.uniform2fv(this.addr,d(e,this.size,2))}function I(t,e){t.uniform3fv(this.addr,d(e,this.size,3))}function U(t,e){t.uniform4fv(this.addr,d(e,this.size,4))}function N(t,e){t.uniformMatrix2fv(this.addr,!1,d(e,this.size,4))}function D(t,e){t.uniformMatrix3fv(this.addr,!1,d(e,this.size,9))}function O(t,e){t.uniformMatrix4fv(this.addr,!1,d(e,this.size,16))}function F(t,e,i){var n=e.length,r=f(i,n);t.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTexture2D(e[a]||zo,r[a])}function B(t,e,i){var n=e.length,r=f(i,n);t.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTextureCube(e[a]||Go,r[a])}function z(t){switch(t){case 5126:return R;case 35664:return C;case 35665:return I;case 35666:return U;case 35674:return N;case 35675:return D;case 35676:return O;case 35678:return F;case 35680:return B;case 5124:case 35670:return P;case 35667:case 35671:return T;case 35668:case 35672:return S;case 35669:case 35673:return A}}function G(t,e,i){this.id=t,this.addr=i,this.setValue=L(e.type)}function H(t,e,i){this.id=t,this.addr=i,this.size=e.size,this.setValue=z(e.type)}function V(t){this.id=t,p.call(this)}function k(t,e){t.seq.push(e),t.map[e.id]=e}function j(t,e,i){var n=t.name,r=n.length;for(ko.lastIndex=0;;){var a=ko.exec(n),o=ko.lastIndex,s=a[1],c="]"===a[2],h=a[3];if(c&&(s|=0),void 0===h||"["===h&&o+2===r){k(i,void 0===h?new G(s,t,e):new H(s,t,e));break}var l=i.map,u=l[s];void 0===u&&(u=new V(s),k(i,u)),i=u}}function W(t,e,i){p.call(this),this.renderer=i;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r!==n;++r){var a=t.getActiveUniform(e,r),o=a.name,s=t.getUniformLocation(e,o);j(a,s,this)}}function X(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}function Y(t,e){this.min=void 0!==t?t:new i(+(1/0),+(1/0)),this.max=void 0!==e?e:new i(-(1/0),-(1/0))}function q(t,e){function n(){var t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),e=new Uint16Array([0,1,2,0,2,3]);a=f.createBuffer(),o=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,a),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),p=f.createTexture(),d=f.createTexture(),m.bindTexture(f.TEXTURE_2D,p),f.texImage2D(f.TEXTURE_2D,0,f.RGB,16,16,0,f.RGB,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),m.bindTexture(f.TEXTURE_2D,d),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,16,16,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},c=r(s),l={vertex:f.getAttribLocation(c,"position"),uv:f.getAttribLocation(c,"uv")},u={renderType:f.getUniformLocation(c,"renderType"),map:f.getUniformLocation(c,"map"),occlusionMap:f.getUniformLocation(c,"occlusionMap"),opacity:f.getUniformLocation(c,"opacity"),color:f.getUniformLocation(c,"color"),scale:f.getUniformLocation(c,"scale"),rotation:f.getUniformLocation(c,"rotation"),screenPosition:f.getUniformLocation(c,"screenPosition")}}function r(e){var i=f.createProgram(),n=f.createShader(f.FRAGMENT_SHADER),r=f.createShader(f.VERTEX_SHADER),a="precision "+t.getPrecision()+" float;\n";return f.shaderSource(n,a+e.fragmentShader),f.shaderSource(r,a+e.vertexShader),f.compileShader(n),f.compileShader(r),f.attachShader(i,n),f.attachShader(i,r),f.linkProgram(i),i}var a,o,s,c,l,u,p,d,f=t.context,m=t.state;this.render=function(r,s,v){if(0!==e.length){var g=new h,y=v.w/v.z,x=.5*v.z,_=.5*v.w,b=16/v.w,w=new i(b*y,b),M=new h(1,1,0),E=new i(1,1),T=new Y;T.min.set(v.x,v.y),T.max.set(v.x+(v.z-16),v.y+(v.w-16)),void 0===c&&n(),f.useProgram(c),m.initAttributes(),m.enableAttribute(l.vertex),m.enableAttribute(l.uv),m.disableUnusedAttributes(),f.uniform1i(u.occlusionMap,0),f.uniform1i(u.map,1),f.bindBuffer(f.ARRAY_BUFFER,a),f.vertexAttribPointer(l.vertex,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),m.disable(f.CULL_FACE),m.setDepthWrite(!1);for(var S=0,A=e.length;S<A;S++){b=16/v.w,w.set(b*y,b);var L=e[S];if(g.set(L.matrixWorld.elements[12],L.matrixWorld.elements[13],L.matrixWorld.elements[14]),g.applyMatrix4(s.matrixWorldInverse),g.applyProjection(s.projectionMatrix),M.copy(g),E.x=v.x+M.x*x+x-8,E.y=v.y+M.y*_+_-8,T.containsPoint(E)===!0){m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,null),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,p),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGB,E.x,E.y,16,16,0),f.uniform1i(u.renderType,0),f.uniform2f(u.scale,w.x,w.y),f.uniform3f(u.screenPosition,M.x,M.y,M.z),m.disable(f.BLEND),m.enable(f.DEPTH_TEST),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,d),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGBA,E.x,E.y,16,16,0),f.uniform1i(u.renderType,1),m.disable(f.DEPTH_TEST),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,p),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),L.positionScreen.copy(M),L.customUpdateCallback?L.customUpdateCallback(L):L.updateLensFlares(),f.uniform1i(u.renderType,2),m.enable(f.BLEND);for(var R=0,P=L.lensFlares.length;R<P;R++){var C=L.lensFlares[R];C.opacity>.001&&C.scale>.001&&(M.x=C.x,M.y=C.y,M.z=C.z,b=C.size*C.scale/v.w,w.x=b*y,w.y=b,f.uniform3f(u.screenPosition,M.x,M.y,M.z),f.uniform2f(u.scale,w.x,w.y),f.uniform1f(u.rotation,C.rotation),f.uniform1f(u.opacity,C.opacity),f.uniform3f(u.color,C.color.r,C.color.g,C.color.b),m.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),t.setTexture2D(C.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0))}}}m.enable(f.CULL_FACE),m.enable(f.DEPTH_TEST),m.setDepthWrite(!0),t.resetGLState()}}}function Z(t,e){function i(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=f.createBuffer(),s=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,o),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),l=r(),u={position:f.getAttribLocation(l,"position"),uv:f.getAttribLocation(l,"uv")},p={uvOffset:f.getUniformLocation(l,"uvOffset"),uvScale:f.getUniformLocation(l,"uvScale"),rotation:f.getUniformLocation(l,"rotation"),scale:f.getUniformLocation(l,"scale"),color:f.getUniformLocation(l,"color"),map:f.getUniformLocation(l,"map"),opacity:f.getUniformLocation(l,"opacity"),modelViewMatrix:f.getUniformLocation(l,"modelViewMatrix"),projectionMatrix:f.getUniformLocation(l,"projectionMatrix"),fogType:f.getUniformLocation(l,"fogType"),fogDensity:f.getUniformLocation(l,"fogDensity"),fogNear:f.getUniformLocation(l,"fogNear"),fogFar:f.getUniformLocation(l,"fogFar"),fogColor:f.getUniformLocation(l,"fogColor"),alphaTest:f.getUniformLocation(l,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var a=i.getContext("2d");a.fillStyle="white",a.fillRect(0,0,8,8),d=new n(i),d.needsUpdate=!0}function r(){var e=f.createProgram(),i=f.createShader(f.VERTEX_SHADER),n=f.createShader(f.FRAGMENT_SHADER);return f.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),f.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),f.compileShader(i),f.compileShader(n),f.attachShader(e,i),f.attachShader(e,n),f.linkProgram(e),e}function a(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var o,s,l,u,p,d,f=t.context,m=t.state,v=new h,g=new c,y=new h;this.render=function(n,r){if(0!==e.length){void 0===l&&i(),f.useProgram(l),m.initAttributes(),m.enableAttribute(u.position),m.enableAttribute(u.uv),m.disableUnusedAttributes(),m.disable(f.CULL_FACE),m.enable(f.BLEND),f.bindBuffer(f.ARRAY_BUFFER,o),f.vertexAttribPointer(u.position,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(u.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.uniformMatrix4fv(p.projectionMatrix,!1,r.projectionMatrix.elements),m.activeTexture(f.TEXTURE0),f.uniform1i(p.map,0);var c=0,h=0,x=n.fog;x?(f.uniform3f(p.fogColor,x.color.r,x.color.g,x.color.b),x&&x.isFog?(f.uniform1f(p.fogNear,x.near),f.uniform1f(p.fogFar,x.far),f.uniform1i(p.fogType,1),c=1,h=1):x&&x.isFogExp2&&(f.uniform1f(p.fogDensity,x.density),f.uniform1i(p.fogType,2),c=2,h=2)):(f.uniform1i(p.fogType,0),c=0,h=0);for(var _=0,b=e.length;_<b;_++){var w=e[_];w.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(a);for(var M=[],_=0,b=e.length;_<b;_++){var w=e[_],E=w.material;if(E.visible!==!1){f.uniform1f(p.alphaTest,E.alphaTest),f.uniformMatrix4fv(p.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(v,g,y),M[0]=y.x,M[1]=y.y;var T=0;n.fog&&E.fog&&(T=h),c!==T&&(f.uniform1i(p.fogType,T),c=T),null!==E.map?(f.uniform2f(p.uvOffset,E.map.offset.x,E.map.offset.y),f.uniform2f(p.uvScale,E.map.repeat.x,E.map.repeat.y)):(f.uniform2f(p.uvOffset,0,0),f.uniform2f(p.uvScale,1,1)),f.uniform1f(p.opacity,E.opacity),f.uniform3f(p.color,E.color.r,E.color.g,E.color.b),f.uniform1f(p.rotation,E.rotation),f.uniform2fv(p.scale,M),m.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),m.setDepthTest(E.depthTest),m.setDepthWrite(E.depthWrite),E.map?t.setTexture2D(E.map,0):t.setTexture2D(d,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0)}}m.enable(f.CULL_FACE),t.resetGLState()}}}function J(){Object.defineProperty(this,"id",{value:Q()}),this.uuid=Fo.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=Dr,this.side=Sr,this.shading=Pr,this.vertexColors=Cr,this.opacity=1,this.transparent=!1,this.blendSrc=Jr,this.blendDst=Qr,this.blendEquation=Hr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=oa,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function Q(){return Xc++}function K(t){J.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function $(t){J.call(this),this.type="MeshDepthMaterial",this.depthPacking=Do,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function tt(t,e){this.min=void 0!==t?t:new h(+(1/0),+(1/0),+(1/0)),this.max=void 0!==e?e:new h(-(1/0),-(1/0),-(1/0))}function et(t,e){this.center=void 0!==t?t:new h,this.radius=void 0!==e?e:0}function it(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function nt(t,e){this.normal=void 0!==t?t:new h(1,0,0),this.constant=void 0!==e?e:0}function rt(t,e,i,n,r,a){this.planes=[void 0!==t?t:new nt,void 0!==e?e:new nt,void 0!==i?i:new nt,void 0!==n?n:new nt,void 0!==r?r:new nt,void 0!==a?a:new nt]}function at(t,e,n,r){function s(e,i,n,r){var a=e.geometry,o=null,s=E,c=e.customDepthMaterial;if(n&&(s=T,c=e.customDistanceMaterial),c)o=c;else{var h=!1;i.morphTargets&&(a&&a.isBufferGeometry?h=a.morphAttributes&&a.morphAttributes.position&&a.morphAttributes.position.length>0:a&&a.isGeometry&&(h=a.morphTargets&&a.morphTargets.length>0));var l=e.isSkinnedMesh&&i.skinning,u=0;h&&(u|=b),l&&(u|=w),o=s[u]}if(t.localClippingEnabled&&i.clipShadows===!0&&0!==i.clippingPlanes.length){var p=o.uuid,d=i.uuid,f=S[p];void 0===f&&(f={},S[p]=f);var m=f[d];void 0===m&&(m=o.clone(),f[d]=m),o=m}o.visible=i.visible,o.wireframe=i.wireframe;var v=i.side;return B.renderSingleSided&&v==Lr&&(v=Sr),B.renderReverseSided&&(v===Sr?v=Ar:v===Ar&&(v=Sr)),o.side=v,o.clipShadows=i.clipShadows,o.clippingPlanes=i.clippingPlanes,o.wireframeLinewidth=i.wireframeLinewidth,o.linewidth=i.linewidth,n&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(r),o}function c(t,e,i){if(t.visible!==!1){var n=0!==(t.layers.mask&e.layers.mask);if(n&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(t.frustumCulled===!1||d.intersectsObject(t)===!0)){var r=t.material;r.visible===!0&&(t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),_.push(t))}for(var a=t.children,o=0,s=a.length;o<s;o++)c(a[o],e,i)}}var u=t.context,p=t.state,d=new rt,f=new l,m=e.shadows,v=new i,g=new i(r.maxTextureSize,r.maxTextureSize),y=new h,x=new h,_=[],b=1,w=2,M=(b|w)+1,E=new Array(M),T=new Array(M),S={},A=[new h(1,0,0),new h(-1,0,0),new h(0,0,1),new h(0,0,-1),new h(0,1,0),new h(0,-1,0)],L=[new h(0,1,0),new h(0,1,0),new h(0,1,0),new h(0,1,0),new h(0,0,1),new h(0,0,-1)],R=[new a,new a,new a,new a,new a,new a],P=new $;P.depthPacking=Oo,P.clipping=!0;for(var C=Wc.distanceRGBA,I=jo.clone(C.uniforms),U=0;U!==M;++U){var N=0!==(U&b),D=0!==(U&w),O=P.clone();O.morphTargets=N,O.skinning=D,E[U]=O;var F=new K({defines:{USE_SHADOWMAP:""},uniforms:I,vertexShader:C.vertexShader,fragmentShader:C.fragmentShader,morphTargets:N,skinning:D,clipping:!0});T[U]=F}var B=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Er,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,i){if(B.enabled!==!1&&(B.autoUpdate!==!1||B.needsUpdate!==!1)&&0!==m.length){p.clearColor(1,1,1,1),p.disable(u.BLEND),p.setDepthTest(!0),p.setScissorTest(!1);for(var r,a,h=0,l=m.length;h<l;h++){var b=m[h],w=b.shadow;if(void 0!==w){var M=w.camera;if(v.copy(w.mapSize),v.min(g),b&&b.isPointLight){r=6,a=!0;var E=v.x,T=v.y;R[0].set(2*E,T,E,T),R[1].set(0,T,E,T),R[2].set(3*E,T,E,T),R[3].set(E,T,E,T),R[4].set(3*E,0,E,T),R[5].set(E,0,E,T),v.x*=4,v.y*=2}else r=1,a=!1;if(null===w.map){var S={minFilter:Ia,magFilter:Ia,format:$a};w.map=new o(v.x,v.y,S),M.updateProjectionMatrix()}w&&w.isSpotLightShadow&&w.update(b);var P=w.map,C=w.matrix;x.setFromMatrixPosition(b.matrixWorld),M.position.copy(x),t.setRenderTarget(P),t.clear();for(var I=0;I<r;I++){if(a){y.copy(M.position),y.add(A[I]),M.up.copy(L[I]),M.lookAt(y);var U=R[I];p.viewport(U)}else y.setFromMatrixPosition(b.target.matrixWorld),M.lookAt(y);M.updateMatrixWorld(),M.matrixWorldInverse.getInverse(M.matrixWorld),C.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),C.multiply(M.projectionMatrix),C.multiply(M.matrixWorldInverse),f.multiplyMatrices(M.projectionMatrix,M.matrixWorldInverse),d.setFromMatrix(f),_.length=0,c(e,i,M);for(var N=0,D=_.length;N<D;N++){var O=_[N],F=n.update(O),z=O.material;if(z&&z.isMultiMaterial)for(var G=F.groups,H=z.materials,V=0,k=G.length;V<k;V++){var j=G[V],W=H[j.materialIndex];if(W.visible===!0){var X=s(O,W,a,x);t.renderBufferDirect(M,null,F,X,O,j)}}else{var X=s(O,z,a,x);t.renderBufferDirect(M,null,F,X,O,null)}}}}else console.warn("THREE.WebGLShadowMap:",b,"has no shadow.")}var Y=t.getClearColor(),q=t.getClearAlpha();t.setClearColor(Y,q),B.needsUpdate=!1}}}function ot(t,e){this.origin=void 0!==t?t:new h,this.direction=void 0!==e?e:new h}function st(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._order=n||st.DefaultOrder}function ct(){this.mask=1}function ht(){function t(){r.setFromEuler(n,!1)}function e(){n.setFromQuaternion(r,void 0,!1)}Object.defineProperty(this,"id",{value:lt()}),this.uuid=Fo.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ht.DefaultUp.clone();var i=new h,n=new st,r=new c,a=new h(1,1,1);n.onChange(t),r.onChange(e),Object.defineProperties(this,{position:{enumerable:!0,value:i},rotation:{enumerable:!0,value:n},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:a},modelViewMatrix:{value:new l},normalMatrix:{value:new it}}),this.matrix=new l,this.matrixWorld=new l,this.matrixAutoUpdate=ht.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ct,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function lt(){return Yc++}function ut(t,e){this.start=void 0!==t?t:new h,this.end=void 0!==e?e:new h}function pt(t,e,i){this.a=void 0!==t?t:new h,this.b=void 0!==e?e:new h,this.c=void 0!==i?i:new h}function dt(t,e,i,n,r,a){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new h,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new X,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}function ft(t){J.call(this),this.type="MeshBasicMaterial",this.color=new X(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ua,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function mt(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=Fo.generateUUID(),this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i===!0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function vt(t,e){return new mt(new Int8Array(t),e)}function gt(t,e){return new mt(new Uint8Array(t),e)}function yt(t,e){return new mt(new Uint8ClampedArray(t),e)}function xt(t,e){return new mt(new Int16Array(t),e)}function _t(t,e){return new mt(new Uint16Array(t),e)}function bt(t,e){return new mt(new Int32Array(t),e)}function wt(t,e){return new mt(new Uint32Array(t),e)}function Mt(t,e){return new mt(new Float32Array(t),e)}function Et(t,e){return new mt(new Float64Array(t),e)}function Tt(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new mt(t,e).setDynamic(!0)}function St(){Object.defineProperty(this,"id",{value:At()}),this.uuid=Fo.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function At(){return qc++}function Lt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=Fo.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Rt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=Fo.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Pt(t,e){ht.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Rt,this.material=void 0!==e?e:new ft({color:16777215*Math.random()}),this.drawMode=Eo,this.updateMorphTargets()}function Ct(t,e,i,n,r,a){function o(t,e,i){var n=0;return n+=(t+1)*(e+1)*2,n+=(t+1)*(i+1)*2,n+=(i+1)*(e+1)*2}function s(t,e,i){var n=0;return n+=t*e*2,n+=t*i*2,n+=i*e*2,6*n}function c(t,e,i,n,r,a,o,s,c,u,p){for(var w=a/c,M=o/u,E=a/2,T=o/2,S=s/2,A=c+1,L=u+1,R=0,P=0,C=new h,I=0;I<L;I++)for(var U=I*M-T,N=0;N<A;N++){var D=N*w-E;C[t]=D*n,C[e]=U*r,C[i]=S,f[g]=C.x,f[g+1]=C.y,f[g+2]=C.z,C[t]=0,C[e]=0,C[i]=s>0?1:-1,m[g]=C.x,m[g+1]=C.y,m[g+2]=C.z,v[y]=N/c,v[y+1]=1-I/u,g+=3,y+=2,R+=1}for(I=0;I<u;I++)for(N=0;N<c;N++){var O=_+N+A*I,F=_+N+A*(I+1),B=_+(N+1)+A*(I+1),z=_+(N+1)+A*I;d[x]=O,d[x+1]=F,d[x+2]=z,d[x+3]=F,d[x+4]=B,d[x+5]=z,x+=6,P+=6}l.addGroup(b,P,p),b+=P,_+=R}Rt.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};var l=this;n=Math.floor(n)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var u=o(n,r,a),p=s(n,r,a),d=new(p>65535?Uint32Array:Uint16Array)(p),f=new Float32Array(3*u),m=new Float32Array(3*u),v=new Float32Array(2*u),g=0,y=0,x=0,_=0,b=0;c("z","y","x",-1,-1,i,e,t,a,r,0),c("z","y","x",1,-1,i,e,-t,a,r,1),c("x","z","y",1,1,t,i,e,n,a,2),c("x","z","y",1,-1,t,i,-e,n,a,3),c("x","y","z",1,-1,t,e,i,n,r,4),c("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(new mt(d,1)),this.addAttribute("position",new mt(f,3)),this.addAttribute("normal",new mt(m,3)),this.addAttribute("uv",new mt(v,2))}function It(t,e,i,n){Rt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};for(var r=t/2,a=e/2,o=Math.floor(i)||1,s=Math.floor(n)||1,c=o+1,h=s+1,l=t/o,u=e/s,p=new Float32Array(c*h*3),d=new Float32Array(c*h*3),f=new Float32Array(c*h*2),m=0,v=0,g=0;g<h;g++)for(var y=g*u-a,x=0;x<c;x++){var _=x*l-r;p[m]=_,p[m+1]=-y,d[m+2]=1,f[v]=x/o,f[v+1]=1-g/s,m+=3,v+=2}m=0;for(var b=new(p.length/3>65535?Uint32Array:Uint16Array)(o*s*6),g=0;g<s;g++)for(var x=0;x<o;x++){var w=x+c*g,M=x+c*(g+1),E=x+1+c*(g+1),T=x+1+c*g;b[m]=w,b[m+1]=M,b[m+2]=T,b[m+3]=M,b[m+4]=E,b[m+5]=T,m+=6}this.setIndex(new mt(b,1)),this.addAttribute("position",new mt(p,3)),this.addAttribute("normal",new mt(d,3)),this.addAttribute("uv",new mt(f,2))}function Ut(){ht.call(this),this.type="Camera",this.matrixWorldInverse=new l,this.projectionMatrix=new l}function Nt(t,e,i,n){Ut.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Dt(t,e,i,n,r,a){Ut.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function Ot(t,e,i){function n(t){s=t}function r(i){i.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(c=t.UNSIGNED_INT,h=4):(c=t.UNSIGNED_SHORT,h=2)}function a(e,n){t.drawElements(s,n,c,e*h),i.calls++,i.vertices+=n,s===t.TRIANGLES&&(i.faces+=n/3)}function o(n,r,a){var o=e.get("ANGLE_instanced_arrays");return null===o?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(o.drawElementsInstancedANGLE(s,a,c,r*h,n.maxInstancedCount),i.calls++,i.vertices+=a*n.maxInstancedCount,void(s===t.TRIANGLES&&(i.faces+=n.maxInstancedCount*a/3)))}var s,c,h;return{setMode:n,setIndex:r,render:a,renderInstances:o}}function Ft(t,e,i){function n(t){o=t}function r(e,n){t.drawArrays(o,e,n),i.calls++,i.vertices+=n,o===t.TRIANGLES&&(i.faces+=n/3)}function a(n){var r=e.get("ANGLE_instanced_arrays");if(null===r)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var a=n.attributes.position,s=0;a&&a.isInterleavedBufferAttribute?(s=a.data.count,r.drawArraysInstancedANGLE(o,0,s,n.maxInstancedCount)):(s=a.count,r.drawArraysInstancedANGLE(o,0,s,n.maxInstancedCount)),i.calls++,i.vertices+=s*n.maxInstancedCount,o===t.TRIANGLES&&(i.faces+=n.maxInstancedCount*s/3)}var o;return{setMode:n,render:r,renderInstances:a}}function Bt(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new h,color:new X,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"SpotLight":n={position:new h,direction:new h,color:new X,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"PointLight":n={position:new h,color:new X,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"HemisphereLight":
3
+ n={direction:new h,skyColor:new X,groundColor:new X}}return t[e.id]=n,n}}}function zt(t){for(var e=t.split("\n"),i=0;i<e.length;i++)e[i]=i+1+": "+e[i];return e.join("\n")}function Gt(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(n),zt(i)),n}function Ht(t){switch(t){case Ao:return["Linear","( value )"];case Lo:return["sRGB","( value )"];case Po:return["RGBE","( value )"];case Io:return["RGBM","( value, 7.0 )"];case Uo:return["RGBM","( value, 16.0 )"];case No:return["RGBD","( value, 256.0 )"];case Ro:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function Vt(t,e){var i=Ht(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function kt(t,e){var i=Ht(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function jt(t,e){var i;switch(e){case ma:i="Linear";break;case va:i="Reinhard";break;case ga:i="Uncharted2";break;case ya:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Wt(t,e,i){t=t||{};var n=[t.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return n.filter(qt).join("\n")}function Xt(t){var e=[];for(var i in t){var n=t[i];n!==!1&&e.push("#define "+i+" "+n)}return e.join("\n")}function Yt(t,e,i){for(var n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),a=0;a<r;a++){var o=t.getActiveAttrib(e,a),s=o.name;n[s]=t.getAttribLocation(e,s)}return n}function qt(t){return""!==t}function Zt(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function Jt(t){function e(t,e){var i=Vc[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Jt(i)}var i=/#include +<([\w\d.]+)>/g;return t.replace(i,e)}function Qt(t){function e(t,e,i,n){for(var r="",a=parseInt(e);a<parseInt(i);a++)r+=n.replace(/\[ i \]/g,"[ "+a+" ]");return r}var i=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return t.replace(i,e)}function Kt(t,e,i,n){var r=t.context,a=i.extensions,o=i.defines,s=i.__webglShader.vertexShader,c=i.__webglShader.fragmentShader,h="SHADOWMAP_TYPE_BASIC";n.shadowMapType===Er?h="SHADOWMAP_TYPE_PCF":n.shadowMapType===Tr&&(h="SHADOWMAP_TYPE_PCF_SOFT");var l="ENVMAP_TYPE_CUBE",u="ENVMAP_MODE_REFLECTION",p="ENVMAP_BLENDING_MULTIPLY";if(n.envMap){switch(i.envMap.mapping){case _a:case ba:l="ENVMAP_TYPE_CUBE";break;case Ta:case Sa:l="ENVMAP_TYPE_CUBE_UV";break;case wa:case Ma:l="ENVMAP_TYPE_EQUIREC";break;case Ea:l="ENVMAP_TYPE_SPHERE"}switch(i.envMap.mapping){case ba:case Ma:u="ENVMAP_MODE_REFRACTION"}switch(i.combine){case ua:p="ENVMAP_BLENDING_MULTIPLY";break;case pa:p="ENVMAP_BLENDING_MIX";break;case da:p="ENVMAP_BLENDING_ADD"}}var d,f,m=t.gammaFactor>0?t.gammaFactor:1,v=Wt(a,n,t.extensions),g=Xt(o),y=r.createProgram();i.isRawShaderMaterial?(d=[g,"\n"].filter(qt).join("\n"),f=[v,g,"\n"].filter(qt).join("\n")):(d=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,g,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(qt).join("\n"),f=[v,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,g,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"","#define GAMMA_FACTOR "+m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+u:"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(n.numClippingPlanes-n.numClipIntersection),n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",n.toneMapping!==fa?"#define TONE_MAPPING":"",n.toneMapping!==fa?Vc.tonemapping_pars_fragment:"",n.toneMapping!==fa?jt("toneMapping",n.toneMapping):"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?Vc.encodings_pars_fragment:"",n.mapEncoding?Vt("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?Vt("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Vt("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?kt("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(qt).join("\n")),s=Jt(s,n),s=Zt(s,n),c=Jt(c,n),c=Zt(c,n),i.isShaderMaterial||(s=Qt(s),c=Qt(c));var x=d+s,_=f+c,b=Gt(r,r.VERTEX_SHADER,x),w=Gt(r,r.FRAGMENT_SHADER,_);r.attachShader(y,b),r.attachShader(y,w),void 0!==i.index0AttributeName?r.bindAttribLocation(y,0,i.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);var M=r.getProgramInfoLog(y),E=r.getShaderInfoLog(b),T=r.getShaderInfoLog(w),S=!0,A=!0;r.getProgramParameter(y,r.LINK_STATUS)===!1?(S=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(y,r.VALIDATE_STATUS),"gl.getProgramInfoLog",M,E,T)):""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):""!==E&&""!==T||(A=!1),A&&(this.diagnostics={runnable:S,material:i,programLog:M,vertexShader:{log:E,prefix:d},fragmentShader:{log:T,prefix:f}}),r.deleteShader(b),r.deleteShader(w);var L;this.getUniforms=function(){return void 0===L&&(L=new W(r,y,t)),L};var R;return this.getAttributes=function(){return void 0===R&&(R=Yt(r,y)),R},this.destroy=function(){r.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Zc++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=b,this.fragmentShader=w,this}function $t(t,e){function i(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var i=e.maxVertexUniforms,n=Math.floor((i-20)/4),r=n;return void 0!==t&&t&&t.isSkinnedMesh&&(r=Math.min(t.skeleton.bones.length,r),r<t.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+t.skeleton.bones.length+", this GPU supports just "+r+" (try OpenGL instead of ANGLE)")),r}function n(t,e){var i;return t?t&&t.isTexture?i=t.encoding:t&&t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),i=t.texture.encoding):i=Ao,i===Ao&&e&&(i=Ro),i}var r=[],a={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},o=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking"];this.getParameters=function(r,o,s,c,h,l){var u=a[r.type],p=i(l),d=t.getPrecision();null!==r.precision&&(d=e.getMaxPrecision(r.precision),d!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead."));var f=t.getCurrentRenderTarget(),m={shaderID:u,precision:d,supportsVertexTextures:e.vertexTextures,outputEncoding:n(f?f.texture:null,t.gammaOutput),map:!!r.map,mapEncoding:n(r.map,t.gammaInput),envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,envMapEncoding:n(r.envMap,t.gammaInput),envMapCubeUV:!!r.envMap&&(r.envMap.mapping===Ta||r.envMap.mapping===Sa),lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:n(r.emissiveMap,t.gammaInput),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,combine:r.combine,vertexColors:r.vertexColors,fog:!!s,useFog:r.fog,fogExp:s&&s.isFogExp2,flatShading:r.shading===Rr,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:r.skinning,maxBones:p,useVertexTexture:e.floatVertexTextures&&l&&l.skeleton&&l.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numHemiLights:o.hemi.length,numClippingPlanes:c,numClipIntersection:h,shadowMapEnabled:t.shadowMap.enabled&&l.receiveShadow&&o.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===Lr,flipSided:r.side===Ar,depthPacking:void 0!==r.depthPacking&&r.depthPacking};return m},this.getProgramCode=function(t,e){var i=[];if(e.shaderID?i.push(e.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)i.push(n),i.push(t.defines[n]);for(var r=0;r<o.length;r++)i.push(e[o[r]]);return i.join()},this.acquireProgram=function(e,i,n){for(var a,o=0,s=r.length;o<s;o++){var c=r[o];if(c.code===n){a=c,++a.usedTimes;break}}return void 0===a&&(a=new Kt(t,n,e,i),r.push(a)),a},this.releaseProgram=function(t){if(0===--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r}function te(t,e,i){function n(t){var r=t.target,s=c[r.id];null!==s.index&&a(s.index),o(s.attributes),r.removeEventListener("dispose",n),delete c[r.id];var h=e.get(r);h.wireframe&&a(h.wireframe),e.delete(r);var l=e.get(s);l.wireframe&&a(l.wireframe),e.delete(s),i.memory.geometries--}function r(t){return t.isInterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function a(e){var i=r(e);void 0!==i&&(t.deleteBuffer(i),s(e))}function o(t){for(var e in t)a(t[e])}function s(t){t.isInterleavedBufferAttribute?e.delete(t.data):e.delete(t)}var c={};return{get:function(t){var e=t.geometry;if(void 0!==c[e.id])return c[e.id];e.addEventListener("dispose",n);var r;return e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Rt).setFromObject(t)),r=e._bufferGeometry),c[e.id]=r,i.memory.geometries++,r}}}function ee(t,e,i){function n(e){var i=h.get(e);e.geometry.isGeometry&&i.updateFromObject(e);var n=i.index,a=i.attributes;null!==n&&r(n,t.ELEMENT_ARRAY_BUFFER);for(var o in a)r(a[o],t.ARRAY_BUFFER);var s=i.morphAttributes;for(var o in s)for(var c=s[o],l=0,u=c.length;l<u;l++)r(c[l],t.ARRAY_BUFFER);return i}function r(t,i){var n=t.isInterleavedBufferAttribute?t.data:t,r=e.get(n);void 0===r.__webglBuffer?a(r,n,i):r.version!==n.version&&o(r,n,i)}function a(e,i,n){e.__webglBuffer=t.createBuffer(),t.bindBuffer(n,e.__webglBuffer);var r=i.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW;t.bufferData(n,i.array,r),e.version=i.version}function o(e,i,n){t.bindBuffer(n,e.__webglBuffer),i.dynamic===!1?t.bufferData(n,i.array,t.STATIC_DRAW):i.updateRange.count===-1?t.bufferSubData(n,0,i.array):0===i.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(n,i.updateRange.offset*i.array.BYTES_PER_ELEMENT,i.array.subarray(i.updateRange.offset,i.updateRange.offset+i.updateRange.count)),i.updateRange.count=0),e.version=i.version}function s(t){return t.isInterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function c(i){var n=e.get(i);if(void 0!==n.wireframe)return n.wireframe;var a=[],o=i.index,s=i.attributes,c=s.position;if(null!==o)for(var h=o.array,l=0,u=h.length;l<u;l+=3){var p=h[l+0],d=h[l+1],f=h[l+2];a.push(p,d,d,f,f,p)}else for(var h=s.position.array,l=0,u=h.length/3-1;l<u;l+=3){var p=l+0,d=l+1,f=l+2;a.push(p,d,d,f,f,p)}var m=c.count>65535?Uint32Array:Uint16Array,v=new mt(new m(a),1);return r(v,t.ELEMENT_ARRAY_BUFFER),n.wireframe=v,v}var h=new te(t,e,i);return{getAttributeBuffer:s,getWireframeAttribute:c,update:n}}function ie(t,e,i,n,r,a,o){function s(t,e){if(t.width>e||t.height>e){var i=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=Math.floor(t.width*i),n.height=Math.floor(t.height*i);var r=n.getContext("2d");return r.drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function c(t){return Fo.isPowerOfTwo(t.width)&&Fo.isPowerOfTwo(t.height)}function h(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=Fo.nearestPowerOfTwo(t.width),e.height=Fo.nearestPowerOfTwo(t.height);var i=e.getContext("2d");return i.drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function l(t){return t.wrapS!==Ra||t.wrapT!==Ra||t.minFilter!==Ia&&t.minFilter!==Da}function u(e){return e===Ia||e===Ua||e===Na?t.NEAREST:t.LINEAR}function p(t){var e=t.target;e.removeEventListener("dispose",p),f(e),A.textures--}function d(t){var e=t.target;e.removeEventListener("dispose",d),m(e),A.textures--}function f(e){var i=n.get(e);if(e.image&&i.__image__webglTextureCube)t.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture)}n.delete(e)}function m(e){var i=n.get(e),r=n.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e&&e.isWebGLRenderTargetCube)for(var a=0;a<6;a++)t.deleteFramebuffer(i.__webglFramebuffer[a]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[a]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n.delete(e.texture),n.delete(e)}}function v(e,r){var a=n.get(e);if(e.version>0&&a.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(o.complete!==!1)return void _(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_2D,a.__webglTexture)}function g(e,o){var h=n.get(e);if(6===e.image.length)if(e.version>0&&h.__version!==e.version){h.__image__webglTextureCube||(e.addEventListener("dispose",p),h.__image__webglTextureCube=t.createTexture(),A.textures++),i.activeTexture(t.TEXTURE0+o),i.bindTexture(t.TEXTURE_CUBE_MAP,h.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var l=e&&e.isCompressedTexture,u=e.image[0]&&e.image[0].isDataTexture,d=[],f=0;f<6;f++)l||u?d[f]=u?e.image[f].image:e.image[f]:d[f]=s(e.image[f],r.maxCubemapSize);var m=d[0],v=c(m),g=a(e.format),y=a(e.type);x(t.TEXTURE_CUBE_MAP,e,v);for(var f=0;f<6;f++)if(l)for(var _,b=d[f].mipmaps,w=0,M=b.length;w<M;w++)_=b[w],e.format!==$a&&e.format!==Ka?i.getCompressedTextureFormats().indexOf(g)>-1?i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,w,g,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,w,g,_.width,_.height,0,g,y,_.data);else u?i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,g,d[f].width,d[f].height,0,g,y,d[f].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,g,g,y,d[f]);e.generateMipmaps&&v&&t.generateMipmap(t.TEXTURE_CUBE_MAP),h.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(t.TEXTURE0+o),i.bindTexture(t.TEXTURE_CUBE_MAP,h.__image__webglTextureCube)}function y(e,r){i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_CUBE_MAP,n.get(e).__webglTexture)}function x(i,o,s){var c;if(s?(t.texParameteri(i,t.TEXTURE_WRAP_S,a(o.wrapS)),t.texParameteri(i,t.TEXTURE_WRAP_T,a(o.wrapT)),t.texParameteri(i,t.TEXTURE_MAG_FILTER,a(o.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,a(o.minFilter))):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),o.wrapS===Ra&&o.wrapT===Ra||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",o),t.texParameteri(i,t.TEXTURE_MAG_FILTER,u(o.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,u(o.minFilter)),o.minFilter!==Ia&&o.minFilter!==Da&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",o)),c=e.get("EXT_texture_filter_anisotropic")){if(o.type===Wa&&null===e.get("OES_texture_float_linear"))return;if(o.type===Xa&&null===e.get("OES_texture_half_float_linear"))return;(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(t.texParameterf(i,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function _(e,n,o){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",p),e.__webglTexture=t.createTexture(),A.textures++),i.activeTexture(t.TEXTURE0+o),i.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment);var u=s(n.image,r.maxTextureSize);l(n)&&c(u)===!1&&(u=h(u));var d=c(u),f=a(n.format),m=a(n.type);x(t.TEXTURE_2D,n,d);var v,g=n.mipmaps;if(n&&n.isDepthTexture){var y=t.DEPTH_COMPONENT;if(n.type===Wa){if(!L)throw new Error("Float Depth Texture only supported in WebGL2.0");y=t.DEPTH_COMPONENT32F}else L&&(y=t.DEPTH_COMPONENT16);n.format===ro&&(y=t.DEPTH_STENCIL),i.texImage2D(t.TEXTURE_2D,0,y,u.width,u.height,0,f,m,null)}else if(n&&n.isDataTexture)if(g.length>0&&d){for(var _=0,b=g.length;_<b;_++)v=g[_],i.texImage2D(t.TEXTURE_2D,_,f,v.width,v.height,0,f,m,v.data);n.generateMipmaps=!1}else i.texImage2D(t.TEXTURE_2D,0,f,u.width,u.height,0,f,m,u.data);else if(n&&n.isCompressedTexture)for(var _=0,b=g.length;_<b;_++)v=g[_],n.format!==$a&&n.format!==Ka?i.getCompressedTextureFormats().indexOf(f)>-1?i.compressedTexImage2D(t.TEXTURE_2D,_,f,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(t.TEXTURE_2D,_,f,v.width,v.height,0,f,m,v.data);else if(g.length>0&&d){for(var _=0,b=g.length;_<b;_++)v=g[_],i.texImage2D(t.TEXTURE_2D,_,f,f,m,v);n.generateMipmaps=!1}else i.texImage2D(t.TEXTURE_2D,0,f,f,m,u);n.generateMipmaps&&d&&t.generateMipmap(t.TEXTURE_2D),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function b(e,r,o,s){var c=a(r.texture.format),h=a(r.texture.type);i.texImage2D(s,0,c,r.width,r.height,0,c,h,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,o,s,n.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,i){t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer&&!i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):i.depthBuffer&&i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,i.width,i.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function M(e,i){var r=i&&i.isWebGLRenderTargetCube;if(r)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),v(i.depthTexture,0);var a=n.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===no)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0);else{if(i.depthTexture.format!==ro)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0)}}function E(e){var i=n.get(e),r=e&&e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");M(i.__webglFramebuffer,e)}else if(r){i.__webglDepthbuffer=[];for(var a=0;a<6;a++)t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer[a]),i.__webglDepthbuffer[a]=t.createRenderbuffer(),w(i.__webglDepthbuffer[a],e)}else t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),w(i.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function T(e){var r=n.get(e),a=n.get(e.texture);e.addEventListener("dispose",d),a.__webglTexture=t.createTexture(),A.textures++;var o=e&&e.isWebGLRenderTargetCube,s=c(e);if(o){r.__webglFramebuffer=[];for(var h=0;h<6;h++)r.__webglFramebuffer[h]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(o){i.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture),x(t.TEXTURE_CUBE_MAP,e.texture,s);for(var h=0;h<6;h++)b(r.__webglFramebuffer[h],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+h);e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_CUBE_MAP),i.bindTexture(t.TEXTURE_CUBE_MAP,null)}else i.bindTexture(t.TEXTURE_2D,a.__webglTexture),x(t.TEXTURE_2D,e.texture,s),b(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_2D),i.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&E(e)}function S(e){var r=e.texture;if(r.generateMipmaps&&c(e)&&r.minFilter!==Ia&&r.minFilter!==Da){var a=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,o=n.get(r).__webglTexture;i.bindTexture(a,o),t.generateMipmap(a),i.bindTexture(a,null)}}var A=o.memory,L="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=v,this.setTextureCube=g,this.setTextureCubeDynamic=y,this.setupRenderTarget=T,this.updateRenderTargetMipmap=S}function ne(){var t={};return{get:function(e){var i=e.uuid,n=t[i];return void 0===n&&(n={},t[i]=n),n},delete:function(e){delete t[e.uuid]},clear:function(){t={}}}}function re(t,e,i){function n(){var e=!1,i=new a,n=null,r=new a;return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,a,o){i.set(e,n,a,o),r.equals(i)===!1&&(t.clearColor(e,n,a,o),r.copy(i))},reset:function(){e=!1,n=null,r.set(0,0,0,1)}}}function r(){var e=!1,i=null,n=null,r=null;return{setTest:function(e){e?d(t.DEPTH_TEST):f(t.DEPTH_TEST)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case na:t.depthFunc(t.NEVER);break;case ra:t.depthFunc(t.ALWAYS);break;case aa:t.depthFunc(t.LESS);break;case oa:t.depthFunc(t.LEQUAL);break;case sa:t.depthFunc(t.EQUAL);break;case ca:t.depthFunc(t.GEQUAL);break;case ha:t.depthFunc(t.GREATER);break;case la:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}}function o(){var e=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,h=null;return{setTest:function(e){e?d(t.STENCIL_TEST):f(t.STENCIL_TEST)},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,o){n===e&&r===i&&a===o||(t.stencilFunc(e,i,o),n=e,r=i,a=o)},setOp:function(e,i,n){o===e&&s===i&&c===n||(t.stencilOp(e,i,n),o=e,s=i,c=n)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,h=null}}}function s(e,i,n){var r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var o=0;o<n;o++)t.texImage2D(i+o,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return a}function c(){D(0,0,0,1),O(1),F(0),d(t.DEPTH_TEST),_(oa),T(!1),S(yr),d(t.CULL_FACE),d(t.BLEND),v(Dr)}function h(){for(var t=0,e=W.length;t<e;t++)W[t]=0}function l(i){if(W[i]=1,0===X[i]&&(t.enableVertexAttribArray(i),X[i]=1),0!==Y[i]){var n=e.get("ANGLE_instanced_arrays");n.vertexAttribDivisorANGLE(i,0),Y[i]=0}}function u(e,i,n){W[e]=1,0===X[e]&&(t.enableVertexAttribArray(e),X[e]=1),Y[e]!==i&&(n.vertexAttribDivisorANGLE(e,i),Y[e]=i)}function p(){for(var e=0,i=X.length;e!==i;++e)X[e]!==W[e]&&(t.disableVertexAttribArray(e),X[e]=0)}function d(e){q[e]!==!0&&(t.enable(e),q[e]=!0)}function f(e){q[e]!==!1&&(t.disable(e),q[e]=!1)}function m(){if(null===Z&&(Z=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var i=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),n=0;n<i.length;n++)Z.push(i[n]);return Z}function v(e,n,r,a,o,s,c,h){e!==Nr?d(t.BLEND):f(t.BLEND),e===J&&h===nt||(e===Or?h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===Fr?h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===Br?h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):h?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),J=e,nt=h),e===zr?(o=o||n,s=s||r,c=c||a,n===Q&&o===tt||(t.blendEquationSeparate(i(n),i(o)),Q=n,tt=o),r===K&&a===$&&s===et&&c===it||(t.blendFuncSeparate(i(r),i(a),i(s),i(c)),K=r,$=a,et=s,it=c)):(Q=null,K=null,$=null,tt=null,et=null,it=null)}function g(t){H.setMask(t)}function y(t){V.setTest(t)}function x(t){V.setMask(t)}function _(t){V.setFunc(t)}function b(t){k.setTest(t)}function w(t){k.setMask(t)}function M(t,e,i){k.setFunc(t,e,i)}function E(t,e,i){k.setOp(t,e,i)}function T(e){rt!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),rt=e)}function S(e){e!==gr?(d(t.CULL_FACE),e!==at&&(e===yr?t.cullFace(t.BACK):e===xr?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):f(t.CULL_FACE),at=e}function A(e){e!==ot&&(t.lineWidth(e),ot=e)}function L(e,i,n){e?(d(t.POLYGON_OFFSET_FILL),st===i&&ct===n||(t.polygonOffset(i,n),st=i,ct=n)):f(t.POLYGON_OFFSET_FILL)}function R(){return ht}function P(e){ht=e,e?d(t.SCISSOR_TEST):f(t.SCISSOR_TEST)}function C(e){void 0===e&&(e=t.TEXTURE0+lt-1),ut!==e&&(t.activeTexture(e),ut=e)}function I(e,i){null===ut&&C();var n=pt[ut];void 0===n&&(n={type:void 0,texture:void 0},pt[ut]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||mt[e]),n.type=e,n.texture=i)}function U(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}}function N(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}}function D(t,e,i,n){H.setClear(t,e,i,n)}function O(t){V.setClear(t)}function F(t){k.setClear(t)}function B(e){dt.equals(e)===!1&&(t.scissor(e.x,e.y,e.z,e.w),dt.copy(e))}function z(e){ft.equals(e)===!1&&(t.viewport(e.x,e.y,e.z,e.w),ft.copy(e))}function G(){for(var e=0;e<X.length;e++)1===X[e]&&(t.disableVertexAttribArray(e),X[e]=0);q={},Z=null,ut=null,
4
+ pt={},J=null,rt=null,at=null,H.reset(),V.reset(),k.reset()}var H=new n,V=new r,k=new o,j=t.getParameter(t.MAX_VERTEX_ATTRIBS),W=new Uint8Array(j),X=new Uint8Array(j),Y=new Uint8Array(j),q={},Z=null,J=null,Q=null,K=null,$=null,tt=null,et=null,it=null,nt=!1,rt=null,at=null,ot=null,st=null,ct=null,ht=null,lt=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ut=null,pt={},dt=new a,ft=new a,mt={};return mt[t.TEXTURE_2D]=s(t.TEXTURE_2D,t.TEXTURE_2D,1),mt[t.TEXTURE_CUBE_MAP]=s(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:H,depth:V,stencil:k},init:c,initAttributes:h,enableAttribute:l,enableAttributeAndDivisor:u,disableUnusedAttributes:p,enable:d,disable:f,getCompressedTextureFormats:m,setBlending:v,setColorWrite:g,setDepthTest:y,setDepthWrite:x,setDepthFunc:_,setStencilTest:b,setStencilWrite:w,setStencilFunc:M,setStencilOp:E,setFlipSided:T,setCullFace:S,setLineWidth:A,setPolygonOffset:L,getScissorTest:R,setScissorTest:P,activeTexture:C,bindTexture:I,compressedTexImage2D:U,texImage2D:N,clearColor:D,clearDepth:O,clearStencil:F,scissor:B,viewport:z,reset:G}}function ae(t,e,i){function n(){if(void 0!==a)return a;var i=e.get("EXT_texture_filter_anisotropic");return a=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a,o=void 0!==i.precision?i.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=i.logarithmicDepthBuffer===!0&&!!e.get("EXT_frag_depth"),h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=l>0,y=!!e.get("OES_texture_float"),x=g&&y;return{getMaxAnisotropy:n,getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:l,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:x}}function oe(t){var e={};return{get:function(i){if(void 0!==e[i])return e[i];var n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":n=t.getExtension("WEBGL_compressed_texture_etc1");break;default:n=t.getExtension(i)}return null===n&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),e[i]=n,n}}}function se(){function t(){h.value!==n&&(h.value=n,h.needsUpdate=r>0),i.numPlanes=r,i.numIntersection=0}function e(t,e,n,r){var a=null!==t?t.length:0,o=null;if(0!==a){if(o=h.value,r!==!0||null===o){var l=n+4*a,u=e.matrixWorldInverse;c.getNormalMatrix(u),(null===o||o.length<l)&&(o=new Float32Array(l));for(var p=0,d=n;p!==a;++p,d+=4)s.copy(t[p]).applyMatrix4(u,c),s.normal.toArray(o,d),o[d+3]=s.constant}h.value=o,h.needsUpdate=!0}return i.numPlanes=a,o}var i=this,n=null,r=0,a=!1,o=!1,s=new nt,c=new it,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(t,i,o){var s=0!==t.length||i||0!==r||a;return a=i,n=e(t,o,0),r=t.length,s},this.beginShadows=function(){o=!0,e(null)},this.endShadows=function(){o=!1,t()},this.setState=function(i,s,c,l,u,p){if(!a||null===i||0===i.length||o&&!c)o?e(null):t();else{var d=o?0:r,f=4*d,m=u.clippingState||null;h.value=m,m=e(i,l,f,p);for(var v=0;v!==f;++v)m[v]=n[v];u.clippingState=m,this.numIntersection=s?this.numPlanes:0,this.numPlanes+=d}}}function ce(t){function e(){return null===ut?Tt:1}function i(t,e,i,n){Y===!0&&(t*=n,e*=n,i*=n),Qt.clearColor(t,e,i,n)}function n(){Qt.init(),Qt.scissor(gt.copy(St).multiplyScalar(Tt)),Qt.viewport(xt.copy(Lt).multiplyScalar(Tt)),i(bt.r,bt.g,bt.b,wt)}function r(){lt=null,vt=null,mt="",dt=-1,Qt.reset()}function o(t){t.preventDefault(),r(),n(),Kt.clear()}function s(t){var e=t.target;e.removeEventListener("dispose",s),c(e)}function c(t){u(t),Kt.delete(t)}function u(t){var e=Kt.get(t).program;t.program=void 0,void 0!==e&&he.releaseProgram(e)}function p(t,e,i,n){var r;if(i&&i.isInstancedBufferGeometry&&(r=Zt.get("ANGLE_instanced_arrays"),null===r))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===n&&(n=0),Qt.initAttributes();var a=i.attributes,o=e.getAttributes(),s=t.defaultAttributeValues;for(var c in o){var h=o[c];if(h>=0){var l=a[c];if(void 0!==l){var u=Yt.FLOAT,p=l.array,d=l.normalized;p instanceof Float32Array?u=Yt.FLOAT:p instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):p instanceof Uint16Array?u=Yt.UNSIGNED_SHORT:p instanceof Int16Array?u=Yt.SHORT:p instanceof Uint32Array?u=Yt.UNSIGNED_INT:p instanceof Int32Array?u=Yt.INT:p instanceof Int8Array?u=Yt.BYTE:p instanceof Uint8Array&&(u=Yt.UNSIGNED_BYTE);var f=l.itemSize,m=ce.getAttributeBuffer(l);if(l.isInterleavedBufferAttribute){var v=l.data,g=v.stride,y=l.offset;v&&v.isInstancedInterleavedBuffer?(Qt.enableAttributeAndDivisor(h,v.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=v.meshPerAttribute*v.count)):Qt.enableAttribute(h),Yt.bindBuffer(Yt.ARRAY_BUFFER,m),Yt.vertexAttribPointer(h,f,u,d,g*v.array.BYTES_PER_ELEMENT,(n*g+y)*v.array.BYTES_PER_ELEMENT)}else l.isInstancedBufferAttribute?(Qt.enableAttributeAndDivisor(h,l.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=l.meshPerAttribute*l.count)):Qt.enableAttribute(h),Yt.bindBuffer(Yt.ARRAY_BUFFER,m),Yt.vertexAttribPointer(h,f,u,d,0,n*f*l.array.BYTES_PER_ELEMENT)}else if(void 0!==s){var x=s[c];if(void 0!==x)switch(x.length){case 2:Yt.vertexAttrib2fv(h,x);break;case 3:Yt.vertexAttrib3fv(h,x);break;case 4:Yt.vertexAttrib4fv(h,x);break;default:Yt.vertexAttrib1fv(h,x)}}}}Qt.disableUnusedAttributes()}function d(t,e){return Math.abs(e[0])-Math.abs(t[0])}function f(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function m(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function v(t,e,i,n,r){var a,o;i.transparent?(a=it,o=++nt):(a=$,o=++tt);var s=a[o];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=i,s.z=jt.z,s.group=r):(s={id:t.id,object:t,geometry:e,material:i,z:jt.z,group:r},a.push(s))}function g(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Vt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),x(Vt)}function y(t){return Vt.center.set(0,0,0),Vt.radius=.7071067811865476,Vt.applyMatrix4(t.matrixWorld),x(Vt)}function x(t){if(!Ut.intersectsSphere(t))return!1;var e=zt.numPlanes;if(0===e)return!0;var i=ht.clippingPlanes,n=t.center,r=-t.radius,a=0;do if(i[a].distanceToPoint(n)<r)return!1;while(++a!==e);return!0}function _(t,e){if(t.visible!==!1){var i=0!==(t.layers.mask&e.layers.mask);if(i)if(t.isLight)Q.push(t);else if(t.isSprite)t.frustumCulled!==!1&&y(t)!==!0||st.push(t);else if(t.isLensFlare)ct.push(t);else if(t.isImmediateRenderObject)ht.sortObjects===!0&&(jt.setFromMatrixPosition(t.matrixWorld),jt.applyProjection(kt)),v(t,null,t.material,jt.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),t.frustumCulled===!1||g(t)===!0)){var n=t.material;if(n.visible===!0){ht.sortObjects===!0&&(jt.setFromMatrixPosition(t.matrixWorld),jt.applyProjection(kt));var r=ce.update(t);if(n.isMultiMaterial)for(var a=r.groups,o=n.materials,s=0,c=a.length;s<c;s++){var h=a[s],l=o[h.materialIndex];l.visible===!0&&v(t,r,l,jt.z,h)}else v(t,r,n,jt.z,null)}}for(var u=t.children,s=0,c=u.length;s<c;s++)_(u[s],e)}}function b(t,e,i,n){for(var r=0,a=t.length;r<a;r++){var o=t[r],s=o.object,c=o.geometry,h=void 0===n?o.material:n,l=o.group;if(s.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),s.onBeforeRender(ht,e,i,c,h,l),s.isImmediateRenderObject){M(h);var u=E(i,e.fog,h,s);mt="",s.render(function(t){ht.renderBufferImmediate(t,u,h)})}else ht.renderBufferDirect(i,e.fog,c,h,s,l);s.onAfterRender(ht,e,i,c,h,l)}}function w(t,e,i){var n=Kt.get(t),r=he.getParameters(t,Wt,e,zt.numPlanes,zt.numIntersection,i),a=he.getProgramCode(t,r),o=n.program,c=!0;if(void 0===o)t.addEventListener("dispose",s);else if(o.code!==a)u(t);else{if(void 0!==r.shaderID)return;c=!1}if(c){if(r.shaderID){var h=Wc[r.shaderID];n.__webglShader={name:t.type,uniforms:jo.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}else n.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=n.__webglShader,o=he.acquireProgram(t,r,a),n.program=o,t.program=o}var l=o.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var p=0;p<ht.maxMorphTargets;p++)l["morphTarget"+p]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var p=0;p<ht.maxMorphNormals;p++)l["morphNormal"+p]>=0&&t.numSupportedMorphNormals++}var d=n.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&t.clipping!==!0||(n.numClippingPlanes=zt.numPlanes,n.numIntersection=zt.numIntersection,d.clippingPlanes=zt.uniform),n.fog=e,n.lightsHash=Wt.hash,t.lights&&(d.ambientLightColor.value=Wt.ambient,d.directionalLights.value=Wt.directional,d.spotLights.value=Wt.spot,d.pointLights.value=Wt.point,d.hemisphereLights.value=Wt.hemi,d.directionalShadowMap.value=Wt.directionalShadowMap,d.directionalShadowMatrix.value=Wt.directionalShadowMatrix,d.spotShadowMap.value=Wt.spotShadowMap,d.spotShadowMatrix.value=Wt.spotShadowMatrix,d.pointShadowMap.value=Wt.pointShadowMap,d.pointShadowMatrix.value=Wt.pointShadowMatrix);var f=n.program.getUniforms(),m=W.seqWithValue(f.seq,d);n.uniformsList=m}function M(t){t.side===Lr?Qt.disable(Yt.CULL_FACE):Qt.enable(Yt.CULL_FACE),Qt.setFlipSided(t.side===Ar),t.transparent===!0?Qt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):Qt.setBlending(Nr),Qt.setDepthFunc(t.depthFunc),Qt.setDepthTest(t.depthTest),Qt.setDepthWrite(t.depthWrite),Qt.setColorWrite(t.colorWrite),Qt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function E(t,e,i,n){_t=0;var r=Kt.get(i);if(Gt&&(Ht||t!==vt)){var a=t===vt&&i.id===dt;zt.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,t,r,a)}i.needsUpdate===!1&&(void 0===r.program?i.needsUpdate=!0:i.fog&&r.fog!==e?i.needsUpdate=!0:i.lights&&r.lightsHash!==Wt.hash?i.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===zt.numPlanes&&r.numIntersection===zt.numIntersection||(i.needsUpdate=!0)),i.needsUpdate&&(w(i,e,n),i.needsUpdate=!1);var o=!1,s=!1,c=!1,h=r.program,l=h.getUniforms(),u=r.__webglShader.uniforms;if(h.id!==lt&&(Yt.useProgram(h.program),lt=h.id,o=!0,s=!0,c=!0),i.id!==dt&&(dt=i.id,s=!0),o||t!==vt){if(l.set(Yt,t,"projectionMatrix"),Jt.logarithmicDepthBuffer&&l.setValue(Yt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==vt&&(vt=t,s=!0,c=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var p=l.map.cameraPosition;void 0!==p&&p.setValue(Yt,jt.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&l.setValue(Yt,"viewMatrix",t.matrixWorldInverse),l.set(Yt,ht,"toneMappingExposure"),l.set(Yt,ht,"toneMappingWhitePoint")}if(i.skinning){l.setOptional(Yt,n,"bindMatrix"),l.setOptional(Yt,n,"bindMatrixInverse");var d=n.skeleton;d&&(Jt.floatVertexTextures&&d.useVertexTexture?(l.set(Yt,d,"boneTexture"),l.set(Yt,d,"boneTextureWidth"),l.set(Yt,d,"boneTextureHeight")):l.setOptional(Yt,d,"boneMatrices"))}return s&&(i.lights&&N(u,c),e&&i.fog&&R(u,e),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshDepthMaterial)&&T(u,i),i.isLineBasicMaterial?S(u,i):i.isLineDashedMaterial?(S(u,i),A(u,i)):i.isPointsMaterial?L(u,i):i.isMeshLambertMaterial?P(u,i):i.isMeshPhongMaterial?C(u,i):i.isMeshPhysicalMaterial?U(u,i):i.isMeshStandardMaterial?I(u,i):i.isMeshDepthMaterial?i.displacementMap&&(u.displacementMap.value=i.displacementMap,u.displacementScale.value=i.displacementScale,u.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&(u.opacity.value=i.opacity),W.upload(Yt,r.uniformsList,u,ht)),l.set(Yt,n,"modelViewMatrix"),l.set(Yt,n,"normalMatrix"),l.setValue(Yt,"modelMatrix",n.matrixWorld),h}function T(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var i;if(e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i){i.isWebGLRenderTarget&&(i=i.texture);var n=i.offset,r=i.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function S(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function A(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function L(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*Tt,t.scale.value=.5*Et,t.map.value=e.map,null!==e.map){var i=e.map.offset,n=e.map.repeat;t.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}}function R(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function P(t,e){e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function C(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function I(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function U(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,I(t,e)}function N(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function D(t){for(var e=0,i=0,n=t.length;i<n;i++){var r=t[i];r.castShadow&&(Wt.shadows[e++]=r)}Wt.shadows.length=e}function O(t,e){var i,n,r,a,o,s,c,h=0,u=0,p=0,d=e.matrixWorldInverse,f=0,m=0,v=0,g=0;for(i=0,n=t.length;i<n;i++)if(r=t[i],a=r.color,o=r.intensity,s=r.distance,c=r.shadow&&r.shadow.map?r.shadow.map.texture:null,r.isAmbientLight)h+=a.r*o,u+=a.g*o,p+=a.b*o;else if(r.isDirectionalLight){var y=le.get(r);y.color.copy(r.color).multiplyScalar(r.intensity),y.direction.setFromMatrixPosition(r.matrixWorld),jt.setFromMatrixPosition(r.target.matrixWorld),y.direction.sub(jt),y.direction.transformDirection(d),y.shadow=r.castShadow,r.castShadow&&(y.shadowBias=r.shadow.bias,y.shadowRadius=r.shadow.radius,y.shadowMapSize=r.shadow.mapSize),Wt.directionalShadowMap[f]=c,Wt.directionalShadowMatrix[f]=r.shadow.matrix,Wt.directional[f++]=y}else if(r.isSpotLight){var y=le.get(r);y.position.setFromMatrixPosition(r.matrixWorld),y.position.applyMatrix4(d),y.color.copy(a).multiplyScalar(o),y.distance=s,y.direction.setFromMatrixPosition(r.matrixWorld),jt.setFromMatrixPosition(r.target.matrixWorld),y.direction.sub(jt),y.direction.transformDirection(d),y.coneCos=Math.cos(r.angle),y.penumbraCos=Math.cos(r.angle*(1-r.penumbra)),y.decay=0===r.distance?0:r.decay,y.shadow=r.castShadow,r.castShadow&&(y.shadowBias=r.shadow.bias,y.shadowRadius=r.shadow.radius,y.shadowMapSize=r.shadow.mapSize),Wt.spotShadowMap[v]=c,Wt.spotShadowMatrix[v]=r.shadow.matrix,Wt.spot[v++]=y}else if(r.isPointLight){var y=le.get(r);y.position.setFromMatrixPosition(r.matrixWorld),y.position.applyMatrix4(d),y.color.copy(r.color).multiplyScalar(r.intensity),y.distance=r.distance,y.decay=0===r.distance?0:r.decay,y.shadow=r.castShadow,r.castShadow&&(y.shadowBias=r.shadow.bias,y.shadowRadius=r.shadow.radius,y.shadowMapSize=r.shadow.mapSize),Wt.pointShadowMap[m]=c,void 0===Wt.pointShadowMatrix[m]&&(Wt.pointShadowMatrix[m]=new l),jt.setFromMatrixPosition(r.matrixWorld).negate(),Wt.pointShadowMatrix[m].identity().setPosition(jt),Wt.point[m++]=y}else if(r.isHemisphereLight){var y=le.get(r);y.direction.setFromMatrixPosition(r.matrixWorld),y.direction.transformDirection(d),y.direction.normalize(),y.skyColor.copy(r.color).multiplyScalar(o),y.groundColor.copy(r.groundColor).multiplyScalar(o),Wt.hemi[g++]=y}Wt.ambient[0]=h,Wt.ambient[1]=u,Wt.ambient[2]=p,Wt.directional.length=f,Wt.spot.length=v,Wt.point.length=m,Wt.hemi.length=g,Wt.hash=f+","+m+","+v+","+g+","+Wt.shadows.length}function F(){var t=_t;return t>=Jt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Jt.maxTextures),_t+=1,t}function B(t){var e;if(t===La)return Yt.REPEAT;if(t===Ra)return Yt.CLAMP_TO_EDGE;if(t===Pa)return Yt.MIRRORED_REPEAT;if(t===Ia)return Yt.NEAREST;if(t===Ua)return Yt.NEAREST_MIPMAP_NEAREST;if(t===Na)return Yt.NEAREST_MIPMAP_LINEAR;if(t===Da)return Yt.LINEAR;if(t===Oa)return Yt.LINEAR_MIPMAP_NEAREST;if(t===Fa)return Yt.LINEAR_MIPMAP_LINEAR;if(t===za)return Yt.UNSIGNED_BYTE;if(t===Ya)return Yt.UNSIGNED_SHORT_4_4_4_4;if(t===qa)return Yt.UNSIGNED_SHORT_5_5_5_1;if(t===Za)return Yt.UNSIGNED_SHORT_5_6_5;if(t===Ga)return Yt.BYTE;if(t===Ha)return Yt.SHORT;if(t===Va)return Yt.UNSIGNED_SHORT;if(t===ka)return Yt.INT;if(t===ja)return Yt.UNSIGNED_INT;if(t===Wa)return Yt.FLOAT;if(t===Xa&&(e=Zt.get("OES_texture_half_float"),null!==e))return e.HALF_FLOAT_OES;if(t===Qa)return Yt.ALPHA;if(t===Ka)return Yt.RGB;if(t===$a)return Yt.RGBA;if(t===to)return Yt.LUMINANCE;if(t===eo)return Yt.LUMINANCE_ALPHA;if(t===no)return Yt.DEPTH_COMPONENT;if(t===ro)return Yt.DEPTH_STENCIL;if(t===Hr)return Yt.FUNC_ADD;if(t===Vr)return Yt.FUNC_SUBTRACT;if(t===kr)return Yt.FUNC_REVERSE_SUBTRACT;if(t===Xr)return Yt.ZERO;if(t===Yr)return Yt.ONE;if(t===qr)return Yt.SRC_COLOR;if(t===Zr)return Yt.ONE_MINUS_SRC_COLOR;if(t===Jr)return Yt.SRC_ALPHA;if(t===Qr)return Yt.ONE_MINUS_SRC_ALPHA;if(t===Kr)return Yt.DST_ALPHA;if(t===$r)return Yt.ONE_MINUS_DST_ALPHA;if(t===ta)return Yt.DST_COLOR;if(t===ea)return Yt.ONE_MINUS_DST_COLOR;if(t===ia)return Yt.SRC_ALPHA_SATURATE;if((t===ao||t===oo||t===so||t===co)&&(e=Zt.get("WEBGL_compressed_texture_s3tc"),null!==e)){if(t===ao)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===oo)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===so)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===co)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===ho||t===lo||t===uo||t===po)&&(e=Zt.get("WEBGL_compressed_texture_pvrtc"),null!==e)){if(t===ho)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===lo)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===uo)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===po)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===fo&&(e=Zt.get("WEBGL_compressed_texture_etc1"),null!==e))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===jr||t===Wr)&&(e=Zt.get("EXT_blend_minmax"),null!==e)){if(t===jr)return e.MIN_EXT;if(t===Wr)return e.MAX_EXT}return t===Ja&&(e=Zt.get("WEBGL_depth_texture"),null!==e)?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",mr),t=t||{};var z=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),G=void 0!==t.context?t.context:null,H=void 0!==t.alpha&&t.alpha,V=void 0===t.depth||t.depth,k=void 0===t.stencil||t.stencil,j=void 0!==t.antialias&&t.antialias,Y=void 0===t.premultipliedAlpha||t.premultipliedAlpha,J=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,Q=[],$=[],tt=-1,it=[],nt=-1,ot=new Float32Array(8),st=[],ct=[];this.domElement=z,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=ma,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var ht=this,lt=null,ut=null,pt=null,dt=-1,mt="",vt=null,gt=new a,yt=null,xt=new a,_t=0,bt=new X(0),wt=0,Mt=z.width,Et=z.height,Tt=1,St=new a(0,0,Mt,Et),At=!1,Lt=new a(0,0,Mt,Et),Ut=new rt,zt=new se,Gt=!1,Ht=!1,Vt=new et,kt=new l,jt=new h,Wt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Xt={calls:0,vertices:0,faces:0,points:0};this.info={render:Xt,memory:{geometries:0,textures:0},programs:null};var Yt;try{var qt={alpha:H,depth:V,stencil:k,antialias:j,premultipliedAlpha:Y,preserveDrawingBuffer:J};if(Yt=G||z.getContext("webgl",qt)||z.getContext("experimental-webgl",qt),null===Yt)throw null!==z.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Yt.getShaderPrecisionFormat&&(Yt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),z.addEventListener("webglcontextlost",o,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var Zt=new oe(Yt);Zt.get("WEBGL_depth_texture"),Zt.get("OES_texture_float"),Zt.get("OES_texture_float_linear"),Zt.get("OES_texture_half_float"),Zt.get("OES_texture_half_float_linear"),Zt.get("OES_standard_derivatives"),Zt.get("ANGLE_instanced_arrays"),Zt.get("OES_element_index_uint")&&(Rt.MaxIndex=4294967296);var Jt=new ae(Yt,Zt,t),Qt=new re(Yt,Zt,B),Kt=new ne,te=new ie(Yt,Zt,Qt,Kt,Jt,B,this.info),ce=new ee(Yt,Kt,this.info),he=new $t(this,Jt),le=new Bt;this.info.programs=he.programs;var ue=new Ft(Yt,Zt,Xt),pe=new Ot(Yt,Zt,Xt),de=new Dt(-1,1,1,-1,0,1),fe=new Nt,me=new Pt(new It(2,2),new ft({depthTest:!1,depthWrite:!1,fog:!1})),ve=Wc.cube,ge=new Pt(new Ct(5,5,5),new K({uniforms:ve.uniforms,vertexShader:ve.vertexShader,fragmentShader:ve.fragmentShader,side:Ar,depthTest:!1,depthWrite:!1,fog:!1}));n(),this.context=Yt,this.capabilities=Jt,this.extensions=Zt,this.properties=Kt,this.state=Qt;var ye=new at(this,Wt,ce,Jt);this.shadowMap=ye;var xe=new Z(this,st),_e=new q(this,ct);this.getContext=function(){return Yt},this.getContextAttributes=function(){return Yt.getContextAttributes()},this.forceContextLoss=function(){Zt.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Jt.getMaxAnisotropy()},this.getPrecision=function(){return Jt.precision},this.getPixelRatio=function(){return Tt},this.setPixelRatio=function(t){void 0!==t&&(Tt=t,this.setSize(Lt.z,Lt.w,!1))},this.getSize=function(){return{width:Mt,height:Et}},this.setSize=function(t,e,i){Mt=t,Et=e,z.width=t*Tt,z.height=e*Tt,i!==!1&&(z.style.width=t+"px",z.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,i,n){Qt.viewport(Lt.set(t,e,i,n))},this.setScissor=function(t,e,i,n){Qt.scissor(St.set(t,e,i,n))},this.setScissorTest=function(t){Qt.setScissorTest(At=t)},this.getClearColor=function(){return bt},this.setClearColor=function(t,e){bt.set(t),wt=void 0!==e?e:1,i(bt.r,bt.g,bt.b,wt)},this.getClearAlpha=function(){return wt},this.setClearAlpha=function(t){wt=t,i(bt.r,bt.g,bt.b,wt)},this.clear=function(t,e,i){var n=0;(void 0===t||t)&&(n|=Yt.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=Yt.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=Yt.STENCIL_BUFFER_BIT),Yt.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,i,n){this.setRenderTarget(t),this.clear(e,i,n)},this.resetGLState=r,this.dispose=function(){it=[],nt=-1,$=[],tt=-1,z.removeEventListener("webglcontextlost",o,!1)},this.renderBufferImmediate=function(t,e,i){Qt.initAttributes();var n=Kt.get(t);t.hasPositions&&!n.position&&(n.position=Yt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=Yt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=Yt.createBuffer()),t.hasColors&&!n.color&&(n.color=Yt.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(Yt.bindBuffer(Yt.ARRAY_BUFFER,n.position),Yt.bufferData(Yt.ARRAY_BUFFER,t.positionArray,Yt.DYNAMIC_DRAW),Qt.enableAttribute(r.position),Yt.vertexAttribPointer(r.position,3,Yt.FLOAT,!1,0,0)),t.hasNormals){if(Yt.bindBuffer(Yt.ARRAY_BUFFER,n.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&i.shading===Rr)for(var a=0,o=3*t.count;a<o;a+=9){var s=t.normalArray,c=(s[a+0]+s[a+3]+s[a+6])/3,h=(s[a+1]+s[a+4]+s[a+7])/3,l=(s[a+2]+s[a+5]+s[a+8])/3;s[a+0]=c,s[a+1]=h,s[a+2]=l,s[a+3]=c,s[a+4]=h,s[a+5]=l,s[a+6]=c,s[a+7]=h,s[a+8]=l}Yt.bufferData(Yt.ARRAY_BUFFER,t.normalArray,Yt.DYNAMIC_DRAW),Qt.enableAttribute(r.normal),Yt.vertexAttribPointer(r.normal,3,Yt.FLOAT,!1,0,0)}t.hasUvs&&i.map&&(Yt.bindBuffer(Yt.ARRAY_BUFFER,n.uv),Yt.bufferData(Yt.ARRAY_BUFFER,t.uvArray,Yt.DYNAMIC_DRAW),Qt.enableAttribute(r.uv),Yt.vertexAttribPointer(r.uv,2,Yt.FLOAT,!1,0,0)),t.hasColors&&i.vertexColors!==Cr&&(Yt.bindBuffer(Yt.ARRAY_BUFFER,n.color),Yt.bufferData(Yt.ARRAY_BUFFER,t.colorArray,Yt.DYNAMIC_DRAW),Qt.enableAttribute(r.color),Yt.vertexAttribPointer(r.color,3,Yt.FLOAT,!1,0,0)),Qt.disableUnusedAttributes(),Yt.drawArrays(Yt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,i,n,r,a,o){M(r);var s=E(t,i,r,a),c=!1,h=n.id+"_"+s.id+"_"+r.wireframe;h!==mt&&(mt=h,c=!0);var l=a.morphTargetInfluences;if(void 0!==l){for(var u=[],f=0,m=l.length;f<m;f++){var v=l[f];u.push([v,f])}u.sort(d),u.length>8&&(u.length=8);for(var g=n.morphAttributes,f=0,m=u.length;f<m;f++){var v=u[f];if(ot[f]=v[0],0!==v[0]){var y=v[1];r.morphTargets===!0&&g.position&&n.addAttribute("morphTarget"+f,g.position[y]),r.morphNormals===!0&&g.normal&&n.addAttribute("morphNormal"+f,g.normal[y])}else r.morphTargets===!0&&n.removeAttribute("morphTarget"+f),r.morphNormals===!0&&n.removeAttribute("morphNormal"+f)}for(var f=u.length,x=ot.length;f<x;f++)ot[f]=0;s.getUniforms().setValue(Yt,"morphTargetInfluences",ot),c=!0}var y=n.index,_=n.attributes.position,b=1;r.wireframe===!0&&(y=ce.getWireframeAttribute(n),b=2);var w;null!==y?(w=pe,w.setIndex(y)):w=ue,c&&(p(r,s,n),null!==y&&Yt.bindBuffer(Yt.ELEMENT_ARRAY_BUFFER,ce.getAttributeBuffer(y)));var T=0;null!==y?T=y.count:void 0!==_&&(T=_.count);var S=n.drawRange.start*b,A=n.drawRange.count*b,L=null!==o?o.start*b:0,R=null!==o?o.count*b:1/0,P=Math.max(S,L),C=Math.min(T,S+A,L+R)-1,I=Math.max(0,C-P+1);if(0!==I){if(a.isMesh)if(r.wireframe===!0)Qt.setLineWidth(r.wireframeLinewidth*e()),w.setMode(Yt.LINES);else switch(a.drawMode){case Eo:w.setMode(Yt.TRIANGLES);break;case To:w.setMode(Yt.TRIANGLE_STRIP);break;case So:w.setMode(Yt.TRIANGLE_FAN)}else if(a.isLine){var U=r.linewidth;void 0===U&&(U=1),Qt.setLineWidth(U*e()),a.isLineSegments?w.setMode(Yt.LINES):w.setMode(Yt.LINE_STRIP)}else a.isPoints&&w.setMode(Yt.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&w.renderInstances(n,P,I):w.render(P,I)}},this.render=function(t,e,n,r){if(void 0!==e&&e.isCamera!==!0)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");mt="",dt=-1,vt=null,t.autoUpdate===!0&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),kt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Ut.setFromMatrix(kt),Q.length=0,tt=-1,nt=-1,st.length=0,ct.length=0,Ht=this.localClippingEnabled,Gt=zt.init(this.clippingPlanes,Ht,e),_(t,e),$.length=tt+1,it.length=nt+1,ht.sortObjects===!0&&($.sort(f),it.sort(m)),Gt&&zt.beginShadows(),D(Q),ye.render(t,e),O(Q,e),Gt&&zt.endShadows(),Xt.calls=0,Xt.vertices=0,Xt.faces=0,Xt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var a=t.background;if(null===a?i(bt.r,bt.g,bt.b,wt):a&&a.isColor&&(i(a.r,a.g,a.b,1),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),a&&a.isCubeTexture?(fe.projectionMatrix.copy(e.projectionMatrix),fe.matrixWorld.extractRotation(e.matrixWorld),fe.matrixWorldInverse.getInverse(fe.matrixWorld),ge.material.uniforms.tCube.value=a,ge.modelViewMatrix.multiplyMatrices(fe.matrixWorldInverse,ge.matrixWorld),ce.update(ge),ht.renderBufferDirect(fe,null,ge.geometry,ge.material,ge,null)):a&&a.isTexture&&(me.material.map=a,ce.update(me),ht.renderBufferDirect(de,null,me.geometry,me.material,me,null)),t.overrideMaterial){var o=t.overrideMaterial;b($,t,e,o),b(it,t,e,o)}else Qt.setBlending(Nr),b($,t,e),b(it,t,e);xe.render(t,e),_e.render(t,e,xt),n&&te.updateRenderTargetMipmap(n),Qt.setDepthTest(!0),Qt.setDepthWrite(!0),Qt.setColorWrite(!0)},this.setFaceCulling=function(t,e){Qt.setCullFace(t),Qt.setFlipSided(e===br)},this.allocTextureUnit=F,this.setTexture2D=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),te.setTexture2D(e,i)}}(),this.setTexture=function(){var t=!1;return function(e,i){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),te.setTexture2D(e,i)}}(),this.setTextureCube=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?te.setTextureCube(e,i):te.setTextureCubeDynamic(e,i)}}(),this.getCurrentRenderTarget=function(){
5
+ return ut},this.setRenderTarget=function(t){ut=t,t&&void 0===Kt.get(t).__webglFramebuffer&&te.setupRenderTarget(t);var e,i=t&&t.isWebGLRenderTargetCube;if(t){var n=Kt.get(t);e=i?n.__webglFramebuffer[t.activeCubeFace]:n.__webglFramebuffer,gt.copy(t.scissor),yt=t.scissorTest,xt.copy(t.viewport)}else e=null,gt.copy(St).multiplyScalar(Tt),yt=At,xt.copy(Lt).multiplyScalar(Tt);if(pt!==e&&(Yt.bindFramebuffer(Yt.FRAMEBUFFER,e),pt=e),Qt.scissor(gt),Qt.setScissorTest(yt),Qt.viewport(xt),i){var r=Kt.get(t.texture);Yt.framebufferTexture2D(Yt.FRAMEBUFFER,Yt.COLOR_ATTACHMENT0,Yt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,i,n,r,a){if((t&&t.isWebGLRenderTarget)===!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var o=Kt.get(t).__webglFramebuffer;if(o){var s=!1;o!==pt&&(Yt.bindFramebuffer(Yt.FRAMEBUFFER,o),s=!0);try{var c=t.texture,h=c.format,l=c.type;if(h!==$a&&B(h)!==Yt.getParameter(Yt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===za||B(l)===Yt.getParameter(Yt.IMPLEMENTATION_COLOR_READ_TYPE)||l===Wa&&(Zt.get("OES_texture_float")||Zt.get("WEBGL_color_buffer_float"))||l===Xa&&Zt.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Yt.checkFramebufferStatus(Yt.FRAMEBUFFER)===Yt.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&Yt.readPixels(e,i,n,r,B(h),B(l),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Yt.bindFramebuffer(Yt.FRAMEBUFFER,pt)}}}}function he(t,e){this.name="",this.color=new X(t),this.density=void 0!==e?e:25e-5}function le(t,e,i){this.name="",this.color=new X(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function ue(){ht.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function pe(t,e,i,n,r){ht.call(this),this.lensFlares=[],this.positionScreen=new h,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,i,n,r)}function de(t){J.call(this),this.type="SpriteMaterial",this.color=new X(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function fe(t){ht.call(this),this.type="Sprite",this.material=void 0!==t?t:new de}function me(){ht.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ve(t,e,i,r,a,o,s,c,h,l,u,p){n.call(this,null,o,s,c,h,l,r,a,u,p),this.image={data:t,width:e,height:i},this.magFilter=void 0!==h?h:Ia,this.minFilter=void 0!==l?l:Ia,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function ge(t,e,i){if(this.useVertexTexture=void 0===i||i,this.identityMatrix=new l,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var n=Math.sqrt(4*this.bones.length);n=Fo.nextPowerOfTwo(Math.ceil(n)),n=Math.max(n,4),this.boneTextureWidth=n,this.boneTextureHeight=n,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new ve(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,$a,Wa)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var r=0,a=this.bones.length;r<a;r++)this.boneInverses.push(new l)}}function ye(t){ht.call(this),this.type="Bone",this.skin=t}function xe(t,e,i){Pt.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new l,this.bindMatrixInverse=new l;var n=[];if(this.geometry&&void 0!==this.geometry.bones){for(var r,a,o=0,s=this.geometry.bones.length;o<s;++o)a=this.geometry.bones[o],r=new ye(this),n.push(r),r.name=a.name,r.position.fromArray(a.pos),r.quaternion.fromArray(a.rotq),void 0!==a.scl&&r.scale.fromArray(a.scl);for(var o=0,s=this.geometry.bones.length;o<s;++o)a=this.geometry.bones[o],a.parent!==-1&&null!==a.parent&&void 0!==n[a.parent]?n[a.parent].add(n[o]):this.add(n[o])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new ge(n,void 0,i),this.matrixWorld)}function _e(t){J.call(this),this.type="LineBasicMaterial",this.color=new X(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function be(t,e,i){return 1===i?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new we(t,e)):(ht.call(this),this.type="Line",this.geometry=void 0!==t?t:new Rt,void(this.material=void 0!==e?e:new _e({color:16777215*Math.random()})))}function we(t,e){be.call(this,t,e),this.type="LineSegments"}function Me(t){J.call(this),this.type="PointsMaterial",this.color=new X(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function Ee(t,e){ht.call(this),this.type="Points",this.geometry=void 0!==t?t:new Rt,this.material=void 0!==e?e:new Me({color:16777215*Math.random()})}function Te(){ht.call(this),this.type="Group"}function Se(t,e,i,r,a,o,s,c,h){function l(){requestAnimationFrame(l),t.readyState>=t.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}n.call(this,t,e,i,r,a,o,s,c,h),this.generateMipmaps=!1;var u=this;l()}function Ae(t,e,i,r,a,o,s,c,h,l,u,p){n.call(this,null,o,s,c,h,l,r,a,u,p),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Le(t,e,i,r,a,o,s,c,h){n.call(this,t,e,i,r,a,o,s,c,h),this.needsUpdate=!0}function Re(t,e,i,r,a,o,s,c,h,l){if(l=void 0!==l?l:no,l!==no&&l!==ro)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n.call(this,null,r,a,o,s,c,l,i,h),this.image={width:t,height:e},this.type=void 0!==i?i:Va,this.magFilter=void 0!==s?s:Ia,this.minFilter=void 0!==c?c:Ia,this.flipY=!1,this.generateMipmaps=!1}function Pe(t){function e(t,e){return t-e}Rt.call(this);var i=[0,0],n={},r=["a","b","c"];if(t&&t.isGeometry){for(var a=t.vertices,o=t.faces,s=0,c=new Uint32Array(6*o.length),h=0,l=o.length;h<l;h++)for(var u=o[h],p=0;p<3;p++){i[0]=u[r[p]],i[1]=u[r[(p+1)%3]],i.sort(e);var d=i.toString();void 0===n[d]&&(c[2*s]=i[0],c[2*s+1]=i[1],n[d]=!0,s++)}for(var f=new Float32Array(2*s*3),h=0,l=s;h<l;h++)for(var p=0;p<2;p++){var m=a[c[2*h+p]],v=6*h+3*p;f[v+0]=m.x,f[v+1]=m.y,f[v+2]=m.z}this.addAttribute("position",new mt(f,3))}else if(t&&t.isBufferGeometry)if(null!==t.index){var g=t.index.array,a=t.attributes.position,y=t.groups,s=0;0===y.length&&t.addGroup(0,g.length);for(var c=new Uint32Array(2*g.length),x=0,_=y.length;x<_;++x)for(var b=y[x],w=b.start,M=b.count,h=w,E=w+M;h<E;h+=3)for(var p=0;p<3;p++){i[0]=g[h+p],i[1]=g[h+(p+1)%3],i.sort(e);var d=i.toString();void 0===n[d]&&(c[2*s]=i[0],c[2*s+1]=i[1],n[d]=!0,s++)}for(var f=new Float32Array(2*s*3),h=0,l=s;h<l;h++)for(var p=0;p<2;p++){var v=6*h+3*p,T=c[2*h+p];f[v+0]=a.getX(T),f[v+1]=a.getY(T),f[v+2]=a.getZ(T)}this.addAttribute("position",new mt(f,3))}else{for(var a=t.attributes.position.array,s=a.length/3,S=s/3,f=new Float32Array(2*s*3),h=0,l=S;h<l;h++)for(var p=0;p<3;p++){var v=18*h+6*p,A=9*h+3*p;f[v+0]=a[A],f[v+1]=a[A+1],f[v+2]=a[A+2];var T=9*h+3*((p+1)%3);f[v+3]=a[T],f[v+4]=a[T+1],f[v+5]=a[T+2]}this.addAttribute("position",new mt(f,3))}}function Ce(t,e,i){Rt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:i};var n,r,a,o,s,c=[],h=[],l=e+1;for(n=0;n<=i;n++)for(s=n/i,r=0;r<=e;r++)o=r/e,a=t(o,s),c.push(a.x,a.y,a.z),h.push(o,s);var u,p,d,f,m=[];for(n=0;n<i;n++)for(r=0;r<e;r++)u=n*l+r,p=n*l+r+1,d=(n+1)*l+r+1,f=(n+1)*l+r,m.push(u,p,f),m.push(p,d,f);this.setIndex((m.length>65535?wt:_t)(m,1)),this.addAttribute("position",Mt(c,3)),this.addAttribute("uv",Mt(h,2)),this.computeVertexNormals()}function Ie(t,e,i){St.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:i},this.fromBufferGeometry(new Ce(t,e,i)),this.mergeVertices()}function Ue(t,e,n,r){function a(t){for(var i=new h,n=new h,r=new h,a=0;a<e.length;a+=3)p(e[a+0],i),p(e[a+1],n),p(e[a+2],r),o(i,n,r,t)}function o(t,e,i,n){var r,a,o=Math.pow(2,n),s=[];for(r=0;r<=o;r++){s[r]=[];var c=t.clone().lerp(i,r/o),h=e.clone().lerp(i,r/o),l=o-r;for(a=0;a<=l;a++)0===a&&r===o?s[r][a]=c:s[r][a]=c.clone().lerp(h,a/l)}for(r=0;r<o;r++)for(a=0;a<2*(o-r)-1;a++){var p=Math.floor(a/2);a%2===0?(u(s[r][p+1]),u(s[r+1][p]),u(s[r][p])):(u(s[r][p+1]),u(s[r+1][p+1]),u(s[r+1][p]))}}function s(t){for(var e=new h,i=0;i<g.length;i+=3)e.x=g[i+0],e.y=g[i+1],e.z=g[i+2],e.normalize().multiplyScalar(t),g[i+0]=e.x,g[i+1]=e.y,g[i+2]=e.z}function c(){for(var t=new h,e=0;e<g.length;e+=3){t.x=g[e+0],t.y=g[e+1],t.z=g[e+2];var i=m(t)/2/Math.PI+.5,n=v(t)/Math.PI+.5;y.push(i,1-n)}d(),l()}function l(){for(var t=0;t<y.length;t+=6){var e=y[t+0],i=y[t+2],n=y[t+4],r=Math.max(e,i,n),a=Math.min(e,i,n);r>.9&&a<.1&&(e<.2&&(y[t+0]+=1),i<.2&&(y[t+2]+=1),n<.2&&(y[t+4]+=1))}}function u(t){g.push(t.x,t.y,t.z)}function p(e,i){var n=3*e;i.x=t[n+0],i.y=t[n+1],i.z=t[n+2]}function d(){for(var t=new h,e=new h,n=new h,r=new h,a=new i,o=new i,s=new i,c=0,l=0;c<g.length;c+=9,l+=6){t.set(g[c+0],g[c+1],g[c+2]),e.set(g[c+3],g[c+4],g[c+5]),n.set(g[c+6],g[c+7],g[c+8]),a.set(y[l+0],y[l+1]),o.set(y[l+2],y[l+3]),s.set(y[l+4],y[l+5]),r.copy(t).add(e).add(n).divideScalar(3);var u=m(r);f(a,l+0,t,u),f(o,l+2,e,u),f(s,l+4,n,u)}}function f(t,e,i,n){n<0&&1===t.x&&(y[e]=t.x-1),0===i.x&&0===i.z&&(y[e]=n/2/Math.PI+.5)}function m(t){return Math.atan2(t.z,-t.x)}function v(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}Rt.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},n=n||1,r=r||0;var g=[],y=[];a(r),s(n),c(),this.addAttribute("position",Mt(g,3)),this.addAttribute("normal",Mt(g.slice(),3)),this.addAttribute("uv",Mt(y,2)),this.normalizeNormals(),this.boundingSphere=new et(new h,n)}function Ne(t,e){var i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],n=[2,1,0,0,3,2,1,3,0,2,3,1];Ue.call(this,i,n,t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function De(t,e){St.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ne(t,e)),this.mergeVertices()}function Oe(t,e){var i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],n=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];Ue.call(this,i,n,t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Fe(t,e){St.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Oe(t,e)),this.mergeVertices()}function Be(t,e){var i=(1+Math.sqrt(5))/2,n=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];Ue.call(this,n,r,t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function ze(t,e){St.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Be(t,e)),this.mergeVertices()}function Ge(t,e){var i=(1+Math.sqrt(5))/2,n=1/i,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];Ue.call(this,r,a,t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function He(t,e){St.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ge(t,e)),this.mergeVertices()}function Ve(t,e,i,n){St.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n},this.fromBufferGeometry(new Ue(t,e,i,n)),this.mergeVertices()}function ke(t,e,n,r,a){function o(){for(p=0;p<e;p++)s(p);s(a===!1?e:0),l(),c()}function s(i){var a=t.getPointAt(i/e),o=u.normals[i],s=u.binormals[i];for(d=0;d<=r;d++){var c=d/r*Math.PI*2,h=Math.sin(c),l=-Math.cos(c);m.x=l*o.x+h*s.x,m.y=l*o.y+h*s.y,m.z=l*o.z+h*s.z,m.normalize(),y.push(m.x,m.y,m.z),f.x=a.x+n*m.x,f.y=a.y+n*m.y,f.z=a.z+n*m.z,g.push(f.x,f.y,f.z)}}function c(){for(d=1;d<=e;d++)for(p=1;p<=r;p++){var t=(r+1)*(d-1)+(p-1),i=(r+1)*d+(p-1),n=(r+1)*d+p,a=(r+1)*(d-1)+p;_.push(t,i,a),_.push(i,n,a)}}function l(){for(p=0;p<=e;p++)for(d=0;d<=r;d++)v.x=p/e,v.y=d/r,x.push(v.x,v.y)}Rt.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:a},e=e||64,n=n||1,r=r||8,a=a||!1;var u=t.computeFrenetFrames(e,a);this.tangents=u.tangents,this.normals=u.normals,this.binormals=u.binormals;var p,d,f=new h,m=new h,v=new i,g=[],y=[],x=[],_=[];o(),this.setIndex((_.length>65535?wt:_t)(_,1)),this.addAttribute("position",Mt(g,3)),this.addAttribute("normal",Mt(y,3)),this.addAttribute("uv",Mt(x,2))}function je(t,e,i,n,r,a){St.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new ke(t,e,i,n,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function We(t,e,n,r,a,o){function s(t,e,i,n,r){var a=Math.cos(t),o=Math.sin(t),s=i/e*t,c=Math.cos(s);r.x=n*(2+c)*.5*a,r.y=n*(2+c)*o*.5,r.z=n*Math.sin(s)*.5}Rt.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:a,q:o},t=t||100,e=e||40,n=Math.floor(n)||64,r=Math.floor(r)||8,a=a||2,o=o||3;var c,l,u=(r+1)*(n+1),p=r*n*2*3,d=new mt(new(p>65535?Uint32Array:Uint16Array)(p),1),f=new mt(new Float32Array(3*u),3),m=new mt(new Float32Array(3*u),3),v=new mt(new Float32Array(2*u),2),g=0,y=0,x=new h,_=new h,b=new i,w=new h,M=new h,E=new h,T=new h,S=new h;for(c=0;c<=n;++c){var A=c/n*a*Math.PI*2;for(s(A,a,o,t,w),s(A+.01,a,o,t,M),T.subVectors(M,w),S.addVectors(M,w),E.crossVectors(T,S),S.crossVectors(E,T),E.normalize(),S.normalize(),l=0;l<=r;++l){var L=l/r*Math.PI*2,R=-e*Math.cos(L),P=e*Math.sin(L);x.x=w.x+(R*S.x+P*E.x),x.y=w.y+(R*S.y+P*E.y),x.z=w.z+(R*S.z+P*E.z),f.setXYZ(g,x.x,x.y,x.z),_.subVectors(x,w).normalize(),m.setXYZ(g,_.x,_.y,_.z),b.x=c/n,b.y=l/r,v.setXY(g,b.x,b.y),g++}}for(l=1;l<=n;l++)for(c=1;c<=r;c++){var C=(r+1)*(l-1)+(c-1),I=(r+1)*l+(c-1),U=(r+1)*l+c,N=(r+1)*(l-1)+c;d.setX(y,C),y++,d.setX(y,I),y++,d.setX(y,N),y++,d.setX(y,I),y++,d.setX(y,U),y++,d.setX(y,N),y++}this.setIndex(d),this.addAttribute("position",f),this.addAttribute("normal",m),this.addAttribute("uv",v)}function Xe(t,e,i,n,r,a,o){St.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new We(t,e,i,n,r,a)),this.mergeVertices()}function Ye(t,e,i,n,r){Rt.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},t=t||100,e=e||40,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;var a,o,s=(i+1)*(n+1),c=i*n*2*3,l=new(c>65535?Uint32Array:Uint16Array)(c),u=new Float32Array(3*s),p=new Float32Array(3*s),d=new Float32Array(2*s),f=0,m=0,v=0,g=new h,y=new h,x=new h;for(a=0;a<=i;a++)for(o=0;o<=n;o++){var _=o/n*r,b=a/i*Math.PI*2;y.x=(t+e*Math.cos(b))*Math.cos(_),y.y=(t+e*Math.cos(b))*Math.sin(_),y.z=e*Math.sin(b),u[f]=y.x,u[f+1]=y.y,u[f+2]=y.z,g.x=t*Math.cos(_),g.y=t*Math.sin(_),x.subVectors(y,g).normalize(),p[f]=x.x,p[f+1]=x.y,p[f+2]=x.z,d[m]=o/n,d[m+1]=a/i,f+=3,m+=2}for(a=1;a<=i;a++)for(o=1;o<=n;o++){var w=(n+1)*a+o-1,M=(n+1)*(a-1)+o-1,E=(n+1)*(a-1)+o,T=(n+1)*a+o;l[v]=w,l[v+1]=M,l[v+2]=T,l[v+3]=M,l[v+4]=E,l[v+5]=T,v+=6}this.setIndex(new mt(l,1)),this.addAttribute("position",new mt(u,3)),this.addAttribute("normal",new mt(p,3)),this.addAttribute("uv",new mt(d,2))}function qe(t,e,i,n,r){St.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new Ye(t,e,i,n,r))}function Ze(t,e){return"undefined"==typeof t?void(t=[]):(St.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),void this.computeFaceNormals())}function Je(t,e){e=e||{};var i=e.font;if((i&&i.isFont)===!1)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new St;var n=i.generateShapes(t,e.size,e.curveSegments);e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),Ze.call(this,n,e),this.type="TextGeometry"}function Qe(t,e,i,n,r,a,o){Rt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},t=t||50,e=Math.max(3,Math.floor(e)||8),i=Math.max(2,Math.floor(i)||6),n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;for(var s=a+o,c=(e+1)*(i+1),l=new mt(new Float32Array(3*c),3),u=new mt(new Float32Array(3*c),3),p=new mt(new Float32Array(2*c),2),d=0,f=[],m=new h,v=0;v<=i;v++){for(var g=[],y=v/i,x=0;x<=e;x++){var _=x/e,b=-t*Math.cos(n+_*r)*Math.sin(a+y*o),w=t*Math.cos(a+y*o),M=t*Math.sin(n+_*r)*Math.sin(a+y*o);m.set(b,w,M).normalize(),l.setXYZ(d,b,w,M),u.setXYZ(d,m.x,m.y,m.z),p.setXY(d,_,1-y),g.push(d),d++}f.push(g)}for(var E=[],v=0;v<i;v++)for(var x=0;x<e;x++){var T=f[v][x+1],S=f[v][x],A=f[v+1][x],L=f[v+1][x+1];(0!==v||a>0)&&E.push(T,S,L),(v!==i-1||s<Math.PI)&&E.push(S,A,L)}this.setIndex(new(l.count>65535?wt:_t)(E,1)),this.addAttribute("position",l),this.addAttribute("normal",u),this.addAttribute("uv",p),this.boundingSphere=new et(new h,t)}function Ke(t,e,i,n,r,a,o){St.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Qe(t,e,i,n,r,a,o))}function $e(t,e,n,r,a,o){Rt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:a,thetaLength:o},t=t||20,e=e||50,a=void 0!==a?a:0,o=void 0!==o?o:2*Math.PI,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?Math.max(1,r):1;var s,c,l,u=(n+1)*(r+1),p=n*r*2*3,d=new mt(new(p>65535?Uint32Array:Uint16Array)(p),1),f=new mt(new Float32Array(3*u),3),m=new mt(new Float32Array(3*u),3),v=new mt(new Float32Array(2*u),2),g=0,y=0,x=t,_=(e-t)/r,b=new h,w=new i;for(c=0;c<=r;c++){for(l=0;l<=n;l++)s=a+l/n*o,b.x=x*Math.cos(s),b.y=x*Math.sin(s),f.setXYZ(g,b.x,b.y,b.z),m.setXYZ(g,0,0,1),w.x=(b.x/e+1)/2,w.y=(b.y/e+1)/2,v.setXY(g,w.x,w.y),g++;x+=_}for(c=0;c<r;c++){var M=c*(n+1);for(l=0;l<n;l++){s=l+M;var E=s,T=s+n+1,S=s+n+2,A=s+1;d.setX(y,E),y++,d.setX(y,T),y++,d.setX(y,S),y++,d.setX(y,E),y++,d.setX(y,S),y++,d.setX(y,A),y++}}this.setIndex(d),this.addAttribute("position",f),this.addAttribute("normal",m),this.addAttribute("uv",v)}function ti(t,e,i,n,r,a){St.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new $e(t,e,i,n,r,a))}function ei(t,e,i,n){St.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new It(t,e,i,n))}function ii(t,e,n,r){Rt.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},e=Math.floor(e)||12,n=n||0,r=r||2*Math.PI,r=Fo.clamp(r,0,2*Math.PI);var a,o,s,c=(e+1)*t.length,l=e*t.length*2*3,u=new mt(new(l>65535?Uint32Array:Uint16Array)(l),1),p=new mt(new Float32Array(3*c),3),d=new mt(new Float32Array(2*c),2),f=0,m=0,v=1/e,g=new h,y=new i;for(o=0;o<=e;o++){var x=n+o*v*r,_=Math.sin(x),b=Math.cos(x);for(s=0;s<=t.length-1;s++)g.x=t[s].x*_,g.y=t[s].y,g.z=t[s].x*b,p.setXYZ(f,g.x,g.y,g.z),y.x=o/e,y.y=s/(t.length-1),d.setXY(f,y.x,y.y),f++}for(o=0;o<e;o++)for(s=0;s<t.length-1;s++){a=s+o*t.length;var w=a,M=a+t.length,E=a+t.length+1,T=a+1;u.setX(m,w),m++,u.setX(m,M),m++,u.setX(m,T),m++,u.setX(m,M),m++,u.setX(m,E),m++,u.setX(m,T),m++}if(this.setIndex(u),this.addAttribute("position",p),this.addAttribute("uv",d),this.computeVertexNormals(),r===2*Math.PI){var S=this.attributes.normal.array,A=new h,L=new h,R=new h;for(a=e*t.length*3,o=0,s=0;o<t.length;o++,s+=3)A.x=S[s+0],A.y=S[s+1],A.z=S[s+2],L.x=S[a+s+0],L.y=S[a+s+1],L.z=S[a+s+2],R.addVectors(A,L).normalize(),S[s+0]=S[a+s+0]=R.x,S[s+1]=S[a+s+1]=R.y,S[s+2]=S[a+s+2]=R.z}}function ni(t,e,i,n){St.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},this.fromBufferGeometry(new ii(t,e,i,n)),this.mergeVertices()}function ri(t,e){St.call(this),this.type="ShapeGeometry",Array.isArray(t)===!1&&(t=[t]),this.addShapeList(t,e),this.computeFaceNormals()}function ai(t,e){function i(t,e){return t-e}Rt.call(this),e=void 0!==e?e:1;var n,r=Math.cos(Fo.DEG2RAD*e),a=[0,0],o={},s=["a","b","c"];t&&t.isBufferGeometry?(n=new St,n.fromBufferGeometry(t)):n=t.clone(),n.mergeVertices(),n.computeFaceNormals();for(var c=n.vertices,h=n.faces,l=0,u=h.length;l<u;l++)for(var p=h[l],d=0;d<3;d++){a[0]=p[s[d]],a[1]=p[s[(d+1)%3]],a.sort(i);var f=a.toString();void 0===o[f]?o[f]={vert1:a[0],vert2:a[1],face1:l,face2:void 0}:o[f].face2=l}var m=[];for(var f in o){var v=o[f];if(void 0===v.face2||h[v.face1].normal.dot(h[v.face2].normal)<=r){var g=c[v.vert1];m.push(g.x),m.push(g.y),m.push(g.z),g=c[v.vert2],m.push(g.x),m.push(g.y),m.push(g.z)}}this.addAttribute("position",new mt(new Float32Array(m),3))}function oi(t,e,n,r,a,o,s,c){function l(){var t=(r+1)*(a+1);return o===!1&&(t+=(r+1)*m+r*m),t}function u(){var t=r*a*2*3;return o===!1&&(t+=r*m*3),t}function p(){var i,o,l=new h,u=new h,p=0,d=(e-t)/n;for(o=0;o<=a;o++){var m=[],v=o/a,g=v*(e-t)+t;for(i=0;i<=r;i++){var A=i/r,L=A*c+s,R=Math.sin(L),P=Math.cos(L);u.x=g*R,u.y=-v*n+T,u.z=g*P,x.setXYZ(w,u.x,u.y,u.z),l.set(R,d,P).normalize(),_.setXYZ(w,l.x,l.y,l.z),b.setXY(w,A,1-v),m.push(w),w++}E.push(m)}for(i=0;i<r;i++)for(o=0;o<a;o++){var C=E[o][i],I=E[o+1][i],U=E[o+1][i+1],N=E[o][i+1];y.setX(M,C),M++,y.setX(M,I),M++,y.setX(M,N),M++,y.setX(M,I),M++,y.setX(M,U),M++,y.setX(M,N),M++,p+=6}f.addGroup(S,p,0),S+=p}function d(n){var a,o,l,u=new i,p=new h,d=0,m=n===!0?t:e,v=n===!0?1:-1;for(o=w,a=1;a<=r;a++)x.setXYZ(w,0,T*v,0),_.setXYZ(w,0,v,0),u.x=.5,u.y=.5,b.setXY(w,u.x,u.y),w++;for(l=w,a=0;a<=r;a++){var g=a/r,E=g*c+s,A=Math.cos(E),L=Math.sin(E);p.x=m*L,p.y=T*v,p.z=m*A,x.setXYZ(w,p.x,p.y,p.z),_.setXYZ(w,0,v,0),u.x=.5*A+.5,u.y=.5*L*v+.5,b.setXY(w,u.x,u.y),w++}for(a=0;a<r;a++){var R=o+a,P=l+a;n===!0?(y.setX(M,P),M++,y.setX(M,P+1),M++,y.setX(M,R),M++):(y.setX(M,P+1),M++,y.setX(M,P),M++,y.setX(M,R),M++),d+=3}f.addGroup(S,d,n===!0?1:2),S+=d}Rt.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:c};var f=this;t=void 0!==t?t:20,e=void 0!==e?e:20,n=void 0!==n?n:100,r=Math.floor(r)||8,a=Math.floor(a)||1,o=void 0!==o&&o,s=void 0!==s?s:0,c=void 0!==c?c:2*Math.PI;var m=0;o===!1&&(t>0&&m++,e>0&&m++);var v=l(),g=u(),y=new mt(new(g>65535?Uint32Array:Uint16Array)(g),1),x=new mt(new Float32Array(3*v),3),_=new mt(new Float32Array(3*v),3),b=new mt(new Float32Array(2*v),2),w=0,M=0,E=[],T=n/2,S=0;p(),o===!1&&(t>0&&d(!0),e>0&&d(!1)),this.setIndex(y),this.addAttribute("position",x),this.addAttribute("normal",_),this.addAttribute("uv",b)}function si(t,e,i,n,r,a,o,s){St.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new oi(t,e,i,n,r,a,o,s)),this.mergeVertices()}function ci(t,e,i,n,r,a,o){si.call(this,0,t,e,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function hi(t,e,i,n,r,a,o){oi.call(this,0,t,e,i,n,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function li(t,e,i,n){Rt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},t=t||50,e=void 0!==e?Math.max(3,e):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r=e+2,a=new Float32Array(3*r),o=new Float32Array(3*r),s=new Float32Array(2*r);o[2]=1,s[0]=.5,s[1]=.5;for(var c=0,l=3,u=2;c<=e;c++,l+=3,u+=2){var p=i+c/e*n;a[l]=t*Math.cos(p),a[l+1]=t*Math.sin(p),o[l+2]=1,s[u]=(a[l]/t+1)/2,s[u+1]=(a[l+1]/t+1)/2}for(var d=[],l=1;l<=e;l++)d.push(l,l+1,0);this.setIndex(new mt(new Uint16Array(d),1)),this.addAttribute("position",new mt(a,3)),this.addAttribute("normal",new mt(o,3)),this.addAttribute("uv",new mt(s,2)),this.boundingSphere=new et(new h,t)}function ui(t,e,i,n){St.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new li(t,e,i,n))}function pi(t,e,i,n,r,a){St.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new Ct(t,e,i,n,r,a)),this.mergeVertices()}function di(){K.call(this,{uniforms:jo.merge([jc.lights,{opacity:{value:1}}]),vertexShader:Vc.shadow_vert,fragmentShader:Vc.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}})}function fi(t){K.call(this,t),this.type="RawShaderMaterial"}function mi(t){this.uuid=Fo.generateUUID(),this.type="MultiMaterial",this.materials=t instanceof Array?t:[],this.visible=!0}function vi(t){J.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new X(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function gi(t){vi.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function yi(t){J.call(this),this.type="MeshPhongMaterial",this.color=new X(16777215),this.specular=new X(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ua,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function xi(t){J.call(this,t),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.morphTargets=!1,this.setValues(t)}function _i(t){J.call(this),this.type="MeshLambertMaterial",this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ua,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function bi(t){J.call(this),this.type="LineDashedMaterial",this.color=new X(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function wi(t,e,i){var n=this,r=!1,a=0,o=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,r===!1&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)}}function Mi(t){this.manager=void 0!==t?t:th}function Ei(t){this.manager=void 0!==t?t:th,this._parser=null}function Ti(t){this.manager=void 0!==t?t:th,this._parser=null}function Si(t){this.manager=void 0!==t?t:th}function Ai(t){this.manager=void 0!==t?t:th}function Li(t){this.manager=void 0!==t?t:th}function Ri(t,e){ht.call(this),this.type="Light",this.color=new X(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Pi(t,e,i){Ri.call(this,t,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ht.DefaultUp),this.updateMatrix(),this.groundColor=new X(e)}function Ci(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new l}function Ii(){Ci.call(this,new Nt(50,1,.5,500))}function Ui(t,e,i,n,r,a){Ri.call(this,t,e),this.type="SpotLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new Ii}function Ni(t,e,i,n){Ri.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1,this.shadow=new Ci(new Nt(90,1,.5,500))}function Di(t){Ci.call(this,new Dt(-5,5,5,-5,.5,500))}function Oi(t,e){Ri.call(this,t,e),this.type="DirectionalLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,this.shadow=new Di}function Fi(t,e){Ri.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Bi(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i}function zi(t,e,i,n){Bi.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Gi(t,e,i,n){Bi.call(this,t,e,i,n)}function Hi(t,e,i,n){Bi.call(this,t,e,i,n)}function Vi(t,e,i,n){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=ih.convertArray(e,this.TimeBufferType),this.values=ih.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation),this.validate(),this.optimize()}function ki(t,e,i,n){Vi.call(this,t,e,i,n)}function ji(t,e,i,n){Bi.call(this,t,e,i,n)}function Wi(t,e,i,n){Vi.call(this,t,e,i,n)}function Xi(t,e,i,n){Vi.call(this,t,e,i,n)}function Yi(t,e,i,n){Vi.call(this,t,e,i,n)}function qi(t,e,i){Vi.call(this,t,e,i)}function Zi(t,e,i,n){Vi.call(this,t,e,i,n)}function Ji(t,e,i,n){Vi.apply(this,arguments)}function Qi(t,e,i){this.name=t,this.tracks=i,this.duration=void 0!==e?e:-1,this.uuid=Fo.generateUUID(),
6
+ this.duration<0&&this.resetDuration(),this.optimize()}function Ki(t){this.manager=void 0!==t?t:th,this.textures={}}function $i(t){this.manager=void 0!==t?t:th}function tn(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function en(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:th,this.withCredentials=!1}function nn(t){this.manager=void 0!==t?t:th,this.texturePath=""}function rn(){}function an(t,e){this.v1=t,this.v2=e}function on(){this.curves=[],this.autoClose=!1}function sn(t,e,i,n,r,a,o,s){this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0}function cn(t){this.points=void 0===t?[]:t}function hn(t,e,i,n){this.v0=t,this.v1=e,this.v2=i,this.v3=n}function ln(t,e,i){this.v0=t,this.v1=e,this.v2=i}function un(){pn.apply(this,arguments),this.holes=[]}function pn(t){on.call(this),this.currentPoint=new i,t&&this.fromPoints(t)}function dn(){this.subPaths=[],this.currentPath=null}function fn(t){this.data=t}function mn(t){this.manager=void 0!==t?t:th}function vn(){return void 0===oh&&(oh=new(window.AudioContext||window.webkitAudioContext)),oh}function gn(t){this.manager=void 0!==t?t:th}function yn(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Nt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Nt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function xn(t,e,i){ht.call(this),this.type="CubeCamera";var n=90,r=1,a=new Nt(n,r,t,e);a.up.set(0,-1,0),a.lookAt(new h(1,0,0)),this.add(a);var o=new Nt(n,r,t,e);o.up.set(0,-1,0),o.lookAt(new h(-1,0,0)),this.add(o);var c=new Nt(n,r,t,e);c.up.set(0,0,1),c.lookAt(new h(0,1,0)),this.add(c);var l=new Nt(n,r,t,e);l.up.set(0,0,-1),l.lookAt(new h(0,-1,0)),this.add(l);var u=new Nt(n,r,t,e);u.up.set(0,-1,0),u.lookAt(new h(0,0,1)),this.add(u);var p=new Nt(n,r,t,e);p.up.set(0,-1,0),p.lookAt(new h(0,0,-1)),this.add(p);var d={format:Ka,magFilter:Da,minFilter:Da};this.renderTarget=new s(i,i,d),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var i=this.renderTarget,n=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,i.activeCubeFace=0,t.render(e,a,i),i.activeCubeFace=1,t.render(e,o,i),i.activeCubeFace=2,t.render(e,c,i),i.activeCubeFace=3,t.render(e,l,i),i.activeCubeFace=4,t.render(e,u,i),i.texture.generateMipmaps=n,i.activeCubeFace=5,t.render(e,p,i),t.setRenderTarget(null)}}function _n(){ht.call(this),this.type="AudioListener",this.context=vn(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function bn(t){ht.call(this),this.type="Audio",this.context=t.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function wn(t){bn.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Mn(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function En(t,e,i){this.binding=t,this.valueSize=i;var n,r=Float64Array;switch(e){case"quaternion":n=this._slerp;break;case"string":case"bool":r=Array,n=this._select;break;default:n=this._lerp}this.buffer=new r(4*i),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Tn(t,e,i){this.path=e,this.parsedPath=i||Tn.parseTrackName(e),this.node=Tn.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Sn(t){this.uuid=Fo.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var i=0,n=arguments.length;i!==n;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function An(t,e,i){this._mixer=t,this._clip=e,this._localRoot=i||null;for(var n=e.tracks,r=n.length,a=new Array(r),o={endingStart:bo,endingEnd:bo},s=0;s!==r;++s){var c=n[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=vo,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Ln(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Rn(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Pn(){Rt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Cn(t,e,i,n){this.uuid=Fo.generateUUID(),this.data=t,this.itemSize=e,this.offset=i,this.normalized=n===!0}function In(t,e){this.uuid=Fo.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Un(t,e,i){In.call(this,t,e),this.meshPerAttribute=i||1}function Nn(t,e,i){mt.call(this,t,e),this.meshPerAttribute=i||1}function Dn(t,e,i,n){this.ray=new ot(t,e),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function On(t,e){return t.distance-e.distance}function Fn(t,e,i,n){if(t.visible!==!1&&(t.raycast(e,i),n===!0))for(var r=t.children,a=0,o=r.length;a<o;a++)Fn(r[a],e,i,!0)}function Bn(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function zn(t){function e(t,e,i,n,r,a,o){var s=.5*(i-t),c=.5*(n-e);return(2*(e-i)+s+c)*o+(-3*(e-i)-2*s-c)*a+s*r+e}this.points=t;var i,n,r,a,o,s,c,l,u,p=[],d={x:0,y:0,z:0};this.initFromArray=function(t){this.points=[];for(var e=0;e<t.length;e++)this.points[e]={x:t[e][0],y:t[e][1],z:t[e][2]}},this.getPoint=function(t){return i=(this.points.length-1)*t,n=Math.floor(i),r=i-n,p[0]=0===n?n:n-1,p[1]=n,p[2]=n>this.points.length-2?this.points.length-1:n+1,p[3]=n>this.points.length-3?this.points.length-1:n+2,s=this.points[p[0]],c=this.points[p[1]],l=this.points[p[2]],u=this.points[p[3]],a=r*r,o=r*a,d.x=e(s.x,c.x,l.x,u.x,r,a,o),d.y=e(s.y,c.y,l.y,u.y,r,a,o),d.z=e(s.z,c.z,l.z,u.z,r,a,o),d},this.getControlPointsArray=function(){var t,e,i=this.points.length,n=[];for(t=0;t<i;t++)e=this.points[t],n[t]=[e.x,e.y,e.z];return n},this.getLength=function(t){var e,i,n,r,a=0,o=0,s=0,c=new h,l=new h,u=[],p=0;for(u[0]=0,t||(t=100),n=this.points.length*t,c.copy(this.points[0]),e=1;e<n;e++)i=e/n,r=this.getPoint(i),l.copy(r),p+=l.distanceTo(c),c.copy(r),a=(this.points.length-1)*i,o=Math.floor(a),o!==s&&(u[o]=p,s=o);return u[u.length]=p,{chunks:u,total:p}},this.reparametrizeByArcLength=function(t){var e,i,n,r,a,o,s,c,l=[],u=new h,p=this.getLength();for(l.push(u.copy(this.points[0]).clone()),e=1;e<this.points.length;e++){for(o=p.chunks[e]-p.chunks[e-1],s=Math.ceil(t*o/p.total),r=(e-1)/(this.points.length-1),a=e/(this.points.length-1),i=1;i<s-1;i++)n=r+i*(1/s)*(a-r),c=this.getPoint(n),l.push(u.copy(c).clone());l.push(u.copy(this.points[e]).clone())}this.points=l}}function Gn(t,e,i){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==i?i:0,this}function Hn(t,e){Pt.call(this,t,e),this.animationsMap={},this.animationsList=[];var i=this.geometry.morphTargets.length,n="__default",r=0,a=i-1,o=i/1;this.createAnimation(n,r,a,o),this.setAnimationWeight(n,1)}function Vn(t){ht.call(this),this.material=t,this.render=function(t){}}function kn(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16711680,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var c=new Rt,h=new Mt(2*o*3,3);c.addAttribute("position",h),we.call(this,c,new _e({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function jn(t){ht.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new Rt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],n=0,r=1,a=32;n<a;n++,r++){var o=n/a*Math.PI*2,s=r/a*Math.PI*2;i.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}e.addAttribute("position",new Mt(i,3));var c=new _e({fog:!1});this.cone=new we(e,c),this.add(this.cone),this.update()}function Wn(t){this.bones=this.getBoneList(t);for(var e=new St,i=0;i<this.bones.length;i++){var n=this.bones[i];n.parent&&n.parent.isBone&&(e.vertices.push(new h),e.vertices.push(new h),e.colors.push(new X(0,0,1)),e.colors.push(new X(0,1,0)))}e.dynamic=!0;var r=new _e({vertexColors:Ur,depthTest:!1,depthWrite:!1,transparent:!0});we.call(this,e,r),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Xn(t,e){this.light=t,this.light.updateMatrixWorld();var i=new Qe(e,4,2),n=new ft({wireframe:!0,fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),Pt.call(this,i,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function Yn(t,e){ht.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new X,new X];var i=new Ke(e,4,2);i.rotateX(-Math.PI/2);for(var n=0,r=8;n<r;n++)i.faces[n].color=this.colors[n<4?0:1];var a=new ft({vertexColors:Ir,wireframe:!0});this.lightSphere=new Pt(i,a),this.add(this.lightSphere),this.update()}function qn(t,e,i,n){e=e||1,i=new X(void 0!==i?i:4473924),n=new X(void 0!==n?n:8947848);for(var r=e/2,a=2*t/e,o=[],s=[],c=0,h=0,l=-t;c<=e;c++,l+=a){o.push(-t,0,l,t,0,l),o.push(l,0,-t,l,0,t);var u=c===r?i:n;u.toArray(s,h),h+=3,u.toArray(s,h),h+=3,u.toArray(s,h),h+=3,u.toArray(s,h),h+=3}var p=new Rt;p.addAttribute("position",new Mt(o,3)),p.addAttribute("color",new Mt(s,3));var d=new _e({vertexColors:Ur});we.call(this,p,d)}function Zn(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16776960,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new Rt,h=new Mt(2*o*3,3);c.addAttribute("position",h),we.call(this,c,new _e({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function Jn(t,e){ht.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var i=new Rt;i.addAttribute("position",new Mt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var n=new _e({fog:!1});this.add(new be(i,n)),i=new Rt,i.addAttribute("position",new Mt([0,0,0,0,0,1],3)),this.add(new be(i,n)),this.update()}function Qn(t){function e(t,e,n){i(t,n),i(e,n)}function i(t,e){n.vertices.push(new h),n.colors.push(new X(e)),void 0===a[t]&&(a[t]=[]),a[t].push(n.vertices.length-1)}var n=new St,r=new _e({color:16777215,vertexColors:Ir}),a={},o=16755200,s=16711680,c=43775,l=16777215,u=3355443;e("n1","n2",o),e("n2","n4",o),e("n4","n3",o),e("n3","n1",o),e("f1","f2",o),e("f2","f4",o),e("f4","f3",o),e("f3","f1",o),e("n1","f1",o),e("n2","f2",o),e("n3","f3",o),e("n4","f4",o),e("p","n1",s),e("p","n2",s),e("p","n3",s),e("p","n4",s),e("u1","u2",c),e("u2","u3",c),e("u3","u1",c),e("c","t",l),e("p","c",u),e("cn1","cn2",u),e("cn3","cn4",u),e("cf1","cf2",u),e("cf3","cf4",u),we.call(this,n,r),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Kn(t,e){var i=void 0!==e?e:8947848;this.object=t,this.box=new tt,Pt.call(this,new pi(1,1,1),new ft({color:i,wireframe:!0}))}function $n(t,e){void 0===e&&(e=16776960);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),r=new Rt;r.setIndex(new mt(i,1)),r.addAttribute("position",new mt(n,3)),we.call(this,r,new _e({color:e})),void 0!==t&&this.update(t)}function tr(t,e,i,n,r,a){ht.call(this),void 0===n&&(n=16776960),void 0===i&&(i=1),void 0===r&&(r=.2*i),void 0===a&&(a=.2*r),this.position.copy(e),this.line=new be(sh,new _e({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Pt(ch,new ft({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,a)}function er(t){t=t||1;var e=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]),i=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),n=new Rt;n.addAttribute("position",new mt(e,3)),n.addAttribute("color",new mt(i,3));var r=new _e({vertexColors:Ur});we.call(this,n,r)}function ir(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),hh.call(this,t),this.type="catmullrom",this.closed=!0}function nr(t,e,i,n,r,a){sn.call(this,t,e,i,i,n,r,a)}function rr(t,e,i,n,r,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new dt(t,e,i,r,a,o)}function ar(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Ee(t,e)}function or(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Ee(t,e)}function sr(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Me(t)}function cr(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Me(t)}function hr(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Me(t)}function lr(t,e,i){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new h(t,e,i)}function ur(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new we(new ai(t.geometry),new _e({color:void 0!==e?e:16777215}))}function pr(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new we(new Pe(t.geometry),new _e({color:void 0!==e?e:16777215}))}function dr(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(t,e){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}function fr(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var n=arguments[i];if(void 0!==n&&null!==n)for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}}(),Object.assign(e.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[t]&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[t]&&i[t].indexOf(e)!==-1},removeEventListener:function(t,e){if(void 0!==this._listeners){var i=this._listeners,n=i[t];if(void 0!==n){var r=n.indexOf(e);r!==-1&&n.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,i=e[t.type];if(void 0!==i){t.target=this;var n=[],r=0,a=i.length;for(r=0;r<a;r++)n[r]=i[r];for(r=0;r<a;r++)n[r].call(this,t)}}}});var mr="82",vr={LEFT:0,MIDDLE:1,RIGHT:2},gr=0,yr=1,xr=2,_r=3,br=0,wr=1,Mr=0,Er=1,Tr=2,Sr=0,Ar=1,Lr=2,Rr=1,Pr=2,Cr=0,Ir=1,Ur=2,Nr=0,Dr=1,Or=2,Fr=3,Br=4,zr=5,Gr={NoBlending:Nr,NormalBlending:Dr,AdditiveBlending:Or,SubtractiveBlending:Fr,MultiplyBlending:Br,CustomBlending:zr},Hr=100,Vr=101,kr=102,jr=103,Wr=104,Xr=200,Yr=201,qr=202,Zr=203,Jr=204,Qr=205,Kr=206,$r=207,ta=208,ea=209,ia=210,na=0,ra=1,aa=2,oa=3,sa=4,ca=5,ha=6,la=7,ua=0,pa=1,da=2,fa=0,ma=1,va=2,ga=3,ya=4,xa=300,_a=301,ba=302,wa=303,Ma=304,Ea=305,Ta=306,Sa=307,Aa={UVMapping:xa,CubeReflectionMapping:_a,CubeRefractionMapping:ba,EquirectangularReflectionMapping:wa,EquirectangularRefractionMapping:Ma,SphericalReflectionMapping:Ea,CubeUVReflectionMapping:Ta,CubeUVRefractionMapping:Sa},La=1e3,Ra=1001,Pa=1002,Ca={RepeatWrapping:La,ClampToEdgeWrapping:Ra,MirroredRepeatWrapping:Pa},Ia=1003,Ua=1004,Na=1005,Da=1006,Oa=1007,Fa=1008,Ba={NearestFilter:Ia,NearestMipMapNearestFilter:Ua,NearestMipMapLinearFilter:Na,LinearFilter:Da,LinearMipMapNearestFilter:Oa,LinearMipMapLinearFilter:Fa},za=1009,Ga=1010,Ha=1011,Va=1012,ka=1013,ja=1014,Wa=1015,Xa=1016,Ya=1017,qa=1018,Za=1019,Ja=1020,Qa=1021,Ka=1022,$a=1023,to=1024,eo=1025,io=$a,no=1026,ro=1027,ao=2001,oo=2002,so=2003,co=2004,ho=2100,lo=2101,uo=2102,po=2103,fo=2151,mo=2200,vo=2201,go=2202,yo=2300,xo=2301,_o=2302,bo=2400,wo=2401,Mo=2402,Eo=0,To=1,So=2,Ao=3e3,Lo=3001,Ro=3007,Po=3002,Co=3003,Io=3004,Uo=3005,No=3006,Do=3200,Oo=3201,Fo={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=new Array(36),n=0;return function(){for(var r=0;r<36;r++)8===r||13===r||18===r||23===r?i[r]="-":14===r?i[r]="4":(n<=2&&(n=33554432+16777216*Math.random()|0),t=15&n,n>>=4,i[r]=e[19===r?3&t|8:t]);return i.join("")}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*(3-2*t))},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*t*(t*(6*t-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Fo.DEG2RAD},radToDeg:function(t){return t*Fo.RAD2DEG},isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t}};i.prototype={constructor:i,isVector2:!0,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new i,e=new i),t.set(n,n),e.set(r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}},n.DEFAULT_IMAGE=void 0,n.DEFAULT_MAPPING=xa,n.prototype={constructor:n,isTexture:!0,set needsUpdate(t){t===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){function e(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var i={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=Fo.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:e(n)}),i.image=n.uuid}return t.textures[this.uuid]=i,i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===xa){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case La:t.x=t.x-Math.floor(t.x);break;case Ra:t.x=t.x<0?0:1;break;case Pa:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case La:t.y=t.y-Math.floor(t.y);break;case Ra:t.y=t.y<0?0:1;break;case Pa:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(n.prototype,e.prototype);var Bo=0;a.prototype={constructor:a,isVector4:!0,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,i,n,r,a=.01,o=.1,s=t.elements,c=s[0],h=s[4],l=s[8],u=s[1],p=s[5],d=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(h-u)<a&&Math.abs(l-f)<a&&Math.abs(d-m)<a){if(Math.abs(h+u)<o&&Math.abs(l+f)<o&&Math.abs(d+m)<o&&Math.abs(c+p+v-3)<o)return this.set(1,0,0,0),this;e=Math.PI;var g=(c+1)/2,y=(p+1)/2,x=(v+1)/2,_=(h+u)/4,b=(l+f)/4,w=(d+m)/4;return g>y&&g>x?g<a?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(g),n=_/i,r=b/i):y>x?y<a?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(y),i=_/n,r=w/n):x<a?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(x),i=b/r,n=w/r),this.set(i,n,r,e),this}var M=Math.sqrt((m-d)*(m-d)+(l-f)*(l-f)+(u-h)*(u-h));return Math.abs(M)<.001&&(M=1),this.x=(m-d)/M,this.y=(l-f)/M,this.z=(u-h)/M,this.w=Math.acos((c+p+v-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new a,e=new a),t.set(i,i,i,i),e.set(n,n,n,n),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this.w=t.array[e+3],this}},Object.assign(o.prototype,e.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.isWebGLRenderTargetCube=!0,c.prototype={constructor:c,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback();
7
+ },get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if((t&&t.isEuler)===!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=Math.cos(t._x/2),n=Math.cos(t._y/2),r=Math.cos(t._z/2),a=Math.sin(t._x/2),o=Math.sin(t._y/2),s=Math.sin(t._z/2),c=t.order;return"XYZ"===c?(this._x=a*n*r+i*o*s,this._y=i*o*r-a*n*s,this._z=i*n*s+a*o*r,this._w=i*n*r-a*o*s):"YXZ"===c?(this._x=a*n*r+i*o*s,this._y=i*o*r-a*n*s,this._z=i*n*s-a*o*r,this._w=i*n*r+a*o*s):"ZXY"===c?(this._x=a*n*r-i*o*s,this._y=i*o*r+a*n*s,this._z=i*n*s+a*o*r,this._w=i*n*r-a*o*s):"ZYX"===c?(this._x=a*n*r-i*o*s,this._y=i*o*r+a*n*s,this._z=i*n*s-a*o*r,this._w=i*n*r+a*o*s):"YZX"===c?(this._x=a*n*r+i*o*s,this._y=i*o*r+a*n*s,this._z=i*n*s-a*o*r,this._w=i*n*r-a*o*s):"XZY"===c&&(this._x=a*n*r-i*o*s,this._y=i*o*r-a*n*s,this._z=i*n*s+a*o*r,this._w=i*n*r+a*o*s),e!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.elements,n=i[0],r=i[4],a=i[8],o=i[1],s=i[5],c=i[9],h=i[2],l=i[6],u=i[10],p=n+s+u;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(l-c)*e,this._y=(a-h)*e,this._z=(o-r)*e):n>s&&n>u?(e=2*Math.sqrt(1+n-s-u),this._w=(l-c)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(a+h)/e):s>u?(e=2*Math.sqrt(1+s-n-u),this._w=(a-h)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(c+l)/e):(e=2*Math.sqrt(1+u-n-s),this._w=(o-r)/e,this._x=(a+h)/e,this._y=(c+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e,i=1e-6;return function(n,r){return void 0===t&&(t=new h),e=n.dot(r)+1,e<i?(e=0,Math.abs(n.x)>Math.abs(n.z)?t.set(-n.y,n.x,0):t.set(0,-n.z,n.y)):t.crossVectors(n,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,s=e._y,c=e._z,h=e._w;return this._x=i*h+a*o+n*c-r*s,this._y=n*h+a*s+r*o-i*c,this._z=r*h+a*c+i*s-n*o,this._w=a*h-i*o-n*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,a=this._w,o=a*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,o),h=Math.sin((1-e)*c)/s,l=Math.sin(e*c)/s;return this._w=a*h+this._w*l,this._x=i*h+this._x*l,this._y=n*h+this._y*l,this._z=r*h+this._z*l,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(c,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,a,o){var s=i[n+0],c=i[n+1],h=i[n+2],l=i[n+3],u=r[a+0],p=r[a+1],d=r[a+2],f=r[a+3];if(l!==f||s!==u||c!==p||h!==d){var m=1-o,v=s*u+c*p+h*d+l*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,v*g);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x}var b=o*g;if(s=s*m+u*b,c=c*m+p*b,h=h*m+d*b,l=l*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=w,c*=w,h*=w,l*=w}}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=l}}),h.prototype={constructor:h,isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return(e&&e.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new c),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,i){return void 0===t&&(t=new c),this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12],this.y=r[1]*e+r[5]*i+r[9]*n+r[13],this.z=r[2]*e+r[6]*i+r[10]*n+r[14],this},applyProjection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*n-o*i,h=s*i+o*e-r*n,l=s*n+r*i-a*e,u=-r*e-a*i-o*n;return this.x=c*s+u*-r+h*-o-l*-a,this.y=h*s+u*-a+l*-r-c*-o,this.z=l*s+u*-o+c*-a-h*-r,this},project:function(){var t;return function(e){return void 0===t&&(t=new l),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new l),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new h,e=new h),t.set(i,i,i),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var i=this.x,n=this.y,r=this.z;return this.x=n*t.z-r*t.y,this.y=r*t.x-i*t.z,this.z=i*t.y-n*t.x,this},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new h),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new h),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Fo.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var i=t;t=e,e=i}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},l.prototype={constructor:l,isMatrix4:!0,set:function(t,e,i,n,r,a,o,s,c,h,l,u,p,d,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=n,v[1]=r,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=h,v[10]=l,v[14]=u,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new l).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new h);var i=this.elements,n=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),a=1/t.setFromMatrixColumn(e,1).length(),o=1/t.setFromMatrixColumn(e,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[4]=n[4]*a,i[5]=n[5]*a,i[6]=n[6]*a,i[8]=n[8]*o,i[9]=n[9]*o,i[10]=n[10]*o,this}}(),makeRotationFromEuler:function(t){(t&&t.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),c=Math.sin(n),h=Math.cos(r),l=Math.sin(r);if("XYZ"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=-s*l,e[8]=c,e[1]=p+d*c,e[5]=u-f*c,e[9]=-o*s,e[2]=f-u*c,e[6]=d+p*c,e[10]=a*s}else if("YXZ"===t.order){var m=s*h,v=s*l,g=c*h,y=c*l;e[0]=m+y*o,e[4]=g*o-v,e[8]=a*c,e[1]=a*l,e[5]=a*h,e[9]=-o,e[2]=v*o-g,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){var m=s*h,v=s*l,g=c*h,y=c*l;e[0]=m-y*o,e[4]=-a*l,e[8]=g+v*o,e[1]=v+g*o,e[5]=a*h,e[9]=y-m*o,e[2]=-a*c,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var u=a*h,p=a*l,d=o*h,f=o*l;e[0]=s*h,e[4]=d*c-p,e[8]=u*c+f,e[1]=s*l,e[5]=f*c+u,e[9]=p*c-d,e[2]=-c,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var x=a*s,_=a*c,b=o*s,w=o*c;e[0]=s*h,e[4]=w-x*l,e[8]=b*l+_,e[1]=l,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=_*l+b,e[10]=x-w*l}else if("XZY"===t.order){var x=a*s,_=a*c,b=o*s,w=o*c;e[0]=s*h,e[4]=-l,e[8]=c*h,e[1]=x*l+w,e[5]=a*h,e[9]=_*l-b,e[2]=b*l-_,e[6]=o*h,e[10]=w*l+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z,a=t.w,o=i+i,s=n+n,c=r+r,h=i*o,l=i*s,u=i*c,p=n*s,d=n*c,f=r*c,m=a*o,v=a*s,g=a*c;return e[0]=1-(p+f),e[4]=l-g,e[8]=u+v,e[1]=l+g,e[5]=1-(h+f),e[9]=d-m,e[2]=u-v,e[6]=d+m,e[10]=1-(h+p),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,i;return function(n,r,a){void 0===t&&(t=new h,e=new h,i=new h);var o=this.elements;return i.subVectors(n,r).normalize(),0===i.lengthSq()&&(i.z=1),t.crossVectors(a,i).normalize(),0===t.lengthSq()&&(i.z+=1e-4,t.crossVectors(a,i).normalize()),e.crossVectors(i,t),o[0]=t.x,o[4]=e.x,o[8]=i.x,o[1]=t.y,o[5]=e.y,o[9]=i.y,o[2]=t.z,o[6]=e.z,o[10]=i.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],h=i[1],l=i[5],u=i[9],p=i[13],d=i[2],f=i[6],m=i[10],v=i[14],g=i[3],y=i[7],x=i[11],_=i[15],b=n[0],w=n[4],M=n[8],E=n[12],T=n[1],S=n[5],A=n[9],L=n[13],R=n[2],P=n[6],C=n[10],I=n[14],U=n[3],N=n[7],D=n[11],O=n[15];return r[0]=a*b+o*T+s*R+c*U,r[4]=a*w+o*S+s*P+c*N,r[8]=a*M+o*A+s*C+c*D,r[12]=a*E+o*L+s*I+c*O,r[1]=h*b+l*T+u*R+p*U,r[5]=h*w+l*S+u*P+p*N,r[9]=h*M+l*A+u*C+p*D,r[13]=h*E+l*L+u*I+p*O,r[2]=d*b+f*T+m*R+v*U,r[6]=d*w+f*S+m*P+v*N,r[10]=d*M+f*A+m*C+v*D,r[14]=d*E+f*L+m*I+v*O,r[3]=g*b+y*T+x*R+_*U,r[7]=g*w+y*S+x*P+_*N,r[11]=g*M+y*A+x*C+_*D,r[15]=g*E+y*L+x*I+_*O,this},multiplyToArray:function(t,e,i){var n=this.elements;return this.multiplyMatrices(t,e),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],i[9]=n[9],i[10]=n[10],i[11]=n[11],i[12]=n[12],i[13]=n[13],i[14]=n[14],i[15]=n[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new h),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,a=i;r<n;r+=3,a+=3)t.fromArray(e,a),t.applyMatrix4(this),t.toArray(e,a);return e}}(),applyToBuffer:function(){var t;return function(e,i,n){void 0===t&&(t=new h),void 0===i&&(i=0),void 0===n&&(n=e.length/e.itemSize);for(var r=0,a=i;r<n;r++,a++)t.x=e.getX(a),t.y=e.getY(a),t.z=e.getZ(a),t.applyMatrix4(this),e.setXYZ(a,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],o=t[5],s=t[9],c=t[13],h=t[2],l=t[6],u=t[10],p=t[14],d=t[3],f=t[7],m=t[11],v=t[15];return d*(+r*s*l-n*c*l-r*o*u+i*c*u+n*o*p-i*s*p)+f*(+e*s*p-e*c*u+r*a*u-n*a*p+n*c*h-r*s*h)+m*(+e*c*l-e*o*p-r*a*l+i*a*p+r*o*h-i*c*h)+v*(-n*o*h-e*s*l+e*o*u+n*a*l-i*a*u+i*s*h)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new h),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var i=this.elements,n=t.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],h=n[5],l=n[6],u=n[7],p=n[8],d=n[9],f=n[10],m=n[11],v=n[12],g=n[13],y=n[14],x=n[15],_=d*y*u-g*f*u+g*l*m-h*y*m-d*l*x+h*f*x,b=v*f*u-p*y*u-v*l*m+c*y*m+p*l*x-c*f*x,w=p*g*u-v*d*u+v*h*m-c*g*m-p*h*x+c*d*x,M=v*d*l-p*g*l-v*h*f+c*g*f+p*h*y-c*d*y,E=r*_+a*b+o*w+s*M;if(0===E){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e===!0)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return i[0]=_*S,i[1]=(g*f*s-d*y*s-g*o*m+a*y*m+d*o*x-a*f*x)*S,i[2]=(h*y*s-g*l*s+g*o*u-a*y*u-h*o*x+a*l*x)*S,i[3]=(d*l*s-h*f*s-d*o*u+a*f*u+h*o*m-a*l*m)*S,i[4]=b*S,i[5]=(p*y*s-v*f*s+v*o*m-r*y*m-p*o*x+r*f*x)*S,i[6]=(v*l*s-c*y*s-v*o*u+r*y*u+c*o*x-r*l*x)*S,i[7]=(c*f*s-p*l*s+p*o*u-r*f*u-c*o*m+r*l*m)*S,i[8]=w*S,i[9]=(v*d*s-p*g*s-v*a*m+r*g*m+p*a*x-r*d*x)*S,i[10]=(c*g*s-v*h*s+v*a*u-r*g*u-c*a*x+r*h*x)*S,i[11]=(p*h*s-c*d*s-p*a*u+r*d*u+c*a*m-r*h*m)*S,i[12]=M*S,i[13]=(p*g*o-v*d*o+v*a*f-r*g*f-p*a*y+r*d*y)*S,i[14]=(v*h*o-c*g*o-v*a*l+r*g*l+c*a*y-r*h*y)*S,i[15]=(c*d*o-p*h*o+p*a*l-r*d*l-c*a*f+r*h*f)*S,this},scale:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))},makeTranslation:function(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,o=t.y,s=t.z,c=r*a,h=r*o;return this.set(c*a+i,c*o-n*s,c*s+n*o,0,c*o+n*s,h*o+i,h*s-n*a,0,c*s-n*o,h*s+n*a,r*s*s+i,0,0,0,0,1),this},makeScale:function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},compose:function(t,e,i){return this.makeRotationFromQuaternion(e),this.scale(i),this.setPosition(t),this},decompose:function(){var t,e;return function(i,n,r){void 0===t&&(t=new h,e=new l);var a=this.elements,o=t.set(a[0],a[1],a[2]).length(),s=t.set(a[4],a[5],a[6]).length(),c=t.set(a[8],a[9],a[10]).length(),u=this.determinant();u<0&&(o=-o),i.x=a[12],i.y=a[13],i.z=a[14],e.elements.set(this.elements);var p=1/o,d=1/s,f=1/c;return e.elements[0]*=p,e.elements[1]*=p,e.elements[2]*=p,e.elements[4]*=d,e.elements[5]*=d,e.elements[6]*=d,e.elements[8]*=f,e.elements[9]*=f,e.elements[10]*=f,n.setFromRotationMatrix(e),r.x=o,r.y=s,r.z=c,this}}(),makeFrustum:function(t,e,i,n,r,a){var o=this.elements,s=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),l=(n+i)/(n-i),u=-(a+r)/(a-r),p=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(t,e,i,n){var r=i*Math.tan(Fo.DEG2RAD*t*.5),a=-r,o=a*e,s=r*e;return this.makeFrustum(o,s,a,r,i,n)},makeOrthographic:function(t,e,i,n,r,a){var o=this.elements,s=1/(e-t),c=1/(i-n),h=1/(a-r),l=(e+t)*s,u=(i+n)*c,p=(a+r)*h;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-l,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}},u.prototype=Object.create(n.prototype),u.prototype.constructor=u,u.prototype.isCubeTexture=!0,Object.defineProperty(u.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var zo=new n,Go=new u,Ho=[],Vo=[];V.prototype.setValue=function(t,e){for(var i=this.seq,n=0,r=i.length;n!==r;++n){var a=i[n];a.setValue(t,e[a.id])}};var ko=/([\w\d_]+)(\])?(\[|\.)?/g;W.prototype.setValue=function(t,e,i){var n=this.map[e];void 0!==n&&n.setValue(t,i,this.renderer)},W.prototype.set=function(t,e,i){var n=this.map[i];void 0!==n&&n.setValue(t,e[i],this.renderer)},W.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},W.upload=function(t,e,i,n){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=i[o.id];s.needsUpdate!==!1&&o.setValue(t,s.value,n)}},W.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var a=t[n];a.id in e&&i.push(a)}return i};var jo={merge:function(t){for(var e={},i=0;i<t.length;i++){var n=this.clone(t[i]);for(var r in n)e[r]=n[r]}return e},clone:function(t){var e={};for(var i in t){e[i]={};for(var n in t[i]){var r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}},Wo="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",Xo="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",Yo="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",qo="#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",Zo="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",Jo="\nvec3 transformed = vec3( position );\n",Qo="\nvec3 objectNormal = vec3( normal );\n",Ko="bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n\treturn any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",$o="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",ts="#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",es="#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",is="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",ns="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",rs="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",as="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",os="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",ss="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",cs="#define PI 3.14159265359\n#define PI2 6.28318530718\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n",hs="#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",ls="#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",us="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",ps="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",ds="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",fs="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",ms=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",vs="\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n 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.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n 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.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n",gs="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",ys="#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",xs="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",_s="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",bs="#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",ws="#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",Ms="#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",Es="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",Ts="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",Ss="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tif ( testLightInRange( lightDistance, pointLight.distance ) ) {\n\t\t\tdirectLight.color = pointLight.color;\n\t\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#include <normal_flip>\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\t#include <normal_flip>\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",As="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",Ls="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",Rs="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",Ps="struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",Cs="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t \tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\t\t\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",Is="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",Us="#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",Ns="#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",Ds="#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",Os="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",Fs="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",Bs="#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",zs="#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",Gs="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",Hs="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",Vs="#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",ks="#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",js="#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",Ws="#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",Xs="#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",Ys="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",qs="vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",Zs="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",Js="#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",Qs="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",Ks="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",$s="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",tc="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",ec="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",ic="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",nc="#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",rc="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",ac="#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",oc="#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",sc="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",cc="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",hc="#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",lc="#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uc="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",pc="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",dc="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",fc="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",mc="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",vc="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",gc="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",yc="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",xc="varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",_c="#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",bc="#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",wc="uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",Mc="varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",Ec="uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",Tc="varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",Sc="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",Ac="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",Lc="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",Rc="#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n}\n",Pc="uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",Cc="#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n}\n",Ic="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",Uc="#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n}\n",Nc="#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",Dc="#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n",Oc="uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n\t#include <logdepthbuf_fragment>\n}\n",Fc="varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",Bc="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",zc="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n",Gc="uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",Hc="#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n",Vc={
8
+ alphamap_fragment:Wo,alphamap_pars_fragment:Xo,alphatest_fragment:Yo,aomap_fragment:qo,aomap_pars_fragment:Zo,begin_vertex:Jo,beginnormal_vertex:Qo,bsdfs:Ko,bumpmap_pars_fragment:$o,clipping_planes_fragment:ts,clipping_planes_pars_fragment:es,clipping_planes_pars_vertex:is,clipping_planes_vertex:ns,color_fragment:rs,color_pars_fragment:as,color_pars_vertex:os,color_vertex:ss,common:cs,cube_uv_reflection_fragment:hs,defaultnormal_vertex:ls,displacementmap_pars_vertex:us,displacementmap_vertex:ps,emissivemap_fragment:ds,emissivemap_pars_fragment:fs,encodings_fragment:ms,encodings_pars_fragment:vs,envmap_fragment:gs,envmap_pars_fragment:ys,envmap_pars_vertex:xs,envmap_vertex:_s,fog_fragment:bs,fog_pars_fragment:ws,lightmap_fragment:Ms,lightmap_pars_fragment:Es,lights_lambert_vertex:Ts,lights_pars:Ss,lights_phong_fragment:As,lights_phong_pars_fragment:Ls,lights_physical_fragment:Rs,lights_physical_pars_fragment:Ps,lights_template:Cs,logdepthbuf_fragment:Is,logdepthbuf_pars_fragment:Us,logdepthbuf_pars_vertex:Ns,logdepthbuf_vertex:Ds,map_fragment:Os,map_pars_fragment:Fs,map_particle_fragment:Bs,map_particle_pars_fragment:zs,metalnessmap_fragment:Gs,metalnessmap_pars_fragment:Hs,morphnormal_vertex:Vs,morphtarget_pars_vertex:ks,morphtarget_vertex:js,normal_flip:Ws,normal_fragment:Xs,normalmap_pars_fragment:Ys,packing:qs,premultiplied_alpha_fragment:Zs,project_vertex:Js,roughnessmap_fragment:Qs,roughnessmap_pars_fragment:Ks,shadowmap_pars_fragment:$s,shadowmap_pars_vertex:tc,shadowmap_vertex:ec,shadowmask_pars_fragment:ic,skinbase_vertex:nc,skinning_pars_vertex:rc,skinning_vertex:ac,skinnormal_vertex:oc,specularmap_fragment:sc,specularmap_pars_fragment:cc,tonemapping_fragment:hc,tonemapping_pars_fragment:lc,uv_pars_fragment:uc,uv_pars_vertex:pc,uv_vertex:dc,uv2_pars_fragment:fc,uv2_pars_vertex:mc,uv2_vertex:vc,worldpos_vertex:gc,cube_frag:yc,cube_vert:xc,depth_frag:_c,depth_vert:bc,distanceRGBA_frag:wc,distanceRGBA_vert:Mc,equirect_frag:Ec,equirect_vert:Tc,linedashed_frag:Sc,linedashed_vert:Ac,meshbasic_frag:Lc,meshbasic_vert:Rc,meshlambert_frag:Pc,meshlambert_vert:Cc,meshphong_frag:Ic,meshphong_vert:Uc,meshphysical_frag:Nc,meshphysical_vert:Dc,normal_frag:Oc,normal_vert:Fc,points_frag:Bc,points_vert:zc,shadow_frag:Gc,shadow_vert:Hc};X.prototype={constructor:X,isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function t(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function(e,i,n){if(e=Fo.euclideanModulo(e,1),i=Fo.clamp(i,0,1),n=Fo.clamp(n,0,1),0===i)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+i):n+i-n*i,a=2*n-r;this.r=t(a,r,e+1/3),this.g=t(a,r,e),this.b=t(a,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(o,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var h=i[1],l=h.length;if(3===l)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}if(t&&t.length>0){var h=kc[t];void 0!==h?this.setHex(h):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(){var t=this.r,e=this.g,i=this.b;return this.r=t*t,this.g=e*e,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,i,n=t||{h:0,s:0,l:0},r=this.r,a=this.g,o=this.b,s=Math.max(r,a,o),c=Math.min(r,a,o),h=(c+s)/2;if(c===s)e=0,i=0;else{var l=s-c;switch(i=h<=.5?l/(s+c):l/(2-s-c),s){case r:e=(a-o)/l+(a<o?6:0);break;case a:e=(o-r)/l+2;break;case o:e=(r-a)/l+4}e/=6}return n.h=e,n.s=i,n.l=h,n},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,i){var n=this.getHSL();return n.h+=t,n.s+=e,n.l+=i,this.setHSL(n.h,n.s,n.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}};var kc={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},jc={common:{diffuse:{value:new X(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new a(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new i(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new X(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}}},points:{diffuse:{value:new X(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new a(0,0,1,1)}}},Wc={basic:{uniforms:jo.merge([jc.common,jc.aomap,jc.fog]),vertexShader:Vc.meshbasic_vert,fragmentShader:Vc.meshbasic_frag},lambert:{uniforms:jo.merge([jc.common,jc.aomap,jc.lightmap,jc.emissivemap,jc.fog,jc.lights,{emissive:{value:new X(0)}}]),vertexShader:Vc.meshlambert_vert,fragmentShader:Vc.meshlambert_frag},phong:{uniforms:jo.merge([jc.common,jc.aomap,jc.lightmap,jc.emissivemap,jc.bumpmap,jc.normalmap,jc.displacementmap,jc.fog,jc.lights,{emissive:{value:new X(0)},specular:{value:new X(1118481)},shininess:{value:30}}]),vertexShader:Vc.meshphong_vert,fragmentShader:Vc.meshphong_frag},standard:{uniforms:jo.merge([jc.common,jc.aomap,jc.lightmap,jc.emissivemap,jc.bumpmap,jc.normalmap,jc.displacementmap,jc.roughnessmap,jc.metalnessmap,jc.fog,jc.lights,{emissive:{value:new X(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Vc.meshphysical_vert,fragmentShader:Vc.meshphysical_frag},points:{uniforms:jo.merge([jc.points,jc.fog]),vertexShader:Vc.points_vert,fragmentShader:Vc.points_frag},dashed:{uniforms:jo.merge([jc.common,jc.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Vc.linedashed_vert,fragmentShader:Vc.linedashed_frag},depth:{uniforms:jo.merge([jc.common,jc.displacementmap]),vertexShader:Vc.depth_vert,fragmentShader:Vc.depth_frag},normal:{uniforms:{opacity:{value:1}},vertexShader:Vc.normal_vert,fragmentShader:Vc.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Vc.cube_vert,fragmentShader:Vc.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Vc.equirect_vert,fragmentShader:Vc.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new h}},vertexShader:Vc.distanceRGBA_vert,fragmentShader:Vc.distanceRGBA_frag}};Wc.physical={uniforms:jo.merge([Wc.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Vc.meshphysical_vert,fragmentShader:Vc.meshphysical_frag},Y.prototype={constructor:Y,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new i;return function(e,i){var n=t.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=+(1/0),this.max.x=this.max.y=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){var e=t||new i;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new i;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){var n=e||new i;return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){var n=e||new i;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new i;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},J.prototype={constructor:J,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){t===!0&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var i=t[e];if(void 0!==i){var n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):"overdraw"===e?this[e]=Number(i):this[e]=i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}var i=void 0===t;i&&(t={textures:{},images:{}});var n={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Dr&&(n.blending=this.blending),this.shading!==Pr&&(n.shading=this.shading),this.side!==Sr&&(n.side=this.side),this.vertexColors!==Cr&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,i){var r=e(t.textures),a=e(t.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(J.prototype,e.prototype);var Xc=0;K.prototype=Object.create(J.prototype),K.prototype.constructor=K,K.prototype.isShaderMaterial=!0,K.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=jo.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},K.prototype.toJSON=function(t){var e=J.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},$.prototype=Object.create(J.prototype),$.prototype.constructor=$,$.prototype.isMeshDepthMaterial=!0,$.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},tt.prototype={constructor:tt,isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=+(1/0),i=+(1/0),n=+(1/0),r=-(1/0),a=-(1/0),o=-(1/0),s=0,c=t.length;s<c;s+=3){var h=t[s],l=t[s+1],u=t[s+2];h<e&&(e=h),l<i&&(i=l),u<n&&(n=u),h>r&&(r=h),l>a&&(a=l),u>o&&(o=u)}this.min.set(e,i,n),this.max.set(r,a,o)},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new h;return function(e,i){var n=t.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),setFromObject:function(){var t=new h;return function(e){var i=this;return e.updateMatrixWorld(!0),this.makeEmpty(),e.traverse(function(e){var n=e.geometry;if(void 0!==n)if(n&&n.isGeometry)for(var r=n.vertices,a=0,o=r.length;a<o;a++)t.copy(r[a]),t.applyMatrix4(e.matrixWorld),i.expandByPoint(t);else if(n&&n.isBufferGeometry){var s=n.attributes.position;if(void 0!==s){var c,h,l;s&&s.isInterleavedBufferAttribute?(c=s.data.array,h=s.offset,l=s.data.stride):(c=s.array,h=0,l=3);for(var a=h,o=c.length;a<o;a+=l)t.fromArray(c,a),t.applyMatrix4(e.matrixWorld),i.expandByPoint(t)}}}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=+(1/0),this.max.x=this.max.y=this.max.z=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){var e=t||new h;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new h;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){var i=e||new h;return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new h),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=t.constant&&i>=t.constant},clampPoint:function(t,e){var i=e||new h;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new h;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),getBoundingSphere:function(){var t=new h;return function(e){var i=e||new et;return this.getCenter(i.center),i.radius=.5*this.getSize(t).length(),i}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new h,new h,new h,new h,new h,new h,new h,new h];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},et.prototype={constructor:et,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new tt;return function(e,i){var n=this.center;void 0!==i?n.copy(i):t.setFromPoints(e).getCenter(n);for(var r=0,a=0,o=e.length;a<o;a++)r=Math.max(r,n.distanceToSquared(e[a]));return this.radius=Math.sqrt(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var i=this.center.distanceToSquared(t),n=e||new h;return n.copy(t),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){var e=t||new tt;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},it.prototype={constructor:it,isMatrix3:!0,set:function(t,e,i,n,r,a,o,s,c){var h=this.elements;return h[0]=t,h[1]=n,h[2]=o,h[3]=e,h[4]=r,h[5]=s,h[6]=i,h[7]=a,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new h),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,a=i;r<n;r+=3,a+=3)t.fromArray(e,a),t.applyMatrix3(this),t.toArray(e,a);return e}}(),applyToBuffer:function(){var t;return function(e,i,n){void 0===t&&(t=new h),void 0===i&&(i=0),void 0===n&&(n=e.length/e.itemSize);for(var r=0,a=i;r<n;r++,a++)t.x=e.getX(a),t.y=e.getY(a),t.z=e.getZ(a),t.applyMatrix3(this),e.setXYZ(a,t.x,t.y,t.z);return e}}(),multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-i*r*h+i*o*s+n*r*c-n*a*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var i=t.elements,n=this.elements,r=i[0],a=i[1],o=i[2],s=i[3],c=i[4],h=i[5],l=i[6],u=i[7],p=i[8],d=p*c-h*u,f=h*l-p*s,m=u*s-c*l,v=r*d+a*f+o*m;if(0===v){var g="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(e===!0)throw new Error(g);return console.warn(g),this.identity()}var y=1/v;return n[0]=d*y,n[1]=(o*u-p*a)*y,n[2]=(h*a-o*c)*y,n[3]=f*y,n[4]=(p*r-o*l)*y,n[5]=(o*s-h*r)*y,n[6]=m*y,n[7]=(a*l-u*r)*y,n[8]=(c*r-a*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(t,e)},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}},nt.prototype={constructor:nt,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new h,e=new h;return function(i,n,r){var a=t.subVectors(r,n).cross(e.subVectors(i,n)).normalize();return this.setFromNormalAndCoplanarPoint(a,i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var i=this.distanceToPoint(t),n=e||new h;return n.copy(this.normal).multiplyScalar(i)},intersectLine:function(){var t=new h;return function(e,i){var n=i||new h,r=e.delta(t),a=this.normal.dot(r);if(0!==a){var o=-(e.start.dot(this.normal)+this.constant)/a;if(!(o<0||o>1))return n.copy(r).multiplyScalar(o).add(e.start)}else if(0===this.distanceToPoint(e.start))return n.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){var e=t||new h;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new h,e=new it;return function(i,n){var r=this.coplanarPoint(t).applyMatrix4(i),a=n||e.getNormalMatrix(i),o=this.normal.applyMatrix3(a).normalize();return this.constant=-r.dot(o),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},rt.prototype={constructor:rt,set:function(t,e,i,n,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this;
9
+ },setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],v=i[13],g=i[14],y=i[15];return e[0].setComponents(o-n,l-s,f-u,y-m).normalize(),e[1].setComponents(o+n,l+s,f+u,y+m).normalize(),e[2].setComponents(o+r,l+c,f+p,y+v).normalize(),e[3].setComponents(o-r,l-c,f-p,y-v).normalize(),e[4].setComponents(o-a,l-h,f-d,y-g).normalize(),e[5].setComponents(o+a,l+h,f+d,y+g).normalize(),this},intersectsObject:function(){var t=new et;return function(e){var i=e.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),t.copy(i.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new et;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){var a=e[r].distanceToPoint(i);if(a<n)return!1}return!0},intersectsBox:function(){var t=new h,e=new h;return function(i){for(var n=this.planes,r=0;r<6;r++){var a=n[r];t.x=a.normal.x>0?i.min.x:i.max.x,e.x=a.normal.x>0?i.max.x:i.min.x,t.y=a.normal.y>0?i.min.y:i.max.y,e.y=a.normal.y>0?i.max.y:i.min.y,t.z=a.normal.z>0?i.min.z:i.max.z,e.z=a.normal.z>0?i.max.z:i.min.z;var o=a.distanceToPoint(t),s=a.distanceToPoint(e);if(o<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}},ot.prototype={constructor:ot,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){var i=e||new h;return i.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new h;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var i=e||new h;i.subVectors(t,this.origin);var n=i.dot(this.direction);return n<0?i.copy(this.origin):i.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new h;return function(e){var i=t.subVectors(e,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(i).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new h,e=new h,i=new h;return function(n,r,a,o){t.copy(n).add(r).multiplyScalar(.5),e.copy(r).sub(n).normalize(),i.copy(this.origin).sub(t);var s,c,h,l,u=.5*n.distanceTo(r),p=-this.direction.dot(e),d=i.dot(this.direction),f=-i.dot(e),m=i.lengthSq(),v=Math.abs(1-p*p);if(v>0)if(s=p*f-d,c=p*d-f,l=u*v,s>=0)if(c>=-l)if(c<=l){var g=1/v;s*=g,c*=g,h=s*(s+p*c+2*d)+c*(p*s+c+2*f)+m}else c=u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;else c<=-l?(s=Math.max(0,-(-p*u+d)),c=s>0?-u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m):c<=l?(s=0,c=Math.min(Math.max(-u,-f),u),h=c*(c+2*f)+m):(s=Math.max(0,-(p*u+d)),c=s>0?u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m);else c=p>0?-u:u,s=Math.max(0,-(p*c+d)),h=-s*s+c*(c+2*f)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(e).multiplyScalar(c).add(t),h}}(),intersectSphere:function(){var t=new h;return function(e,i){t.subVectors(e.center,this.origin);var n=t.dot(this.direction),r=t.dot(t)-n*n,a=e.radius*e.radius;if(r>a)return null;var o=Math.sqrt(a-r),s=n-o,c=n+o;return s<0&&c<0?null:s<0?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);if(0===e)return!0;var i=t.normal.dot(this.direction);return i*e<0},intersectBox:function(t,e){var i,n,r,a,o,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return c>=0?(i=(t.min.x-u.x)*c,n=(t.max.x-u.x)*c):(i=(t.max.x-u.x)*c,n=(t.min.x-u.x)*c),h>=0?(r=(t.min.y-u.y)*h,a=(t.max.y-u.y)*h):(r=(t.max.y-u.y)*h,a=(t.min.y-u.y)*h),i>a||r>n?null:((r>i||i!==i)&&(i=r),(a<n||n!==n)&&(n=a),l>=0?(o=(t.min.z-u.z)*l,s=(t.max.z-u.z)*l):(o=(t.max.z-u.z)*l,s=(t.min.z-u.z)*l),i>s||o>n?null:((o>i||i!==i)&&(i=o),(s<n||n!==n)&&(n=s),n<0?null:this.at(i>=0?i:n,e)))},intersectsBox:function(){var t=new h;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new h,e=new h,i=new h,n=new h;return function(r,a,o,s,c){e.subVectors(a,r),i.subVectors(o,r),n.crossVectors(e,i);var h,l=this.direction.dot(n);if(l>0){if(s)return null;h=1}else{if(!(l<0))return null;h=-1,l=-l}t.subVectors(this.origin,r);var u=h*this.direction.dot(i.crossVectors(t,i));if(u<0)return null;var p=h*this.direction.dot(e.cross(t));if(p<0)return null;if(u+p>l)return null;var d=-h*t.dot(n);return d<0?null:this.at(d/l,c)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},st.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],st.DefaultOrder="XYZ",st.prototype={constructor:st,isEuler:!0,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var n=Fo.clamp,r=t.elements,a=r[0],o=r[4],s=r[8],c=r[1],h=r[5],l=r[9],u=r[2],p=r[6],d=r[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===e?(this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,h))):"YZX"===e?(this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(p,h),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,i!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,i,n){return void 0===t&&(t=new l),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,i,n)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new c;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new h(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},ct.prototype={constructor:ct,set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)},test:function(t){return 0!==(this.mask&t.mask)}},ht.DefaultUp=new h(0,1,0),ht.DefaultMatrixAutoUpdate=!0,Object.assign(ht.prototype,e.prototype,{isObject3D:!0,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new c;return function(e,i){return t.setFromAxisAngle(e,i),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new h(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new h(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new h(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new h;return function(e,i){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(i)),this}}(),translateX:function(){var t=new h(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new h(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new h(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new l;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new l;return function(e){t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var i=this.children.indexOf(t);i!==-1&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(i,1))},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var i=0,n=this.children.length;i<n;i++){var r=this.children[i],a=r.getObjectByProperty(t,e);if(void 0!==a)return a}},getWorldPosition:function(t){var e=t||new h;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new h,e=new h;return function(i){var n=i||new c;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,n,e),n}}(),getWorldRotation:function(){var t=new c;return function(e){var i=e||new st;return this.getWorldQuaternion(t),i.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new h,e=new c;return function(i){var n=i||new h;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,n),n}}(),getWorldDirection:function(){var t=new c;return function(e){var i=e||new h;return this.getWorldQuaternion(t),i.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverse(t)},traverseVisible:function(t){if(this.visible!==!1){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate===!0&&this.updateMatrix(),this.matrixWorldNeedsUpdate!==!0&&t!==!0||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)},toJSON:function(t){function e(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}var i=void 0===t||""===t,n={};i&&(t={geometries:{},materials:{},textures:{},images:{}},n.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var r={};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),r.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===t.geometries[this.geometry.uuid]&&(t.geometries[this.geometry.uuid]=this.geometry.toJSON(t)),r.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===t.materials[this.material.uuid]&&(t.materials[this.material.uuid]=this.material.toJSON(t)),r.material=this.material.uuid),this.children.length>0){r.children=[];for(var a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(t).object)}if(i){var o=e(t.geometries),s=e(t.materials),c=e(t.textures),h=e(t.images);o.length>0&&(n.geometries=o),s.length>0&&(n.materials=s),c.length>0&&(n.textures=c),h.length>0&&(n.images=h)}return n.object=r,n},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(var i=0;i<t.children.length;i++){var n=t.children[i];this.add(n.clone())}return this}});var Yc=0;ut.prototype={constructor:ut,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){var e=t||new h;return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){var e=t||new h;return e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var i=e||new h;return this.delta(i).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new h,e=new h;return function(i,n){t.subVectors(i,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),a=e.dot(t),o=a/r;return n&&(o=Fo.clamp(o,0,1)),o}}(),closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e),r=i||new h;return this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},pt.normal=function(){var t=new h;return function(e,i,n,r){var a=r||new h;a.subVectors(n,i),t.subVectors(e,i),a.cross(t);var o=a.lengthSq();return o>0?a.multiplyScalar(1/Math.sqrt(o)):a.set(0,0,0)}}(),pt.barycoordFromPoint=function(){var t=new h,e=new h,i=new h;return function(n,r,a,o,s){t.subVectors(o,r),e.subVectors(a,r),i.subVectors(n,r);var c=t.dot(t),l=t.dot(e),u=t.dot(i),p=e.dot(e),d=e.dot(i),f=c*p-l*l,m=s||new h;if(0===f)return m.set(-2,-1,-1);var v=1/f,g=(p*u-l*d)*v,y=(c*d-l*u)*v;return m.set(1-g-y,y,g)}}(),pt.containsPoint=function(){var t=new h;return function(e,i,n,r){var a=pt.barycoordFromPoint(e,i,n,r,t);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}(),pt.prototype={constructor:pt,set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new h,e=new h;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){var e=t||new h;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return pt.normal(this.a,this.b,this.c,t)},plane:function(t){var e=t||new nt;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return pt.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return pt.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,i,n;return function(r,a){void 0===t&&(t=new nt,e=[new ut,new ut,new ut],i=new h,n=new h);var o=a||new h,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,i),this.containsPoint(i)===!0)o.copy(i);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c<e.length;c++){e[c].closestPointToPoint(i,!0,n);var l=i.distanceToSquared(n);l<s&&(s=l,o.copy(n))}}return o}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},dt.prototype={constructor:dt,clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(var e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}},ft.prototype=Object.create(J.prototype),ft.prototype.constructor=ft,ft.prototype.isMeshBasicMaterial=!0,ft.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},mt.prototype={constructor:mt,isBufferAttribute:!0,set needsUpdate(t){t===!0&&this.version++},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.itemSize:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new X),e[i++]=a.r,e[i++]=a.g,e[i++]=a.b}return this},copyIndicesArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];e[i++]=a.a,e[i++]=a.b,e[i++]=a.c}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,r=0,a=t.length;r<a;r++){var o=t[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),o=new i),e[n++]=o.x,e[n++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new h),e[i++]=a.x,e[i++]=a.y,e[i++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var o=t[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),o=new a),e[i++]=o.x,e[i++]=o.y,e[i++]=o.z,e[i++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this},clone:function(){return(new this.constructor).copy(this)}},Object.assign(St.prototype,e.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=(new it).getNormalMatrix(t),i=0,n=this.vertices.length;i<n;i++){var r=this.vertices[i];r.applyMatrix4(t)}for(var i=0,n=this.faces.length;i<n;i++){var a=this.faces[i];a.normal.applyMatrix3(e).normalize();for(var o=0,s=a.vertexNormals.length;o<s;o++)a.vertexNormals[o].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new l),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new l),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new l),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,i,n){return void 0===t&&(t=new l),t.makeTranslation(e,i,n),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,i,n){return void 0===t&&(t=new l),t.makeScale(e,i,n),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new ht),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,i,r){var a=void 0!==s?[p[t].clone(),p[e].clone(),p[i].clone()]:[],o=void 0!==c?[n.colors[t].clone(),n.colors[e].clone(),n.colors[i].clone()]:[],h=new dt(t,e,i,a,o,r);n.faces.push(h),void 0!==l&&n.faceVertexUvs[0].push([d[t].clone(),d[e].clone(),d[i].clone()]),void 0!==u&&n.faceVertexUvs[1].push([f[t].clone(),f[e].clone(),f[i].clone()])}var n=this,r=null!==t.index?t.index.array:void 0,a=t.attributes,o=a.position.array,s=void 0!==a.normal?a.normal.array:void 0,c=void 0!==a.color?a.color.array:void 0,l=void 0!==a.uv?a.uv.array:void 0,u=void 0!==a.uv2?a.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var p=[],d=[],f=[],m=0,v=0;m<o.length;m+=3,v+=2)n.vertices.push(new h(o[m],o[m+1],o[m+2])),void 0!==s&&p.push(new h(s[m],s[m+1],s[m+2])),void 0!==c&&n.colors.push(new X(c[m],c[m+1],c[m+2])),void 0!==l&&d.push(new i(l[v],l[v+1])),void 0!==u&&f.push(new i(u[v],u[v+1]));if(void 0!==r){var g=t.groups;if(g.length>0)for(var m=0;m<g.length;m++)for(var y=g[m],x=y.start,_=y.count,v=x,b=x+_;v<b;v+=3)e(r[v],r[v+1],r[v+2],y.materialIndex);else for(var m=0;m<r.length;m+=3)e(r[m],r[m+1],r[m+2])}else for(var m=0;m<o.length/3;m+=3)e(m,m+1,m+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,i=0===e?1:1/e,n=new l;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var t=new h,e=new h,i=0,n=this.faces.length;i<n;i++){var r=this.faces[i],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,i,n,r,a,o;for(o=new Array(this.vertices.length),e=0,i=this.vertices.length;e<i;e++)o[e]=new h;if(t){var s,c,l,u=new h,p=new h;for(n=0,r=this.faces.length;n<r;n++)a=this.faces[n],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),p.subVectors(s,c),u.cross(p),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),n=0,r=this.faces.length;n<r;n++)a=this.faces[n],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,i=this.vertices.length;e<i;e++)o[e].normalize();for(n=0,r=this.faces.length;n<r;n++){a=this.faces[n];var d=a.vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){i=this.faces[t];var n=i.vertexNormals;3===n.length?(n[0].copy(i.normal),n[1].copy(i.normal),n[2].copy(i.normal)):(n[0]=i.normal.clone(),n[1]=i.normal.clone(),n[2]=i.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i<n;i++)for(r=this.faces[i],r.__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),t=0,e=r.vertexNormals.length;t<e;t++)r.__originalVertexNormals[t]?r.__originalVertexNormals[t].copy(r.vertexNormals[t]):r.__originalVertexNormals[t]=r.vertexNormals[t].clone();var a=new St;for(a.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var o,s,c=this.morphNormals[t].faceNormals,l=this.morphNormals[t].vertexNormals;for(i=0,n=this.faces.length;i<n;i++)o=new h,s={a:new h,b:new h,c:new h},c.push(o),l.push(s)}var u=this.morphNormals[t];a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals();var o,s;for(i=0,n=this.faces.length;i<n;i++)r=this.faces[i],o=u.faceNormals[i],s=u.vertexNormals[i],o.copy(r.normal),s.a.copy(r.vertexNormals[0]),s.b.copy(r.vertexNormals[1]),s.c.copy(r.vertexNormals[2])}for(i=0,n=this.faces.length;i<n;i++)r=this.faces[i],r.normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var t=0,e=this.vertices,i=0,n=e.length;i<n;i++)i>0&&(t+=e[i].distanceTo(e[i-1])),this.lineDistances[i]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new tt),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new et),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if((t&&t.isGeometry)===!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var n,r=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,c=t.faces,h=this.faceVertexUvs[0],l=t.faceVertexUvs[0],u=this.colors,p=t.colors;void 0===i&&(i=0),void 0!==e&&(n=(new it).getNormalMatrix(e));for(var d=0,f=o.length;d<f;d++){var m=o[d],v=m.clone();void 0!==e&&v.applyMatrix4(e),a.push(v)}for(var d=0,f=p.length;d<f;d++)u.push(p[d].clone());for(d=0,f=c.length;d<f;d++){var g,y,x,_=c[d],b=_.vertexNormals,w=_.vertexColors;g=new dt(_.a+r,_.b+r,_.c+r),g.normal.copy(_.normal),void 0!==n&&g.normal.applyMatrix3(n).normalize();for(var M=0,E=b.length;M<E;M++)y=b[M].clone(),void 0!==n&&y.applyMatrix3(n).normalize(),g.vertexNormals.push(y);g.color.copy(_.color);for(var M=0,E=w.length;M<E;M++)x=w[M],g.vertexColors.push(x.clone());g.materialIndex=_.materialIndex+i,s.push(g)}for(d=0,f=l.length;d<f;d++){var T=l[d],S=[];if(void 0!==T){for(var M=0,E=T.length;M<E;M++)S.push(T[M].clone());h.push(S)}}},mergeMesh:function(t){return(t&&t.isMesh)===!1?void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t):(t.matrixAutoUpdate&&t.updateMatrix(),void this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,i,n,r,a,o,s,c={},h=[],l=[],u=4,p=Math.pow(10,u);for(i=0,n=this.vertices.length;i<n;i++)t=this.vertices[i],e=Math.round(t.x*p)+"_"+Math.round(t.y*p)+"_"+Math.round(t.z*p),void 0===c[e]?(c[e]=i,h.push(this.vertices[i]),l[i]=h.length-1):l[i]=l[c[e]];var d=[];for(i=0,n=this.faces.length;i<n;i++){r=this.faces[i],r.a=l[r.a],r.b=l[r.b],r.c=l[r.c],a=[r.a,r.b,r.c];for(var f=-1,m=0;m<3;m++)if(a[m]===a[(m+1)%3]){f=m,d.push(i);break}}for(i=d.length-1;i>=0;i--){var v=d[i];for(this.faces.splice(v,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(v,1)}var g=this.vertices.length-h.length;return this.vertices=h,g},sortFacesByMaterialIndex:function(){function t(t,e){return t.materialIndex-e.materialIndex}for(var e=this.faces,i=e.length,n=0;n<i;n++)e[n]._id=n;e.sort(t);var r,a,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];o&&o.length===i&&(r=[]),s&&s.length===i&&(a=[]);for(var n=0;n<i;n++){var c=e[n]._id;r&&r.push(o[c]),a&&a.push(s[c])}r&&(this.faceVertexUvs[0]=r),a&&(this.faceVertexUvs[1]=a)},toJSON:function(){function t(t,e,i){return i?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==p[e]?p[e]:(p[e]=u.length/3,u.push(t.x,t.y,t.z),p[e])}function i(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==f[e]?f[e]:(f[e]=d.length,d.push(t.getHex()),f[e])}function n(t){var e=t.x.toString()+t.y.toString();return void 0!==v[e]?v[e]:(v[e]=m.length/2,m.push(t.x,t.y),v[e])}var r={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var o in a)void 0!==a[o]&&(r[o]=a[o]);return r}for(var s=[],c=0;c<this.vertices.length;c++){var h=this.vertices[c];s.push(h.x,h.y,h.z)}for(var l=[],u=[],p={},d=[],f={},m=[],v={},c=0;c<this.faces.length;c++){var g=this.faces[c],y=!0,x=!1,_=void 0!==this.faceVertexUvs[0][c],b=g.normal.length()>0,w=g.vertexNormals.length>0,M=1!==g.color.r||1!==g.color.g||1!==g.color.b,E=g.vertexColors.length>0,T=0;if(T=t(T,0,0),T=t(T,1,y),T=t(T,2,x),T=t(T,3,_),T=t(T,4,b),T=t(T,5,w),T=t(T,6,M),T=t(T,7,E),l.push(T),l.push(g.a,g.b,g.c),l.push(g.materialIndex),_){var S=this.faceVertexUvs[0][c];l.push(n(S[0]),n(S[1]),n(S[2]))}if(b&&l.push(e(g.normal)),w){var A=g.vertexNormals;l.push(e(A[0]),e(A[1]),e(A[2]))}if(M&&l.push(i(g.color)),E){var L=g.vertexColors;l.push(i(L[0]),i(L[1]),i(L[2]))}}return r.data={},r.data.vertices=s,r.data.normals=u,d.length>0&&(r.data.colors=d),m.length>0&&(r.data.uvs=[m]),r.data.faces=l,r},clone:function(){return(new St).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]],this.colors=[];for(var e=t.vertices,i=0,n=e.length;i<n;i++)this.vertices.push(e[i].clone());for(var r=t.colors,i=0,n=r.length;i<n;i++)this.colors.push(r[i].clone());
10
+ for(var a=t.faces,i=0,n=a.length;i<n;i++)this.faces.push(a[i].clone());for(var i=0,n=t.faceVertexUvs.length;i<n;i++){var o=t.faceVertexUvs[i];void 0===this.faceVertexUvs[i]&&(this.faceVertexUvs[i]=[]);for(var s=0,c=o.length;s<c;s++){for(var h=o[s],l=[],u=0,p=h.length;u<p;u++){var d=h[u];l.push(d.clone())}this.faceVertexUvs[i].push(l)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var qc=0;Object.assign(Lt.prototype,e.prototype,{computeBoundingBox:St.prototype.computeBoundingBox,computeBoundingSphere:St.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(t){for(var e,i,n=[],r=t.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==i&&(i=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,n.push(e)),e={start:3*a,materialIndex:i})}void 0!==e&&(e.count=3*a-e.start,n.push(e)),this.groups=n},fromGeometry:function(t){var e,n=t.faces,r=t.vertices,a=t.faceVertexUvs,o=a[0]&&a[0].length>0,s=a[1]&&a[1].length>0,c=t.morphTargets,h=c.length;if(h>0){e=[];for(var l=0;l<h;l++)e[l]=[];this.morphTargets.position=e}var u,p=t.morphNormals,d=p.length;if(d>0){u=[];for(var l=0;l<d;l++)u[l]=[];this.morphTargets.normal=u}for(var f=t.skinIndices,m=t.skinWeights,v=f.length===r.length,g=m.length===r.length,l=0;l<n.length;l++){var y=n[l];this.vertices.push(r[y.a],r[y.b],r[y.c]);var x=y.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{var _=y.normal;this.normals.push(_,_,_)}var b=y.vertexColors;if(3===b.length)this.colors.push(b[0],b[1],b[2]);else{var w=y.color;this.colors.push(w,w,w)}if(o===!0){var M=a[0][l];void 0!==M?this.uvs.push(M[0],M[1],M[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new i,new i,new i))}if(s===!0){var M=a[1][l];void 0!==M?this.uvs2.push(M[0],M[1],M[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new i,new i,new i))}for(var E=0;E<h;E++){var T=c[E].vertices;e[E].push(T[y.a],T[y.b],T[y.c])}for(var E=0;E<d;E++){var S=p[E].vertexNormals[l];u[E].push(S.a,S.b,S.c)}v&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.assign(Rt.prototype,e.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e){return(e&&e.isBufferAttribute)===!1&&(e&&e.isInterleavedBufferAttribute)===!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new mt(arguments[1],arguments[2]))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0);var i=this.attributes.normal;if(void 0!==i){var n=(new it).getNormalMatrix(t);n.applyToVector3Array(i.array),i.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new l),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new l),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new l),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,i,n){return void 0===t&&(t=new l),t.makeTranslation(e,i,n),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,i,n){return void 0===t&&(t=new l),t.makeScale(e,i,n),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new ht),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t&&t.isPoints||t&&t.isLine){var i=new Mt(3*e.vertices.length,3),n=new Mt(3*e.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(e.vertices)),this.addAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new Mt(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t&&t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t&&t.isMesh){var i=e.__directGeometry;if(e.elementsNeedUpdate===!0&&(i=void 0,e.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(e);i.verticesNeedUpdate=e.verticesNeedUpdate,i.normalsNeedUpdate=e.normalsNeedUpdate,i.colorsNeedUpdate=e.colorsNeedUpdate,i.uvsNeedUpdate=e.uvsNeedUpdate,i.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=i}var n;return e.verticesNeedUpdate===!0&&(n=this.attributes.position,void 0!==n&&(n.copyVector3sArray(e.vertices),n.needsUpdate=!0),e.verticesNeedUpdate=!1),e.normalsNeedUpdate===!0&&(n=this.attributes.normal,void 0!==n&&(n.copyVector3sArray(e.normals),n.needsUpdate=!0),e.normalsNeedUpdate=!1),e.colorsNeedUpdate===!0&&(n=this.attributes.color,void 0!==n&&(n.copyColorsArray(e.colors),n.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(n=this.attributes.uv,void 0!==n&&(n.copyVector2sArray(e.uvs),n.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(n=this.attributes.lineDistance,void 0!==n&&(n.copyArray(e.lineDistances),n.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Lt).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new mt(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new mt(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new mt(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new mt(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new mt(a,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var o=t.vertices.length>65535?Uint32Array:Uint16Array,s=new o(3*t.indices.length);this.setIndex(new mt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var h=[],l=t.morphTargets[c],u=0,p=l.length;u<p;u++){var d=l[u],f=new Mt(3*d.length,3);h.push(f.copyVector3sArray(d))}this.morphAttributes[c]=h}if(t.skinIndices.length>0){var m=new Mt(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var v=new Mt(4*t.skinWeights.length,4);this.addAttribute("skinWeight",v.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new tt);var t=this.attributes.position.array;void 0!==t?this.boundingBox.setFromArray(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new tt,e=new h;return function(){null===this.boundingSphere&&(this.boundingSphere=new et);var i=this.attributes.position;if(i){var n=i.array,r=this.boundingSphere.center;t.setFromArray(n),t.getCenter(r);for(var a=0,o=0,s=n.length;o<s;o+=3)e.fromArray(n,o),a=Math.max(a,r.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,i=this.groups;if(e.position){var n=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new mt(new Float32Array(n.length),3));else for(var r=e.normal.array,a=0,o=r.length;a<o;a++)r[a]=0;var s,c,l,u=e.normal.array,p=new h,d=new h,f=new h,m=new h,v=new h;if(t){var g=t.array;0===i.length&&this.addGroup(0,g.length);for(var y=0,x=i.length;y<x;++y)for(var _=i[y],b=_.start,w=_.count,a=b,o=b+w;a<o;a+=3)s=3*g[a+0],c=3*g[a+1],l=3*g[a+2],p.fromArray(n,s),d.fromArray(n,c),f.fromArray(n,l),m.subVectors(f,d),v.subVectors(p,d),m.cross(v),u[s]+=m.x,u[s+1]+=m.y,u[s+2]+=m.z,u[c]+=m.x,u[c+1]+=m.y,u[c+2]+=m.z,u[l]+=m.x,u[l+1]+=m.y,u[l+2]+=m.z}else for(var a=0,o=n.length;a<o;a+=9)p.fromArray(n,a),d.fromArray(n,a+3),f.fromArray(n,a+6),m.subVectors(f,d),v.subVectors(p,d),m.cross(v),u[a]=m.x,u[a+1]=m.y,u[a+2]=m.z,u[a+3]=m.x,u[a+4]=m.y,u[a+5]=m.z,u[a+6]=m.x,u[a+7]=m.y,u[a+8]=m.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if((t&&t.isBufferGeometry)===!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0);var i=this.attributes;for(var n in i)if(void 0!==t.attributes[n])for(var r=i[n],a=r.array,o=t.attributes[n],s=o.array,c=o.itemSize,h=0,l=c*e;h<s.length;h++,l++)a[l]=s[h];return this},normalizeNormals:function(){for(var t,e,i,n,r=this.attributes.normal.array,a=0,o=r.length;a<o;a+=3)t=r[a],e=r[a+1],i=r[a+2],n=1/Math.sqrt(t*t+e*e+i*i),r[a]*=n,r[a+1]*=n,r[a+2]*=n},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Rt,e=this.index.array,i=this.attributes;for(var n in i){for(var r=i[n],a=r.array,o=r.itemSize,s=new a.constructor(e.length*o),c=0,h=0,l=0,u=e.length;l<u;l++){c=e[l]*o;for(var p=0;p<o;p++)s[h++]=a[c++]}t.addAttribute(n,new mt(s,o))}return t},toJSON:function(){var t={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};var n=this.index;if(null!==n){var r=Array.prototype.slice.call(n.array);t.data.index={type:n.array.constructor.name,array:r}}var a=this.attributes;for(var i in a){var o=a[i],r=Array.prototype.slice.call(o.array);t.data.attributes[i]={itemSize:o.itemSize,type:o.array.constructor.name,array:r,normalized:o.normalized}}var s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new Rt).copy(this)},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var i=t.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var a=t.groups,o=0,s=a.length;o<s;o++){var c=a[o];this.addGroup(c.start,c.count,c.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Rt.MaxIndex=65535,Pt.prototype=Object.assign(Object.create(ht.prototype),{constructor:Pt,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return ht.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){var t=this.geometry.morphTargets;if(void 0!==t&&t.length>0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,i=t.length;e<i;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[t[e].name]=e}},raycast:function(){function t(t,e,i,n,r,a,o){return pt.barycoordFromPoint(t,e,i,n,y),r.multiplyScalar(y.x),a.multiplyScalar(y.y),o.multiplyScalar(y.z),r.add(a).add(o),r.clone()}function e(t,e,i,n,r,a,o){var s,c=t.material;if(s=c.side===Ar?i.intersectTriangle(a,r,n,!0,o):i.intersectTriangle(n,r,a,c.side!==Lr,o),null===s)return null;_.copy(o),_.applyMatrix4(t.matrixWorld);var h=e.ray.origin.distanceTo(_);return h<e.near||h>e.far?null:{distance:h,point:_.clone(),object:t}}function n(i,n,r,a,o,h,l,p){s.fromArray(a,3*h),c.fromArray(a,3*l),u.fromArray(a,3*p);var d=e(i,n,r,s,c,u,x);return d&&(o&&(m.fromArray(o,2*h),v.fromArray(o,2*l),g.fromArray(o,2*p),d.uv=t(x,s,c,u,m,v,g)),d.face=new dt(h,l,p,pt.normal(s,c,u)),d.faceIndex=h),d}var r=new l,a=new ot,o=new et,s=new h,c=new h,u=new h,p=new h,d=new h,f=new h,m=new i,v=new i,g=new i,y=new h,x=new h,_=new h;return function(i,h){var l=this.geometry,y=this.material,_=this.matrixWorld;if(void 0!==y&&(null===l.boundingSphere&&l.computeBoundingSphere(),o.copy(l.boundingSphere),o.applyMatrix4(_),i.ray.intersectsSphere(o)!==!1&&(r.getInverse(_),a.copy(i.ray).applyMatrix4(r),null===l.boundingBox||a.intersectsBox(l.boundingBox)!==!1))){var b,w;if(l&&l.isBufferGeometry){var M,E,T,S=l.index,A=l.attributes,L=A.position.array;if(void 0!==A.uv&&(b=A.uv.array),null!==S)for(var R=S.array,P=0,C=R.length;P<C;P+=3)M=R[P],E=R[P+1],T=R[P+2],w=n(this,i,a,L,b,M,E,T),w&&(w.faceIndex=Math.floor(P/3),h.push(w));else for(var P=0,C=L.length;P<C;P+=9)M=P/3,E=M+1,T=M+2,w=n(this,i,a,L,b,M,E,T),w&&(w.index=M,h.push(w))}else if(l&&l.isGeometry){var I,U,N,D=y&&y.isMultiMaterial,O=D===!0?y.materials:null,F=l.vertices,B=l.faces,z=l.faceVertexUvs[0];z.length>0&&(b=z);for(var G=0,H=B.length;G<H;G++){var V=B[G],k=D===!0?O[V.materialIndex]:y;if(void 0!==k){if(I=F[V.a],U=F[V.b],N=F[V.c],k.morphTargets===!0){var j=l.morphTargets,W=this.morphTargetInfluences;s.set(0,0,0),c.set(0,0,0),u.set(0,0,0);for(var X=0,Y=j.length;X<Y;X++){var q=W[X];if(0!==q){var Z=j[X].vertices;s.addScaledVector(p.subVectors(Z[V.a],I),q),c.addScaledVector(d.subVectors(Z[V.b],U),q),u.addScaledVector(f.subVectors(Z[V.c],N),q)}}s.add(I),c.add(U),u.add(N),I=s,U=c,N=u}if(w=e(this,i,a,I,U,N,x)){if(b){var J=b[G];m.copy(J[0]),v.copy(J[1]),g.copy(J[2]),w.uv=t(x,I,U,N,m,v,g)}w.face=V,w.faceIndex=G,h.push(w)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ct.prototype=Object.create(Rt.prototype),Ct.prototype.constructor=Ct,It.prototype=Object.create(Rt.prototype),It.prototype.constructor=It,Ut.prototype=Object.create(ht.prototype),Ut.prototype.constructor=Ut,Ut.prototype.isCamera=!0,Ut.prototype.getWorldDirection=function(){var t=new c;return function(e){var i=e||new h;return this.getWorldQuaternion(t),i.set(0,0,-1).applyQuaternion(t)}}(),Ut.prototype.lookAt=function(){var t=new l;return function(e){t.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(t)}}(),Ut.prototype.clone=function(){return(new this.constructor).copy(this)},Ut.prototype.copy=function(t){return ht.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},Nt.prototype=Object.assign(Object.create(Ut.prototype),{constructor:Nt,isPerspectiveCamera:!0,copy:function(t){return Ut.prototype.copy.call(this,t),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*Fo.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Fo.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Fo.RAD2DEG*Math.atan(Math.tan(.5*Fo.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,i,n,r,a){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*Fo.DEG2RAD*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==a){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*n/o,e-=a.offsetY*i/s,n*=a.width/o,i*=a.height/s}var c=this.filmOffset;0!==c&&(r+=t*c/this.getFilmWidth()),this.projectionMatrix.makeFrustum(r,r+n,e-i,e,t,this.far)},toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Dt.prototype=Object.assign(Object.create(Ut.prototype),{constructor:Dt,isOrthographicCamera:!0,copy:function(t){return Ut.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,i,n,r,a){this.view={fullWidth:t,fullHeight:e,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-t,a=i+t,o=n+e,s=n-e;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),h=this.zoom/(this.view.height/this.view.fullHeight),l=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;r+=l*(this.view.offsetX/c),a=r+l*(this.view.width/c),o-=u*(this.view.offsetY/h),s=o-u*(this.view.height/h)}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far)},toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}});var Zc=0;he.prototype.isFogExp2=!0,he.prototype.clone=function(){return new he(this.color.getHex(),this.density)},he.prototype.toJSON=function(t){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},le.prototype.isFog=!0,le.prototype.clone=function(){return new le(this.color.getHex(),this.near,this.far)},le.prototype.toJSON=function(t){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},ue.prototype=Object.create(ht.prototype),ue.prototype.constructor=ue,ue.prototype.copy=function(t,e){return ht.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},ue.prototype.toJSON=function(t){var e=ht.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e},pe.prototype=Object.assign(Object.create(ht.prototype),{constructor:pe,isLensFlare:!0,copy:function(t){ht.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,i=t.lensFlares.length;e<i;e++)this.lensFlares.push(t.lensFlares[e]);return this},add:function(t,e,i,n,r,a){void 0===e&&(e=-1),void 0===i&&(i=0),void 0===a&&(a=1),void 0===r&&(r=new X(16777215)),void 0===n&&(n=Dr),i=Math.min(i,Math.max(0,i)),this.lensFlares.push({texture:t,size:e,distance:i,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:r,blending:n})},updateLensFlares:function(){var t,e,i=this.lensFlares.length,n=2*-this.positionScreen.x,r=2*-this.positionScreen.y;for(t=0;t<i;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+n*e.distance,e.y=this.positionScreen.y+r*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),de.prototype=Object.create(J.prototype),de.prototype.constructor=de,de.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},fe.prototype=Object.assign(Object.create(ht.prototype),{constructor:fe,isSprite:!0,raycast:function(){var t=new h;return function(e,i){t.setFromMatrixPosition(this.matrixWorld);var n=e.ray.distanceSqToPoint(t),r=this.scale.x*this.scale.y/4;n>r||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),me.prototype=Object.assign(Object.create(ht.prototype),{constructor:me,copy:function(t){ht.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i<n;i++){var r=e[i];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var i=this.levels,n=0;n<i.length&&!(e<i[n].distance);n++);i.splice(n,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,i=1,n=e.length;i<n&&!(t<e[i].distance);i++);return e[i-1].object},raycast:function(){var t=new h;return function(e,i){t.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(t);this.getObjectForDistance(n).raycast(e,i)}}(),update:function(){var t=new h,e=new h;return function(i){var n=this.levels;if(n.length>1){t.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);n[0].object.visible=!0;for(var a=1,o=n.length;a<o&&r>=n[a].distance;a++)n[a-1].object.visible=!1,n[a].object.visible=!0;for(;a<o;a++)n[a].object.visible=!1}}}(),toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);e.object.levels=[];for(var i=this.levels,n=0,r=i.length;n<r;n++){var a=i[n];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}}),ve.prototype=Object.create(n.prototype),ve.prototype.constructor=ve,ve.prototype.isDataTexture=!0,Object.assign(ge.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var i=new l;this.bones[t]&&i.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(i)}},pose:function(){for(var t,e=0,i=this.bones.length;e<i;e++)t=this.bones[e],t&&t.matrixWorld.getInverse(this.boneInverses[e]);for(var e=0,i=this.bones.length;e<i;e++)t=this.bones[e],t&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){var t=new l;return function(){for(var e=0,i=this.bones.length;e<i;e++){var n=this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix;t.multiplyMatrices(n,this.boneInverses[e]),t.toArray(this.boneMatrices,16*e)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new ge(this.bones,this.boneInverses,this.useVertexTexture)}}),ye.prototype=Object.assign(Object.create(ht.prototype),{constructor:ye,isBone:!0,copy:function(t){return ht.prototype.copy.call(this,t),this.skin=t.skin,this}}),xe.prototype=Object.assign(Object.create(Pt.prototype),{constructor:xe,isSkinnedMesh:!0,bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry&&this.geometry.isGeometry)for(var t=0;t<this.geometry.skinWeights.length;t++){var e=this.geometry.skinWeights[t],i=1/e.lengthManhattan();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry)for(var n=new a,r=this.geometry.attributes.skinWeight,t=0;t<r.count;t++){n.x=r.getX(t),n.y=r.getY(t),n.z=r.getZ(t),n.w=r.getW(t);var i=1/n.lengthManhattan();i!==1/0?n.multiplyScalar(i):n.set(1,0,0,0),r.setXYZW(t,n.x,n.y,n.z,n.w)}},updateMatrixWorld:function(t){Pt.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material,this.skeleton.useVertexTexture).copy(this)}}),_e.prototype=Object.create(J.prototype),_e.prototype.constructor=_e,_e.prototype.isLineBasicMaterial=!0,_e.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},be.prototype=Object.assign(Object.create(ht.prototype),{constructor:be,isLine:!0,raycast:function(){var t=new l,e=new ot,i=new et;return function(n,r){var a=n.linePrecision,o=a*a,s=this.geometry,c=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(c),n.ray.intersectsSphere(i)!==!1){t.getInverse(c),e.copy(n.ray).applyMatrix4(t);var l=new h,u=new h,p=new h,d=new h,f=this&&this.isLineSegments?2:1;if(s&&s.isBufferGeometry){var m=s.index,v=s.attributes,g=v.position.array;if(null!==m)for(var y=m.array,x=0,_=y.length-1;x<_;x+=f){var b=y[x],w=y[x+1];l.fromArray(g,3*b),u.fromArray(g,3*w);var M=e.distanceSqToSegment(l,u,d,p);if(!(M>o)){d.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(d);E<n.near||E>n.far||r.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,_=g.length/3-1;x<_;x+=f){l.fromArray(g,3*x),u.fromArray(g,3*x+3);var M=e.distanceSqToSegment(l,u,d,p);if(!(M>o)){d.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(d);E<n.near||E>n.far||r.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(s&&s.isGeometry)for(var T=s.vertices,S=T.length,x=0;x<S-1;x+=f){var M=e.distanceSqToSegment(T[x],T[x+1],d,p);if(!(M>o)){d.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(d);E<n.near||E>n.far||r.push({distance:E,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),we.prototype=Object.assign(Object.create(be.prototype),{constructor:we,isLineSegments:!0}),Me.prototype=Object.create(J.prototype),Me.prototype.constructor=Me,Me.prototype.isPointsMaterial=!0,Me.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Ee.prototype=Object.assign(Object.create(ht.prototype),{constructor:Ee,isPoints:!0,raycast:function(){var t=new l,e=new ot,i=new et;return function(n,r){function a(t,i){var a=e.distanceSqToPoint(t);if(a<p){var s=e.closestPointToPoint(t);s.applyMatrix4(c);var h=n.ray.origin.distanceTo(s);if(h<n.near||h>n.far)return;r.push({distance:h,distanceToRay:Math.sqrt(a),point:s.clone(),index:i,face:null,object:o})}}var o=this,s=this.geometry,c=this.matrixWorld,l=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(c),n.ray.intersectsSphere(i)!==!1){t.getInverse(c),e.copy(n.ray).applyMatrix4(t);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),p=u*u,d=new h;if(s&&s.isBufferGeometry){var f=s.index,m=s.attributes,v=m.position.array;if(null!==f)for(var g=f.array,y=0,x=g.length;y<x;y++){var _=g[y];d.fromArray(v,3*_),a(d,_)}else for(var y=0,b=v.length/3;y<b;y++)d.fromArray(v,3*y),a(d,y)}else for(var w=s.vertices,y=0,b=w.length;y<b;y++)a(w[y],y)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Te.prototype=Object.assign(Object.create(ht.prototype),{constructor:Te}),Se.prototype=Object.create(n.prototype),Se.prototype.constructor=Se,Ae.prototype=Object.create(n.prototype),Ae.prototype.constructor=Ae,Ae.prototype.isCompressedTexture=!0,Le.prototype=Object.create(n.prototype),Le.prototype.constructor=Le,Re.prototype=Object.create(n.prototype),Re.prototype.constructor=Re,Re.prototype.isDepthTexture=!0,Pe.prototype=Object.create(Rt.prototype),Pe.prototype.constructor=Pe,Ce.prototype=Object.create(Rt.prototype),Ce.prototype.constructor=Ce,Ie.prototype=Object.create(St.prototype),Ie.prototype.constructor=Ie,Ue.prototype=Object.create(Rt.prototype),Ue.prototype.constructor=Ue,Ne.prototype=Object.create(Ue.prototype),Ne.prototype.constructor=Ne,De.prototype=Object.create(St.prototype),De.prototype.constructor=De,Oe.prototype=Object.create(Ue.prototype),Oe.prototype.constructor=Oe,Fe.prototype=Object.create(St.prototype),Fe.prototype.constructor=Fe,Be.prototype=Object.create(Ue.prototype),Be.prototype.constructor=Be,ze.prototype=Object.create(St.prototype),ze.prototype.constructor=ze,Ge.prototype=Object.create(Ue.prototype),Ge.prototype.constructor=Ge,He.prototype=Object.create(St.prototype),He.prototype.constructor=He,Ve.prototype=Object.create(St.prototype),Ve.prototype.constructor=Ve,ke.prototype=Object.create(Rt.prototype),ke.prototype.constructor=ke,je.prototype=Object.create(St.prototype),je.prototype.constructor=je,We.prototype=Object.create(Rt.prototype),We.prototype.constructor=We,Xe.prototype=Object.create(St.prototype),Xe.prototype.constructor=Xe,Ye.prototype=Object.create(Rt.prototype),Ye.prototype.constructor=Ye,qe.prototype=Object.create(St.prototype),qe.prototype.constructor=qe;var Jc={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i},triangulate:function(){function t(t,e,i,n,r,a){var o,s,c,h,l,u,p,d,f;if(s=t[a[e]].x,c=t[a[e]].y,h=t[a[i]].x,l=t[a[i]].y,u=t[a[n]].x,p=t[a[n]].y,(h-s)*(p-c)-(l-c)*(u-s)<=0)return!1;var m,v,g,y,x,_,b,w,M,E,T,S,A,L,R;for(m=u-h,v=p-l,g=s-u,y=c-p,x=h-s,_=l-c,o=0;o<r;o++)if(d=t[a[o]].x,f=t[a[o]].y,!(d===s&&f===c||d===h&&f===l||d===u&&f===p)&&(b=d-s,w=f-c,M=d-h,E=f-l,T=d-u,S=f-p,R=m*E-v*M,A=x*w-_*b,L=g*S-y*T,R>=-Number.EPSILON&&L>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(e,i){var n=e.length;if(n<3)return null;var r,a,o,s=[],c=[],h=[];if(Jc.area(e)>0)for(a=0;a<n;a++)c[a]=a;else for(a=0;a<n;a++)c[a]=n-1-a;var l=n,u=2*l;for(a=l-1;l>2;){if(u--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?h:s;if(r=a,l<=r&&(r=0),a=r+1,l<=a&&(a=0),o=a+1,l<=o&&(o=0),t(e,r,a,o,l,c)){var p,d,f,m,v;for(p=c[r],d=c[a],f=c[o],s.push([e[p],e[d],e[f]]),h.push([c[r],c[a],c[o]]),m=a,v=a+1;v<l;m++,v++)c[m]=c[v];l--,u=2*l}}return i?h:s}}(),triangulateShape:function(t,e){function i(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function n(t,e,i){return t.x!==e.x?t.x<e.x?t.x<=i.x&&i.x<=e.x:e.x<=i.x&&i.x<=t.x:t.y<e.y?t.y<=i.y&&i.y<=e.y:e.y<=i.y&&i.y<=t.y}function r(t,e,i,r,a){var o=e.x-t.x,s=e.y-t.y,c=r.x-i.x,h=r.y-i.y,l=t.x-i.x,u=t.y-i.y,p=s*c-o*h,d=s*l-o*u;
11
+ if(Math.abs(p)>Number.EPSILON){var f;if(p>0){if(d<0||d>p)return[];if(f=h*l-c*u,f<0||f>p)return[]}else{if(d>0||d<p)return[];if(f=h*l-c*u,f>0||f<p)return[]}if(0===f)return!a||0!==d&&d!==p?[t]:[];if(f===p)return!a||0!==d&&d!==p?[e]:[];if(0===d)return[i];if(d===p)return[r];var m=f/p;return[{x:t.x+m*o,y:t.y+m*s}]}if(0!==d||h*l!==c*u)return[];var v=0===o&&0===s,g=0===c&&0===h;if(v&&g)return t.x!==i.x||t.y!==i.y?[]:[t];if(v)return n(i,r,t)?[t]:[];if(g)return n(t,e,i)?[i]:[];var y,x,_,b,w,M,E,T;return 0!==o?(t.x<e.x?(y=t,_=t.x,x=e,b=e.x):(y=e,_=e.x,x=t,b=t.x),i.x<r.x?(w=i,E=i.x,M=r,T=r.x):(w=r,E=r.x,M=i,T=i.x)):(t.y<e.y?(y=t,_=t.y,x=e,b=e.y):(y=e,_=e.y,x=t,b=t.y),i.y<r.y?(w=i,E=i.y,M=r,T=r.y):(w=r,E=r.y,M=i,T=i.y)),_<=E?b<E?[]:b===E?a?[]:[w]:b<=T?[w,x]:[w,M]:_>T?[]:_===T?a?[]:[y]:b<=T?[y,x]:[y,M]}function a(t,e,i,n){var r=e.x-t.x,a=e.y-t.y,o=i.x-t.x,s=i.y-t.y,c=n.x-t.x,h=n.y-t.y,l=r*s-a*o,u=r*h-a*c;if(Math.abs(l)>Number.EPSILON){var p=c*s-h*o;return l>0?u>=0&&p>=0:u>=0||p>=0}return u>0}function o(t,e){function i(t,e){var i=y.length-1,n=t-1;n<0&&(n=i);var r=t+1;r>i&&(r=0);var o=a(y[t],y[n],y[r],s[e]);if(!o)return!1;var c=s.length-1,h=e-1;h<0&&(h=c);var l=e+1;return l>c&&(l=0),o=a(s[e],s[h],s[l],y[t]),!!o}function n(t,e){var i,n,a;for(i=0;i<y.length;i++)if(n=i+1,n%=y.length,a=r(t,e,y[i],y[n],!0),a.length>0)return!0;return!1}function o(t,i){var n,a,o,s,c;for(n=0;n<x.length;n++)for(a=e[x[n]],o=0;o<a.length;o++)if(s=o+1,s%=a.length,c=r(t,i,a[o],a[s],!0),c.length>0)return!0;return!1}for(var s,c,h,l,u,p,d,f,m,v,g,y=t.concat(),x=[],_=[],b=0,w=e.length;b<w;b++)x.push(b);for(var M=0,E=2*x.length;x.length>0;){if(E--,E<0){console.log("Infinite Loop! Holes left:"+x.length+", Probably Hole outside Shape!");break}for(h=M;h<y.length;h++){l=y[h],c=-1;for(var b=0;b<x.length;b++)if(p=x[b],d=l.x+":"+l.y+":"+p,void 0===_[d]){s=e[p];for(var T=0;T<s.length;T++)if(u=s[T],i(h,T)&&!n(l,u)&&!o(l,u)){c=T,x.splice(b,1),f=y.slice(0,h+1),m=y.slice(h),v=s.slice(c),g=s.slice(0,c+1),y=f.concat(v).concat(g).concat(m),M=h;break}if(c>=0)break;_[d]=!0}if(c>=0)break}}return y}i(t),e.forEach(i);for(var s,c,h,l,u,p,d={},f=t.concat(),m=0,v=e.length;m<v;m++)Array.prototype.push.apply(f,e[m]);for(s=0,c=f.length;s<c;s++)u=f[s].x+":"+f[s].y,void 0!==d[u]&&console.warn("THREE.ShapeUtils: Duplicate point",u,s),d[u]=s;var g=o(t,e),y=Jc.triangulate(g,!1);for(s=0,c=y.length;s<c;s++)for(l=y[s],h=0;h<3;h++)u=l[h].x+":"+l[h].y,p=d[u],void 0!==p&&(l[h]=p);return y.concat()},isClockWise:function(t){return Jc.area(t)<0},b2:function(){function t(t,e){var i=1-t;return i*i*e}function e(t,e){return 2*(1-t)*t*e}function i(t,e){return t*t*e}return function(n,r,a,o){return t(n,r)+e(n,a)+i(n,o)}}(),b3:function(){function t(t,e){var i=1-t;return i*i*i*e}function e(t,e){var i=1-t;return 3*i*i*t*e}function i(t,e){var i=1-t;return 3*i*t*t*e}function n(t,e){return t*t*t*e}return function(r,a,o,s,c){return t(r,a)+e(r,o)+i(r,s)+n(r,c)}}()};Ze.prototype=Object.create(St.prototype),Ze.prototype.constructor=Ze,Ze.prototype.addShapeList=function(t,e){for(var i=t.length,n=0;n<i;n++){var r=t[n];this.addShape(r,e)}},Ze.prototype.addShape=function(t,e){function n(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}function r(t,e,n){var r,a,o=1,s=t.x-e.x,c=t.y-e.y,h=n.x-t.x,l=n.y-t.y,u=s*s+c*c,p=s*l-c*h;if(Math.abs(p)>Number.EPSILON){var d=Math.sqrt(u),f=Math.sqrt(h*h+l*l),m=e.x-c/d,v=e.y+s/d,g=n.x-l/f,y=n.y+h/f,x=((g-m)*l-(y-v)*h)/(s*l-c*h);r=m+s*x-t.x,a=v+c*x-t.y;var _=r*r+a*a;if(_<=2)return new i(r,a);o=Math.sqrt(_/2)}else{var b=!1;s>Number.EPSILON?h>Number.EPSILON&&(b=!0):s<-Number.EPSILON?h<-Number.EPSILON&&(b=!0):Math.sign(c)===Math.sign(l)&&(b=!0),b?(r=-c,a=s,o=Math.sqrt(u)):(r=s,a=c,o=Math.sqrt(u/2))}return new i(r/o,a/o)}function a(){if(b){var t=0,e=j*t;for(Y=0;Y<W;Y++)k=O[Y],l(k[2]+e,k[1]+e,k[0]+e);for(t=M+2*_,e=j*t,Y=0;Y<W;Y++)k=O[Y],l(k[0]+e,k[1]+e,k[2]+e)}else{for(Y=0;Y<W;Y++)k=O[Y],l(k[2],k[1],k[0]);for(Y=0;Y<W;Y++)k=O[Y],l(k[0]+j*M,k[1]+j*M,k[2]+j*M)}}function o(){var t=0;for(s(F,t),t+=F.length,L=0,R=N.length;L<R;L++)A=N[L],s(A,t),t+=A.length}function s(t,e){var i,n;for(Y=t.length;--Y>=0;){i=Y,n=Y-1,n<0&&(n=t.length-1);var r=0,a=M+2*_;for(r=0;r<a;r++){var o=j*r,s=j*(r+1),c=e+i+o,h=e+n+o,l=e+n+s,p=e+i+s;u(c,h,l,p,t,r,a,i,n)}}}function c(t,e,i){P.vertices.push(new h(t,e,i))}function l(t,e,i){t+=C,e+=C,i+=C,P.faces.push(new dt(t,e,i,null,null,0));var n=S.generateTopUV(P,t,e,i);P.faceVertexUvs[0].push(n)}function u(t,e,i,n,r,a,o,s,c){t+=C,e+=C,i+=C,n+=C,P.faces.push(new dt(t,e,n,null,null,1)),P.faces.push(new dt(e,i,n,null,null,1));var h=S.generateSideWallUV(P,t,e,i,n);P.faceVertexUvs[0].push([h[0],h[1],h[3]]),P.faceVertexUvs[0].push([h[1],h[2],h[3]])}var p,d,f,m,v,g=void 0!==e.amount?e.amount:100,y=void 0!==e.bevelThickness?e.bevelThickness:6,x=void 0!==e.bevelSize?e.bevelSize:y-2,_=void 0!==e.bevelSegments?e.bevelSegments:3,b=void 0===e.bevelEnabled||e.bevelEnabled,w=void 0!==e.curveSegments?e.curveSegments:12,M=void 0!==e.steps?e.steps:1,E=e.extrudePath,T=!1,S=void 0!==e.UVGenerator?e.UVGenerator:Ze.WorldUVGenerator;E&&(p=E.getSpacedPoints(M),T=!0,b=!1,d=void 0!==e.frames?e.frames:E.computeFrenetFrames(M,!1),f=new h,m=new h,v=new h),b||(_=0,y=0,x=0);var A,L,R,P=this,C=this.vertices.length,I=t.extractPoints(w),U=I.shape,N=I.holes,D=!Jc.isClockWise(U);if(D){for(U=U.reverse(),L=0,R=N.length;L<R;L++)A=N[L],Jc.isClockWise(A)&&(N[L]=A.reverse());D=!1}var O=Jc.triangulateShape(U,N),F=U;for(L=0,R=N.length;L<R;L++)A=N[L],U=U.concat(A);for(var B,z,G,H,V,k,j=U.length,W=O.length,X=[],Y=0,q=F.length,Z=q-1,J=Y+1;Y<q;Y++,Z++,J++)Z===q&&(Z=0),J===q&&(J=0),X[Y]=r(F[Y],F[Z],F[J]);var Q,K=[],$=X.concat();for(L=0,R=N.length;L<R;L++){for(A=N[L],Q=[],Y=0,q=A.length,Z=q-1,J=Y+1;Y<q;Y++,Z++,J++)Z===q&&(Z=0),J===q&&(J=0),Q[Y]=r(A[Y],A[Z],A[J]);K.push(Q),$=$.concat(Q)}for(B=0;B<_;B++){for(G=B/_,H=y*Math.cos(G*Math.PI/2),z=x*Math.sin(G*Math.PI/2),Y=0,q=F.length;Y<q;Y++)V=n(F[Y],X[Y],z),c(V.x,V.y,-H);for(L=0,R=N.length;L<R;L++)for(A=N[L],Q=K[L],Y=0,q=A.length;Y<q;Y++)V=n(A[Y],Q[Y],z),c(V.x,V.y,-H)}for(z=x,Y=0;Y<j;Y++)V=b?n(U[Y],$[Y],z):U[Y],T?(m.copy(d.normals[0]).multiplyScalar(V.x),f.copy(d.binormals[0]).multiplyScalar(V.y),v.copy(p[0]).add(m).add(f),c(v.x,v.y,v.z)):c(V.x,V.y,0);var tt;for(tt=1;tt<=M;tt++)for(Y=0;Y<j;Y++)V=b?n(U[Y],$[Y],z):U[Y],T?(m.copy(d.normals[tt]).multiplyScalar(V.x),f.copy(d.binormals[tt]).multiplyScalar(V.y),v.copy(p[tt]).add(m).add(f),c(v.x,v.y,v.z)):c(V.x,V.y,g/M*tt);for(B=_-1;B>=0;B--){for(G=B/_,H=y*Math.cos(G*Math.PI/2),z=x*Math.sin(G*Math.PI/2),Y=0,q=F.length;Y<q;Y++)V=n(F[Y],X[Y],z),c(V.x,V.y,g+H);for(L=0,R=N.length;L<R;L++)for(A=N[L],Q=K[L],Y=0,q=A.length;Y<q;Y++)V=n(A[Y],Q[Y],z),T?c(V.x,V.y+p[M-1].y,p[M-1].x+H):c(V.x,V.y,g+H)}a(),o()},Ze.WorldUVGenerator={generateTopUV:function(t,e,n,r){var a=t.vertices,o=a[e],s=a[n],c=a[r];return[new i(o.x,o.y),new i(s.x,s.y),new i(c.x,c.y)]},generateSideWallUV:function(t,e,n,r,a){var o=t.vertices,s=o[e],c=o[n],h=o[r],l=o[a];return Math.abs(s.y-c.y)<.01?[new i(s.x,1-s.z),new i(c.x,1-c.z),new i(h.x,1-h.z),new i(l.x,1-l.z)]:[new i(s.y,1-s.z),new i(c.y,1-c.z),new i(h.y,1-h.z),new i(l.y,1-l.z)]}},Je.prototype=Object.create(Ze.prototype),Je.prototype.constructor=Je,Qe.prototype=Object.create(Rt.prototype),Qe.prototype.constructor=Qe,Ke.prototype=Object.create(St.prototype),Ke.prototype.constructor=Ke,$e.prototype=Object.create(Rt.prototype),$e.prototype.constructor=$e,ti.prototype=Object.create(St.prototype),ti.prototype.constructor=ti,ei.prototype=Object.create(St.prototype),ei.prototype.constructor=ei,ii.prototype=Object.create(Rt.prototype),ii.prototype.constructor=ii,ni.prototype=Object.create(St.prototype),ni.prototype.constructor=ni,ri.prototype=Object.create(St.prototype),ri.prototype.constructor=ri,ri.prototype.addShapeList=function(t,e){for(var i=0,n=t.length;i<n;i++)this.addShape(t[i],e);return this},ri.prototype.addShape=function(t,e){void 0===e&&(e={});var i,n,r,a=void 0!==e.curveSegments?e.curveSegments:12,o=e.material,s=void 0===e.UVGenerator?Ze.WorldUVGenerator:e.UVGenerator,c=this.vertices.length,l=t.extractPoints(a),u=l.shape,p=l.holes,d=!Jc.isClockWise(u);if(d){for(u=u.reverse(),i=0,n=p.length;i<n;i++)r=p[i],Jc.isClockWise(r)&&(p[i]=r.reverse());d=!1}var f=Jc.triangulateShape(u,p);for(i=0,n=p.length;i<n;i++)r=p[i],u=u.concat(r);var m,v,g=u.length,y=f.length;for(i=0;i<g;i++)m=u[i],this.vertices.push(new h(m.x,m.y,0));for(i=0;i<y;i++){v=f[i];var x=v[0]+c,_=v[1]+c,b=v[2]+c;this.faces.push(new dt(x,_,b,null,null,o)),this.faceVertexUvs[0].push(s.generateTopUV(this,x,_,b))}},ai.prototype=Object.create(Rt.prototype),ai.prototype.constructor=ai,oi.prototype=Object.create(Rt.prototype),oi.prototype.constructor=oi,si.prototype=Object.create(St.prototype),si.prototype.constructor=si,ci.prototype=Object.create(si.prototype),ci.prototype.constructor=ci,hi.prototype=Object.create(oi.prototype),hi.prototype.constructor=hi,li.prototype=Object.create(Rt.prototype),li.prototype.constructor=li,ui.prototype=Object.create(St.prototype),ui.prototype.constructor=ui,pi.prototype=Object.create(St.prototype),pi.prototype.constructor=pi;var Qc=Object.freeze({WireframeGeometry:Pe,ParametricGeometry:Ie,ParametricBufferGeometry:Ce,TetrahedronGeometry:De,TetrahedronBufferGeometry:Ne,OctahedronGeometry:Fe,OctahedronBufferGeometry:Oe,IcosahedronGeometry:ze,IcosahedronBufferGeometry:Be,DodecahedronGeometry:He,DodecahedronBufferGeometry:Ge,PolyhedronGeometry:Ve,PolyhedronBufferGeometry:Ue,TubeGeometry:je,TubeBufferGeometry:ke,TorusKnotGeometry:Xe,TorusKnotBufferGeometry:We,TorusGeometry:qe,TorusBufferGeometry:Ye,TextGeometry:Je,SphereBufferGeometry:Qe,SphereGeometry:Ke,RingGeometry:ti,RingBufferGeometry:$e,PlaneBufferGeometry:It,PlaneGeometry:ei,LatheGeometry:ni,LatheBufferGeometry:ii,ShapeGeometry:ri,ExtrudeGeometry:Ze,EdgesGeometry:ai,ConeGeometry:ci,ConeBufferGeometry:hi,CylinderGeometry:si,CylinderBufferGeometry:oi,CircleBufferGeometry:li,CircleGeometry:ui,BoxBufferGeometry:Ct,BoxGeometry:pi});di.prototype=Object.create(K.prototype),di.prototype.constructor=di,di.prototype.isShadowMaterial=!0,fi.prototype=Object.create(K.prototype),fi.prototype.constructor=fi,fi.prototype.isRawShaderMaterial=!0,mi.prototype={constructor:mi,isMultiMaterial:!0,toJSON:function(t){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},i=this.materials,n=0,r=i.length;n<r;n++){var a=i[n].toJSON(t);delete a.metadata,e.materials.push(a)}return e.visible=this.visible,e},clone:function(){for(var t=new this.constructor,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t.visible=this.visible,t}},vi.prototype=Object.create(J.prototype),vi.prototype.constructor=vi,vi.prototype.isMeshStandardMaterial=!0,vi.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},gi.prototype=Object.create(vi.prototype),gi.prototype.constructor=gi,gi.prototype.isMeshPhysicalMaterial=!0,gi.prototype.copy=function(t){return vi.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},yi.prototype=Object.create(J.prototype),yi.prototype.constructor=yi,yi.prototype.isMeshPhongMaterial=!0,yi.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},xi.prototype=Object.create(J.prototype),xi.prototype.constructor=xi,xi.prototype.isMeshNormalMaterial=!0,xi.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},_i.prototype=Object.create(J.prototype),_i.prototype.constructor=_i,_i.prototype.isMeshLambertMaterial=!0,_i.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},bi.prototype=Object.create(J.prototype),bi.prototype.constructor=bi,bi.prototype.isLineDashedMaterial=!0,bi.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Kc=Object.freeze({ShadowMaterial:di,SpriteMaterial:de,RawShaderMaterial:fi,ShaderMaterial:K,PointsMaterial:Me,MultiMaterial:mi,MeshPhysicalMaterial:gi,MeshStandardMaterial:vi,MeshPhongMaterial:yi,MeshNormalMaterial:xi,MeshLambertMaterial:_i,MeshDepthMaterial:$,MeshBasicMaterial:ft,LineDashedMaterial:bi,LineBasicMaterial:_e,Material:J}),$c={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},th=new wi;Object.assign(Mi.prototype,{load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var r=this,a=$c.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout(function(){e&&e(a),r.manager.itemEnd(t)},0),a;var o=/^data:(.*?)(;base64)?,(.*)$/,s=t.match(o);if(s){var c=s[1],h=!!s[2],l=s[3];l=window.decodeURIComponent(l),h&&(l=window.atob(l));try{var u,p=(this.responseType||"").toLowerCase();switch(p){case"arraybuffer":case"blob":u=new ArrayBuffer(l.length);for(var d=new Uint8Array(u),f=0;f<l.length;f++)d[f]=l.charCodeAt(f);"blob"===p&&(u=new Blob([u],{type:c}));break;case"document":var m=new DOMParser;u=m.parseFromString(l,c);break;case"json":u=JSON.parse(l);break;default:u=l}window.setTimeout(function(){e&&e(u),r.manager.itemEnd(t)},0)}catch(e){window.setTimeout(function(){n&&n(e),r.manager.itemError(t)},0)}}else{var v=new XMLHttpRequest;v.open("GET",t,!0),v.addEventListener("load",function(i){var a=i.target.response;$c.add(t,a),200===this.status?(e&&e(a),r.manager.itemEnd(t)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),e&&e(a),r.manager.itemEnd(t)):(n&&n(i),r.manager.itemError(t))},!1),void 0!==i&&v.addEventListener("progress",function(t){i(t)},!1),v.addEventListener("error",function(e){n&&n(e),r.manager.itemError(t)},!1),void 0!==this.responseType&&(v.responseType=this.responseType),void 0!==this.withCredentials&&(v.withCredentials=this.withCredentials),v.overrideMimeType&&v.overrideMimeType("text/plain"),v.send(null)}return r.manager.itemStart(t),v},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this}}),Object.assign(Ei.prototype,{load:function(t,e,i,n){function r(r){c.load(t[r],function(t){var i=a._parser(t,!0);o[r]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},h+=1,6===h&&(1===i.mipmapCount&&(s.minFilter=Da),s.format=i.format,s.needsUpdate=!0,e&&e(s))},i,n)}var a=this,o=[],s=new Ae;s.image=o;var c=new Mi(this.manager);if(c.setPath(this.path),c.setResponseType("arraybuffer"),Array.isArray(t))for(var h=0,l=0,u=t.length;l<u;++l)r(l);else c.load(t,function(t){var i=a._parser(t,!0);if(i.isCubemap)for(var n=i.mipmaps.length/i.mipmapCount,r=0;r<n;r++){o[r]={mipmaps:[]};for(var c=0;c<i.mipmapCount;c++)o[r].mipmaps.push(i.mipmaps[r*i.mipmapCount+c]),o[r].format=i.format,o[r].width=i.width,o[r].height=i.height}else s.image.width=i.width,s.image.height=i.height,s.mipmaps=i.mipmaps;1===i.mipmapCount&&(s.minFilter=Da),s.format=i.format,s.needsUpdate=!0,e&&e(s)},i,n);return s},setPath:function(t){return this.path=t,this}});var eh=Ti;Object.assign(Ti.prototype,{load:function(t,e,i,n){var r=this,a=new ve,o=new Mi(this.manager);return o.setResponseType("arraybuffer"),o.load(t,function(t){var i=r._parser(t);i&&(void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:Ra,a.wrapT=void 0!==i.wrapT?i.wrapT:Ra,a.magFilter=void 0!==i.magFilter?i.magFilter:Da,a.minFilter=void 0!==i.minFilter?i.minFilter:Fa,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps),1===i.mipmapCount&&(a.minFilter=Da),a.needsUpdate=!0,e&&e(a,i))},i,n),a}}),Object.assign(Si.prototype,{load:function(t,e,i,n){var r=this,a=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(a.onload=function(){a.onload=null,URL.revokeObjectURL(a.src),e&&e(a),r.manager.itemEnd(t)},a.onerror=n,0===t.indexOf("data:"))a.src=t;else{var o=new Mi;o.setPath(this.path),o.setResponseType("blob"),o.setWithCredentials(this.withCredentials),o.load(t,function(t){a.src=URL.createObjectURL(t)},i,n)}return r.manager.itemStart(t),a},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Ai.prototype,{load:function(t,e,i,n){function r(i){o.load(t[i],function(t){a.images[i]=t,s++,6===s&&(a.needsUpdate=!0,e&&e(a))},void 0,n)}var a=new u,o=new Si(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);for(var s=0,c=0;c<t.length;++c)r(c);return a},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Li.prototype,{load:function(t,e,i,r){var a=new n,o=new Si(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setWithCredentials(this.withCredentials),o.setPath(this.path),o.load(t,function(i){var n=t.search(/\.(jpg|jpeg)$/)>0||0===t.search(/^data\:image\/jpeg/);a.format=n?Ka:$a,a.image=i,a.needsUpdate=!0,void 0!==e&&e(a)},i,r),a},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),Ri.prototype=Object.assign(Object.create(ht.prototype),{constructor:Ri,isLight:!0,copy:function(t){return ht.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Pi.prototype=Object.assign(Object.create(Ri.prototype),{constructor:Pi,isHemisphereLight:!0,copy:function(t){return Ri.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Ci.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Ii.prototype=Object.assign(Object.create(Ci.prototype),{constructor:Ii,isSpotLightShadow:!0,update:function(t){var e=2*Fo.RAD2DEG*t.angle,i=this.mapSize.width/this.mapSize.height,n=t.distance||500,r=this.camera;e===r.fov&&i===r.aspect&&n===r.far||(r.fov=e,r.aspect=i,r.far=n,r.updateProjectionMatrix())}}),Ui.prototype=Object.assign(Object.create(Ri.prototype),{constructor:Ui,isSpotLight:!0,copy:function(t){return Ri.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Ni.prototype=Object.assign(Object.create(Ri.prototype),{constructor:Ni,isPointLight:!0,copy:function(t){return Ri.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Di.prototype=Object.assign(Object.create(Ci.prototype),{constructor:Di}),Oi.prototype=Object.assign(Object.create(Ri.prototype),{constructor:Oi,isDirectionalLight:!0,copy:function(t){return Ri.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Fi.prototype=Object.assign(Object.create(Ri.prototype),{constructor:Fi,isAmbientLight:!0});var ih={arraySlice:function(t,e,i){return ih.isTypedArray(t)?new t.constructor(t.subarray(e,i)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,i){return t[e]-t[i]}for(var i=t.length,n=new Array(i),r=0;r!==i;++r)n[r]=r;return n.sort(e),n},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),a=0,o=0;o!==n;++a)for(var s=i[a]*e,c=0;c!==e;++c)r[o++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,a=t[0];void 0!==a&&void 0===a[n];)a=t[r++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o)){do o=a[n],void 0!==o&&(e.push(a.time),i.push.apply(i,o)),a=t[r++];while(void 0!==a)}else if(void 0!==o.toArray){do o=a[n],void 0!==o&&(e.push(a.time),o.toArray(i,i.length)),a=t[r++];while(void 0!==a)}else do o=a[n],void 0!==o&&(e.push(a.time),i.push(o)),a=t[r++];while(void 0!==a)}}};Bi.prototype={constructor:Bi,evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var a;i:{n:if(!(t<n)){for(var o=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===o)break;if(r=n,n=e[++i],t<n)break e}a=e.length;break i}{if(t>=r)break t;var s=e[1];t<s&&(i=2,r=s);for(var o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===o)break;if(n=r,r=e[--i-1],t>=r)break e}a=i,i=0}}for(;i<a;){var c=i+a>>>1;t<e[c]?a=c:i=c+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n,a=0;a!==n;++a)e[a]=i[r+a];return e},interpolate_:function(t,e,i,n){throw new Error("call to abstract method")},intervalChanged_:function(t,e,i){}},Object.assign(Bi.prototype,{beforeStart_:Bi.prototype.copySampleValue_,afterEnd_:Bi.prototype.copySampleValue_}),zi.prototype=Object.assign(Object.create(Bi.prototype),{constructor:zi,DefaultSettings_:{endingStart:bo,endingEnd:bo},intervalChanged_:function(t,e,i){var n=this.parameterPositions,r=t-2,a=t+1,o=n[r],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case wo:r=t,o=2*e-i;break;case Mo:r=n.length-2,o=e+n[r]-n[r+1];break;default:r=t,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case wo:a=t,s=2*i-e;break;case Mo:a=1,s=i+n[1]-n[0];break;default:a=t-1,s=e}var c=.5*(i-e),h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(s-i),this._offsetPrev=r*h,this._offsetNext=a*h},interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(i-e)/(n-e),f=d*d,m=f*d,v=-u*m+2*u*f-u*d,g=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,_=0;_!==o;++_)r[_]=v*a[h+_]+g*a[c+_]+y*a[s+_]+x*a[l+_];return r}}),Gi.prototype=Object.assign(Object.create(Bi.prototype),{constructor:Gi,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=(i-e)/(n-e),l=1-h,u=0;u!==o;++u)r[u]=a[c+u]*l+a[s+u]*h;return r}}),Hi.prototype=Object.assign(Object.create(Bi.prototype),{constructor:Hi,interpolate_:function(t,e,i,n){return this.copySampleValue_(t-1)}});var nh;nh={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:xo,InterpolantFactoryMethodDiscrete:function(t){return new Hi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Gi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new zi(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case yo:e=this.InterpolantFactoryMethodDiscrete;break;case xo:e=this.InterpolantFactoryMethodLinear;break;case _o:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(i)}this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return yo;case this.InterpolantFactoryMethodLinear:return xo;case this.InterpolantFactoryMethodSmooth:return _o}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]*=t;return this},trim:function(t,e){for(var i=this.times,n=i.length,r=0,a=n-1;r!==n&&i[r]<t;)++r;for(;a!==-1&&i[a]>e;)--a;if(++a,0!==r||a!==n){r>=a&&(a=Math.max(a,1),r=a-1);var o=this.getValueSize();this.times=ih.arraySlice(i,r,a),this.values=ih.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("invalid value size in track",this),t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("track is empty",this),t=!1);for(var a=null,o=0;o!==r;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,o,s),t=!1;break}if(null!==a&&a>s){console.error("out of order keys",this,o,s,a),t=!1;break}a=s}if(void 0!==n&&ih.isTypedArray(n))for(var o=0,c=n.length;o!==c;++o){var h=n[o];if(isNaN(h)){console.error("value is not a valid number",this,o,h),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=this.getInterpolation()===_o,r=1,a=t.length-1,o=1;o<a;++o){var s=!1,c=t[o],h=t[o+1];if(c!==h&&(1!==o||c!==c[0]))if(n)s=!0;else for(var l=o*i,u=l-i,p=l+i,d=0;d!==i;++d){var f=e[l+d];if(f!==e[u+d]||f!==e[p+d]){s=!0;break}}if(s){if(o!==r){t[r]=t[o];for(var m=o*i,v=r*i,d=0;d!==i;++d)e[v+d]=e[m+d]}++r}}if(a>0){t[r]=t[a];for(var m=a*i,v=r*i,d=0;d!==i;++d)e[v+d]=e[m+d];++r}return r!==t.length&&(this.times=ih.arraySlice(t,0,r),this.values=ih.arraySlice(e,0,r*i)),this}},ki.prototype=Object.assign(Object.create(nh),{constructor:ki,ValueTypeName:"vector"}),ji.prototype=Object.assign(Object.create(Bi.prototype),{constructor:ji,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,h=(i-e)/(n-e),l=s+o;s!==l;s+=4)c.slerpFlat(r,0,a,s-o,a,s,h);return r}}),Wi.prototype=Object.assign(Object.create(nh),{constructor:Wi,ValueTypeName:"quaternion",DefaultInterpolation:xo,InterpolantFactoryMethodLinear:function(t){return new ji(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Xi.prototype=Object.assign(Object.create(nh),{constructor:Xi,ValueTypeName:"number"}),Yi.prototype=Object.assign(Object.create(nh),{constructor:Yi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:yo,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),qi.prototype=Object.assign(Object.create(nh),{constructor:qi,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:yo,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Zi.prototype=Object.assign(Object.create(nh),{constructor:Zi,ValueTypeName:"color"}),Ji.prototype=nh,nh.constructor=Ji,Object.assign(Ji,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=Ji._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var i=[],n=[];ih.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,i=t.constructor;if(void 0!==i.toJSON)e=i.toJSON(t);else{e={name:t.name,times:ih.convertArray(t.times,Array),values:ih.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Xi;case"vector":case"vector2":case"vector3":case"vector4":return ki;case"color":return Zi;case"quaternion":return Wi;case"bool":case"boolean":return qi;case"string":return Yi}throw new Error("Unsupported typeName: "+t)}}),Qi.prototype={constructor:Qi,resetDuration:function(){for(var t=this.tracks,e=0,i=0,n=t.length;i!==n;++i){var r=this.tracks[i];e=Math.max(e,r.times[r.times.length-1])}this.duration=e},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}},Object.assign(Qi,{parse:function(t){for(var e=[],i=t.tracks,n=1/(t.fps||1),r=0,a=i.length;r!==a;++r)e.push(Ji.parse(i[r]).scale(n));return new Qi(t.name,t.duration,e)},toJSON:function(t){for(var e=[],i=t.tracks,n={
12
+ name:t.name,duration:t.duration,tracks:e},r=0,a=i.length;r!==a;++r)e.push(Ji.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){for(var r=e.length,a=[],o=0;o<r;o++){var s=[],c=[];s.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);var h=ih.getKeyframeOrder(s);s=ih.sortedArray(s,1,h),c=ih.sortedArray(c,1,h),n||0!==s[0]||(s.push(r),c.push(c[0])),a.push(new Xi(".morphTargetInfluences["+e[o].name+"]",s,c).scale(1/i))}return new Qi(t,-1,a)},findByName:function(t,e){var i=t;if(!Array.isArray(t)){var n=t;i=n.geometry&&n.geometry.animations||n.animations}for(var r=0;r<i.length;r++)if(i[r].name===e)return i[r];return null},CreateClipsFromMorphTargetSequences:function(t,e,i){for(var n={},r=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],c=s.name.match(r);if(c&&c.length>1){var h=c[1],l=n[h];l||(n[h]=l=[]),l.push(s)}}var u=[];for(var h in n)u.push(Qi.CreateFromMorphTargetSequence(h,n[h],e,i));return u},parseAnimation:function(t,e){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var i=function(t,e,i,n,r){if(0!==i.length){var a=[],o=[];ih.flattenJSON(i,a,o,n),0!==a.length&&r.push(new t(e,a,o))}},n=[],r=t.name||"default",a=t.length||-1,o=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var h=s[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var l={},u=0;u<h.length;u++)if(h[u].morphTargets)for(var p=0;p<h[u].morphTargets.length;p++)l[h[u].morphTargets[p]]=-1;for(var d in l){for(var f=[],m=[],p=0;p!==h[u].morphTargets.length;++p){var v=h[u];f.push(v.time),m.push(v.morphTarget===d?1:0)}n.push(new Xi(".morphTargetInfluence["+d+"]",f,m))}a=l.length*(o||1)}else{var g=".bones["+e[c].name+"]";i(ki,g+".position",h,"pos",n),i(Wi,g+".quaternion",h,"rot",n),i(ki,g+".scale",h,"scl",n)}}if(0===n.length)return null;var y=new Qi(r,a,n);return y}}),Object.assign(Ki.prototype,{load:function(t,e,i,n){var r=this,a=new Mi(r.manager);a.load(t,function(t){e(r.parse(JSON.parse(t)))},i,n)},setTextures:function(t){this.textures=t},parse:function(t){function e(t){return void 0===n[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),n[t]}var n=this.textures,r=new Kc[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&r.specular.setHex(t.specular),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.uniforms&&(r.uniforms=t.uniforms),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(r.vertexColors=t.vertexColors),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.shading&&(r.shading=t.shading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.side&&(r.side=t.side),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.skinning&&(r.skinning=t.skinning),void 0!==t.morphTargets&&(r.morphTargets=t.morphTargets),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=e(t.map)),void 0!==t.alphaMap&&(r.alphaMap=e(t.alphaMap),r.transparent=!0),void 0!==t.bumpMap&&(r.bumpMap=e(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=e(t.normalMap)),void 0!==t.normalScale){var a=t.normalScale;Array.isArray(a)===!1&&(a=[a,a]),r.normalScale=(new i).fromArray(a)}if(void 0!==t.displacementMap&&(r.displacementMap=e(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=e(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=e(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=e(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=e(t.specularMap)),void 0!==t.envMap&&(r.envMap=e(t.envMap)),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.lightMap&&(r.lightMap=e(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=e(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.materials)for(var o=0,s=t.materials.length;o<s;o++)r.materials.push(this.parse(t.materials[o]));return r}}),Object.assign($i.prototype,{load:function(t,e,i,n){var r=this,a=new Mi(r.manager);a.load(t,function(t){e(r.parse(JSON.parse(t)))},i,n)},parse:function(t){var e=new Rt,i=t.data.index,n={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};if(void 0!==i){var r=new n[i.type](i.array);e.setIndex(new mt(r,1))}var a=t.data.attributes;for(var o in a){var s=a[o],r=new n[s.type](s.array);e.addAttribute(o,new mt(r,s.itemSize,s.normalized))}var c=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==c)for(var l=0,u=c.length;l!==u;++l){var p=c[l];e.addGroup(p.start,p.count,p.materialIndex)}var d=t.data.boundingSphere;if(void 0!==d){var f=new h;void 0!==d.center&&f.fromArray(d.center),e.boundingSphere=new et(f,d.radius)}return e}}),tn.prototype={constructor:tn,crossOrigin:void 0,extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e,i){for(var n=[],r=0;r<t.length;++r)n[r]=this.createMaterial(t[r],e,i);return n},createMaterial:function(){var t,e,i;return function(n,r,a){function o(t,i,n,o,c){var h,l=r+t,u=tn.Handlers.get(l);null!==u?h=u.load(l):(e.setCrossOrigin(a),h=e.load(l)),void 0!==i&&(h.repeat.fromArray(i),1!==i[0]&&(h.wrapS=La),1!==i[1]&&(h.wrapT=La)),void 0!==n&&h.offset.fromArray(n),void 0!==o&&("repeat"===o[0]&&(h.wrapS=La),"mirror"===o[0]&&(h.wrapS=Pa),"repeat"===o[1]&&(h.wrapT=La),"mirror"===o[1]&&(h.wrapT=Pa)),void 0!==c&&(h.anisotropy=c);var p=Fo.generateUUID();return s[p]=h,p}void 0===t&&(t=new X),void 0===e&&(e=new Li),void 0===i&&(i=new Ki);var s={},c={uuid:Fo.generateUUID(),type:"MeshLambertMaterial"};for(var h in n){var l=n[h];switch(h){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":c.name=l;break;case"blending":c.blending=Gr[l];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",h,"is no longer supported.");break;case"colorDiffuse":c.color=t.fromArray(l).getHex();break;case"colorSpecular":c.specular=t.fromArray(l).getHex();break;case"colorEmissive":c.emissive=t.fromArray(l).getHex();break;case"specularCoef":c.shininess=l;break;case"shading":"basic"===l.toLowerCase()&&(c.type="MeshBasicMaterial"),"phong"===l.toLowerCase()&&(c.type="MeshPhongMaterial"),"standard"===l.toLowerCase()&&(c.type="MeshStandardMaterial");break;case"mapDiffuse":c.map=o(l,n.mapDiffuseRepeat,n.mapDiffuseOffset,n.mapDiffuseWrap,n.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":c.emissiveMap=o(l,n.mapEmissiveRepeat,n.mapEmissiveOffset,n.mapEmissiveWrap,n.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":c.lightMap=o(l,n.mapLightRepeat,n.mapLightOffset,n.mapLightWrap,n.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":c.aoMap=o(l,n.mapAORepeat,n.mapAOOffset,n.mapAOWrap,n.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":c.bumpMap=o(l,n.mapBumpRepeat,n.mapBumpOffset,n.mapBumpWrap,n.mapBumpAnisotropy);break;case"mapBumpScale":c.bumpScale=l;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":c.normalMap=o(l,n.mapNormalRepeat,n.mapNormalOffset,n.mapNormalWrap,n.mapNormalAnisotropy);break;case"mapNormalFactor":c.normalScale=[l,l];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":c.specularMap=o(l,n.mapSpecularRepeat,n.mapSpecularOffset,n.mapSpecularWrap,n.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":c.metalnessMap=o(l,n.mapMetalnessRepeat,n.mapMetalnessOffset,n.mapMetalnessWrap,n.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":c.roughnessMap=o(l,n.mapRoughnessRepeat,n.mapRoughnessOffset,n.mapRoughnessWrap,n.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":c.alphaMap=o(l,n.mapAlphaRepeat,n.mapAlphaOffset,n.mapAlphaWrap,n.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":c.side=Ar;break;case"doubleSided":c.side=Lr;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),c.opacity=l;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":c[h]=l;break;case"vertexColors":l===!0&&(c.vertexColors=Ur),"face"===l&&(c.vertexColors=Ir);break;default:console.error("THREE.Loader.createMaterial: Unsupported",h,l)}}return"MeshBasicMaterial"===c.type&&delete c.emissive,"MeshPhongMaterial"!==c.type&&delete c.specular,c.opacity<1&&(c.transparent=!0),i.setTextures(s),i.parse(c)}}()},tn.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,i=0,n=e.length;i<n;i+=2){var r=e[i],a=e[i+1];if(r.test(t))return a}return null}},Object.assign(en.prototype,{load:function(t,e,i,n){var r=this,a=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:tn.prototype.extractUrlBase(t),o=new Mi(this.manager);o.setWithCredentials(this.withCredentials),o.load(t,function(i){var n=JSON.parse(i),o=n.metadata;if(void 0!==o){var s=o.type;if(void 0!==s){if("object"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}}var c=r.parse(n,a);e(c.geometry,c.materials)},i,n)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){function n(e){function n(t,e){return t&1<<e}var r,a,o,s,l,u,p,d,f,m,v,g,y,x,_,b,w,M,E,T,S,A,L,R,P,C,I,U=t.faces,N=t.vertices,D=t.normals,O=t.colors,F=0;if(void 0!==t.uvs){for(r=0;r<t.uvs.length;r++)t.uvs[r].length&&F++;for(r=0;r<F;r++)c.faceVertexUvs[r]=[]}for(s=0,l=N.length;s<l;)M=new h,M.x=N[s++]*e,M.y=N[s++]*e,M.z=N[s++]*e,c.vertices.push(M);for(s=0,l=U.length;s<l;)if(m=U[s++],v=n(m,0),g=n(m,1),y=n(m,3),x=n(m,4),_=n(m,5),b=n(m,6),w=n(m,7),v){if(T=new dt,T.a=U[s],T.b=U[s+1],T.c=U[s+3],S=new dt,S.a=U[s+1],S.b=U[s+2],S.c=U[s+3],s+=4,g&&(f=U[s++],T.materialIndex=f,S.materialIndex=f),o=c.faces.length,y)for(r=0;r<F;r++)for(R=t.uvs[r],c.faceVertexUvs[r][o]=[],c.faceVertexUvs[r][o+1]=[],a=0;a<4;a++)d=U[s++],C=R[2*d],I=R[2*d+1],P=new i(C,I),2!==a&&c.faceVertexUvs[r][o].push(P),0!==a&&c.faceVertexUvs[r][o+1].push(P);if(x&&(p=3*U[s++],T.normal.set(D[p++],D[p++],D[p]),S.normal.copy(T.normal)),_)for(r=0;r<4;r++)p=3*U[s++],L=new h(D[p++],D[p++],D[p]),2!==r&&T.vertexNormals.push(L),0!==r&&S.vertexNormals.push(L);if(b&&(u=U[s++],A=O[u],T.color.setHex(A),S.color.setHex(A)),w)for(r=0;r<4;r++)u=U[s++],A=O[u],2!==r&&T.vertexColors.push(new X(A)),0!==r&&S.vertexColors.push(new X(A));c.faces.push(T),c.faces.push(S)}else{if(E=new dt,E.a=U[s++],E.b=U[s++],E.c=U[s++],g&&(f=U[s++],E.materialIndex=f),o=c.faces.length,y)for(r=0;r<F;r++)for(R=t.uvs[r],c.faceVertexUvs[r][o]=[],a=0;a<3;a++)d=U[s++],C=R[2*d],I=R[2*d+1],P=new i(C,I),c.faceVertexUvs[r][o].push(P);if(x&&(p=3*U[s++],E.normal.set(D[p++],D[p++],D[p])),_)for(r=0;r<3;r++)p=3*U[s++],L=new h(D[p++],D[p++],D[p]),E.vertexNormals.push(L);if(b&&(u=U[s++],E.color.setHex(O[u])),w)for(r=0;r<3;r++)u=U[s++],E.vertexColors.push(new X(O[u]));c.faces.push(E)}}function r(){var e=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var i=0,n=t.skinWeights.length;i<n;i+=e){var r=t.skinWeights[i],o=e>1?t.skinWeights[i+1]:0,s=e>2?t.skinWeights[i+2]:0,h=e>3?t.skinWeights[i+3]:0;c.skinWeights.push(new a(r,o,s,h))}if(t.skinIndices)for(var i=0,n=t.skinIndices.length;i<n;i+=e){var l=t.skinIndices[i],u=e>1?t.skinIndices[i+1]:0,p=e>2?t.skinIndices[i+2]:0,d=e>3?t.skinIndices[i+3]:0;c.skinIndices.push(new a(l,u,p,d))}c.bones=t.bones,c.bones&&c.bones.length>0&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+") should match.")}function o(e){if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i<n;i++){c.morphTargets[i]={},c.morphTargets[i].name=t.morphTargets[i].name,c.morphTargets[i].vertices=[];for(var r=c.morphTargets[i].vertices,a=t.morphTargets[i].vertices,o=0,s=a.length;o<s;o+=3){var l=new h;l.x=a[o]*e,l.y=a[o+1]*e,l.z=a[o+2]*e,r.push(l)}}if(void 0!==t.morphColors&&t.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var u=c.faces,p=t.morphColors[0].colors,i=0,n=u.length;i<n;i++)u[i].color.fromArray(p,3*i)}}function s(){var e=[],i=[];void 0!==t.animation&&i.push(t.animation),void 0!==t.animations&&(t.animations.length?i=i.concat(t.animations):i.push(t.animations));for(var n=0;n<i.length;n++){var r=Qi.parseAnimation(i[n],c.bones);r&&e.push(r)}if(c.morphTargets){var a=Qi.CreateClipsFromMorphTargetSequences(c.morphTargets,10);e=e.concat(a)}e.length>0&&(c.animations=e)}var c=new St,l=void 0!==t.scale?1/t.scale:1;if(n(l),r(),o(l),s(),c.computeFaceNormals(),c.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:c};var u=tn.prototype.initMaterials(t.materials,e,this.crossOrigin);return{geometry:c,materials:u}}}),Object.assign(nn.prototype,{load:function(t,e,i,n){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this,a=new Mi(r.manager);a.load(t,function(t){r.parse(JSON.parse(t),e)},i,n)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var i=this.parseGeometries(t.geometries),n=this.parseImages(t.images,function(){void 0!==e&&e(o)}),r=this.parseTextures(t.textures,n),a=this.parseMaterials(t.materials,r),o=this.parseObject(t.object,i,a);return t.animations&&(o.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(o),o},parseGeometries:function(t){var e={};if(void 0!==t)for(var i=new en,n=new $i,r=0,a=t.length;r<a;r++){var o,s=t[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Qc[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Qc[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Qc[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Qc[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Qc[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Qc[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":o=new Qc[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Qc[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Qc[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Qc[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Qc[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":o=n.parse(s);break;case"Geometry":o=i.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),e[s.uuid]=o}return e},parseMaterials:function(t,e){var i={};if(void 0!==t){var n=new Ki;n.setTextures(e);for(var r=0,a=t.length;r<a;r++){var o=n.parse(t[r]);i[o.uuid]=o}}return i},parseAnimations:function(t){for(var e=[],i=0;i<t.length;i++){var n=Qi.parse(t[i]);e.push(n)}return e},parseImages:function(t,e){function i(t){return n.manager.itemStart(t),o.load(t,function(){n.manager.itemEnd(t)},void 0,function(){n.manager.itemError(t)})}var n=this,r={};if(void 0!==t&&t.length>0){var a=new wi(e),o=new Si(a);o.setCrossOrigin(this.crossOrigin);for(var s=0,c=t.length;s<c;s++){var h=t[s],l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h.url)?h.url:n.texturePath+h.url;r[h.uuid]=i(l)}}return r},parseTextures:function(t,e){function i(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var r={};if(void 0!==t)for(var a=0,o=t.length;a<o;a++){var s=t[a];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var c=new n(e[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=i(s.mapping,Aa)),void 0!==s.offset&&c.offset.fromArray(s.offset),void 0!==s.repeat&&c.repeat.fromArray(s.repeat),void 0!==s.wrap&&(c.wrapS=i(s.wrap[0],Ca),c.wrapT=i(s.wrap[1],Ca)),void 0!==s.minFilter&&(c.minFilter=i(s.minFilter,Ba)),void 0!==s.magFilter&&(c.magFilter=i(s.magFilter,Ba)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),void 0!==s.flipY&&(c.flipY=s.flipY),r[s.uuid]=c}return r},parseObject:function(){var t=new l;return function(e,i,n){function r(t){return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),i[t]}function a(t){if(void 0!==t)return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}var o;switch(e.type){case"Scene":o=new ue,void 0!==e.background&&Number.isInteger(e.background)&&(o.background=new X(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?o.fog=new le(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(o.fog=new he(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":o=new Nt(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(o.focus=e.focus),void 0!==e.zoom&&(o.zoom=e.zoom),void 0!==e.filmGauge&&(o.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(o.filmOffset=e.filmOffset),void 0!==e.view&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Dt(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":o=new Fi(e.color,e.intensity);break;case"DirectionalLight":o=new Oi(e.color,e.intensity);break;case"PointLight":o=new Ni(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":o=new Ui(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new Pi(e.color,e.groundColor,e.intensity);break;case"Mesh":var s=r(e.geometry),c=a(e.material);o=s.bones&&s.bones.length>0?new xe(s,c):new Pt(s,c);break;case"LOD":o=new me;break;case"Line":o=new be(r(e.geometry),a(e.material),e.mode);break;case"LineSegments":o=new we(r(e.geometry),a(e.material));break;case"PointCloud":case"Points":o=new Ee(r(e.geometry),a(e.material));break;case"Sprite":o=new fe(a(e.material));break;case"Group":o=new Te;break;default:o=new ht}if(o.uuid=e.uuid,void 0!==e.name&&(o.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(o.position,o.quaternion,o.scale)):(void 0!==e.position&&o.position.fromArray(e.position),void 0!==e.rotation&&o.rotation.fromArray(e.rotation),void 0!==e.quaternion&&o.quaternion.fromArray(e.quaternion),void 0!==e.scale&&o.scale.fromArray(e.scale)),void 0!==e.castShadow&&(o.castShadow=e.castShadow),void 0!==e.receiveShadow&&(o.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(o.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(o.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&o.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(o.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(o.visible=e.visible),void 0!==e.userData&&(o.userData=e.userData),void 0!==e.children)for(var h in e.children)o.add(this.parseObject(e.children[h],i,n));if("LOD"===e.type)for(var l=e.levels,u=0;u<l.length;u++){var p=l[u],h=o.getObjectByProperty("uuid",p.object);void 0!==h&&o.addLevel(h,p.distance)}return o}}()}),rn.prototype={constructor:rn,getPoint:function(t){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},getPoints:function(t){t||(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t){t||(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(t||(t=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i,n=[],r=this.getPoint(0),a=0;for(n.push(0),i=1;i<=t;i++)e=this.getPoint(i/t),a+=e.distanceTo(r),n.push(a),r=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var i,n=this.getLengths(),r=0,a=n.length;i=e?e:t*n[a-1];for(var o,s=0,c=a-1;s<=c;)if(r=Math.floor(s+(c-s)/2),o=n[r]-i,o<0)s=r+1;else{if(!(o>0)){c=r;break}c=r-1}if(r=c,n[r]===i){var h=r/(a-1);return h}var l=n[r],u=n[r+1],p=u-l,d=(i-l)/p,h=(r+d)/(a-1);return h},getTangent:function(t){var e=1e-4,i=t-e,n=t+e;i<0&&(i=0),n>1&&(n=1);var r=this.getPoint(i),a=this.getPoint(n),o=a.clone().sub(r);return o.normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var i,n,r,a=new h,o=[],s=[],c=[],u=new h,p=new l;for(i=0;i<=t;i++)n=i/t,o[i]=this.getTangentAt(n),o[i].normalize();s[0]=new h,c[0]=new h;var d=Number.MAX_VALUE,f=Math.abs(o[0].x),m=Math.abs(o[0].y),v=Math.abs(o[0].z);for(f<=d&&(d=f,a.set(1,0,0)),m<=d&&(d=m,a.set(0,1,0)),v<=d&&a.set(0,0,1),u.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],u),c[0].crossVectors(o[0],s[0]),i=1;i<=t;i++)s[i]=s[i-1].clone(),c[i]=c[i-1].clone(),u.crossVectors(o[i-1],o[i]),u.length()>Number.EPSILON&&(u.normalize(),r=Math.acos(Fo.clamp(o[i-1].dot(o[i]),-1,1)),s[i].applyMatrix4(p.makeRotationAxis(u,r))),c[i].crossVectors(o[i],s[i]);if(e===!0)for(r=Math.acos(Fo.clamp(s[0].dot(s[t]),-1,1)),r/=t,o[0].dot(u.crossVectors(s[0],s[t]))>0&&(r=-r),i=1;i<=t;i++)s[i].applyMatrix4(p.makeRotationAxis(o[i],r*i)),c[i].crossVectors(o[i],s[i]);return{tangents:o,normals:s,binormals:c}}},rn.create=function(t,e){return t.prototype=Object.create(rn.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},an.prototype=Object.create(rn.prototype),an.prototype.constructor=an,an.prototype.isLineCurve=!0,an.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},an.prototype.getPointAt=function(t){return this.getPoint(t)},an.prototype.getTangent=function(t){var e=this.v2.clone().sub(this.v1);return e.normalize()},on.prototype=Object.assign(Object.create(rn.prototype),{constructor:on,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new an(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=e){var r=i[n]-e,a=this.curves[n],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){t||(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,i=[],n=0,r=this.curves;n<r.length;n++)for(var a=r[n],o=a&&a.isEllipseCurve?2*t:a&&a.isLineCurve?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),c=0;c<s.length;c++){var h=s[c];e&&e.equals(h)||(i.push(h),e=h)}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new St,i=0,n=t.length;i<n;i++){var r=t[i];e.vertices.push(new h(r.x,r.y,r.z||0))}return e}}),sn.prototype=Object.create(rn.prototype),sn.prototype.constructor=sn,sn.prototype.isEllipseCurve=!0,sn.prototype.getPoint=function(t){for(var e=2*Math.PI,n=this.aEndAngle-this.aStartAngle,r=Math.abs(n)<Number.EPSILON;n<0;)n+=e;for(;n>e;)n-=e;n<Number.EPSILON&&(n=r?0:e),this.aClockwise!==!0||r||(n===e?n=-e:n-=e);var a=this.aStartAngle+t*n,o=this.aX+this.xRadius*Math.cos(a),s=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){var c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),l=o-this.aX,u=s-this.aY;o=l*c-u*h+this.aX,s=l*h+u*c+this.aY}return new i(o,s)};var rh={tangentQuadraticBezier:function(t,e,i,n){return 2*(1-t)*(i-e)+2*t*(n-i)},tangentCubicBezier:function(t,e,i,n,r){return-3*e*(1-t)*(1-t)+3*i*(1-t)*(1-t)-6*t*i*(1-t)+6*t*n*(1-t)-3*t*t*n+3*t*t*r},tangentSpline:function(t,e,i,n,r){var a=6*t*t-6*t,o=3*t*t-4*t+1,s=-6*t*t+6*t,c=3*t*t-2*t;return a+o+s+c},interpolate:function(t,e,i,n,r){var a=.5*(i-t),o=.5*(n-e),s=r*r,c=r*s;return(2*e-2*i+a+o)*c+(-3*e+3*i-2*a-o)*s+a*r+e}};cn.prototype=Object.create(rn.prototype),cn.prototype.constructor=cn,cn.prototype.isSplineCurve=!0,cn.prototype.getPoint=function(t){var e=this.points,n=(e.length-1)*t,r=Math.floor(n),a=n-r,o=e[0===r?r:r-1],s=e[r],c=e[r>e.length-2?e.length-1:r+1],h=e[r>e.length-3?e.length-1:r+2],l=rh.interpolate;return new i(l(o.x,s.x,c.x,h.x,a),l(o.y,s.y,c.y,h.y,a))},hn.prototype=Object.create(rn.prototype),hn.prototype.constructor=hn,hn.prototype.getPoint=function(t){var e=Jc.b3;return new i(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},hn.prototype.getTangent=function(t){var e=rh.tangentCubicBezier;return new i(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},ln.prototype=Object.create(rn.prototype),ln.prototype.constructor=ln,ln.prototype.getPoint=function(t){var e=Jc.b2;return new i(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},ln.prototype.getTangent=function(t){var e=rh.tangentQuadraticBezier;return new i(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()};var ah=Object.assign(Object.create(on.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var n=new an(this.currentPoint.clone(),new i(t,e));this.curves.push(n),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,n,r){var a=new ln(this.currentPoint.clone(),new i(t,e),new i(n,r));this.curves.push(a),this.currentPoint.set(n,r)},bezierCurveTo:function(t,e,n,r,a,o){var s=new hn(this.currentPoint.clone(),new i(t,e),new i(n,r),new i(a,o));this.curves.push(s),this.currentPoint.set(a,o)},splineThru:function(t){var e=[this.currentPoint.clone()].concat(t),i=new cn(e);this.curves.push(i),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,i,n,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+o,e+s,i,n,r,a)},absarc:function(t,e,i,n,r,a){this.absellipse(t,e,i,i,n,r,a)},ellipse:function(t,e,i,n,r,a,o,s){var c=this.currentPoint.x,h=this.currentPoint.y;this.absellipse(t+c,e+h,i,n,r,a,o,s)},absellipse:function(t,e,i,n,r,a,o,s){var c=new sn(t,e,i,n,r,a,o,s);if(this.curves.length>0){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)}});un.prototype=Object.assign(Object.create(ah),{constructor:un,getPointsHoles:function(t){for(var e=[],i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e},extractAllPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},extractPoints:function(t){return this.extractAllPoints(t)}}),pn.prototype=ah,ah.constructor=pn,dn.prototype={moveTo:function(t,e){this.currentPath=new pn,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,i,n){this.currentPath.quadraticCurveTo(t,e,i,n)},bezierCurveTo:function(t,e,i,n,r,a){this.currentPath.bezierCurveTo(t,e,i,n,r,a)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function i(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i],a=new un;a.curves=r.curves,e.push(a)}return e}function n(t,e){for(var i=e.length,n=!1,r=i-1,a=0;a<i;r=a++){var o=e[r],s=e[a],c=s.x-o.x,h=s.y-o.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(o=e[a],c=-c,s=e[r],h=-h),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var l=h*(t.x-o.x)-c*(t.y-o.y);if(0===l)return!0;if(l<0)continue;n=!n}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return n}var r=Jc.isClockWise,a=this.subPaths;if(0===a.length)return[];if(e===!0)return i(a);var o,s,c,h=[];if(1===a.length)return s=a[0],c=new un,c.curves=s.curves,h.push(c),h;var l=!r(a[0].getPoints());l=t?!l:l;var u,p=[],d=[],f=[],m=0;d[m]=void 0,f[m]=[];for(var v=0,g=a.length;v<g;v++)s=a[v],u=s.getPoints(),o=r(u),o=t?!o:o,o?(!l&&d[m]&&m++,d[m]={s:new un,p:u},d[m].s.curves=s.curves,l&&m++,f[m]=[]):f[m].push({h:s,p:u[0]});if(!d[0])return i(a);if(d.length>1){for(var y=!1,x=[],_=0,b=d.length;_<b;_++)p[_]=[];for(var _=0,b=d.length;_<b;_++)for(var w=f[_],M=0;M<w.length;M++){for(var E=w[M],T=!0,S=0;S<d.length;S++)n(E.p,d[S].p)&&(_!==S&&x.push({froms:_,tos:S,hole:M}),T?(T=!1,p[S].push(E)):y=!0);T&&p[_].push(E)}x.length>0&&(y||(f=p))}for(var A,v=0,L=d.length;v<L;v++){c=d[v].s,h.push(c),A=f[v];for(var R=0,P=A.length;R<P;R++)c.holes.push(A[R].h)}return h}},Object.assign(fn.prototype,{isFont:!0,generateShapes:function(t,e,i){function n(t){for(var i=String(t).split(""),n=e/a.resolution,o=0,s=[],c=0;c<i.length;c++){
13
+ var h=r(i[c],n,o);o+=h.offset,s.push(h.path)}return s}function r(t,e,n){var r=a.glyphs[t]||a.glyphs["?"];if(r){var o,s,c,h,l,u,p,d,f,m,v,g=new dn,y=[],x=Jc.b2,_=Jc.b3;if(r.o)for(var b=r._cachedOutline||(r._cachedOutline=r.o.split(" ")),w=0,M=b.length;w<M;){var E=b[w++];switch(E){case"m":o=b[w++]*e+n,s=b[w++]*e,g.moveTo(o,s);break;case"l":o=b[w++]*e+n,s=b[w++]*e,g.lineTo(o,s);break;case"q":if(c=b[w++]*e+n,h=b[w++]*e,p=b[w++]*e+n,d=b[w++]*e,g.quadraticCurveTo(p,d,c,h),v=y[y.length-1]){l=v.x,u=v.y;for(var T=1;T<=i;T++){var S=T/i;x(S,l,p,c),x(S,u,d,h)}}break;case"b":if(c=b[w++]*e+n,h=b[w++]*e,p=b[w++]*e+n,d=b[w++]*e,f=b[w++]*e+n,m=b[w++]*e,g.bezierCurveTo(p,d,f,m,c,h),v=y[y.length-1]){l=v.x,u=v.y;for(var T=1;T<=i;T++){var S=T/i;_(S,l,p,f,c),_(S,u,d,m,h)}}}}return{offset:r.ha*e,path:g}}}void 0===e&&(e=100),void 0===i&&(i=4);for(var a=this.data,o=n(t),s=[],c=0,h=o.length;c<h;c++)Array.prototype.push.apply(s,o[c].toShapes());return s}}),Object.assign(mn.prototype,{load:function(t,e,i,n){var r=this,a=new Mi(this.manager);a.load(t,function(t){var i;try{i=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),i=JSON.parse(t.substring(65,t.length-2))}var n=r.parse(i);e&&e(n)},i,n)},parse:function(t){return new fn(t)}});var oh;Object.assign(gn.prototype,{load:function(t,e,i,n){var r=new Mi(this.manager);r.setResponseType("arraybuffer"),r.load(t,function(t){var i=vn();i.decodeAudioData(t,function(t){e(t)})},i,n)}}),Object.assign(yn.prototype,{update:function(){var t,e,i,n,r,a,o,s=new l,c=new l;return function(h){var l=t!==this||e!==h.focus||i!==h.fov||n!==h.aspect*this.aspect||r!==h.near||a!==h.far||o!==h.zoom;if(l){t=this,e=h.focus,i=h.fov,n=h.aspect*this.aspect,r=h.near,a=h.far,o=h.zoom;var u,p,d=h.projectionMatrix.clone(),f=this.eyeSep/2,m=f*r/e,v=r*Math.tan(Fo.DEG2RAD*i*.5)/o;c.elements[12]=-f,s.elements[12]=f,u=-v*n+m,p=v*n+m,d.elements[0]=2*r/(p-u),d.elements[8]=(p+u)/(p-u),this.cameraL.projectionMatrix.copy(d),u=-v*n-m,p=v*n-m,d.elements[0]=2*r/(p-u),d.elements[8]=(p+u)/(p-u),this.cameraR.projectionMatrix.copy(d)}this.cameraL.matrixWorld.copy(h.matrixWorld).multiply(c),this.cameraR.matrixWorld.copy(h.matrixWorld).multiply(s)}}()}),xn.prototype=Object.create(ht.prototype),xn.prototype.constructor=xn,_n.prototype=Object.assign(Object.create(ht.prototype),{constructor:_n,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){this.gain.gain.value=t},updateMatrixWorld:function(){var t=new h,e=new c,i=new h,n=new h;return function(r){ht.prototype.updateMatrixWorld.call(this,r);var a=this.context.listener,o=this.up;this.matrixWorld.decompose(t,e,i),n.set(0,0,-1).applyQuaternion(e),a.setPosition(t.x,t.y,t.z),a.setOrientation(n.x,n.y,n.z,o.x,o.y,o.z)}}()}),bn.prototype=Object.assign(Object.create(ht.prototype),{constructor:bn,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.source.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");if(this.hasPlaybackControl===!1)return void console.warn("THREE.Audio: this Audio has no playback control.");var t=this.context.createBufferSource();return t.buffer=this.source.buffer,t.loop=this.source.loop,t.onended=this.source.onended,t.start(0,this.startTime),t.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=t,this.connect()},pause:function(){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this)},stop:function(){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0,this.isPlaying=!1,this)},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),this.isPlaying===!0?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=t,this.isPlaying===!0&&(this.source.playbackRate.value=this.playbackRate),this)},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},setLoop:function(t){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):void(this.source.loop=t)},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),wn.prototype=Object.assign(Object.create(bn.prototype),{constructor:wn,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){this.panner.refDistance=t},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){this.panner.rolloffFactor=t},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){this.panner.distanceModel=t},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){this.panner.maxDistance=t},updateMatrixWorld:function(){var t=new h;return function(e){ht.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),Object.assign(Mn.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),i=0;i<e.length;i++)t+=e[i];return t/e.length}}),En.prototype={constructor:En,accumulate:function(t,e){var i=this.buffer,n=this.valueSize,r=t*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)i[r+o]=i[o];a=e}else{a+=e;var s=e/a;this._mixBufferRegion(i,r,0,s,n)}this.cumulativeWeight=a},apply:function(t){var e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,r<1){var o=3*e;this._mixBufferRegion(i,n,o,1-r,e)}for(var s=e,c=e+e;s!==c;++s)if(i[s]!==i[s+e]){a.setValue(i,n);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,i=this.valueSize,n=3*i;t.getValue(e,n);for(var r=i,a=n;r!==a;++r)e[r]=e[n+r%i];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,i,n,r){if(n>=.5)for(var a=0;a!==r;++a)t[e+a]=t[i+a]},_slerp:function(t,e,i,n,r){c.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var a=1-n,o=0;o!==r;++o){var s=e+o;t[s]=t[s]*a+t[i+o]*n}}},Tn.prototype={constructor:Tn,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=Tn.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(i){var a=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error(" can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var o=0;o<t.length;o++)if(t[o].name===a){a=o;break}break;default:if(void 0===t[i])return void console.error(" can not bind to objectName of node, undefined",this);t=t[i]}if(void 0!==a){if(void 0===t[a])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,t);t=t[a]}}var s=t[n];if(void 0===s){var c=e.nodeName;return void console.error(" trying to update property for track: "+c+"."+n+" but it wasn't found.",t)}var h=this.Versioning.None;void 0!==t.needsUpdate?(h=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(h=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var l=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!t.geometry.morphTargets)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(var o=0;o<this.node.geometry.morphTargets.length;o++)if(t.geometry.morphTargets[o].name===r){r=o;break}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):void 0!==s.length?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][h]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(Tn.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:Tn.prototype.getValue,_setValue_unbound:Tn.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)t[e++]=i[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),Tn.Composite=function(t,e,i){var n=i||Tn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)},Tn.Composite.prototype={constructor:Tn.Composite,getValue:function(t,e){this.bind();var i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},Tn.create=function(t,e,i){return t&&t.isAnimationObjectGroup?new Tn.Composite(t,e,i):new Tn(t,e,i)},Tn.parseTrackName=function(t){var e=/^((?:\w+[\/:])*)(\w+)?(?:\.(\w+)(?:\[(.+)\])?)?\.(\w+)(?:\[(.+)\])?$/,i=e.exec(t);if(!i)throw new Error("cannot parse trackName at all: "+t);var n={nodeName:i[2],objectName:i[3],objectIndex:i[4],propertyName:i[5],propertyIndex:i[6]};if(null===n.propertyName||0===n.propertyName.length)throw new Error("can not parse propertyName from trackName: "+t);return n},Tn.findNode=function(t,e){if(!e||""===e||"root"===e||"."===e||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){var i=function(t){for(var i=0;i<t.bones.length;i++){var n=t.bones[i];if(n.name===e)return n}return null},n=i(t.skeleton);if(n)return n}if(t.children){var r=function(t){for(var i=0;i<t.length;i++){var n=t[i];if(n.name===e||n.uuid===e)return n;var a=r(n.children);if(a)return a}return null},a=r(t.children);if(a)return a}return null},Sn.prototype={constructor:Sn,isAnimationObjectGroup:!0,add:function(t){for(var e=this._objects,i=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._paths,o=this._parsedPaths,s=this._bindings,c=s.length,h=0,l=arguments.length;h!==l;++h){var u=arguments[h],p=u.uuid,d=r[p];if(void 0===d){d=i++,r[p]=d,e.push(u);for(var f=0,m=c;f!==m;++f)s[f].push(new Tn(u,a[f],o[f]))}else if(d<n){var v=e[d],g=--n,y=e[g];r[y.uuid]=d,e[d]=y,r[p]=g,e[g]=u;for(var f=0,m=c;f!==m;++f){var x=s[f],_=x[g],b=x[d];x[d]=_,void 0===b&&(b=new Tn(u,a[f],o[f])),x[g]=b}}else e[d]!==v&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=n},remove:function(t){for(var e=this._objects,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],h=c.uuid,l=n[h];if(void 0!==l&&l>=i){var u=i++,p=e[u];n[p.uuid]=l,e[l]=p,n[h]=u,e[u]=c;for(var d=0,f=a;d!==f;++d){var m=r[d],v=m[u],g=m[l];m[l]=v,m[u]=g}}}this.nCachedObjects_=i},uncache:function(t){for(var e=this._objects,i=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._bindings,o=a.length,s=0,c=arguments.length;s!==c;++s){var h=arguments[s],l=h.uuid,u=r[l];if(void 0!==u)if(delete r[l],u<n){var p=--n,d=e[p],f=--i,m=e[f];r[d.uuid]=u,e[u]=d,r[m.uuid]=p,e[p]=m,e.pop();for(var v=0,g=o;v!==g;++v){var y=a[v],x=y[p],_=y[f];y[u]=x,y[p]=_,y.pop()}}else{var f=--i,m=e[f];r[m.uuid]=u,e[u]=m,e.pop();for(var v=0,g=o;v!==g;++v){var y=a[v];y[u]=y[f],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(t,e){var i=this._bindingsIndicesByPath,n=i[t],r=this._bindings;if(void 0!==n)return r[n];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,h=this.nCachedObjects_,l=new Array(c);n=r.length,i[t]=n,a.push(t),o.push(e),r.push(l);for(var u=h,p=s.length;u!==p;++u){var d=s[u];l[u]=new Tn(d,t,e)}return l},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){var n=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=t[o];e[c]=i,a[i]=s,a.pop(),r[i]=r[o],r.pop(),n[i]=n[o],n.pop()}}},An.prototype={constructor:An,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){var n=this._clip.duration,r=t._clip.duration,a=r/n,o=n/r;t.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(t,e,i){return t.crossFadeFrom(this,e,i)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,i){var n=this._mixer,r=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=r,s[1]=r+i,c[0]=t/o,c[1]=e/o,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,i,n){var r=this._startTime;if(null!==r){var a=(t-r)*i;if(a<0||0===i)return;this._startTime=null,e=i*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(o),h[l].accumulate(n,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var i=this._clip.duration,n=this.loop,r=this._loopCount;if(n===mo){r===-1&&(this.loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var a=n===go;if(r===-1&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),e>=i||e<0){var o=Math.floor(e/i);e-=i*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1===(1&r))return this.time=e,i-e}return this.time=e,e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=wo,n.endingEnd=wo):(t?n.endingStart=this.zeroSlopeAtStart?wo:bo:n.endingStart=Mo,e?n.endingEnd=this.zeroSlopeAtEnd?wo:bo:n.endingEnd=Mo)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=e,o[1]=r+t,s[1]=i,this}},Object.assign(Ln.prototype,e.prototype,{clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Qi.findByName(i,t):t,a=null!==r?r.uuid:t,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[n];if(void 0!==c)return c;s=o.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var h=new An(this,r,e);return this._bindAction(h,s),this._addInactiveAction(h,a,n),h},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Qi.findByName(i,t):t,a=r?r.uuid:t,o=this._actionsByClip[a];return void 0!==o?o.actionByRoot[n]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(var r=0;r!==n;++r)i[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1,o=0;o!==i;++o){var s=e[o];s.enabled&&s._update(n,t,r,a)}for(var c=this._bindings,h=this._nActiveBindings,o=0;o!==h;++o)c[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var h=c._cacheIndex,l=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=h,e[h]=l,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(t){var e=t.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot,a=r[e];void 0!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[e];if(void 0!==s)for(var c in s){var h=s[c];h.restoreOriginalState(),this._removeInactiveBinding(h)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),Object.assign(Ln.prototype,{_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,a=t._propertyBindings,o=t._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==r;++l){var u=n[l],p=u.name,d=h[p];if(void 0!==d)a[l]=d;else{if(d=a[l],void 0!==d){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=e&&e._propertyBindings[l].binding.parsedPath;d=new En(Tn.create(i,p,f),u.ValueTypeName,u.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,s,p),a[l]=d}o[l].resultBuffer=d.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,i){var n=this._actions,r=this._actionsByClip,a=r[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=n.length,n.push(t),a.actionByRoot[i]=t},_removeInactiveAction:function(t){var e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,c=s[s.length-1],h=t._byClipCacheIndex;c._byClipCacheIndex=h,s[h]=c,s.pop(),t._byClipCacheIndex=null;var l=o.actionByRoot,u=(e._localRoot||this._root).uuid;delete l[u],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0===--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(t){var e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackAction:function(t){var e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_addInactiveBinding:function(t,e,i){var n=this._bindingsByRootAndName,r=n[e],a=this._bindings;void 0===r&&(r={},n[e]=r),r[i]=t,t._cacheIndex=a.length,a.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,o=a[n],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete o[r];t:{for(var h in o)break t;delete a[n]}},_lendBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_takeBackBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,i=t[e];return void 0===i&&(i=new Gi(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=e,t[e]=i),i},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r},_controlInterpolantsResultBuffer:new Float32Array(1)}),Pn.prototype=Object.create(Rt.prototype),Pn.prototype.constructor=Pn,Pn.prototype.isInstancedBufferGeometry=!0,Pn.prototype.addGroup=function(t,e,i){this.groups.push({start:t,count:e,materialIndex:i})},Pn.prototype.copy=function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var i=t.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var a=t.groups,o=0,s=a.length;o<s;o++){var c=a[o];this.addGroup(c.start,c.count,c.materialIndex)}return this},Cn.prototype={constructor:Cn,isInterleavedBufferAttribute:!0,get count(){return this.data.count},get array(){return this.data.array},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}},In.prototype={constructor:In,isInterleavedBuffer:!0,set needsUpdate(t){t===!0&&this.version++},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.stride:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.stride,i*=e.stride;for(var n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)}},Un.prototype=Object.create(In.prototype),Un.prototype.constructor=Un,Un.prototype.isInstancedInterleavedBuffer=!0,Un.prototype.copy=function(t){return In.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},Nn.prototype=Object.create(mt.prototype),Nn.prototype.constructor=Nn,Nn.prototype.isInstancedBufferAttribute=!0,Nn.prototype.copy=function(t){return mt.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},Dn.prototype={constructor:Dn,linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e){var i=[];return Fn(t,this,i,e),i.sort(On),i},intersectObjects:function(t,e){var i=[];if(Array.isArray(t)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var n=0,r=t.length;n<r;n++)Fn(t[n],this,i,e);return i.sort(On),i}},Bn.prototype={constructor:Bn,start:function(){this.startTime=(performance||Date).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running&&this.start(),this.running){var e=(performance||Date).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}},Gn.prototype={constructor:Gn,set:function(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){var t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(Fo.clamp(t.y/this.radius,-1,1))),this}},Hn.prototype=Object.create(Pt.prototype),Hn.prototype.constructor=Hn,Hn.prototype.createAnimation=function(t,e,i,n){var r={start:e,end:i,length:i-e+1,fps:n,duration:(i-e)/n,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[t]=r,this.animationsList.push(r)},Hn.prototype.autoCreateAnimations=function(t){for(var e,i=/([a-z]+)_?(\d+)/i,n={},r=this.geometry,a=0,o=r.morphTargets.length;a<o;a++){var s=r.morphTargets[a],c=s.name.match(i);if(c&&c.length>1){var h=c[1];n[h]||(n[h]={start:1/0,end:-(1/0)});var l=n[h];a<l.start&&(l.start=a),a>l.end&&(l.end=a),e||(e=h)}}for(var h in n){var l=n[h];this.createAnimation(h,l.start,l.end,t);
14
+ }this.firstAnimation=e},Hn.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},Hn.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},Hn.prototype.setAnimationFPS=function(t,e){var i=this.animationsMap[t];i&&(i.fps=e,i.duration=(i.end-i.start)/i.fps)},Hn.prototype.setAnimationDuration=function(t,e){var i=this.animationsMap[t];i&&(i.duration=e,i.fps=(i.end-i.start)/i.duration)},Hn.prototype.setAnimationWeight=function(t,e){var i=this.animationsMap[t];i&&(i.weight=e)},Hn.prototype.setAnimationTime=function(t,e){var i=this.animationsMap[t];i&&(i.time=e)},Hn.prototype.getAnimationTime=function(t){var e=0,i=this.animationsMap[t];return i&&(e=i.time),e},Hn.prototype.getAnimationDuration=function(t){var e=-1,i=this.animationsMap[t];return i&&(e=i.duration),e},Hn.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},Hn.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},Hn.prototype.update=function(t){for(var e=0,i=this.animationsList.length;e<i;e++){var n=this.animationsList[e];if(n.active){var r=n.duration/n.length;n.time+=n.direction*t,n.mirroredLoop?(n.time>n.duration||n.time<0)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),n.time<0&&(n.time=0,n.directionBackwards=!1)):(n.time=n.time%n.duration,n.time<0&&(n.time+=n.duration));var a=n.start+Fo.clamp(Math.floor(n.time/r),0,n.length-1),o=n.weight;a!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*o,this.morphTargetInfluences[a]=0,n.lastFrame=n.currentFrame,n.currentFrame=a);var s=n.time%r/r;n.directionBackwards&&(s=1-s),n.currentFrame!==n.lastFrame?(this.morphTargetInfluences[n.currentFrame]=s*o,this.morphTargetInfluences[n.lastFrame]=(1-s)*o):this.morphTargetInfluences[n.currentFrame]=o}}},Vn.prototype=Object.create(ht.prototype),Vn.prototype.constructor=Vn,Vn.prototype.isImmediateRenderObject=!0,kn.prototype=Object.create(we.prototype),kn.prototype.constructor=kn,kn.prototype.update=function(){var t=new h,e=new h,i=new it;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,c=o.faces,h=0,l=0,u=c.length;l<u;l++)for(var p=c[l],d=0,f=p.vertexNormals.length;d<f;d++){var m=s[p[n[d]]],v=p.vertexNormals[d];t.copy(m).applyMatrix4(r),e.copy(v).applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),a.setXYZ(h,t.x,t.y,t.z),h+=1,a.setXYZ(h,e.x,e.y,e.z),h+=1}else if(o&&o.isBufferGeometry)for(var g=o.attributes.position,y=o.attributes.normal,h=0,d=0,f=g.count;d<f;d++)t.set(g.getX(d),g.getY(d),g.getZ(d)).applyMatrix4(r),e.set(y.getX(d),y.getY(d),y.getZ(d)),e.applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),a.setXYZ(h,t.x,t.y,t.z),h+=1,a.setXYZ(h,e.x,e.y,e.z),h+=1;return a.needsUpdate=!0,this}}(),jn.prototype=Object.create(ht.prototype),jn.prototype.constructor=jn,jn.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},jn.prototype.update=function(){var t=new h,e=new h;return function(){var i=this.light.distance?this.light.distance:1e3,n=i*Math.tan(this.light.angle);this.cone.scale.set(n,n,i),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),Wn.prototype=Object.create(we.prototype),Wn.prototype.constructor=Wn,Wn.prototype.getBoneList=function(t){var e=[];t&&t.isBone&&e.push(t);for(var i=0;i<t.children.length;i++)e.push.apply(e,this.getBoneList(t.children[i]));return e},Wn.prototype.update=function(){for(var t=this.geometry,e=(new l).getInverse(this.root.matrixWorld),i=new l,n=0,r=0;r<this.bones.length;r++){var a=this.bones[r];a.parent&&a.parent.isBone&&(i.multiplyMatrices(e,a.matrixWorld),t.vertices[n].setFromMatrixPosition(i),i.multiplyMatrices(e,a.parent.matrixWorld),t.vertices[n+1].setFromMatrixPosition(i),n+=2)}t.verticesNeedUpdate=!0,t.computeBoundingSphere()},Xn.prototype=Object.create(Pt.prototype),Xn.prototype.constructor=Xn,Xn.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Xn.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},Yn.prototype=Object.create(ht.prototype),Yn.prototype.constructor=Yn,Yn.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},Yn.prototype.update=function(){var t=new h;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),qn.prototype=Object.create(we.prototype),qn.prototype.constructor=qn,qn.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Zn.prototype=Object.create(we.prototype),Zn.prototype.constructor=Zn,Zn.prototype.update=function(){var t=new h,e=new h,i=new it;return function(){this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,r=this.geometry.attributes.position,a=this.object.geometry,o=a.vertices,s=a.faces,c=0,h=0,l=s.length;h<l;h++){var u=s[h],p=u.normal;t.copy(o[u.a]).add(o[u.b]).add(o[u.c]).divideScalar(3).applyMatrix4(n),e.copy(p).applyMatrix3(i).normalize().multiplyScalar(this.size).add(t),r.setXYZ(c,t.x,t.y,t.z),c+=1,r.setXYZ(c,e.x,e.y,e.z),c+=1}return r.needsUpdate=!0,this}}(),Jn.prototype=Object.create(ht.prototype),Jn.prototype.constructor=Jn,Jn.prototype.dispose=function(){var t=this.children[0],e=this.children[1];t.geometry.dispose(),t.material.dispose(),e.geometry.dispose(),e.material.dispose()},Jn.prototype.update=function(){var t=new h,e=new h,i=new h;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),i.subVectors(e,t);var n=this.children[0],r=this.children[1];n.lookAt(i),n.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),r.lookAt(i),r.scale.z=i.length()}}(),Qn.prototype=Object.create(we.prototype),Qn.prototype.constructor=Qn,Qn.prototype.update=function(){function t(t,a,o,s){n.set(a,o,s).unproject(r);var c=i[t];if(void 0!==c)for(var h=0,l=c.length;h<l;h++)e.vertices[c[h]].copy(n)}var e,i,n=new h,r=new Ut;return function(){e=this.geometry,i=this.pointMap;var n=1,a=1;r.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-n,-a,-1),t("n2",n,-a,-1),t("n3",-n,a,-1),t("n4",n,a,-1),t("f1",-n,-a,1),t("f2",n,-a,1),t("f3",-n,a,1),t("f4",n,a,1),t("u1",.7*n,1.1*a,-1),t("u2",.7*-n,1.1*a,-1),t("u3",0,2*a,-1),t("cf1",-n,0,1),t("cf2",n,0,1),t("cf3",0,-a,1),t("cf4",0,a,1),t("cn1",-n,0,-1),t("cn2",n,0,-1),t("cn3",0,-a,-1),t("cn4",0,a,-1),e.verticesNeedUpdate=!0}}(),Kn.prototype=Object.create(Pt.prototype),Kn.prototype.constructor=Kn,Kn.prototype.update=function(){this.box.setFromObject(this.object),this.box.getSize(this.scale),this.box.getCenter(this.position)},$n.prototype=Object.create(we.prototype),$n.prototype.constructor=$n,$n.prototype.update=function(){var t=new tt;return function(e){if(e&&e.isBox3?t.copy(e):t.setFromObject(e),!t.isEmpty()){var i=t.min,n=t.max,r=this.geometry.attributes.position,a=r.array;a[0]=n.x,a[1]=n.y,a[2]=n.z,a[3]=i.x,a[4]=n.y,a[5]=n.z,a[6]=i.x,a[7]=i.y,a[8]=n.z,a[9]=n.x,a[10]=i.y,a[11]=n.z,a[12]=n.x,a[13]=n.y,a[14]=i.z,a[15]=i.x,a[16]=n.y,a[17]=i.z,a[18]=i.x,a[19]=i.y,a[20]=i.z,a[21]=n.x,a[22]=i.y,a[23]=i.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}();var sh=new Rt;sh.addAttribute("position",new Mt([0,0,0,0,1,0],3));var ch=new oi(0,.5,1,5,1);ch.translate(0,-.5,0),tr.prototype=Object.create(ht.prototype),tr.prototype.constructor=tr,tr.prototype.setDirection=function(){var t,e=new h;return function(i){i.y>.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(i.z,0,-i.x).normalize(),t=Math.acos(i.y),this.quaternion.setFromAxisAngle(e,t))}}(),tr.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},tr.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},er.prototype=Object.create(we.prototype),er.prototype.constructor=er;var hh=function(){function t(){}var e=new h,i=new t,n=new t,r=new t;return t.prototype.init=function(t,e,i,n){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-n,this.c3=2*t-2*e+i+n},t.prototype.initNonuniformCatmullRom=function(t,e,i,n,r,a,o){var s=(e-t)/r-(i-t)/(r+a)+(i-e)/a,c=(i-e)/a-(n-e)/(a+o)+(n-i)/o;s*=a,c*=a,this.init(e,i,s,c)},t.prototype.initCatmullRom=function(t,e,i,n,r){this.init(e,i,r*(i-t),r*(n-e))},t.prototype.calc=function(t){var e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i},rn.create(function(t){this.points=t||[],this.closed=!1},function(t){var a,o,s,c,l=this.points;c=l.length,c<2&&console.log("duh, you need at least 2 points"),a=(c-(this.closed?0:1))*t,o=Math.floor(a),s=a-o,this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/l.length)+1)*l.length:0===s&&o===c-1&&(o=c-2,s=1);var u,p,d,f;if(this.closed||o>0?u=l[(o-1)%c]:(e.subVectors(l[0],l[1]).add(l[0]),u=e),p=l[o%c],d=l[(o+1)%c],this.closed||o+2<c?f=l[(o+2)%c]:(e.subVectors(l[c-1],l[c-2]).add(l[c-1]),f=e),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25,v=Math.pow(u.distanceToSquared(p),m),g=Math.pow(p.distanceToSquared(d),m),y=Math.pow(d.distanceToSquared(f),m);g<1e-4&&(g=1),v<1e-4&&(v=g),y<1e-4&&(y=g),i.initNonuniformCatmullRom(u.x,p.x,d.x,f.x,v,g,y),n.initNonuniformCatmullRom(u.y,p.y,d.y,f.y,v,g,y),r.initNonuniformCatmullRom(u.z,p.z,d.z,f.z,v,g,y)}else if("catmullrom"===this.type){var x=void 0!==this.tension?this.tension:.5;i.initCatmullRom(u.x,p.x,d.x,f.x,x),n.initCatmullRom(u.y,p.y,d.y,f.y,x),r.initCatmullRom(u.z,p.z,d.z,f.z,x)}var _=new h(i.calc(s),n.calc(s),r.calc(s));return _})}();ir.prototype=Object.create(hh.prototype);var lh=rn.create(function(t){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0===t?[]:t},function(t){var e=this.points,i=(e.length-1)*t,n=Math.floor(i),r=i-n,a=e[0==n?n:n-1],o=e[n],s=e[n>e.length-2?e.length-1:n+1],c=e[n>e.length-3?e.length-1:n+2],l=rh.interpolate;return new h(l(a.x,o.x,s.x,c.x,r),l(a.y,o.y,s.y,c.y,r),l(a.z,o.z,s.z,c.z,r))}),uh=rn.create(function(t,e,i,n){this.v0=t,this.v1=e,this.v2=i,this.v3=n},function(t){var e=Jc.b3;return new h(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),ph=rn.create(function(t,e,i){this.v0=t,this.v1=e,this.v2=i},function(t){var e=Jc.b2;return new h(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),dh=rn.create(function(t,e){this.v1=t,this.v2=e},function(t){if(1===t)return this.v2.clone();var e=new h;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e});nr.prototype=Object.create(sn.prototype),nr.prototype.constructor=nr;var fh={createMultiMaterialObject:function(t,e){for(var i=new Te,n=0,r=e.length;n<r;n++)i.add(new Pt(t,e[n]));return i},detach:function(t,e,i){t.applyMatrix(e.matrixWorld),e.remove(t),i.add(t)},attach:function(t,e,i){var n=new l;n.getInverse(i.matrixWorld),t.applyMatrix(n),e.remove(t),i.add(t)}},mh=0,vh=1;Object.assign(Y.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(tt.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(ut.prototype,{center:function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)}}),Object.assign(it.prototype,{multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)}}),Object.assign(l.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(t){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(t){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(t){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(t){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(t,e){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}),Object.assign(nt.prototype,{isIntersectionLine:function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)}}),Object.assign(c.prototype,{multiplyVector3:function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)}}),Object.assign(ot.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(un.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ze(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ri(this,t)}}),Object.assign(h.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)}}),Object.assign(ht.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(t){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(ht.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(t){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(me.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Nt.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Ri.prototype,{onlyShadow:{set:function(t){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(t){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(t){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(mt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.assign(Rt.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(Rt.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(J.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(t){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new X}}}),Object.defineProperties(yi.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(t){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(K.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),e.prototype=Object.assign(Object.create({constructor:e,apply:function(t){console.warn("THREE.EventDispatcher: .apply is deprecated, just inherit or Object.assign the prototype to mix-in."),Object.assign(t,this)}}),e.prototype),Object.defineProperties(Rn.prototype,{dynamic:{set:function(t){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.assign(ce.prototype,{supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(ce.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(at.prototype,{cullFace:{get:function(){return this.renderReverseSided?xr:yr},set:function(t){var e=t!==yr;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}}),Object.defineProperties(o.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.assign(bn.prototype,{load:function(t){console.warn("THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.");var e=this,i=new gn;return i.load(t,function(t){e.setBuffer(t)}),this}}),Object.assign(Mn.prototype,{getData:function(t){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()}});var gh={merge:function(t,e,i){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var n;e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),n=e.matrix,e=e.geometry),t.merge(e,n,i)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},yh={crossOrigin:void 0,loadTexture:function(t,e,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Li;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},loadTextureCube:function(t,e,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new Ai;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}};t.WebGLRenderTargetCube=s,t.WebGLRenderTarget=o,t.WebGLRenderer=ce,t.ShaderLib=Wc,t.UniformsLib=jc,t.UniformsUtils=jo,t.ShaderChunk=Vc,t.FogExp2=he,t.Fog=le,t.Scene=ue,t.LensFlare=pe,t.Sprite=fe,t.LOD=me,t.SkinnedMesh=xe,t.Skeleton=ge,t.Bone=ye,t.Mesh=Pt,t.LineSegments=we,t.Line=be,t.Points=Ee,t.Group=Te,t.VideoTexture=Se,t.DataTexture=ve,t.CompressedTexture=Ae,t.CubeTexture=u,t.CanvasTexture=Le,t.DepthTexture=Re,t.TextureIdCount=r,t.Texture=n,t.MaterialIdCount=Q,t.CompressedTextureLoader=Ei,t.BinaryTextureLoader=Ti,t.DataTextureLoader=eh,t.CubeTextureLoader=Ai,t.TextureLoader=Li,t.ObjectLoader=nn,t.MaterialLoader=Ki,t.BufferGeometryLoader=$i,t.DefaultLoadingManager=th,t.LoadingManager=wi,t.JSONLoader=en,t.ImageLoader=Si,t.FontLoader=mn,t.XHRLoader=Mi,t.Loader=tn,t.Cache=$c,t.AudioLoader=gn,t.SpotLightShadow=Ii,t.SpotLight=Ui,t.PointLight=Ni,t.HemisphereLight=Pi,t.DirectionalLightShadow=Di,t.DirectionalLight=Oi,t.AmbientLight=Fi,t.LightShadow=Ci,t.Light=Ri,t.StereoCamera=yn,t.PerspectiveCamera=Nt,t.OrthographicCamera=Dt,t.CubeCamera=xn,t.Camera=Ut,t.AudioListener=_n,t.PositionalAudio=wn,t.getAudioContext=vn,t.AudioAnalyser=Mn,t.Audio=bn,t.VectorKeyframeTrack=ki,t.StringKeyframeTrack=Yi,t.QuaternionKeyframeTrack=Wi,t.NumberKeyframeTrack=Xi,t.ColorKeyframeTrack=Zi,t.BooleanKeyframeTrack=qi,t.PropertyMixer=En,t.PropertyBinding=Tn,t.KeyframeTrack=Ji,t.AnimationUtils=ih,t.AnimationObjectGroup=Sn,t.AnimationMixer=Ln,t.AnimationClip=Qi,t.Uniform=Rn,t.InstancedBufferGeometry=Pn,t.BufferGeometry=Rt,t.GeometryIdCount=At,t.Geometry=St,t.InterleavedBufferAttribute=Cn,t.InstancedInterleavedBuffer=Un,t.InterleavedBuffer=In,t.InstancedBufferAttribute=Nn,t.DynamicBufferAttribute=Tt,t.Float64Attribute=Et,t.Float32Attribute=Mt,t.Uint32Attribute=wt,t.Int32Attribute=bt,t.Uint16Attribute=_t,
15
+ t.Int16Attribute=xt,t.Uint8ClampedAttribute=yt,t.Uint8Attribute=gt,t.Int8Attribute=vt,t.BufferAttribute=mt,t.Face3=dt,t.Object3DIdCount=lt,t.Object3D=ht,t.Raycaster=Dn,t.Layers=ct,t.EventDispatcher=e,t.Clock=Bn,t.QuaternionLinearInterpolant=ji,t.LinearInterpolant=Gi,t.DiscreteInterpolant=Hi,t.CubicInterpolant=zi,t.Interpolant=Bi,t.Triangle=pt,t.Spline=zn,t.Math=Fo,t.Spherical=Gn,t.Plane=nt,t.Frustum=rt,t.Sphere=et,t.Ray=ot,t.Matrix4=l,t.Matrix3=it,t.Box3=tt,t.Box2=Y,t.Line3=ut,t.Euler=st,t.Vector4=a,t.Vector3=h,t.Vector2=i,t.Quaternion=c,t.ColorKeywords=kc,t.Color=X,t.MorphBlendMesh=Hn,t.ImmediateRenderObject=Vn,t.VertexNormalsHelper=kn,t.SpotLightHelper=jn,t.SkeletonHelper=Wn,t.PointLightHelper=Xn,t.HemisphereLightHelper=Yn,t.GridHelper=qn,t.FaceNormalsHelper=Zn,t.DirectionalLightHelper=Jn,t.CameraHelper=Qn,t.BoundingBoxHelper=Kn,t.BoxHelper=$n,t.ArrowHelper=tr,t.AxisHelper=er,t.ClosedSplineCurve3=ir,t.CatmullRomCurve3=hh,t.SplineCurve3=lh,t.CubicBezierCurve3=uh,t.QuadraticBezierCurve3=ph,t.LineCurve3=dh,t.ArcCurve=nr,t.EllipseCurve=sn,t.SplineCurve=cn,t.CubicBezierCurve=hn,t.QuadraticBezierCurve=ln,t.LineCurve=an,t.Shape=un,t.ShapePath=dn,t.Path=pn,t.Font=fn,t.CurvePath=on,t.Curve=rn,t.ShapeUtils=Jc,t.SceneUtils=fh,t.CurveUtils=rh,t.WireframeGeometry=Pe,t.ParametricGeometry=Ie,t.ParametricBufferGeometry=Ce,t.TetrahedronGeometry=De,t.TetrahedronBufferGeometry=Ne,t.OctahedronGeometry=Fe,t.OctahedronBufferGeometry=Oe,t.IcosahedronGeometry=ze,t.IcosahedronBufferGeometry=Be,t.DodecahedronGeometry=He,t.DodecahedronBufferGeometry=Ge,t.PolyhedronGeometry=Ve,t.PolyhedronBufferGeometry=Ue,t.TubeGeometry=je,t.TubeBufferGeometry=ke,t.TorusKnotGeometry=Xe,t.TorusKnotBufferGeometry=We,t.TorusGeometry=qe,t.TorusBufferGeometry=Ye,t.TextGeometry=Je,t.SphereBufferGeometry=Qe,t.SphereGeometry=Ke,t.RingGeometry=ti,t.RingBufferGeometry=$e,t.PlaneBufferGeometry=It,t.PlaneGeometry=ei,t.LatheGeometry=ni,t.LatheBufferGeometry=ii,t.ShapeGeometry=ri,t.ExtrudeGeometry=Ze,t.EdgesGeometry=ai,t.ConeGeometry=ci,t.ConeBufferGeometry=hi;t.CylinderGeometry=si;t.CylinderBufferGeometry=oi,t.CircleBufferGeometry=li,t.CircleGeometry=ui,t.BoxBufferGeometry=Ct,t.BoxGeometry=pi,t.ShadowMaterial=di,t.SpriteMaterial=de,t.RawShaderMaterial=fi,t.ShaderMaterial=K,t.PointsMaterial=Me,t.MultiMaterial=mi,t.MeshPhysicalMaterial=gi,t.MeshStandardMaterial=vi,t.MeshPhongMaterial=yi,t.MeshNormalMaterial=xi,t.MeshLambertMaterial=_i,t.MeshDepthMaterial=$,t.MeshBasicMaterial=ft,t.LineDashedMaterial=bi,t.LineBasicMaterial=_e,t.Material=J,t.REVISION=mr,t.MOUSE=vr,t.CullFaceNone=gr,t.CullFaceBack=yr,t.CullFaceFront=xr,t.CullFaceFrontBack=_r,t.FrontFaceDirectionCW=br,t.FrontFaceDirectionCCW=wr,t.BasicShadowMap=Mr,t.PCFShadowMap=Er,t.PCFSoftShadowMap=Tr,t.FrontSide=Sr,t.BackSide=Ar,t.DoubleSide=Lr,t.FlatShading=Rr,t.SmoothShading=Pr,t.NoColors=Cr,t.FaceColors=Ir,t.VertexColors=Ur,t.NoBlending=Nr,t.NormalBlending=Dr,t.AdditiveBlending=Or,t.SubtractiveBlending=Fr,t.MultiplyBlending=Br,t.CustomBlending=zr,t.BlendingMode=Gr,t.AddEquation=Hr,t.SubtractEquation=Vr,t.ReverseSubtractEquation=kr,t.MinEquation=jr,t.MaxEquation=Wr,t.ZeroFactor=Xr,t.OneFactor=Yr,t.SrcColorFactor=qr,t.OneMinusSrcColorFactor=Zr,t.SrcAlphaFactor=Jr,t.OneMinusSrcAlphaFactor=Qr,t.DstAlphaFactor=Kr,t.OneMinusDstAlphaFactor=$r,t.DstColorFactor=ta,t.OneMinusDstColorFactor=ea,t.SrcAlphaSaturateFactor=ia,t.NeverDepth=na,t.AlwaysDepth=ra,t.LessDepth=aa,t.LessEqualDepth=oa,t.EqualDepth=sa,t.GreaterEqualDepth=ca,t.GreaterDepth=ha,t.NotEqualDepth=la,t.MultiplyOperation=ua,t.MixOperation=pa,t.AddOperation=da,t.NoToneMapping=fa,t.LinearToneMapping=ma,t.ReinhardToneMapping=va,t.Uncharted2ToneMapping=ga,t.CineonToneMapping=ya,t.UVMapping=xa,t.CubeReflectionMapping=_a,t.CubeRefractionMapping=ba,t.EquirectangularReflectionMapping=wa,t.EquirectangularRefractionMapping=Ma,t.SphericalReflectionMapping=Ea,t.CubeUVReflectionMapping=Ta,t.CubeUVRefractionMapping=Sa,t.TextureMapping=Aa,t.RepeatWrapping=La,t.ClampToEdgeWrapping=Ra,t.MirroredRepeatWrapping=Pa,t.TextureWrapping=Ca,t.NearestFilter=Ia,t.NearestMipMapNearestFilter=Ua,t.NearestMipMapLinearFilter=Na,t.LinearFilter=Da,t.LinearMipMapNearestFilter=Oa,t.LinearMipMapLinearFilter=Fa,t.TextureFilter=Ba,t.UnsignedByteType=za,t.ByteType=Ga,t.ShortType=Ha,t.UnsignedShortType=Va,t.IntType=ka,t.UnsignedIntType=ja,t.FloatType=Wa,t.HalfFloatType=Xa,t.UnsignedShort4444Type=Ya,t.UnsignedShort5551Type=qa,t.UnsignedShort565Type=Za,t.UnsignedInt248Type=Ja,t.AlphaFormat=Qa,t.RGBFormat=Ka,t.RGBAFormat=$a,t.LuminanceFormat=to,t.LuminanceAlphaFormat=eo,t.RGBEFormat=io,t.DepthFormat=no,t.DepthStencilFormat=ro,t.RGB_S3TC_DXT1_Format=ao,t.RGBA_S3TC_DXT1_Format=oo,t.RGBA_S3TC_DXT3_Format=so,t.RGBA_S3TC_DXT5_Format=co,t.RGB_PVRTC_4BPPV1_Format=ho,t.RGB_PVRTC_2BPPV1_Format=lo,t.RGBA_PVRTC_4BPPV1_Format=uo,t.RGBA_PVRTC_2BPPV1_Format=po,t.RGB_ETC1_Format=fo,t.LoopOnce=mo,t.LoopRepeat=vo,t.LoopPingPong=go,t.InterpolateDiscrete=yo,t.InterpolateLinear=xo,t.InterpolateSmooth=_o,t.ZeroCurvatureEnding=bo,t.ZeroSlopeEnding=wo,t.WrapAroundEnding=Mo,t.TrianglesDrawMode=Eo,t.TriangleStripDrawMode=To,t.TriangleFanDrawMode=So,t.LinearEncoding=Ao,t.sRGBEncoding=Lo,t.GammaEncoding=Ro,t.RGBEEncoding=Po,t.LogLuvEncoding=Co,t.RGBM7Encoding=Io,t.RGBM16Encoding=Uo,t.RGBDEncoding=No,t.BasicDepthPacking=Do,t.RGBADepthPacking=Oo,t.CubeGeometry=pi,t.Face4=rr,t.LineStrip=mh,t.LinePieces=vh,t.MeshFaceMaterial=mi,t.PointCloud=ar,t.Particle=fe,t.ParticleSystem=or,t.PointCloudMaterial=sr,t.ParticleBasicMaterial=cr,t.ParticleSystemMaterial=hr,t.Vertex=lr,t.EdgesHelper=ur,t.WireframeHelper=pr,t.GeometryUtils=gh,t.ImageUtils=yh,t.Projector=dr,t.CanvasRenderer=fr,Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AudioContext",{get:function(){return t.getAudioContext()}})});
@@ -0,0 +1,1118 @@
1
+ /**
2
+ * @author mrdoob / http://mrdoob.com/
3
+ */
4
+
5
+ THREE.SpriteCanvasMaterial = function ( parameters ) {
6
+
7
+ THREE.Material.call( this );
8
+
9
+ this.type = 'SpriteCanvasMaterial';
10
+
11
+ this.color = new THREE.Color( 0xffffff );
12
+ this.program = function ( context, color ) {};
13
+
14
+ this.setValues( parameters );
15
+
16
+ };
17
+
18
+ THREE.SpriteCanvasMaterial.prototype = Object.create( THREE.Material.prototype );
19
+ THREE.SpriteCanvasMaterial.prototype.constructor = THREE.SpriteCanvasMaterial;
20
+
21
+ THREE.SpriteCanvasMaterial.prototype.clone = function () {
22
+
23
+ var material = new THREE.SpriteCanvasMaterial();
24
+
25
+ material.copy( this );
26
+ material.color.copy( this.color );
27
+ material.program = this.program;
28
+
29
+ return material;
30
+
31
+ };
32
+
33
+ //
34
+
35
+ THREE.CanvasRenderer = function ( parameters ) {
36
+
37
+ console.log( 'THREE.CanvasRenderer', THREE.REVISION );
38
+
39
+ parameters = parameters || {};
40
+
41
+ var _this = this,
42
+ _renderData, _elements, _lights,
43
+ _projector = new THREE.Projector(),
44
+
45
+ _canvas = parameters.canvas !== undefined
46
+ ? parameters.canvas
47
+ : document.createElement( 'canvas' ),
48
+
49
+ _canvasWidth = _canvas.width,
50
+ _canvasHeight = _canvas.height,
51
+ _canvasWidthHalf = Math.floor( _canvasWidth / 2 ),
52
+ _canvasHeightHalf = Math.floor( _canvasHeight / 2 ),
53
+
54
+ _viewportX = 0,
55
+ _viewportY = 0,
56
+ _viewportWidth = _canvasWidth,
57
+ _viewportHeight = _canvasHeight,
58
+
59
+ _pixelRatio = 1,
60
+
61
+ _context = _canvas.getContext( '2d', {
62
+ alpha: parameters.alpha === true
63
+ } ),
64
+
65
+ _clearColor = new THREE.Color( 0x000000 ),
66
+ _clearAlpha = parameters.alpha === true ? 0 : 1,
67
+
68
+ _contextGlobalAlpha = 1,
69
+ _contextGlobalCompositeOperation = 0,
70
+ _contextStrokeStyle = null,
71
+ _contextFillStyle = null,
72
+ _contextLineWidth = null,
73
+ _contextLineCap = null,
74
+ _contextLineJoin = null,
75
+ _contextLineDash = [],
76
+
77
+ _camera,
78
+
79
+ _v1, _v2, _v3, _v4,
80
+ _v5 = new THREE.RenderableVertex(),
81
+ _v6 = new THREE.RenderableVertex(),
82
+
83
+ _v1x, _v1y, _v2x, _v2y, _v3x, _v3y,
84
+ _v4x, _v4y, _v5x, _v5y, _v6x, _v6y,
85
+
86
+ _color = new THREE.Color(),
87
+ _color1 = new THREE.Color(),
88
+ _color2 = new THREE.Color(),
89
+ _color3 = new THREE.Color(),
90
+ _color4 = new THREE.Color(),
91
+
92
+ _diffuseColor = new THREE.Color(),
93
+ _emissiveColor = new THREE.Color(),
94
+
95
+ _lightColor = new THREE.Color(),
96
+
97
+ _patterns = {},
98
+
99
+ _image, _uvs,
100
+ _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y,
101
+
102
+ _clipBox = new THREE.Box2(),
103
+ _clearBox = new THREE.Box2(),
104
+ _elemBox = new THREE.Box2(),
105
+
106
+ _ambientLight = new THREE.Color(),
107
+ _directionalLights = new THREE.Color(),
108
+ _pointLights = new THREE.Color(),
109
+
110
+ _vector3 = new THREE.Vector3(), // Needed for PointLight
111
+ _centroid = new THREE.Vector3(),
112
+ _normal = new THREE.Vector3(),
113
+ _normalViewMatrix = new THREE.Matrix3();
114
+
115
+ /* TODO
116
+ _canvas.mozImageSmoothingEnabled = false;
117
+ _canvas.webkitImageSmoothingEnabled = false;
118
+ _canvas.msImageSmoothingEnabled = false;
119
+ _canvas.imageSmoothingEnabled = false;
120
+ */
121
+
122
+ // dash+gap fallbacks for Firefox and everything else
123
+
124
+ if ( _context.setLineDash === undefined ) {
125
+
126
+ _context.setLineDash = function () {};
127
+
128
+ }
129
+
130
+ this.domElement = _canvas;
131
+
132
+ this.autoClear = true;
133
+ this.sortObjects = true;
134
+ this.sortElements = true;
135
+
136
+ this.info = {
137
+
138
+ render: {
139
+
140
+ vertices: 0,
141
+ faces: 0
142
+
143
+ }
144
+
145
+ };
146
+
147
+ // WebGLRenderer compatibility
148
+
149
+ this.supportsVertexTextures = function () {};
150
+ this.setFaceCulling = function () {};
151
+
152
+ // API
153
+
154
+ this.getContext = function () {
155
+
156
+ return _context;
157
+
158
+ };
159
+
160
+ this.getContextAttributes = function () {
161
+
162
+ return _context.getContextAttributes();
163
+
164
+ };
165
+
166
+ this.getPixelRatio = function () {
167
+
168
+ return _pixelRatio;
169
+
170
+ };
171
+
172
+ this.setPixelRatio = function ( value ) {
173
+
174
+ if ( value !== undefined ) _pixelRatio = value;
175
+
176
+ };
177
+
178
+ this.setSize = function ( width, height, updateStyle ) {
179
+
180
+ _canvasWidth = width * _pixelRatio;
181
+ _canvasHeight = height * _pixelRatio;
182
+
183
+ _canvas.width = _canvasWidth;
184
+ _canvas.height = _canvasHeight;
185
+
186
+ _canvasWidthHalf = Math.floor( _canvasWidth / 2 );
187
+ _canvasHeightHalf = Math.floor( _canvasHeight / 2 );
188
+
189
+ if ( updateStyle !== false ) {
190
+
191
+ _canvas.style.width = width + 'px';
192
+ _canvas.style.height = height + 'px';
193
+
194
+ }
195
+
196
+ _clipBox.min.set( - _canvasWidthHalf, - _canvasHeightHalf );
197
+ _clipBox.max.set( _canvasWidthHalf, _canvasHeightHalf );
198
+
199
+ _clearBox.min.set( - _canvasWidthHalf, - _canvasHeightHalf );
200
+ _clearBox.max.set( _canvasWidthHalf, _canvasHeightHalf );
201
+
202
+ _contextGlobalAlpha = 1;
203
+ _contextGlobalCompositeOperation = 0;
204
+ _contextStrokeStyle = null;
205
+ _contextFillStyle = null;
206
+ _contextLineWidth = null;
207
+ _contextLineCap = null;
208
+ _contextLineJoin = null;
209
+
210
+ this.setViewport( 0, 0, width, height );
211
+
212
+ };
213
+
214
+ this.setViewport = function ( x, y, width, height ) {
215
+
216
+ _viewportX = x * _pixelRatio;
217
+ _viewportY = y * _pixelRatio;
218
+
219
+ _viewportWidth = width * _pixelRatio;
220
+ _viewportHeight = height * _pixelRatio;
221
+
222
+ };
223
+
224
+ this.setScissor = function () {};
225
+ this.setScissorTest = function () {};
226
+
227
+ this.setClearColor = function ( color, alpha ) {
228
+
229
+ _clearColor.set( color );
230
+ _clearAlpha = alpha !== undefined ? alpha : 1;
231
+
232
+ _clearBox.min.set( - _canvasWidthHalf, - _canvasHeightHalf );
233
+ _clearBox.max.set( _canvasWidthHalf, _canvasHeightHalf );
234
+
235
+ };
236
+
237
+ this.setClearColorHex = function ( hex, alpha ) {
238
+
239
+ console.warn( 'THREE.CanvasRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.' );
240
+ this.setClearColor( hex, alpha );
241
+
242
+ };
243
+
244
+ this.getClearColor = function () {
245
+
246
+ return _clearColor;
247
+
248
+ };
249
+
250
+ this.getClearAlpha = function () {
251
+
252
+ return _clearAlpha;
253
+
254
+ };
255
+
256
+ this.getMaxAnisotropy = function () {
257
+
258
+ return 0;
259
+
260
+ };
261
+
262
+ this.clear = function () {
263
+
264
+ if ( _clearBox.isEmpty() === false ) {
265
+
266
+ _clearBox.intersect( _clipBox );
267
+ _clearBox.expandByScalar( 2 );
268
+
269
+ _clearBox.min.x = _clearBox.min.x + _canvasWidthHalf;
270
+ _clearBox.min.y = - _clearBox.min.y + _canvasHeightHalf; // higher y value !
271
+ _clearBox.max.x = _clearBox.max.x + _canvasWidthHalf;
272
+ _clearBox.max.y = - _clearBox.max.y + _canvasHeightHalf; // lower y value !
273
+
274
+ if ( _clearAlpha < 1 ) {
275
+
276
+ _context.clearRect(
277
+ _clearBox.min.x | 0,
278
+ _clearBox.max.y | 0,
279
+ ( _clearBox.max.x - _clearBox.min.x ) | 0,
280
+ ( _clearBox.min.y - _clearBox.max.y ) | 0
281
+ );
282
+
283
+ }
284
+
285
+ if ( _clearAlpha > 0 ) {
286
+
287
+ setBlending( THREE.NormalBlending );
288
+ setOpacity( 1 );
289
+
290
+ setFillStyle( 'rgba(' + Math.floor( _clearColor.r * 255 ) + ',' + Math.floor( _clearColor.g * 255 ) + ',' + Math.floor( _clearColor.b * 255 ) + ',' + _clearAlpha + ')' );
291
+
292
+ _context.fillRect(
293
+ _clearBox.min.x | 0,
294
+ _clearBox.max.y | 0,
295
+ ( _clearBox.max.x - _clearBox.min.x ) | 0,
296
+ ( _clearBox.min.y - _clearBox.max.y ) | 0
297
+ );
298
+
299
+ }
300
+
301
+ _clearBox.makeEmpty();
302
+
303
+ }
304
+
305
+ };
306
+
307
+ // compatibility
308
+
309
+ this.clearColor = function () {};
310
+ this.clearDepth = function () {};
311
+ this.clearStencil = function () {};
312
+
313
+ this.render = function ( scene, camera ) {
314
+
315
+ if ( camera instanceof THREE.Camera === false ) {
316
+
317
+ console.error( 'THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.' );
318
+ return;
319
+
320
+ }
321
+
322
+ if ( this.autoClear === true ) this.clear();
323
+
324
+ _this.info.render.vertices = 0;
325
+ _this.info.render.faces = 0;
326
+
327
+ _context.setTransform( _viewportWidth / _canvasWidth, 0, 0, - _viewportHeight / _canvasHeight, _viewportX, _canvasHeight - _viewportY );
328
+ _context.translate( _canvasWidthHalf, _canvasHeightHalf );
329
+
330
+ _renderData = _projector.projectScene( scene, camera, this.sortObjects, this.sortElements );
331
+ _elements = _renderData.elements;
332
+ _lights = _renderData.lights;
333
+ _camera = camera;
334
+
335
+ _normalViewMatrix.getNormalMatrix( camera.matrixWorldInverse );
336
+
337
+ /* DEBUG
338
+ setFillStyle( 'rgba( 0, 255, 255, 0.5 )' );
339
+ _context.fillRect( _clipBox.min.x, _clipBox.min.y, _clipBox.max.x - _clipBox.min.x, _clipBox.max.y - _clipBox.min.y );
340
+ */
341
+
342
+ calculateLights();
343
+
344
+ for ( var e = 0, el = _elements.length; e < el; e ++ ) {
345
+
346
+ var element = _elements[ e ];
347
+
348
+ var material = element.material;
349
+
350
+ if ( material === undefined || material.opacity === 0 ) continue;
351
+
352
+ _elemBox.makeEmpty();
353
+
354
+ if ( element instanceof THREE.RenderableSprite ) {
355
+
356
+ _v1 = element;
357
+ _v1.x *= _canvasWidthHalf; _v1.y *= _canvasHeightHalf;
358
+
359
+ renderSprite( _v1, element, material );
360
+
361
+ } else if ( element instanceof THREE.RenderableLine ) {
362
+
363
+ _v1 = element.v1; _v2 = element.v2;
364
+
365
+ _v1.positionScreen.x *= _canvasWidthHalf; _v1.positionScreen.y *= _canvasHeightHalf;
366
+ _v2.positionScreen.x *= _canvasWidthHalf; _v2.positionScreen.y *= _canvasHeightHalf;
367
+
368
+ _elemBox.setFromPoints( [
369
+ _v1.positionScreen,
370
+ _v2.positionScreen
371
+ ] );
372
+
373
+ if ( _clipBox.intersectsBox( _elemBox ) === true ) {
374
+
375
+ renderLine( _v1, _v2, element, material );
376
+
377
+ }
378
+
379
+ } else if ( element instanceof THREE.RenderableFace ) {
380
+
381
+ _v1 = element.v1; _v2 = element.v2; _v3 = element.v3;
382
+
383
+ if ( _v1.positionScreen.z < - 1 || _v1.positionScreen.z > 1 ) continue;
384
+ if ( _v2.positionScreen.z < - 1 || _v2.positionScreen.z > 1 ) continue;
385
+ if ( _v3.positionScreen.z < - 1 || _v3.positionScreen.z > 1 ) continue;
386
+
387
+ _v1.positionScreen.x *= _canvasWidthHalf; _v1.positionScreen.y *= _canvasHeightHalf;
388
+ _v2.positionScreen.x *= _canvasWidthHalf; _v2.positionScreen.y *= _canvasHeightHalf;
389
+ _v3.positionScreen.x *= _canvasWidthHalf; _v3.positionScreen.y *= _canvasHeightHalf;
390
+
391
+ if ( material.overdraw > 0 ) {
392
+
393
+ expand( _v1.positionScreen, _v2.positionScreen, material.overdraw );
394
+ expand( _v2.positionScreen, _v3.positionScreen, material.overdraw );
395
+ expand( _v3.positionScreen, _v1.positionScreen, material.overdraw );
396
+
397
+ }
398
+
399
+ _elemBox.setFromPoints( [
400
+ _v1.positionScreen,
401
+ _v2.positionScreen,
402
+ _v3.positionScreen
403
+ ] );
404
+
405
+ if ( _clipBox.intersectsBox( _elemBox ) === true ) {
406
+
407
+ renderFace3( _v1, _v2, _v3, 0, 1, 2, element, material );
408
+
409
+ }
410
+
411
+ }
412
+
413
+ /* DEBUG
414
+ setLineWidth( 1 );
415
+ setStrokeStyle( 'rgba( 0, 255, 0, 0.5 )' );
416
+ _context.strokeRect( _elemBox.min.x, _elemBox.min.y, _elemBox.max.x - _elemBox.min.x, _elemBox.max.y - _elemBox.min.y );
417
+ */
418
+
419
+ _clearBox.union( _elemBox );
420
+
421
+ }
422
+
423
+ /* DEBUG
424
+ setLineWidth( 1 );
425
+ setStrokeStyle( 'rgba( 255, 0, 0, 0.5 )' );
426
+ _context.strokeRect( _clearBox.min.x, _clearBox.min.y, _clearBox.max.x - _clearBox.min.x, _clearBox.max.y - _clearBox.min.y );
427
+ */
428
+
429
+ _context.setTransform( 1, 0, 0, 1, 0, 0 );
430
+
431
+ };
432
+
433
+ //
434
+
435
+ function calculateLights() {
436
+
437
+ _ambientLight.setRGB( 0, 0, 0 );
438
+ _directionalLights.setRGB( 0, 0, 0 );
439
+ _pointLights.setRGB( 0, 0, 0 );
440
+
441
+ for ( var l = 0, ll = _lights.length; l < ll; l ++ ) {
442
+
443
+ var light = _lights[ l ];
444
+ var lightColor = light.color;
445
+
446
+ if ( light instanceof THREE.AmbientLight ) {
447
+
448
+ _ambientLight.add( lightColor );
449
+
450
+ } else if ( light instanceof THREE.DirectionalLight ) {
451
+
452
+ // for sprites
453
+
454
+ _directionalLights.add( lightColor );
455
+
456
+ } else if ( light instanceof THREE.PointLight ) {
457
+
458
+ // for sprites
459
+
460
+ _pointLights.add( lightColor );
461
+
462
+ }
463
+
464
+ }
465
+
466
+ }
467
+
468
+ function calculateLight( position, normal, color ) {
469
+
470
+ for ( var l = 0, ll = _lights.length; l < ll; l ++ ) {
471
+
472
+ var light = _lights[ l ];
473
+
474
+ _lightColor.copy( light.color );
475
+
476
+ if ( light instanceof THREE.DirectionalLight ) {
477
+
478
+ var lightPosition = _vector3.setFromMatrixPosition( light.matrixWorld ).normalize();
479
+
480
+ var amount = normal.dot( lightPosition );
481
+
482
+ if ( amount <= 0 ) continue;
483
+
484
+ amount *= light.intensity;
485
+
486
+ color.add( _lightColor.multiplyScalar( amount ) );
487
+
488
+ } else if ( light instanceof THREE.PointLight ) {
489
+
490
+ var lightPosition = _vector3.setFromMatrixPosition( light.matrixWorld );
491
+
492
+ var amount = normal.dot( _vector3.subVectors( lightPosition, position ).normalize() );
493
+
494
+ if ( amount <= 0 ) continue;
495
+
496
+ amount *= light.distance == 0 ? 1 : 1 - Math.min( position.distanceTo( lightPosition ) / light.distance, 1 );
497
+
498
+ if ( amount == 0 ) continue;
499
+
500
+ amount *= light.intensity;
501
+
502
+ color.add( _lightColor.multiplyScalar( amount ) );
503
+
504
+ }
505
+
506
+ }
507
+
508
+ }
509
+
510
+ function renderSprite( v1, element, material ) {
511
+
512
+ setOpacity( material.opacity );
513
+ setBlending( material.blending );
514
+
515
+ var scaleX = element.scale.x * _canvasWidthHalf;
516
+ var scaleY = element.scale.y * _canvasHeightHalf;
517
+
518
+ var dist = 0.5 * Math.sqrt( scaleX * scaleX + scaleY * scaleY ); // allow for rotated sprite
519
+ _elemBox.min.set( v1.x - dist, v1.y - dist );
520
+ _elemBox.max.set( v1.x + dist, v1.y + dist );
521
+
522
+ if ( material instanceof THREE.SpriteMaterial ) {
523
+
524
+ var texture = material.map;
525
+
526
+ if ( texture !== null ) {
527
+
528
+ var pattern = _patterns[ texture.id ];
529
+
530
+ if ( pattern === undefined || pattern.version !== texture.version ) {
531
+
532
+ pattern = textureToPattern( texture );
533
+ _patterns[ texture.id ] = pattern;
534
+
535
+ }
536
+
537
+ if ( pattern.canvas !== undefined ) {
538
+
539
+ setFillStyle( pattern.canvas );
540
+
541
+ var bitmap = texture.image;
542
+
543
+ var ox = bitmap.width * texture.offset.x;
544
+ var oy = bitmap.height * texture.offset.y;
545
+
546
+ var sx = bitmap.width * texture.repeat.x;
547
+ var sy = bitmap.height * texture.repeat.y;
548
+
549
+ var cx = scaleX / sx;
550
+ var cy = scaleY / sy;
551
+
552
+ _context.save();
553
+ _context.translate( v1.x, v1.y );
554
+ if ( material.rotation !== 0 ) _context.rotate( material.rotation );
555
+ _context.translate( - scaleX / 2, - scaleY / 2 );
556
+ _context.scale( cx, cy );
557
+ _context.translate( - ox, - oy );
558
+ _context.fillRect( ox, oy, sx, sy );
559
+ _context.restore();
560
+
561
+ }
562
+
563
+ } else {
564
+
565
+ // no texture
566
+
567
+ setFillStyle( material.color.getStyle() );
568
+
569
+ _context.save();
570
+ _context.translate( v1.x, v1.y );
571
+ if ( material.rotation !== 0 ) _context.rotate( material.rotation );
572
+ _context.scale( scaleX, - scaleY );
573
+ _context.fillRect( - 0.5, - 0.5, 1, 1 );
574
+ _context.restore();
575
+
576
+ }
577
+
578
+ } else if ( material instanceof THREE.SpriteCanvasMaterial ) {
579
+
580
+ setStrokeStyle( material.color.getStyle() );
581
+ setFillStyle( material.color.getStyle() );
582
+
583
+ _context.save();
584
+ _context.translate( v1.x, v1.y );
585
+ if ( material.rotation !== 0 ) _context.rotate( material.rotation );
586
+ _context.scale( scaleX, scaleY );
587
+
588
+ material.program( _context );
589
+
590
+ _context.restore();
591
+
592
+ }
593
+
594
+ /* DEBUG
595
+ setStrokeStyle( 'rgb(255,255,0)' );
596
+ _context.beginPath();
597
+ _context.moveTo( v1.x - 10, v1.y );
598
+ _context.lineTo( v1.x + 10, v1.y );
599
+ _context.moveTo( v1.x, v1.y - 10 );
600
+ _context.lineTo( v1.x, v1.y + 10 );
601
+ _context.stroke();
602
+ */
603
+
604
+ }
605
+
606
+ function renderLine( v1, v2, element, material ) {
607
+
608
+ setOpacity( material.opacity );
609
+ setBlending( material.blending );
610
+
611
+ _context.beginPath();
612
+ _context.moveTo( v1.positionScreen.x, v1.positionScreen.y );
613
+ _context.lineTo( v2.positionScreen.x, v2.positionScreen.y );
614
+
615
+ if ( material instanceof THREE.LineBasicMaterial ) {
616
+
617
+ setLineWidth( material.linewidth );
618
+ setLineCap( material.linecap );
619
+ setLineJoin( material.linejoin );
620
+
621
+ if ( material.vertexColors !== THREE.VertexColors ) {
622
+
623
+ setStrokeStyle( material.color.getStyle() );
624
+
625
+ } else {
626
+
627
+ var colorStyle1 = element.vertexColors[ 0 ].getStyle();
628
+ var colorStyle2 = element.vertexColors[ 1 ].getStyle();
629
+
630
+ if ( colorStyle1 === colorStyle2 ) {
631
+
632
+ setStrokeStyle( colorStyle1 );
633
+
634
+ } else {
635
+
636
+ try {
637
+
638
+ var grad = _context.createLinearGradient(
639
+ v1.positionScreen.x,
640
+ v1.positionScreen.y,
641
+ v2.positionScreen.x,
642
+ v2.positionScreen.y
643
+ );
644
+ grad.addColorStop( 0, colorStyle1 );
645
+ grad.addColorStop( 1, colorStyle2 );
646
+
647
+ } catch ( exception ) {
648
+
649
+ grad = colorStyle1;
650
+
651
+ }
652
+
653
+ setStrokeStyle( grad );
654
+
655
+ }
656
+
657
+ }
658
+
659
+ _context.stroke();
660
+ _elemBox.expandByScalar( material.linewidth * 2 );
661
+
662
+ } else if ( material instanceof THREE.LineDashedMaterial ) {
663
+
664
+ setLineWidth( material.linewidth );
665
+ setLineCap( material.linecap );
666
+ setLineJoin( material.linejoin );
667
+ setStrokeStyle( material.color.getStyle() );
668
+ setLineDash( [ material.dashSize, material.gapSize ] );
669
+
670
+ _context.stroke();
671
+
672
+ _elemBox.expandByScalar( material.linewidth * 2 );
673
+
674
+ setLineDash( [] );
675
+
676
+ }
677
+
678
+ }
679
+
680
+ function renderFace3( v1, v2, v3, uv1, uv2, uv3, element, material ) {
681
+
682
+ _this.info.render.vertices += 3;
683
+ _this.info.render.faces ++;
684
+
685
+ setOpacity( material.opacity );
686
+ setBlending( material.blending );
687
+
688
+ _v1x = v1.positionScreen.x; _v1y = v1.positionScreen.y;
689
+ _v2x = v2.positionScreen.x; _v2y = v2.positionScreen.y;
690
+ _v3x = v3.positionScreen.x; _v3y = v3.positionScreen.y;
691
+
692
+ drawTriangle( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y );
693
+
694
+ if ( ( material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) && material.map === null ) {
695
+
696
+ _diffuseColor.copy( material.color );
697
+ _emissiveColor.copy( material.emissive );
698
+
699
+ if ( material.vertexColors === THREE.FaceColors ) {
700
+
701
+ _diffuseColor.multiply( element.color );
702
+
703
+ }
704
+
705
+ _color.copy( _ambientLight );
706
+
707
+ _centroid.copy( v1.positionWorld ).add( v2.positionWorld ).add( v3.positionWorld ).divideScalar( 3 );
708
+
709
+ calculateLight( _centroid, element.normalModel, _color );
710
+
711
+ _color.multiply( _diffuseColor ).add( _emissiveColor );
712
+
713
+ material.wireframe === true
714
+ ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
715
+ : fillPath( _color );
716
+
717
+ } else if ( material instanceof THREE.MeshBasicMaterial ||
718
+ material instanceof THREE.MeshLambertMaterial ||
719
+ material instanceof THREE.MeshPhongMaterial ) {
720
+
721
+ if ( material.map !== null ) {
722
+
723
+ var mapping = material.map.mapping;
724
+
725
+ if ( mapping === THREE.UVMapping ) {
726
+
727
+ _uvs = element.uvs;
728
+ patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uvs[ uv1 ].x, _uvs[ uv1 ].y, _uvs[ uv2 ].x, _uvs[ uv2 ].y, _uvs[ uv3 ].x, _uvs[ uv3 ].y, material.map );
729
+
730
+ }
731
+
732
+ } else if ( material.envMap !== null ) {
733
+
734
+ if ( material.envMap.mapping === THREE.SphericalReflectionMapping ) {
735
+
736
+ _normal.copy( element.vertexNormalsModel[ uv1 ] ).applyMatrix3( _normalViewMatrix );
737
+ _uv1x = 0.5 * _normal.x + 0.5;
738
+ _uv1y = 0.5 * _normal.y + 0.5;
739
+
740
+ _normal.copy( element.vertexNormalsModel[ uv2 ] ).applyMatrix3( _normalViewMatrix );
741
+ _uv2x = 0.5 * _normal.x + 0.5;
742
+ _uv2y = 0.5 * _normal.y + 0.5;
743
+
744
+ _normal.copy( element.vertexNormalsModel[ uv3 ] ).applyMatrix3( _normalViewMatrix );
745
+ _uv3x = 0.5 * _normal.x + 0.5;
746
+ _uv3y = 0.5 * _normal.y + 0.5;
747
+
748
+ patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, material.envMap );
749
+
750
+ }
751
+
752
+ } else {
753
+
754
+ _color.copy( material.color );
755
+
756
+ if ( material.vertexColors === THREE.FaceColors ) {
757
+
758
+ _color.multiply( element.color );
759
+
760
+ }
761
+
762
+ material.wireframe === true
763
+ ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
764
+ : fillPath( _color );
765
+
766
+ }
767
+
768
+ } else if ( material instanceof THREE.MeshNormalMaterial ) {
769
+
770
+ _normal.copy( element.normalModel ).applyMatrix3( _normalViewMatrix );
771
+
772
+ _color.setRGB( _normal.x, _normal.y, _normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 );
773
+
774
+ material.wireframe === true
775
+ ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
776
+ : fillPath( _color );
777
+
778
+ } else {
779
+
780
+ _color.setRGB( 1, 1, 1 );
781
+
782
+ material.wireframe === true
783
+ ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
784
+ : fillPath( _color );
785
+
786
+ }
787
+
788
+ }
789
+
790
+ //
791
+
792
+ function drawTriangle( x0, y0, x1, y1, x2, y2 ) {
793
+
794
+ _context.beginPath();
795
+ _context.moveTo( x0, y0 );
796
+ _context.lineTo( x1, y1 );
797
+ _context.lineTo( x2, y2 );
798
+ _context.closePath();
799
+
800
+ }
801
+
802
+ function strokePath( color, linewidth, linecap, linejoin ) {
803
+
804
+ setLineWidth( linewidth );
805
+ setLineCap( linecap );
806
+ setLineJoin( linejoin );
807
+ setStrokeStyle( color.getStyle() );
808
+
809
+ _context.stroke();
810
+
811
+ _elemBox.expandByScalar( linewidth * 2 );
812
+
813
+ }
814
+
815
+ function fillPath( color ) {
816
+
817
+ setFillStyle( color.getStyle() );
818
+ _context.fill();
819
+
820
+ }
821
+
822
+ function textureToPattern( texture ) {
823
+
824
+ if ( texture.version === 0 ||
825
+ texture instanceof THREE.CompressedTexture ||
826
+ texture instanceof THREE.DataTexture ) {
827
+
828
+ return {
829
+ canvas: undefined,
830
+ version: texture.version
831
+ };
832
+
833
+ }
834
+
835
+ var image = texture.image;
836
+
837
+ if ( image.complete === false ) {
838
+
839
+ return {
840
+ canvas: undefined,
841
+ version: 0
842
+ };
843
+
844
+ }
845
+
846
+ var canvas = document.createElement( 'canvas' );
847
+ canvas.width = image.width;
848
+ canvas.height = image.height;
849
+
850
+ var context = canvas.getContext( '2d' );
851
+ context.setTransform( 1, 0, 0, - 1, 0, image.height );
852
+ context.drawImage( image, 0, 0 );
853
+
854
+ var repeatX = texture.wrapS === THREE.RepeatWrapping;
855
+ var repeatY = texture.wrapT === THREE.RepeatWrapping;
856
+
857
+ var repeat = 'no-repeat';
858
+
859
+ if ( repeatX === true && repeatY === true ) {
860
+
861
+ repeat = 'repeat';
862
+
863
+ } else if ( repeatX === true ) {
864
+
865
+ repeat = 'repeat-x';
866
+
867
+ } else if ( repeatY === true ) {
868
+
869
+ repeat = 'repeat-y';
870
+
871
+ }
872
+
873
+ var pattern = _context.createPattern( canvas, repeat );
874
+
875
+ if ( texture.onUpdate ) texture.onUpdate( texture );
876
+
877
+ return {
878
+ canvas: pattern,
879
+ version: texture.version
880
+ };
881
+
882
+ }
883
+
884
+ function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) {
885
+
886
+ var pattern = _patterns[ texture.id ];
887
+
888
+ if ( pattern === undefined || pattern.version !== texture.version ) {
889
+
890
+ pattern = textureToPattern( texture );
891
+ _patterns[ texture.id ] = pattern;
892
+
893
+ }
894
+
895
+ if ( pattern.canvas !== undefined ) {
896
+
897
+ setFillStyle( pattern.canvas );
898
+
899
+ } else {
900
+
901
+ setFillStyle( 'rgba( 0, 0, 0, 1)' );
902
+ _context.fill();
903
+ return;
904
+
905
+ }
906
+
907
+ // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120
908
+
909
+ var a, b, c, d, e, f, det, idet,
910
+ offsetX = texture.offset.x / texture.repeat.x,
911
+ offsetY = texture.offset.y / texture.repeat.y,
912
+ width = texture.image.width * texture.repeat.x,
913
+ height = texture.image.height * texture.repeat.y;
914
+
915
+ u0 = ( u0 + offsetX ) * width;
916
+ v0 = ( v0 + offsetY ) * height;
917
+
918
+ u1 = ( u1 + offsetX ) * width;
919
+ v1 = ( v1 + offsetY ) * height;
920
+
921
+ u2 = ( u2 + offsetX ) * width;
922
+ v2 = ( v2 + offsetY ) * height;
923
+
924
+ x1 -= x0; y1 -= y0;
925
+ x2 -= x0; y2 -= y0;
926
+
927
+ u1 -= u0; v1 -= v0;
928
+ u2 -= u0; v2 -= v0;
929
+
930
+ det = u1 * v2 - u2 * v1;
931
+
932
+ if ( det === 0 ) return;
933
+
934
+ idet = 1 / det;
935
+
936
+ a = ( v2 * x1 - v1 * x2 ) * idet;
937
+ b = ( v2 * y1 - v1 * y2 ) * idet;
938
+ c = ( u1 * x2 - u2 * x1 ) * idet;
939
+ d = ( u1 * y2 - u2 * y1 ) * idet;
940
+
941
+ e = x0 - a * u0 - c * v0;
942
+ f = y0 - b * u0 - d * v0;
943
+
944
+ _context.save();
945
+ _context.transform( a, b, c, d, e, f );
946
+ _context.fill();
947
+ _context.restore();
948
+
949
+ }
950
+
951
+ function clipImage( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, image ) {
952
+
953
+ // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120
954
+
955
+ var a, b, c, d, e, f, det, idet,
956
+ width = image.width - 1,
957
+ height = image.height - 1;
958
+
959
+ u0 *= width; v0 *= height;
960
+ u1 *= width; v1 *= height;
961
+ u2 *= width; v2 *= height;
962
+
963
+ x1 -= x0; y1 -= y0;
964
+ x2 -= x0; y2 -= y0;
965
+
966
+ u1 -= u0; v1 -= v0;
967
+ u2 -= u0; v2 -= v0;
968
+
969
+ det = u1 * v2 - u2 * v1;
970
+
971
+ idet = 1 / det;
972
+
973
+ a = ( v2 * x1 - v1 * x2 ) * idet;
974
+ b = ( v2 * y1 - v1 * y2 ) * idet;
975
+ c = ( u1 * x2 - u2 * x1 ) * idet;
976
+ d = ( u1 * y2 - u2 * y1 ) * idet;
977
+
978
+ e = x0 - a * u0 - c * v0;
979
+ f = y0 - b * u0 - d * v0;
980
+
981
+ _context.save();
982
+ _context.transform( a, b, c, d, e, f );
983
+ _context.clip();
984
+ _context.drawImage( image, 0, 0 );
985
+ _context.restore();
986
+
987
+ }
988
+
989
+ // Hide anti-alias gaps
990
+
991
+ function expand( v1, v2, pixels ) {
992
+
993
+ var x = v2.x - v1.x, y = v2.y - v1.y,
994
+ det = x * x + y * y, idet;
995
+
996
+ if ( det === 0 ) return;
997
+
998
+ idet = pixels / Math.sqrt( det );
999
+
1000
+ x *= idet; y *= idet;
1001
+
1002
+ v2.x += x; v2.y += y;
1003
+ v1.x -= x; v1.y -= y;
1004
+
1005
+ }
1006
+
1007
+ // Context cached methods.
1008
+
1009
+ function setOpacity( value ) {
1010
+
1011
+ if ( _contextGlobalAlpha !== value ) {
1012
+
1013
+ _context.globalAlpha = value;
1014
+ _contextGlobalAlpha = value;
1015
+
1016
+ }
1017
+
1018
+ }
1019
+
1020
+ function setBlending( value ) {
1021
+
1022
+ if ( _contextGlobalCompositeOperation !== value ) {
1023
+
1024
+ if ( value === THREE.NormalBlending ) {
1025
+
1026
+ _context.globalCompositeOperation = 'source-over';
1027
+
1028
+ } else if ( value === THREE.AdditiveBlending ) {
1029
+
1030
+ _context.globalCompositeOperation = 'lighter';
1031
+
1032
+ } else if ( value === THREE.SubtractiveBlending ) {
1033
+
1034
+ _context.globalCompositeOperation = 'darker';
1035
+
1036
+ } else if ( value === THREE.MultiplyBlending ) {
1037
+
1038
+ _context.globalCompositeOperation = 'multiply';
1039
+
1040
+ }
1041
+
1042
+ _contextGlobalCompositeOperation = value;
1043
+
1044
+ }
1045
+
1046
+ }
1047
+
1048
+ function setLineWidth( value ) {
1049
+
1050
+ if ( _contextLineWidth !== value ) {
1051
+
1052
+ _context.lineWidth = value;
1053
+ _contextLineWidth = value;
1054
+
1055
+ }
1056
+
1057
+ }
1058
+
1059
+ function setLineCap( value ) {
1060
+
1061
+ // "butt", "round", "square"
1062
+
1063
+ if ( _contextLineCap !== value ) {
1064
+
1065
+ _context.lineCap = value;
1066
+ _contextLineCap = value;
1067
+
1068
+ }
1069
+
1070
+ }
1071
+
1072
+ function setLineJoin( value ) {
1073
+
1074
+ // "round", "bevel", "miter"
1075
+
1076
+ if ( _contextLineJoin !== value ) {
1077
+
1078
+ _context.lineJoin = value;
1079
+ _contextLineJoin = value;
1080
+
1081
+ }
1082
+
1083
+ }
1084
+
1085
+ function setStrokeStyle( value ) {
1086
+
1087
+ if ( _contextStrokeStyle !== value ) {
1088
+
1089
+ _context.strokeStyle = value;
1090
+ _contextStrokeStyle = value;
1091
+
1092
+ }
1093
+
1094
+ }
1095
+
1096
+ function setFillStyle( value ) {
1097
+
1098
+ if ( _contextFillStyle !== value ) {
1099
+
1100
+ _context.fillStyle = value;
1101
+ _contextFillStyle = value;
1102
+
1103
+ }
1104
+
1105
+ }
1106
+
1107
+ function setLineDash( value ) {
1108
+
1109
+ if ( _contextLineDash.length !== value.length ) {
1110
+
1111
+ _context.setLineDash( value );
1112
+ _contextLineDash = value;
1113
+
1114
+ }
1115
+
1116
+ }
1117
+
1118
+ };