@playdrop/playdrop-cli 0.3.1-build.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1315) hide show
  1. package/README.md +24 -0
  2. package/bin/playdrop +3 -0
  3. package/bin/playdrop-cli +2 -0
  4. package/config/client-meta.json +45 -0
  5. package/dist/apiClient.d.ts +9 -0
  6. package/dist/apiClient.js +21 -0
  7. package/dist/apps/build.d.ts +24 -0
  8. package/dist/apps/build.js +561 -0
  9. package/dist/apps/index.d.ts +15 -0
  10. package/dist/apps/index.js +23 -0
  11. package/dist/apps/upload.d.ts +19 -0
  12. package/dist/apps/upload.js +114 -0
  13. package/dist/apps/validate.d.ts +3 -0
  14. package/dist/apps/validate.js +75 -0
  15. package/dist/catalogue-utils.d.ts +24 -0
  16. package/dist/catalogue-utils.js +121 -0
  17. package/dist/catalogue.d.ts +262 -0
  18. package/dist/catalogue.js +1289 -0
  19. package/dist/clientInfo.d.ts +6 -0
  20. package/dist/clientInfo.js +51 -0
  21. package/dist/commandContext.d.ts +15 -0
  22. package/dist/commandContext.js +40 -0
  23. package/dist/commands/asset-packs.d.ts +27 -0
  24. package/dist/commands/asset-packs.js +508 -0
  25. package/dist/commands/assets.d.ts +35 -0
  26. package/dist/commands/assets.js +668 -0
  27. package/dist/commands/build.d.ts +1 -0
  28. package/dist/commands/build.js +56 -0
  29. package/dist/commands/capture.d.ts +11 -0
  30. package/dist/commands/capture.js +681 -0
  31. package/dist/commands/create.d.ts +6 -0
  32. package/dist/commands/create.js +1174 -0
  33. package/dist/commands/detail.d.ts +5 -0
  34. package/dist/commands/detail.js +320 -0
  35. package/dist/commands/dev.d.ts +1 -0
  36. package/dist/commands/dev.js +281 -0
  37. package/dist/commands/devServer.d.ts +18 -0
  38. package/dist/commands/devServer.js +122 -0
  39. package/dist/commands/devShared.d.ts +24 -0
  40. package/dist/commands/devShared.js +213 -0
  41. package/dist/commands/documentation.d.ts +1 -0
  42. package/dist/commands/documentation.js +152 -0
  43. package/dist/commands/feedback.d.ts +16 -0
  44. package/dist/commands/feedback.js +323 -0
  45. package/dist/commands/format.d.ts +1 -0
  46. package/dist/commands/format.js +65 -0
  47. package/dist/commands/generation.d.ts +33 -0
  48. package/dist/commands/generation.js +509 -0
  49. package/dist/commands/init.d.ts +13 -0
  50. package/dist/commands/init.js +300 -0
  51. package/dist/commands/list.d.ts +7 -0
  52. package/dist/commands/list.js +347 -0
  53. package/dist/commands/login.d.ts +10 -0
  54. package/dist/commands/login.js +117 -0
  55. package/dist/commands/logout.d.ts +1 -0
  56. package/dist/commands/logout.js +8 -0
  57. package/dist/commands/migrateCatalogueV2.d.ts +1 -0
  58. package/dist/commands/migrateCatalogueV2.js +142 -0
  59. package/dist/commands/upgrade.d.ts +1 -0
  60. package/dist/commands/upgrade.js +28 -0
  61. package/dist/commands/upload.d.ts +4 -0
  62. package/dist/commands/upload.js +651 -0
  63. package/dist/commands/validate.d.ts +1 -0
  64. package/dist/commands/validate.js +53 -0
  65. package/dist/commands/versions.d.ts +17 -0
  66. package/dist/commands/versions.js +384 -0
  67. package/dist/commands/whoami.d.ts +1 -0
  68. package/dist/commands/whoami.js +72 -0
  69. package/dist/config.d.ts +10 -0
  70. package/dist/config.js +41 -0
  71. package/dist/environment.d.ts +11 -0
  72. package/dist/environment.js +66 -0
  73. package/dist/http.d.ts +6 -0
  74. package/dist/http.js +49 -0
  75. package/dist/index.d.ts +2 -0
  76. package/dist/index.js +700 -0
  77. package/dist/messages.d.ts +12 -0
  78. package/dist/messages.js +65 -0
  79. package/dist/playwright.d.ts +10 -0
  80. package/dist/playwright.js +100 -0
  81. package/dist/proxyFetch.d.ts +14 -0
  82. package/dist/proxyFetch.js +203 -0
  83. package/dist/taskSelection.d.ts +16 -0
  84. package/dist/taskSelection.js +205 -0
  85. package/dist/taskUtils.d.ts +4 -0
  86. package/dist/taskUtils.js +35 -0
  87. package/dist/uploadLog.d.ts +15 -0
  88. package/dist/uploadLog.js +118 -0
  89. package/node_modules/@playdrop/ai-client/dist/index.d.ts +377 -0
  90. package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +1 -0
  91. package/node_modules/@playdrop/ai-client/dist/index.js +318 -0
  92. package/node_modules/@playdrop/ai-client/package.json +21 -0
  93. package/node_modules/@playdrop/api-client/dist/client.d.ts +299 -0
  94. package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -0
  95. package/node_modules/@playdrop/api-client/dist/client.js +1908 -0
  96. package/node_modules/@playdrop/api-client/dist/index.d.ts +177 -0
  97. package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -0
  98. package/node_modules/@playdrop/api-client/dist/index.js +329 -0
  99. package/node_modules/@playdrop/api-client/package.json +32 -0
  100. package/node_modules/@playdrop/config/client-meta.json +45 -0
  101. package/node_modules/@playdrop/config/dist/src/constants.d.ts +9 -0
  102. package/node_modules/@playdrop/config/dist/src/constants.d.ts.map +1 -0
  103. package/node_modules/@playdrop/config/dist/src/constants.js +10 -0
  104. package/node_modules/@playdrop/config/dist/src/index.d.ts +13 -0
  105. package/node_modules/@playdrop/config/dist/src/index.d.ts.map +1 -0
  106. package/node_modules/@playdrop/config/dist/src/index.js +197 -0
  107. package/node_modules/@playdrop/config/dist/src/server/fastify.d.ts +12 -0
  108. package/node_modules/@playdrop/config/dist/src/server/fastify.d.ts.map +1 -0
  109. package/node_modules/@playdrop/config/dist/src/server/fastify.js +103 -0
  110. package/node_modules/@playdrop/config/dist/src/types.d.ts +59 -0
  111. package/node_modules/@playdrop/config/dist/src/types.d.ts.map +1 -0
  112. package/node_modules/@playdrop/config/dist/src/types.js +2 -0
  113. package/node_modules/@playdrop/config/dist/test/validateClientEnvironment.test.d.ts +2 -0
  114. package/node_modules/@playdrop/config/dist/test/validateClientEnvironment.test.d.ts.map +1 -0
  115. package/node_modules/@playdrop/config/dist/test/validateClientEnvironment.test.js +63 -0
  116. package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -0
  117. package/node_modules/@playdrop/config/package.json +19 -0
  118. package/node_modules/@playdrop/entity-core/dist/src/entity-cleaner.d.ts +13 -0
  119. package/node_modules/@playdrop/entity-core/dist/src/entity-cleaner.js +146 -0
  120. package/node_modules/@playdrop/entity-core/dist/src/entity-cleaner.js.map +1 -0
  121. package/node_modules/@playdrop/entity-core/dist/src/entity-utils.d.ts +47 -0
  122. package/node_modules/@playdrop/entity-core/dist/src/entity-utils.js +328 -0
  123. package/node_modules/@playdrop/entity-core/dist/src/entity-utils.js.map +1 -0
  124. package/node_modules/@playdrop/entity-core/dist/src/format-utils.d.ts +3 -0
  125. package/node_modules/@playdrop/entity-core/dist/src/format-utils.js +38 -0
  126. package/node_modules/@playdrop/entity-core/dist/src/format-utils.js.map +1 -0
  127. package/node_modules/@playdrop/entity-core/dist/src/humanoid/geometry.d.ts +23 -0
  128. package/node_modules/@playdrop/entity-core/dist/src/humanoid/geometry.js +11 -0
  129. package/node_modules/@playdrop/entity-core/dist/src/humanoid/geometry.js.map +1 -0
  130. package/node_modules/@playdrop/entity-core/dist/src/humanoid/index.d.ts +4 -0
  131. package/node_modules/@playdrop/entity-core/dist/src/humanoid/index.js +21 -0
  132. package/node_modules/@playdrop/entity-core/dist/src/humanoid/index.js.map +1 -0
  133. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/common.d.ts +4 -0
  134. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/common.js +24 -0
  135. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/common.js.map +1 -0
  136. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/index.d.ts +3 -0
  137. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/index.js +20 -0
  138. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/index.js.map +1 -0
  139. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/textured-builder.d.ts +3 -0
  140. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/textured-builder.js +431 -0
  141. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/textured-builder.js.map +1 -0
  142. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/types.d.ts +6 -0
  143. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/types.js +3 -0
  144. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/types.js.map +1 -0
  145. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/voxel-builder.d.ts +3 -0
  146. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/voxel-builder.js +396 -0
  147. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r15/voxel-builder.js.map +1 -0
  148. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/builder.d.ts +12 -0
  149. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/builder.js +199 -0
  150. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/builder.js.map +1 -0
  151. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/index.d.ts +4 -0
  152. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/index.js +18 -0
  153. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/index.js.map +1 -0
  154. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/scanner.d.ts +43 -0
  155. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/scanner.js +142 -0
  156. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/scanner.js.map +1 -0
  157. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/textures/artifacts.d.ts +26 -0
  158. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/textures/artifacts.js +65 -0
  159. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/textures/artifacts.js.map +1 -0
  160. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/textures/face-map.d.ts +33 -0
  161. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/textures/face-map.js +175 -0
  162. package/node_modules/@playdrop/entity-core/dist/src/humanoid/r6/textures/face-map.js.map +1 -0
  163. package/node_modules/@playdrop/entity-core/dist/src/humanoid/templates/humanoid_r15.json +1517 -0
  164. package/node_modules/@playdrop/entity-core/dist/src/humanoid/templates/humanoid_r6.json +61 -0
  165. package/node_modules/@playdrop/entity-core/dist/src/humanoid/templates/index.d.ts +10 -0
  166. package/node_modules/@playdrop/entity-core/dist/src/humanoid/templates/index.js +23 -0
  167. package/node_modules/@playdrop/entity-core/dist/src/humanoid/templates/index.js.map +1 -0
  168. package/node_modules/@playdrop/entity-core/dist/src/index.d.ts +19 -0
  169. package/node_modules/@playdrop/entity-core/dist/src/index.js +36 -0
  170. package/node_modules/@playdrop/entity-core/dist/src/index.js.map +1 -0
  171. package/node_modules/@playdrop/entity-core/dist/src/materials.d.ts +26 -0
  172. package/node_modules/@playdrop/entity-core/dist/src/materials.js +188 -0
  173. package/node_modules/@playdrop/entity-core/dist/src/materials.js.map +1 -0
  174. package/node_modules/@playdrop/entity-core/dist/src/palette_tools.d.ts +68 -0
  175. package/node_modules/@playdrop/entity-core/dist/src/palette_tools.js +491 -0
  176. package/node_modules/@playdrop/entity-core/dist/src/palette_tools.js.map +1 -0
  177. package/node_modules/@playdrop/entity-core/dist/src/serialization.d.ts +4 -0
  178. package/node_modules/@playdrop/entity-core/dist/src/serialization.js +382 -0
  179. package/node_modules/@playdrop/entity-core/dist/src/serialization.js.map +1 -0
  180. package/node_modules/@playdrop/entity-core/dist/src/textures.d.ts +29 -0
  181. package/node_modules/@playdrop/entity-core/dist/src/textures.js +214 -0
  182. package/node_modules/@playdrop/entity-core/dist/src/textures.js.map +1 -0
  183. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/infer-face.d.ts +9 -0
  184. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/infer-face.js +316 -0
  185. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/infer-face.js.map +1 -0
  186. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/layer-mode.d.ts +9 -0
  187. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/layer-mode.js +153 -0
  188. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/layer-mode.js.map +1 -0
  189. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/merge-overlay.d.ts +2 -0
  190. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/merge-overlay.js +121 -0
  191. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/merge-overlay.js.map +1 -0
  192. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/slice.d.ts +20 -0
  193. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/slice.js +398 -0
  194. package/node_modules/@playdrop/entity-core/dist/src/transforms/textured-boxes/slice.js.map +1 -0
  195. package/node_modules/@playdrop/entity-core/dist/src/transforms/upscale.d.ts +3 -0
  196. package/node_modules/@playdrop/entity-core/dist/src/transforms/upscale.js +210 -0
  197. package/node_modules/@playdrop/entity-core/dist/src/transforms/upscale.js.map +1 -0
  198. package/node_modules/@playdrop/entity-core/dist/src/transforms/voxels/slice.d.ts +12 -0
  199. package/node_modules/@playdrop/entity-core/dist/src/transforms/voxels/slice.js +81 -0
  200. package/node_modules/@playdrop/entity-core/dist/src/transforms/voxels/slice.js.map +1 -0
  201. package/node_modules/@playdrop/entity-core/dist/src/transforms/voxels/textured-to-voxel.d.ts +12 -0
  202. package/node_modules/@playdrop/entity-core/dist/src/transforms/voxels/textured-to-voxel.js +323 -0
  203. package/node_modules/@playdrop/entity-core/dist/src/transforms/voxels/textured-to-voxel.js.map +1 -0
  204. package/node_modules/@playdrop/entity-core/dist/src/types.d.ts +168 -0
  205. package/node_modules/@playdrop/entity-core/dist/src/types.js +3 -0
  206. package/node_modules/@playdrop/entity-core/dist/src/types.js.map +1 -0
  207. package/node_modules/@playdrop/entity-core/dist/src/validation.d.ts +24 -0
  208. package/node_modules/@playdrop/entity-core/dist/src/validation.js +641 -0
  209. package/node_modules/@playdrop/entity-core/dist/src/validation.js.map +1 -0
  210. package/node_modules/@playdrop/entity-core/dist/src/voxels/greedy-mesher.d.ts +11 -0
  211. package/node_modules/@playdrop/entity-core/dist/src/voxels/greedy-mesher.js +135 -0
  212. package/node_modules/@playdrop/entity-core/dist/src/voxels/greedy-mesher.js.map +1 -0
  213. package/node_modules/@playdrop/entity-core/dist/src/voxels.d.ts +23 -0
  214. package/node_modules/@playdrop/entity-core/dist/src/voxels.js +57 -0
  215. package/node_modules/@playdrop/entity-core/dist/src/voxels.js.map +1 -0
  216. package/node_modules/@playdrop/entity-core/dist/test/entity-utils.test.d.ts +1 -0
  217. package/node_modules/@playdrop/entity-core/dist/test/entity-utils.test.js +92 -0
  218. package/node_modules/@playdrop/entity-core/dist/test/entity-utils.test.js.map +1 -0
  219. package/node_modules/@playdrop/entity-core/dist/test/greedy-mesher.test.d.ts +1 -0
  220. package/node_modules/@playdrop/entity-core/dist/test/greedy-mesher.test.js +48 -0
  221. package/node_modules/@playdrop/entity-core/dist/test/greedy-mesher.test.js.map +1 -0
  222. package/node_modules/@playdrop/entity-core/dist/test/humanoid/humanoid-builders.test.d.ts +1 -0
  223. package/node_modules/@playdrop/entity-core/dist/test/humanoid/humanoid-builders.test.js +270 -0
  224. package/node_modules/@playdrop/entity-core/dist/test/humanoid/humanoid-builders.test.js.map +1 -0
  225. package/node_modules/@playdrop/entity-core/dist/test/index.test.d.ts +1 -0
  226. package/node_modules/@playdrop/entity-core/dist/test/index.test.js +48 -0
  227. package/node_modules/@playdrop/entity-core/dist/test/index.test.js.map +1 -0
  228. package/node_modules/@playdrop/entity-core/dist/test/layer-mode.test.d.ts +1 -0
  229. package/node_modules/@playdrop/entity-core/dist/test/layer-mode.test.js +67 -0
  230. package/node_modules/@playdrop/entity-core/dist/test/layer-mode.test.js.map +1 -0
  231. package/node_modules/@playdrop/entity-core/dist/test/materials.test.d.ts +1 -0
  232. package/node_modules/@playdrop/entity-core/dist/test/materials.test.js +55 -0
  233. package/node_modules/@playdrop/entity-core/dist/test/materials.test.js.map +1 -0
  234. package/node_modules/@playdrop/entity-core/dist/test/palette-tools.test.d.ts +1 -0
  235. package/node_modules/@playdrop/entity-core/dist/test/palette-tools.test.js +124 -0
  236. package/node_modules/@playdrop/entity-core/dist/test/palette-tools.test.js.map +1 -0
  237. package/node_modules/@playdrop/entity-core/dist/test/serialization.test.d.ts +1 -0
  238. package/node_modules/@playdrop/entity-core/dist/test/serialization.test.js +35 -0
  239. package/node_modules/@playdrop/entity-core/dist/test/serialization.test.js.map +1 -0
  240. package/node_modules/@playdrop/entity-core/dist/test/textures.test.d.ts +1 -0
  241. package/node_modules/@playdrop/entity-core/dist/test/textures.test.js +120 -0
  242. package/node_modules/@playdrop/entity-core/dist/test/textures.test.js.map +1 -0
  243. package/node_modules/@playdrop/entity-core/dist/test/types.test.d.ts +1 -0
  244. package/node_modules/@playdrop/entity-core/dist/test/types.test.js +32 -0
  245. package/node_modules/@playdrop/entity-core/dist/test/types.test.js.map +1 -0
  246. package/node_modules/@playdrop/entity-core/dist/test/upscale.test.d.ts +1 -0
  247. package/node_modules/@playdrop/entity-core/dist/test/upscale.test.js +100 -0
  248. package/node_modules/@playdrop/entity-core/dist/test/upscale.test.js.map +1 -0
  249. package/node_modules/@playdrop/entity-core/dist/test/validation.test.d.ts +1 -0
  250. package/node_modules/@playdrop/entity-core/dist/test/validation.test.js +61 -0
  251. package/node_modules/@playdrop/entity-core/dist/test/validation.test.js.map +1 -0
  252. package/node_modules/@playdrop/entity-core/dist/test/voxels.test.d.ts +1 -0
  253. package/node_modules/@playdrop/entity-core/dist/test/voxels.test.js +51 -0
  254. package/node_modules/@playdrop/entity-core/dist/test/voxels.test.js.map +1 -0
  255. package/node_modules/@playdrop/entity-core/package.json +20 -0
  256. package/node_modules/@playdrop/entity-three/dist/src/animations.d.ts +4 -0
  257. package/node_modules/@playdrop/entity-three/dist/src/animations.js +70 -0
  258. package/node_modules/@playdrop/entity-three/dist/src/builders.d.ts +8 -0
  259. package/node_modules/@playdrop/entity-three/dist/src/builders.js +330 -0
  260. package/node_modules/@playdrop/entity-three/dist/src/context.d.ts +24 -0
  261. package/node_modules/@playdrop/entity-three/dist/src/context.js +32 -0
  262. package/node_modules/@playdrop/entity-three/dist/src/exporters/glb.d.ts +100 -0
  263. package/node_modules/@playdrop/entity-three/dist/src/exporters/glb.js +926 -0
  264. package/node_modules/@playdrop/entity-three/dist/src/exporters/image.d.ts +18 -0
  265. package/node_modules/@playdrop/entity-three/dist/src/exporters/image.js +288 -0
  266. package/node_modules/@playdrop/entity-three/dist/src/index.d.ts +17 -0
  267. package/node_modules/@playdrop/entity-three/dist/src/index.js +15 -0
  268. package/node_modules/@playdrop/entity-three/dist/src/instantiate.d.ts +40 -0
  269. package/node_modules/@playdrop/entity-three/dist/src/instantiate.js +70 -0
  270. package/node_modules/@playdrop/entity-three/dist/src/nodes.d.ts +8 -0
  271. package/node_modules/@playdrop/entity-three/dist/src/nodes.js +63 -0
  272. package/node_modules/@playdrop/entity-three/dist/src/overlays.d.ts +7 -0
  273. package/node_modules/@playdrop/entity-three/dist/src/overlays.js +97 -0
  274. package/node_modules/@playdrop/entity-three/dist/src/primitives.d.ts +4 -0
  275. package/node_modules/@playdrop/entity-three/dist/src/primitives.js +20 -0
  276. package/node_modules/@playdrop/entity-three/dist/src/scene.d.ts +3 -0
  277. package/node_modules/@playdrop/entity-three/dist/src/scene.js +144 -0
  278. package/node_modules/@playdrop/entity-three/dist/src/skinned-mesh.d.ts +29 -0
  279. package/node_modules/@playdrop/entity-three/dist/src/skinned-mesh.js +625 -0
  280. package/node_modules/@playdrop/entity-three/dist/src/texture-atlas.d.ts +13 -0
  281. package/node_modules/@playdrop/entity-three/dist/src/texture-atlas.js +107 -0
  282. package/node_modules/@playdrop/entity-three/dist/src/textures.d.ts +17 -0
  283. package/node_modules/@playdrop/entity-three/dist/src/textures.js +191 -0
  284. package/node_modules/@playdrop/entity-three/dist/src/types.d.ts +112 -0
  285. package/node_modules/@playdrop/entity-three/dist/src/types.js +1 -0
  286. package/node_modules/@playdrop/entity-three/dist/src/voxels/faces.d.ts +28 -0
  287. package/node_modules/@playdrop/entity-three/dist/src/voxels/faces.js +442 -0
  288. package/node_modules/@playdrop/entity-three/dist/src/voxels/mesher.d.ts +24 -0
  289. package/node_modules/@playdrop/entity-three/dist/src/voxels/mesher.js +88 -0
  290. package/node_modules/@playdrop/entity-three/dist/test/export-image.playwright.test.d.ts +1 -0
  291. package/node_modules/@playdrop/entity-three/dist/test/export-image.playwright.test.js +116 -0
  292. package/node_modules/@playdrop/entity-three/dist/test/fixtures/render-worker.d.ts +20 -0
  293. package/node_modules/@playdrop/entity-three/dist/test/fixtures/render-worker.js +63 -0
  294. package/node_modules/@playdrop/entity-three/dist/test/glb-skinned.test.d.ts +1 -0
  295. package/node_modules/@playdrop/entity-three/dist/test/glb-skinned.test.js +86 -0
  296. package/node_modules/@playdrop/entity-three/dist/test/index.test.d.ts +1 -0
  297. package/node_modules/@playdrop/entity-three/dist/test/index.test.js +8 -0
  298. package/node_modules/@playdrop/entity-three/dist/test/instantiate.test.d.ts +1 -0
  299. package/node_modules/@playdrop/entity-three/dist/test/instantiate.test.js +68 -0
  300. package/node_modules/@playdrop/entity-three/dist/test/overlays.test.d.ts +1 -0
  301. package/node_modules/@playdrop/entity-three/dist/test/overlays.test.js +20 -0
  302. package/node_modules/@playdrop/entity-three/dist/test/scene-filter.test.d.ts +1 -0
  303. package/node_modules/@playdrop/entity-three/dist/test/scene-filter.test.js +51 -0
  304. package/node_modules/@playdrop/entity-three/dist/test/scene-smoke.test.d.ts +1 -0
  305. package/node_modules/@playdrop/entity-three/dist/test/scene-smoke.test.js +63 -0
  306. package/node_modules/@playdrop/entity-three/dist/test/skinned-mesh.test.d.ts +1 -0
  307. package/node_modules/@playdrop/entity-three/dist/test/skinned-mesh.test.js +51 -0
  308. package/node_modules/@playdrop/entity-three/dist/test/textured-overlay.test.d.ts +1 -0
  309. package/node_modules/@playdrop/entity-three/dist/test/textured-overlay.test.js +116 -0
  310. package/node_modules/@playdrop/entity-three/dist/test/voxels.test.d.ts +1 -0
  311. package/node_modules/@playdrop/entity-three/dist/test/voxels.test.js +20 -0
  312. package/node_modules/@playdrop/entity-three/package.json +27 -0
  313. package/node_modules/@playdrop/types/dist/api.d.ts +647 -0
  314. package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -0
  315. package/node_modules/@playdrop/types/dist/api.js +39 -0
  316. package/node_modules/@playdrop/types/dist/app.d.ts +35 -0
  317. package/node_modules/@playdrop/types/dist/app.d.ts.map +1 -0
  318. package/node_modules/@playdrop/types/dist/app.js +64 -0
  319. package/node_modules/@playdrop/types/dist/asset-pack.d.ts +106 -0
  320. package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -0
  321. package/node_modules/@playdrop/types/dist/asset-pack.js +4 -0
  322. package/node_modules/@playdrop/types/dist/asset.d.ts +188 -0
  323. package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -0
  324. package/node_modules/@playdrop/types/dist/asset.js +100 -0
  325. package/node_modules/@playdrop/types/dist/ecs.d.ts +39 -0
  326. package/node_modules/@playdrop/types/dist/ecs.d.ts.map +1 -0
  327. package/node_modules/@playdrop/types/dist/ecs.js +93 -0
  328. package/node_modules/@playdrop/types/dist/engine-builtins.d.ts +17 -0
  329. package/node_modules/@playdrop/types/dist/engine-builtins.d.ts.map +1 -0
  330. package/node_modules/@playdrop/types/dist/engine-builtins.js +577 -0
  331. package/node_modules/@playdrop/types/dist/entity.d.ts +36 -0
  332. package/node_modules/@playdrop/types/dist/entity.d.ts.map +1 -0
  333. package/node_modules/@playdrop/types/dist/entity.js +40 -0
  334. package/node_modules/@playdrop/types/dist/graph.d.ts +34 -0
  335. package/node_modules/@playdrop/types/dist/graph.d.ts.map +1 -0
  336. package/node_modules/@playdrop/types/dist/graph.js +8 -0
  337. package/node_modules/@playdrop/types/dist/index.d.ts +10 -0
  338. package/node_modules/@playdrop/types/dist/index.d.ts.map +1 -0
  339. package/node_modules/@playdrop/types/dist/index.js +14 -0
  340. package/node_modules/@playdrop/types/dist/profile-asset-semantics.d.ts +22 -0
  341. package/node_modules/@playdrop/types/dist/profile-asset-semantics.d.ts.map +1 -0
  342. package/node_modules/@playdrop/types/dist/profile-asset-semantics.js +105 -0
  343. package/node_modules/@playdrop/types/dist/realtime.d.ts +221 -0
  344. package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -0
  345. package/node_modules/@playdrop/types/dist/realtime.js +7 -0
  346. package/node_modules/@playdrop/types/dist/version.d.ts +149 -0
  347. package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -0
  348. package/node_modules/@playdrop/types/dist/version.js +76 -0
  349. package/node_modules/@playdrop/types/package.json +63 -0
  350. package/node_modules/three/LICENSE +21 -0
  351. package/node_modules/three/README.md +86 -0
  352. package/node_modules/three/build/three.cjs +53732 -0
  353. package/node_modules/three/build/three.module.js +53316 -0
  354. package/node_modules/three/build/three.module.min.js +6 -0
  355. package/node_modules/three/examples/fonts/LICENSE +13 -0
  356. package/node_modules/three/examples/fonts/README.md +11 -0
  357. package/node_modules/three/examples/fonts/droid/NOTICE +190 -0
  358. package/node_modules/three/examples/fonts/droid/README.txt +18 -0
  359. package/node_modules/three/examples/fonts/droid/droid_sans_bold.typeface.json +1 -0
  360. package/node_modules/three/examples/fonts/droid/droid_sans_mono_regular.typeface.json +1 -0
  361. package/node_modules/three/examples/fonts/droid/droid_sans_regular.typeface.json +1 -0
  362. package/node_modules/three/examples/fonts/droid/droid_serif_bold.typeface.json +1 -0
  363. package/node_modules/three/examples/fonts/droid/droid_serif_regular.typeface.json +1 -0
  364. package/node_modules/three/examples/fonts/gentilis_bold.typeface.json +1 -0
  365. package/node_modules/three/examples/fonts/gentilis_regular.typeface.json +1 -0
  366. package/node_modules/three/examples/fonts/helvetiker_bold.typeface.json +1 -0
  367. package/node_modules/three/examples/fonts/helvetiker_regular.typeface.json +1 -0
  368. package/node_modules/three/examples/fonts/optimer_bold.typeface.json +1 -0
  369. package/node_modules/three/examples/fonts/optimer_regular.typeface.json +1 -0
  370. package/node_modules/three/examples/fonts/ttf/README.md +9 -0
  371. package/node_modules/three/examples/fonts/ttf/kenpixel.ttf +0 -0
  372. package/node_modules/three/examples/jsm/Addons.js +295 -0
  373. package/node_modules/three/examples/jsm/animation/AnimationClipCreator.js +116 -0
  374. package/node_modules/three/examples/jsm/animation/CCDIKSolver.js +482 -0
  375. package/node_modules/three/examples/jsm/animation/MMDAnimationHelper.js +1207 -0
  376. package/node_modules/three/examples/jsm/animation/MMDPhysics.js +1406 -0
  377. package/node_modules/three/examples/jsm/cameras/CinematicCamera.js +208 -0
  378. package/node_modules/three/examples/jsm/capabilities/WebGL.js +108 -0
  379. package/node_modules/three/examples/jsm/capabilities/WebGPU.js +57 -0
  380. package/node_modules/three/examples/jsm/controls/ArcballControls.js +3224 -0
  381. package/node_modules/three/examples/jsm/controls/DragControls.js +221 -0
  382. package/node_modules/three/examples/jsm/controls/FirstPersonControls.js +325 -0
  383. package/node_modules/three/examples/jsm/controls/FlyControls.js +326 -0
  384. package/node_modules/three/examples/jsm/controls/MapControls.js +28 -0
  385. package/node_modules/three/examples/jsm/controls/OrbitControls.js +1506 -0
  386. package/node_modules/three/examples/jsm/controls/PointerLockControls.js +162 -0
  387. package/node_modules/three/examples/jsm/controls/TrackballControls.js +828 -0
  388. package/node_modules/three/examples/jsm/controls/TransformControls.js +1573 -0
  389. package/node_modules/three/examples/jsm/csm/CSM.js +384 -0
  390. package/node_modules/three/examples/jsm/csm/CSMFrustum.js +152 -0
  391. package/node_modules/three/examples/jsm/csm/CSMHelper.js +193 -0
  392. package/node_modules/three/examples/jsm/csm/CSMShader.js +295 -0
  393. package/node_modules/three/examples/jsm/curves/CurveExtras.js +422 -0
  394. package/node_modules/three/examples/jsm/curves/NURBSCurve.js +80 -0
  395. package/node_modules/three/examples/jsm/curves/NURBSSurface.js +52 -0
  396. package/node_modules/three/examples/jsm/curves/NURBSUtils.js +542 -0
  397. package/node_modules/three/examples/jsm/curves/NURBSVolume.js +62 -0
  398. package/node_modules/three/examples/jsm/effects/AnaglyphEffect.js +154 -0
  399. package/node_modules/three/examples/jsm/effects/AsciiEffect.js +263 -0
  400. package/node_modules/three/examples/jsm/effects/OutlineEffect.js +539 -0
  401. package/node_modules/three/examples/jsm/effects/ParallaxBarrierEffect.js +119 -0
  402. package/node_modules/three/examples/jsm/effects/PeppersGhostEffect.js +153 -0
  403. package/node_modules/three/examples/jsm/effects/StereoEffect.js +55 -0
  404. package/node_modules/three/examples/jsm/environments/DebugEnvironment.js +52 -0
  405. package/node_modules/three/examples/jsm/environments/RoomEnvironment.js +148 -0
  406. package/node_modules/three/examples/jsm/exporters/DRACOExporter.js +267 -0
  407. package/node_modules/three/examples/jsm/exporters/EXRExporter.js +579 -0
  408. package/node_modules/three/examples/jsm/exporters/GLTFExporter.js +3309 -0
  409. package/node_modules/three/examples/jsm/exporters/KTX2Exporter.js +292 -0
  410. package/node_modules/three/examples/jsm/exporters/MMDExporter.js +217 -0
  411. package/node_modules/three/examples/jsm/exporters/OBJExporter.js +284 -0
  412. package/node_modules/three/examples/jsm/exporters/PLYExporter.js +528 -0
  413. package/node_modules/three/examples/jsm/exporters/STLExporter.js +199 -0
  414. package/node_modules/three/examples/jsm/exporters/USDZExporter.js +720 -0
  415. package/node_modules/three/examples/jsm/geometries/BoxLineGeometry.js +69 -0
  416. package/node_modules/three/examples/jsm/geometries/ConvexGeometry.js +53 -0
  417. package/node_modules/three/examples/jsm/geometries/DecalGeometry.js +356 -0
  418. package/node_modules/three/examples/jsm/geometries/InstancedPointsGeometry.js +174 -0
  419. package/node_modules/three/examples/jsm/geometries/ParametricGeometries.js +254 -0
  420. package/node_modules/three/examples/jsm/geometries/ParametricGeometry.js +139 -0
  421. package/node_modules/three/examples/jsm/geometries/RoundedBoxGeometry.js +155 -0
  422. package/node_modules/three/examples/jsm/geometries/SDFGeometryGenerator.js +144 -0
  423. package/node_modules/three/examples/jsm/geometries/TeapotGeometry.js +704 -0
  424. package/node_modules/three/examples/jsm/geometries/TextGeometry.js +57 -0
  425. package/node_modules/three/examples/jsm/helpers/LightProbeHelper.js +130 -0
  426. package/node_modules/three/examples/jsm/helpers/OctreeHelper.js +73 -0
  427. package/node_modules/three/examples/jsm/helpers/PositionalAudioHelper.js +109 -0
  428. package/node_modules/three/examples/jsm/helpers/RectAreaLightHelper.js +85 -0
  429. package/node_modules/three/examples/jsm/helpers/TextureHelper.js +237 -0
  430. package/node_modules/three/examples/jsm/helpers/VertexNormalsHelper.js +96 -0
  431. package/node_modules/three/examples/jsm/helpers/VertexTangentsHelper.js +88 -0
  432. package/node_modules/three/examples/jsm/helpers/ViewHelper.js +333 -0
  433. package/node_modules/three/examples/jsm/interactive/HTMLMesh.js +572 -0
  434. package/node_modules/three/examples/jsm/interactive/InteractiveGroup.js +116 -0
  435. package/node_modules/three/examples/jsm/interactive/SelectionBox.js +227 -0
  436. package/node_modules/three/examples/jsm/interactive/SelectionHelper.js +104 -0
  437. package/node_modules/three/examples/jsm/libs/ammo.wasm.js +822 -0
  438. package/node_modules/three/examples/jsm/libs/ammo.wasm.wasm +0 -0
  439. package/node_modules/three/examples/jsm/libs/basis/README.md +46 -0
  440. package/node_modules/three/examples/jsm/libs/basis/basis_transcoder.js +21 -0
  441. package/node_modules/three/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
  442. package/node_modules/three/examples/jsm/libs/chevrotain.module.min.js +141 -0
  443. package/node_modules/three/examples/jsm/libs/draco/README.md +32 -0
  444. package/node_modules/three/examples/jsm/libs/draco/draco_decoder.js +34 -0
  445. package/node_modules/three/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
  446. package/node_modules/three/examples/jsm/libs/draco/draco_encoder.js +33 -0
  447. package/node_modules/three/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
  448. package/node_modules/three/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
  449. package/node_modules/three/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
  450. package/node_modules/three/examples/jsm/libs/draco/gltf/draco_encoder.js +33 -0
  451. package/node_modules/three/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
  452. package/node_modules/three/examples/jsm/libs/ecsy.module.js +1792 -0
  453. package/node_modules/three/examples/jsm/libs/fflate.module.js +2474 -0
  454. package/node_modules/three/examples/jsm/libs/ktx-parse.module.js +1 -0
  455. package/node_modules/three/examples/jsm/libs/lil-gui.module.min.js +8 -0
  456. package/node_modules/three/examples/jsm/libs/lottie_canvas.module.js +14849 -0
  457. package/node_modules/three/examples/jsm/libs/meshopt_decoder.module.js +178 -0
  458. package/node_modules/three/examples/jsm/libs/mikktspace.module.js +128 -0
  459. package/node_modules/three/examples/jsm/libs/mmdparser.module.js +11530 -0
  460. package/node_modules/three/examples/jsm/libs/motion-controllers.module.js +397 -0
  461. package/node_modules/three/examples/jsm/libs/opentype.module.js +14506 -0
  462. package/node_modules/three/examples/jsm/libs/potpack.module.js +125 -0
  463. package/node_modules/three/examples/jsm/libs/rhino3dm/rhino3dm.js +8743 -0
  464. package/node_modules/three/examples/jsm/libs/rhino3dm/rhino3dm.module.js +8749 -0
  465. package/node_modules/three/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  466. package/node_modules/three/examples/jsm/libs/stats.module.js +167 -0
  467. package/node_modules/three/examples/jsm/libs/surfaceNet.js +201 -0
  468. package/node_modules/three/examples/jsm/libs/tween.module.js +858 -0
  469. package/node_modules/three/examples/jsm/libs/utif.module.js +1665 -0
  470. package/node_modules/three/examples/jsm/libs/zstddec.module.js +1 -0
  471. package/node_modules/three/examples/jsm/lights/IESSpotLight.js +25 -0
  472. package/node_modules/three/examples/jsm/lights/LightProbeGenerator.js +286 -0
  473. package/node_modules/three/examples/jsm/lights/RectAreaLightUniformsLib.js +79 -0
  474. package/node_modules/three/examples/jsm/lines/Line2.js +19 -0
  475. package/node_modules/three/examples/jsm/lines/LineGeometry.js +79 -0
  476. package/node_modules/three/examples/jsm/lines/LineMaterial.js +619 -0
  477. package/node_modules/three/examples/jsm/lines/LineSegments2.js +361 -0
  478. package/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js +241 -0
  479. package/node_modules/three/examples/jsm/lines/Wireframe.js +56 -0
  480. package/node_modules/three/examples/jsm/lines/WireframeGeometry2.js +24 -0
  481. package/node_modules/three/examples/jsm/loaders/3DMLoader.js +1772 -0
  482. package/node_modules/three/examples/jsm/loaders/3MFLoader.js +1478 -0
  483. package/node_modules/three/examples/jsm/loaders/AMFLoader.js +521 -0
  484. package/node_modules/three/examples/jsm/loaders/BVHLoader.js +437 -0
  485. package/node_modules/three/examples/jsm/loaders/ColladaLoader.js +4116 -0
  486. package/node_modules/three/examples/jsm/loaders/DDSLoader.js +318 -0
  487. package/node_modules/three/examples/jsm/loaders/DRACOLoader.js +613 -0
  488. package/node_modules/three/examples/jsm/loaders/EXRLoader.js +2309 -0
  489. package/node_modules/three/examples/jsm/loaders/FBXLoader.js +4314 -0
  490. package/node_modules/three/examples/jsm/loaders/FontLoader.js +183 -0
  491. package/node_modules/three/examples/jsm/loaders/GCodeLoader.js +261 -0
  492. package/node_modules/three/examples/jsm/loaders/GLTFLoader.js +4663 -0
  493. package/node_modules/three/examples/jsm/loaders/HDRCubeTextureLoader.js +115 -0
  494. package/node_modules/three/examples/jsm/loaders/IESLoader.js +337 -0
  495. package/node_modules/three/examples/jsm/loaders/KMZLoader.js +130 -0
  496. package/node_modules/three/examples/jsm/loaders/KTX2Loader.js +932 -0
  497. package/node_modules/three/examples/jsm/loaders/KTXLoader.js +176 -0
  498. package/node_modules/three/examples/jsm/loaders/LDrawLoader.js +2470 -0
  499. package/node_modules/three/examples/jsm/loaders/LUT3dlLoader.js +183 -0
  500. package/node_modules/three/examples/jsm/loaders/LUTCubeLoader.js +167 -0
  501. package/node_modules/three/examples/jsm/loaders/LUTImageLoader.js +163 -0
  502. package/node_modules/three/examples/jsm/loaders/LWOLoader.js +1052 -0
  503. package/node_modules/three/examples/jsm/loaders/LogLuvLoader.js +606 -0
  504. package/node_modules/three/examples/jsm/loaders/LottieLoader.js +77 -0
  505. package/node_modules/three/examples/jsm/loaders/MD2Loader.js +399 -0
  506. package/node_modules/three/examples/jsm/loaders/MDDLoader.js +102 -0
  507. package/node_modules/three/examples/jsm/loaders/MMDLoader.js +2276 -0
  508. package/node_modules/three/examples/jsm/loaders/MTLLoader.js +567 -0
  509. package/node_modules/three/examples/jsm/loaders/MaterialXLoader.js +852 -0
  510. package/node_modules/three/examples/jsm/loaders/NRRDLoader.js +686 -0
  511. package/node_modules/three/examples/jsm/loaders/OBJLoader.js +905 -0
  512. package/node_modules/three/examples/jsm/loaders/PCDLoader.js +467 -0
  513. package/node_modules/three/examples/jsm/loaders/PDBLoader.js +232 -0
  514. package/node_modules/three/examples/jsm/loaders/PLYLoader.js +771 -0
  515. package/node_modules/three/examples/jsm/loaders/PVRLoader.js +251 -0
  516. package/node_modules/three/examples/jsm/loaders/RGBELoader.js +450 -0
  517. package/node_modules/three/examples/jsm/loaders/RGBMLoader.js +1065 -0
  518. package/node_modules/three/examples/jsm/loaders/STLLoader.js +410 -0
  519. package/node_modules/three/examples/jsm/loaders/SVGLoader.js +3173 -0
  520. package/node_modules/three/examples/jsm/loaders/TDSLoader.js +1124 -0
  521. package/node_modules/three/examples/jsm/loaders/TGALoader.js +517 -0
  522. package/node_modules/three/examples/jsm/loaders/TIFFLoader.js +36 -0
  523. package/node_modules/three/examples/jsm/loaders/TTFLoader.js +214 -0
  524. package/node_modules/three/examples/jsm/loaders/TiltLoader.js +520 -0
  525. package/node_modules/three/examples/jsm/loaders/USDZLoader.js +822 -0
  526. package/node_modules/three/examples/jsm/loaders/VOXLoader.js +311 -0
  527. package/node_modules/three/examples/jsm/loaders/VRMLLoader.js +3533 -0
  528. package/node_modules/three/examples/jsm/loaders/VTKLoader.js +1163 -0
  529. package/node_modules/three/examples/jsm/loaders/XYZLoader.js +106 -0
  530. package/node_modules/three/examples/jsm/loaders/lwo/IFFParser.js +1214 -0
  531. package/node_modules/three/examples/jsm/loaders/lwo/LWO2Parser.js +414 -0
  532. package/node_modules/three/examples/jsm/loaders/lwo/LWO3Parser.js +373 -0
  533. package/node_modules/three/examples/jsm/materials/MeshGouraudMaterial.js +426 -0
  534. package/node_modules/three/examples/jsm/materials/MeshPostProcessingMaterial.js +144 -0
  535. package/node_modules/three/examples/jsm/math/Capsule.js +82 -0
  536. package/node_modules/three/examples/jsm/math/ColorConverter.js +36 -0
  537. package/node_modules/three/examples/jsm/math/ConvexHull.js +1271 -0
  538. package/node_modules/three/examples/jsm/math/ImprovedNoise.js +71 -0
  539. package/node_modules/three/examples/jsm/math/Lut.js +204 -0
  540. package/node_modules/three/examples/jsm/math/MeshSurfaceSampler.js +250 -0
  541. package/node_modules/three/examples/jsm/math/OBB.js +423 -0
  542. package/node_modules/three/examples/jsm/math/Octree.js +540 -0
  543. package/node_modules/three/examples/jsm/math/SimplexNoise.js +444 -0
  544. package/node_modules/three/examples/jsm/misc/ConvexObjectBreaker.js +519 -0
  545. package/node_modules/three/examples/jsm/misc/GPUComputationRenderer.js +446 -0
  546. package/node_modules/three/examples/jsm/misc/Gyroscope.js +66 -0
  547. package/node_modules/three/examples/jsm/misc/MD2Character.js +276 -0
  548. package/node_modules/three/examples/jsm/misc/MD2CharacterComplex.js +576 -0
  549. package/node_modules/three/examples/jsm/misc/MorphAnimMesh.js +75 -0
  550. package/node_modules/three/examples/jsm/misc/MorphBlendMesh.js +322 -0
  551. package/node_modules/three/examples/jsm/misc/ProgressiveLightMap.js +323 -0
  552. package/node_modules/three/examples/jsm/misc/RollerCoaster.js +566 -0
  553. package/node_modules/three/examples/jsm/misc/Timer.js +128 -0
  554. package/node_modules/three/examples/jsm/misc/TubePainter.js +202 -0
  555. package/node_modules/three/examples/jsm/misc/Volume.js +473 -0
  556. package/node_modules/three/examples/jsm/misc/VolumeSlice.js +229 -0
  557. package/node_modules/three/examples/jsm/modifiers/CurveModifier.js +344 -0
  558. package/node_modules/three/examples/jsm/modifiers/EdgeSplitModifier.js +279 -0
  559. package/node_modules/three/examples/jsm/modifiers/SimplifyModifier.js +617 -0
  560. package/node_modules/three/examples/jsm/modifiers/TessellateModifier.js +307 -0
  561. package/node_modules/three/examples/jsm/nodes/Nodes.js +193 -0
  562. package/node_modules/three/examples/jsm/nodes/accessors/BitangentNode.js +89 -0
  563. package/node_modules/three/examples/jsm/nodes/accessors/BufferAttributeNode.js +127 -0
  564. package/node_modules/three/examples/jsm/nodes/accessors/BufferNode.js +30 -0
  565. package/node_modules/three/examples/jsm/nodes/accessors/CameraNode.js +119 -0
  566. package/node_modules/three/examples/jsm/nodes/accessors/CubeTextureNode.js +61 -0
  567. package/node_modules/three/examples/jsm/nodes/accessors/InstanceNode.js +71 -0
  568. package/node_modules/three/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +21 -0
  569. package/node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js +314 -0
  570. package/node_modules/three/examples/jsm/nodes/accessors/MaterialReferenceNode.js +51 -0
  571. package/node_modules/three/examples/jsm/nodes/accessors/ModelNode.js +33 -0
  572. package/node_modules/three/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +39 -0
  573. package/node_modules/three/examples/jsm/nodes/accessors/MorphNode.js +245 -0
  574. package/node_modules/three/examples/jsm/nodes/accessors/NormalNode.js +96 -0
  575. package/node_modules/three/examples/jsm/nodes/accessors/Object3DNode.js +150 -0
  576. package/node_modules/three/examples/jsm/nodes/accessors/PointUVNode.js +26 -0
  577. package/node_modules/three/examples/jsm/nodes/accessors/PositionNode.js +104 -0
  578. package/node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js +102 -0
  579. package/node_modules/three/examples/jsm/nodes/accessors/ReflectVectorNode.js +35 -0
  580. package/node_modules/three/examples/jsm/nodes/accessors/SceneNode.js +52 -0
  581. package/node_modules/three/examples/jsm/nodes/accessors/SkinningNode.js +103 -0
  582. package/node_modules/three/examples/jsm/nodes/accessors/StorageBufferNode.js +54 -0
  583. package/node_modules/three/examples/jsm/nodes/accessors/TangentNode.js +103 -0
  584. package/node_modules/three/examples/jsm/nodes/accessors/TextureBicubicNode.js +94 -0
  585. package/node_modules/three/examples/jsm/nodes/accessors/TextureNode.js +367 -0
  586. package/node_modules/three/examples/jsm/nodes/accessors/TextureSizeNode.js +35 -0
  587. package/node_modules/three/examples/jsm/nodes/accessors/TextureStoreNode.js +82 -0
  588. package/node_modules/three/examples/jsm/nodes/accessors/UVNode.js +47 -0
  589. package/node_modules/three/examples/jsm/nodes/accessors/UserDataNode.js +29 -0
  590. package/node_modules/three/examples/jsm/nodes/accessors/VertexColorNode.js +70 -0
  591. package/node_modules/three/examples/jsm/nodes/code/CodeNode.js +78 -0
  592. package/node_modules/three/examples/jsm/nodes/code/ExpressionNode.js +37 -0
  593. package/node_modules/three/examples/jsm/nodes/code/FunctionCallNode.js +96 -0
  594. package/node_modules/three/examples/jsm/nodes/code/FunctionNode.js +138 -0
  595. package/node_modules/three/examples/jsm/nodes/code/ScriptableNode.js +488 -0
  596. package/node_modules/three/examples/jsm/nodes/code/ScriptableValueNode.js +167 -0
  597. package/node_modules/three/examples/jsm/nodes/core/ArrayUniformNode.js +26 -0
  598. package/node_modules/three/examples/jsm/nodes/core/AssignNode.js +72 -0
  599. package/node_modules/three/examples/jsm/nodes/core/AttributeNode.js +108 -0
  600. package/node_modules/three/examples/jsm/nodes/core/BypassNode.js +45 -0
  601. package/node_modules/three/examples/jsm/nodes/core/CacheNode.js +49 -0
  602. package/node_modules/three/examples/jsm/nodes/core/ConstNode.js +32 -0
  603. package/node_modules/three/examples/jsm/nodes/core/ContextNode.js +61 -0
  604. package/node_modules/three/examples/jsm/nodes/core/IndexNode.js +66 -0
  605. package/node_modules/three/examples/jsm/nodes/core/InputNode.js +83 -0
  606. package/node_modules/three/examples/jsm/nodes/core/LightingModel.js +17 -0
  607. package/node_modules/three/examples/jsm/nodes/core/Node.js +483 -0
  608. package/node_modules/three/examples/jsm/nodes/core/NodeAttribute.js +15 -0
  609. package/node_modules/three/examples/jsm/nodes/core/NodeBuilder.js +1256 -0
  610. package/node_modules/three/examples/jsm/nodes/core/NodeCache.js +26 -0
  611. package/node_modules/three/examples/jsm/nodes/core/NodeCode.js +15 -0
  612. package/node_modules/three/examples/jsm/nodes/core/NodeFrame.js +143 -0
  613. package/node_modules/three/examples/jsm/nodes/core/NodeFunction.js +22 -0
  614. package/node_modules/three/examples/jsm/nodes/core/NodeFunctionInput.js +17 -0
  615. package/node_modules/three/examples/jsm/nodes/core/NodeKeywords.js +80 -0
  616. package/node_modules/three/examples/jsm/nodes/core/NodeParser.js +11 -0
  617. package/node_modules/three/examples/jsm/nodes/core/NodeUniform.js +40 -0
  618. package/node_modules/three/examples/jsm/nodes/core/NodeUtils.js +210 -0
  619. package/node_modules/three/examples/jsm/nodes/core/NodeVar.js +14 -0
  620. package/node_modules/three/examples/jsm/nodes/core/NodeVarying.js +17 -0
  621. package/node_modules/three/examples/jsm/nodes/core/OutputStructNode.js +62 -0
  622. package/node_modules/three/examples/jsm/nodes/core/ParameterNode.js +33 -0
  623. package/node_modules/three/examples/jsm/nodes/core/PropertyNode.js +72 -0
  624. package/node_modules/three/examples/jsm/nodes/core/StackNode.js +89 -0
  625. package/node_modules/three/examples/jsm/nodes/core/StructTypeNode.js +24 -0
  626. package/node_modules/three/examples/jsm/nodes/core/TempNode.js +58 -0
  627. package/node_modules/three/examples/jsm/nodes/core/UniformGroup.js +13 -0
  628. package/node_modules/three/examples/jsm/nodes/core/UniformGroupNode.js +36 -0
  629. package/node_modules/three/examples/jsm/nodes/core/UniformNode.js +80 -0
  630. package/node_modules/three/examples/jsm/nodes/core/VarNode.js +60 -0
  631. package/node_modules/three/examples/jsm/nodes/core/VaryingNode.js +65 -0
  632. package/node_modules/three/examples/jsm/nodes/core/constants.js +28 -0
  633. package/node_modules/three/examples/jsm/nodes/display/AfterImageNode.js +148 -0
  634. package/node_modules/three/examples/jsm/nodes/display/AnamorphicNode.js +148 -0
  635. package/node_modules/three/examples/jsm/nodes/display/BlendModeNode.js +99 -0
  636. package/node_modules/three/examples/jsm/nodes/display/BumpMapNode.js +99 -0
  637. package/node_modules/three/examples/jsm/nodes/display/ColorAdjustmentNode.js +99 -0
  638. package/node_modules/three/examples/jsm/nodes/display/ColorSpaceNode.js +108 -0
  639. package/node_modules/three/examples/jsm/nodes/display/FrontFacingNode.js +27 -0
  640. package/node_modules/three/examples/jsm/nodes/display/GaussianBlurNode.js +190 -0
  641. package/node_modules/three/examples/jsm/nodes/display/NormalMapNode.js +108 -0
  642. package/node_modules/three/examples/jsm/nodes/display/PassNode.js +183 -0
  643. package/node_modules/three/examples/jsm/nodes/display/PosterizeNode.js +32 -0
  644. package/node_modules/three/examples/jsm/nodes/display/ToneMappingNode.js +184 -0
  645. package/node_modules/three/examples/jsm/nodes/display/ViewportDepthNode.js +97 -0
  646. package/node_modules/three/examples/jsm/nodes/display/ViewportDepthTextureNode.js +31 -0
  647. package/node_modules/three/examples/jsm/nodes/display/ViewportNode.js +134 -0
  648. package/node_modules/three/examples/jsm/nodes/display/ViewportSharedTextureNode.js +31 -0
  649. package/node_modules/three/examples/jsm/nodes/display/ViewportTextureNode.js +75 -0
  650. package/node_modules/three/examples/jsm/nodes/fog/FogExp2Node.js +35 -0
  651. package/node_modules/three/examples/jsm/nodes/fog/FogNode.js +38 -0
  652. package/node_modules/three/examples/jsm/nodes/fog/FogRangeNode.js +34 -0
  653. package/node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +40 -0
  654. package/node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
  655. package/node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +57 -0
  656. package/node_modules/three/examples/jsm/nodes/functions/BSDF/DFGApprox.js +30 -0
  657. package/node_modules/three/examples/jsm/nodes/functions/BSDF/D_GGX.js +23 -0
  658. package/node_modules/three/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
  659. package/node_modules/three/examples/jsm/nodes/functions/BSDF/F_Schlick.js +16 -0
  660. package/node_modules/three/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js +21 -0
  661. package/node_modules/three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +28 -0
  662. package/node_modules/three/examples/jsm/nodes/functions/PhongLightingModel.js +67 -0
  663. package/node_modules/three/examples/jsm/nodes/functions/PhysicalLightingModel.js +393 -0
  664. package/node_modules/three/examples/jsm/nodes/functions/material/getGeometryRoughness.js +13 -0
  665. package/node_modules/three/examples/jsm/nodes/functions/material/getRoughness.js +18 -0
  666. package/node_modules/three/examples/jsm/nodes/geometry/RangeNode.js +104 -0
  667. package/node_modules/three/examples/jsm/nodes/gpgpu/ComputeNode.js +85 -0
  668. package/node_modules/three/examples/jsm/nodes/lighting/AONode.js +27 -0
  669. package/node_modules/three/examples/jsm/nodes/lighting/AmbientLightNode.js +27 -0
  670. package/node_modules/three/examples/jsm/nodes/lighting/AnalyticLightNode.js +241 -0
  671. package/node_modules/three/examples/jsm/nodes/lighting/DirectionalLightNode.js +40 -0
  672. package/node_modules/three/examples/jsm/nodes/lighting/EnvironmentNode.js +181 -0
  673. package/node_modules/three/examples/jsm/nodes/lighting/HemisphereLightNode.js +55 -0
  674. package/node_modules/three/examples/jsm/nodes/lighting/IESSpotLightNode.js +39 -0
  675. package/node_modules/three/examples/jsm/nodes/lighting/LightNode.js +57 -0
  676. package/node_modules/three/examples/jsm/nodes/lighting/LightUtils.js +17 -0
  677. package/node_modules/three/examples/jsm/nodes/lighting/LightingContextNode.js +66 -0
  678. package/node_modules/three/examples/jsm/nodes/lighting/LightingNode.js +21 -0
  679. package/node_modules/three/examples/jsm/nodes/lighting/LightsNode.js +188 -0
  680. package/node_modules/three/examples/jsm/nodes/lighting/PointLightNode.js +68 -0
  681. package/node_modules/three/examples/jsm/nodes/lighting/SpotLightNode.js +89 -0
  682. package/node_modules/three/examples/jsm/nodes/loaders/NodeLoader.js +108 -0
  683. package/node_modules/three/examples/jsm/nodes/loaders/NodeMaterialLoader.js +59 -0
  684. package/node_modules/three/examples/jsm/nodes/loaders/NodeObjectLoader.js +70 -0
  685. package/node_modules/three/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +162 -0
  686. package/node_modules/three/examples/jsm/nodes/materials/Line2NodeMaterial.js +436 -0
  687. package/node_modules/three/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +28 -0
  688. package/node_modules/three/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +54 -0
  689. package/node_modules/three/examples/jsm/nodes/materials/Materials.js +16 -0
  690. package/node_modules/three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +28 -0
  691. package/node_modules/three/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +34 -0
  692. package/node_modules/three/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +40 -0
  693. package/node_modules/three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +65 -0
  694. package/node_modules/three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +155 -0
  695. package/node_modules/three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.js +84 -0
  696. package/node_modules/three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +80 -0
  697. package/node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js +570 -0
  698. package/node_modules/three/examples/jsm/nodes/materials/PointsNodeMaterial.js +39 -0
  699. package/node_modules/three/examples/jsm/nodes/materials/SpriteNodeMaterial.js +90 -0
  700. package/node_modules/three/examples/jsm/nodes/materialx/DISCLAIMER.md +199 -0
  701. package/node_modules/three/examples/jsm/nodes/materialx/MaterialXNodes.js +68 -0
  702. package/node_modules/three/examples/jsm/nodes/materialx/lib/mx_hsv.js +130 -0
  703. package/node_modules/three/examples/jsm/nodes/materialx/lib/mx_noise.js +1430 -0
  704. package/node_modules/three/examples/jsm/nodes/materialx/lib/mx_transform_color.js +29 -0
  705. package/node_modules/three/examples/jsm/nodes/math/CondNode.js +86 -0
  706. package/node_modules/three/examples/jsm/nodes/math/HashNode.js +34 -0
  707. package/node_modules/three/examples/jsm/nodes/math/MathNode.js +371 -0
  708. package/node_modules/three/examples/jsm/nodes/math/MathUtils.js +15 -0
  709. package/node_modules/three/examples/jsm/nodes/math/OperatorNode.js +274 -0
  710. package/node_modules/three/examples/jsm/nodes/math/TriNoise3D.js +71 -0
  711. package/node_modules/three/examples/jsm/nodes/parsers/GLSLNodeFunction.js +152 -0
  712. package/node_modules/three/examples/jsm/nodes/parsers/GLSLNodeParser.js +14 -0
  713. package/node_modules/three/examples/jsm/nodes/procedural/CheckerNode.js +42 -0
  714. package/node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js +634 -0
  715. package/node_modules/three/examples/jsm/nodes/utils/ArrayElementNode.js +41 -0
  716. package/node_modules/three/examples/jsm/nodes/utils/ConvertNode.js +65 -0
  717. package/node_modules/three/examples/jsm/nodes/utils/DiscardNode.js +27 -0
  718. package/node_modules/three/examples/jsm/nodes/utils/EquirectUVNode.js +33 -0
  719. package/node_modules/three/examples/jsm/nodes/utils/FunctionOverloadingNode.js +95 -0
  720. package/node_modules/three/examples/jsm/nodes/utils/JoinNode.js +61 -0
  721. package/node_modules/three/examples/jsm/nodes/utils/LoopNode.js +198 -0
  722. package/node_modules/three/examples/jsm/nodes/utils/MatcapUVNode.js +30 -0
  723. package/node_modules/three/examples/jsm/nodes/utils/MaxMipLevelNode.js +46 -0
  724. package/node_modules/three/examples/jsm/nodes/utils/OscNode.js +81 -0
  725. package/node_modules/three/examples/jsm/nodes/utils/PackingNode.js +55 -0
  726. package/node_modules/three/examples/jsm/nodes/utils/ReflectorNode.js +227 -0
  727. package/node_modules/three/examples/jsm/nodes/utils/RemapNode.js +42 -0
  728. package/node_modules/three/examples/jsm/nodes/utils/RotateNode.js +68 -0
  729. package/node_modules/three/examples/jsm/nodes/utils/RotateUVNode.js +35 -0
  730. package/node_modules/three/examples/jsm/nodes/utils/SetNode.js +62 -0
  731. package/node_modules/three/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +37 -0
  732. package/node_modules/three/examples/jsm/nodes/utils/SplitNode.js +112 -0
  733. package/node_modules/three/examples/jsm/nodes/utils/SpriteSheetUVNode.js +41 -0
  734. package/node_modules/three/examples/jsm/nodes/utils/TimerNode.js +94 -0
  735. package/node_modules/three/examples/jsm/nodes/utils/TriplanarTexturesNode.js +62 -0
  736. package/node_modules/three/examples/jsm/objects/GroundedSkybox.js +50 -0
  737. package/node_modules/three/examples/jsm/objects/InstancedPoints.js +21 -0
  738. package/node_modules/three/examples/jsm/objects/Lensflare.js +397 -0
  739. package/node_modules/three/examples/jsm/objects/MarchingCubes.js +1176 -0
  740. package/node_modules/three/examples/jsm/objects/QuadMesh.js +66 -0
  741. package/node_modules/three/examples/jsm/objects/Reflector.js +264 -0
  742. package/node_modules/three/examples/jsm/objects/ReflectorForSSRPass.js +352 -0
  743. package/node_modules/three/examples/jsm/objects/Refractor.js +327 -0
  744. package/node_modules/three/examples/jsm/objects/ShadowMesh.js +80 -0
  745. package/node_modules/three/examples/jsm/objects/Sky.js +219 -0
  746. package/node_modules/three/examples/jsm/objects/Water.js +333 -0
  747. package/node_modules/three/examples/jsm/objects/Water2.js +361 -0
  748. package/node_modules/three/examples/jsm/offscreen/jank.js +45 -0
  749. package/node_modules/three/examples/jsm/offscreen/offscreen.js +8 -0
  750. package/node_modules/three/examples/jsm/offscreen/scene.js +86 -0
  751. package/node_modules/three/examples/jsm/physics/AmmoPhysics.js +306 -0
  752. package/node_modules/three/examples/jsm/physics/RapierPhysics.js +220 -0
  753. package/node_modules/three/examples/jsm/postprocessing/AfterimagePass.js +104 -0
  754. package/node_modules/three/examples/jsm/postprocessing/BloomPass.js +172 -0
  755. package/node_modules/three/examples/jsm/postprocessing/BokehPass.js +141 -0
  756. package/node_modules/three/examples/jsm/postprocessing/ClearPass.js +46 -0
  757. package/node_modules/three/examples/jsm/postprocessing/CubeTexturePass.js +85 -0
  758. package/node_modules/three/examples/jsm/postprocessing/DotScreenPass.js +65 -0
  759. package/node_modules/three/examples/jsm/postprocessing/EffectComposer.js +231 -0
  760. package/node_modules/three/examples/jsm/postprocessing/FilmPass.js +64 -0
  761. package/node_modules/three/examples/jsm/postprocessing/GTAOPass.js +582 -0
  762. package/node_modules/three/examples/jsm/postprocessing/GlitchPass.js +128 -0
  763. package/node_modules/three/examples/jsm/postprocessing/HalftonePass.js +79 -0
  764. package/node_modules/three/examples/jsm/postprocessing/LUTPass.js +174 -0
  765. package/node_modules/three/examples/jsm/postprocessing/MaskPass.js +104 -0
  766. package/node_modules/three/examples/jsm/postprocessing/OutlinePass.js +654 -0
  767. package/node_modules/three/examples/jsm/postprocessing/OutputPass.js +95 -0
  768. package/node_modules/three/examples/jsm/postprocessing/Pass.js +95 -0
  769. package/node_modules/three/examples/jsm/postprocessing/RenderPass.js +99 -0
  770. package/node_modules/three/examples/jsm/postprocessing/RenderPixelatedPass.js +235 -0
  771. package/node_modules/three/examples/jsm/postprocessing/SAOPass.js +335 -0
  772. package/node_modules/three/examples/jsm/postprocessing/SMAAPass.js +199 -0
  773. package/node_modules/three/examples/jsm/postprocessing/SSAARenderPass.js +228 -0
  774. package/node_modules/three/examples/jsm/postprocessing/SSAOPass.js +420 -0
  775. package/node_modules/three/examples/jsm/postprocessing/SSRPass.js +641 -0
  776. package/node_modules/three/examples/jsm/postprocessing/SavePass.js +79 -0
  777. package/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +77 -0
  778. package/node_modules/three/examples/jsm/postprocessing/TAARenderPass.js +188 -0
  779. package/node_modules/three/examples/jsm/postprocessing/TexturePass.js +67 -0
  780. package/node_modules/three/examples/jsm/postprocessing/UnrealBloomPass.js +415 -0
  781. package/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +215 -0
  782. package/node_modules/three/examples/jsm/renderers/CSS3DRenderer.js +329 -0
  783. package/node_modules/three/examples/jsm/renderers/Projector.js +918 -0
  784. package/node_modules/three/examples/jsm/renderers/SVGRenderer.js +556 -0
  785. package/node_modules/three/examples/jsm/renderers/common/Animation.js +47 -0
  786. package/node_modules/three/examples/jsm/renderers/common/Attributes.js +75 -0
  787. package/node_modules/three/examples/jsm/renderers/common/Backend.js +195 -0
  788. package/node_modules/three/examples/jsm/renderers/common/Background.js +134 -0
  789. package/node_modules/three/examples/jsm/renderers/common/Binding.js +25 -0
  790. package/node_modules/three/examples/jsm/renderers/common/Bindings.js +173 -0
  791. package/node_modules/three/examples/jsm/renderers/common/Buffer.js +38 -0
  792. package/node_modules/three/examples/jsm/renderers/common/BufferUtils.js +33 -0
  793. package/node_modules/three/examples/jsm/renderers/common/ChainMap.js +89 -0
  794. package/node_modules/three/examples/jsm/renderers/common/Color4.js +37 -0
  795. package/node_modules/three/examples/jsm/renderers/common/ComputePipeline.js +17 -0
  796. package/node_modules/three/examples/jsm/renderers/common/Constants.js +14 -0
  797. package/node_modules/three/examples/jsm/renderers/common/CubeRenderTarget.js +65 -0
  798. package/node_modules/three/examples/jsm/renderers/common/DataMap.js +54 -0
  799. package/node_modules/three/examples/jsm/renderers/common/Geometries.js +215 -0
  800. package/node_modules/three/examples/jsm/renderers/common/Info.js +107 -0
  801. package/node_modules/three/examples/jsm/renderers/common/Pipeline.js +13 -0
  802. package/node_modules/three/examples/jsm/renderers/common/Pipelines.js +322 -0
  803. package/node_modules/three/examples/jsm/renderers/common/PostProcessing.js +25 -0
  804. package/node_modules/three/examples/jsm/renderers/common/ProgrammableStage.js +20 -0
  805. package/node_modules/three/examples/jsm/renderers/common/RenderContext.js +41 -0
  806. package/node_modules/three/examples/jsm/renderers/common/RenderContexts.js +74 -0
  807. package/node_modules/three/examples/jsm/renderers/common/RenderList.js +186 -0
  808. package/node_modules/three/examples/jsm/renderers/common/RenderLists.js +38 -0
  809. package/node_modules/three/examples/jsm/renderers/common/RenderObject.js +178 -0
  810. package/node_modules/three/examples/jsm/renderers/common/RenderObjects.js +91 -0
  811. package/node_modules/three/examples/jsm/renderers/common/RenderPipeline.js +16 -0
  812. package/node_modules/three/examples/jsm/renderers/common/Renderer.js +1247 -0
  813. package/node_modules/three/examples/jsm/renderers/common/SampledTexture.js +83 -0
  814. package/node_modules/three/examples/jsm/renderers/common/Sampler.js +18 -0
  815. package/node_modules/three/examples/jsm/renderers/common/StorageBuffer.js +17 -0
  816. package/node_modules/three/examples/jsm/renderers/common/StorageBufferAttribute.js +17 -0
  817. package/node_modules/three/examples/jsm/renderers/common/StorageTexture.js +20 -0
  818. package/node_modules/three/examples/jsm/renderers/common/Textures.js +354 -0
  819. package/node_modules/three/examples/jsm/renderers/common/Uniform.js +140 -0
  820. package/node_modules/three/examples/jsm/renderers/common/UniformBuffer.js +15 -0
  821. package/node_modules/three/examples/jsm/renderers/common/UniformsGroup.js +299 -0
  822. package/node_modules/three/examples/jsm/renderers/common/nodes/NodeBuilderState.js +44 -0
  823. package/node_modules/three/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +49 -0
  824. package/node_modules/three/examples/jsm/renderers/common/nodes/NodeSampler.js +15 -0
  825. package/node_modules/three/examples/jsm/renderers/common/nodes/NodeUniform.js +135 -0
  826. package/node_modules/three/examples/jsm/renderers/common/nodes/NodeUniformsGroup.js +44 -0
  827. package/node_modules/three/examples/jsm/renderers/common/nodes/Nodes.js +495 -0
  828. package/node_modules/three/examples/jsm/renderers/webgl/WebGLBackend.js +1362 -0
  829. package/node_modules/three/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +679 -0
  830. package/node_modules/three/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +252 -0
  831. package/node_modules/three/examples/jsm/renderers/webgl/utils/WebGLCapabilities.js +36 -0
  832. package/node_modules/three/examples/jsm/renderers/webgl/utils/WebGLConstants.js +11 -0
  833. package/node_modules/three/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +36 -0
  834. package/node_modules/three/examples/jsm/renderers/webgl/utils/WebGLState.js +738 -0
  835. package/node_modules/three/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +647 -0
  836. package/node_modules/three/examples/jsm/renderers/webgl/utils/WebGLUtils.js +284 -0
  837. package/node_modules/three/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +320 -0
  838. package/node_modules/three/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +26 -0
  839. package/node_modules/three/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +794 -0
  840. package/node_modules/three/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +51 -0
  841. package/node_modules/three/examples/jsm/renderers/webgpu/WebGPUBackend.js +1321 -0
  842. package/node_modules/three/examples/jsm/renderers/webgpu/WebGPURenderer.js +53 -0
  843. package/node_modules/three/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +1103 -0
  844. package/node_modules/three/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +104 -0
  845. package/node_modules/three/examples/jsm/renderers/webgpu/nodes/WGSLNodeParser.js +14 -0
  846. package/node_modules/three/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +287 -0
  847. package/node_modules/three/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +244 -0
  848. package/node_modules/three/examples/jsm/renderers/webgpu/utils/WebGPUConstants.js +324 -0
  849. package/node_modules/three/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +591 -0
  850. package/node_modules/three/examples/jsm/renderers/webgpu/utils/WebGPUTexturePassUtils.js +285 -0
  851. package/node_modules/three/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +1040 -0
  852. package/node_modules/three/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +93 -0
  853. package/node_modules/three/examples/jsm/shaders/ACESFilmicToneMappingShader.js +89 -0
  854. package/node_modules/three/examples/jsm/shaders/AfterimageShader.js +58 -0
  855. package/node_modules/three/examples/jsm/shaders/BasicShader.js +29 -0
  856. package/node_modules/three/examples/jsm/shaders/BleachBypassShader.js +62 -0
  857. package/node_modules/three/examples/jsm/shaders/BlendShader.js +49 -0
  858. package/node_modules/three/examples/jsm/shaders/BokehShader.js +145 -0
  859. package/node_modules/three/examples/jsm/shaders/BokehShader2.js +397 -0
  860. package/node_modules/three/examples/jsm/shaders/BrightnessContrastShader.js +56 -0
  861. package/node_modules/three/examples/jsm/shaders/ColorCorrectionShader.js +52 -0
  862. package/node_modules/three/examples/jsm/shaders/ColorifyShader.js +51 -0
  863. package/node_modules/three/examples/jsm/shaders/ConvolutionShader.js +103 -0
  864. package/node_modules/three/examples/jsm/shaders/CopyShader.js +45 -0
  865. package/node_modules/three/examples/jsm/shaders/DOFMipMapShader.js +56 -0
  866. package/node_modules/three/examples/jsm/shaders/DepthLimitedBlurShader.js +171 -0
  867. package/node_modules/three/examples/jsm/shaders/DigitalGlitch.js +101 -0
  868. package/node_modules/three/examples/jsm/shaders/DotScreenShader.js +70 -0
  869. package/node_modules/three/examples/jsm/shaders/ExposureShader.js +44 -0
  870. package/node_modules/three/examples/jsm/shaders/FXAAShader.js +288 -0
  871. package/node_modules/three/examples/jsm/shaders/FilmShader.js +59 -0
  872. package/node_modules/three/examples/jsm/shaders/FocusShader.js +89 -0
  873. package/node_modules/three/examples/jsm/shaders/FreiChenShader.js +96 -0
  874. package/node_modules/three/examples/jsm/shaders/GTAOShader.js +424 -0
  875. package/node_modules/three/examples/jsm/shaders/GammaCorrectionShader.js +43 -0
  876. package/node_modules/three/examples/jsm/shaders/GodRaysShader.js +321 -0
  877. package/node_modules/three/examples/jsm/shaders/HalftoneShader.js +312 -0
  878. package/node_modules/three/examples/jsm/shaders/HorizontalBlurShader.js +59 -0
  879. package/node_modules/three/examples/jsm/shaders/HorizontalTiltShiftShader.js +63 -0
  880. package/node_modules/three/examples/jsm/shaders/HueSaturationShader.js +67 -0
  881. package/node_modules/three/examples/jsm/shaders/KaleidoShader.js +58 -0
  882. package/node_modules/three/examples/jsm/shaders/LuminosityHighPassShader.js +66 -0
  883. package/node_modules/three/examples/jsm/shaders/LuminosityShader.js +48 -0
  884. package/node_modules/three/examples/jsm/shaders/MMDToonShader.js +134 -0
  885. package/node_modules/three/examples/jsm/shaders/MirrorShader.js +56 -0
  886. package/node_modules/three/examples/jsm/shaders/NormalMapShader.js +55 -0
  887. package/node_modules/three/examples/jsm/shaders/OutputShader.js +81 -0
  888. package/node_modules/three/examples/jsm/shaders/PoissonDenoiseShader.js +226 -0
  889. package/node_modules/three/examples/jsm/shaders/RGBShiftShader.js +54 -0
  890. package/node_modules/three/examples/jsm/shaders/SAOShader.js +179 -0
  891. package/node_modules/three/examples/jsm/shaders/SMAAShader.js +466 -0
  892. package/node_modules/three/examples/jsm/shaders/SSAOShader.js +300 -0
  893. package/node_modules/three/examples/jsm/shaders/SSRShader.js +370 -0
  894. package/node_modules/three/examples/jsm/shaders/SepiaShader.js +52 -0
  895. package/node_modules/three/examples/jsm/shaders/SobelOperatorShader.js +92 -0
  896. package/node_modules/three/examples/jsm/shaders/SubsurfaceScatteringShader.js +90 -0
  897. package/node_modules/three/examples/jsm/shaders/TechnicolorShader.js +45 -0
  898. package/node_modules/three/examples/jsm/shaders/ToonShader.js +326 -0
  899. package/node_modules/three/examples/jsm/shaders/TriangleBlurShader.js +74 -0
  900. package/node_modules/three/examples/jsm/shaders/UnpackDepthRGBAShader.js +47 -0
  901. package/node_modules/three/examples/jsm/shaders/VelocityShader.js +130 -0
  902. package/node_modules/three/examples/jsm/shaders/VerticalBlurShader.js +59 -0
  903. package/node_modules/three/examples/jsm/shaders/VerticalTiltShiftShader.js +63 -0
  904. package/node_modules/three/examples/jsm/shaders/VignetteShader.js +51 -0
  905. package/node_modules/three/examples/jsm/shaders/VolumeShader.js +289 -0
  906. package/node_modules/three/examples/jsm/shaders/WaterRefractionShader.js +95 -0
  907. package/node_modules/three/examples/jsm/textures/FlakesTexture.js +40 -0
  908. package/node_modules/three/examples/jsm/transpiler/AST.js +270 -0
  909. package/node_modules/three/examples/jsm/transpiler/GLSLDecoder.js +941 -0
  910. package/node_modules/three/examples/jsm/transpiler/ShaderToyDecoder.js +49 -0
  911. package/node_modules/three/examples/jsm/transpiler/TSLEncoder.js +715 -0
  912. package/node_modules/three/examples/jsm/transpiler/Transpiler.js +18 -0
  913. package/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +1371 -0
  914. package/node_modules/three/examples/jsm/utils/CameraUtils.js +73 -0
  915. package/node_modules/three/examples/jsm/utils/GPUStatsPanel.js +128 -0
  916. package/node_modules/three/examples/jsm/utils/GeometryCompressionUtils.js +639 -0
  917. package/node_modules/three/examples/jsm/utils/GeometryUtils.js +221 -0
  918. package/node_modules/three/examples/jsm/utils/LDrawUtils.js +202 -0
  919. package/node_modules/three/examples/jsm/utils/PackedPhongMaterial.js +178 -0
  920. package/node_modules/three/examples/jsm/utils/SceneUtils.js +254 -0
  921. package/node_modules/three/examples/jsm/utils/ShadowMapViewer.js +210 -0
  922. package/node_modules/three/examples/jsm/utils/SkeletonUtils.js +413 -0
  923. package/node_modules/three/examples/jsm/utils/SortUtils.js +160 -0
  924. package/node_modules/three/examples/jsm/utils/TextureUtils.js +98 -0
  925. package/node_modules/three/examples/jsm/utils/UVsDebug.js +165 -0
  926. package/node_modules/three/examples/jsm/utils/WorkerPool.js +102 -0
  927. package/node_modules/three/examples/jsm/webxr/ARButton.js +232 -0
  928. package/node_modules/three/examples/jsm/webxr/OculusHandModel.js +109 -0
  929. package/node_modules/three/examples/jsm/webxr/OculusHandPointerModel.js +413 -0
  930. package/node_modules/three/examples/jsm/webxr/Text2D.js +38 -0
  931. package/node_modules/three/examples/jsm/webxr/VRButton.js +225 -0
  932. package/node_modules/three/examples/jsm/webxr/XRButton.js +224 -0
  933. package/node_modules/three/examples/jsm/webxr/XRControllerModelFactory.js +304 -0
  934. package/node_modules/three/examples/jsm/webxr/XREstimatedLight.js +223 -0
  935. package/node_modules/three/examples/jsm/webxr/XRHandMeshModel.js +114 -0
  936. package/node_modules/three/examples/jsm/webxr/XRHandModelFactory.js +105 -0
  937. package/node_modules/three/examples/jsm/webxr/XRHandPrimitiveModel.js +103 -0
  938. package/node_modules/three/examples/jsm/webxr/XRPlanes.js +100 -0
  939. package/node_modules/three/package.json +124 -0
  940. package/node_modules/three/src/Three.Legacy.js +1 -0
  941. package/node_modules/three/src/Three.js +184 -0
  942. package/node_modules/three/src/animation/AnimationAction.js +700 -0
  943. package/node_modules/three/src/animation/AnimationClip.js +473 -0
  944. package/node_modules/three/src/animation/AnimationMixer.js +770 -0
  945. package/node_modules/three/src/animation/AnimationObjectGroup.js +387 -0
  946. package/node_modules/three/src/animation/AnimationUtils.js +356 -0
  947. package/node_modules/three/src/animation/KeyframeTrack.js +462 -0
  948. package/node_modules/three/src/animation/PropertyBinding.js +719 -0
  949. package/node_modules/three/src/animation/PropertyMixer.js +318 -0
  950. package/node_modules/three/src/animation/tracks/BooleanKeyframeTrack.js +19 -0
  951. package/node_modules/three/src/animation/tracks/ColorKeyframeTrack.js +15 -0
  952. package/node_modules/three/src/animation/tracks/NumberKeyframeTrack.js +12 -0
  953. package/node_modules/three/src/animation/tracks/QuaternionKeyframeTrack.js +23 -0
  954. package/node_modules/three/src/animation/tracks/StringKeyframeTrack.js +15 -0
  955. package/node_modules/three/src/animation/tracks/VectorKeyframeTrack.js +12 -0
  956. package/node_modules/three/src/audio/Audio.js +400 -0
  957. package/node_modules/three/src/audio/AudioAnalyser.js +40 -0
  958. package/node_modules/three/src/audio/AudioContext.js +25 -0
  959. package/node_modules/three/src/audio/AudioListener.js +137 -0
  960. package/node_modules/three/src/audio/PositionalAudio.js +146 -0
  961. package/node_modules/three/src/cameras/ArrayCamera.js +17 -0
  962. package/node_modules/three/src/cameras/Camera.js +69 -0
  963. package/node_modules/three/src/cameras/CubeCamera.js +173 -0
  964. package/node_modules/three/src/cameras/OrthographicCamera.js +136 -0
  965. package/node_modules/three/src/cameras/PerspectiveCamera.js +268 -0
  966. package/node_modules/three/src/cameras/StereoCamera.js +100 -0
  967. package/node_modules/three/src/constants.js +216 -0
  968. package/node_modules/three/src/core/BufferAttribute.js +650 -0
  969. package/node_modules/three/src/core/BufferGeometry.js +1079 -0
  970. package/node_modules/three/src/core/Clock.js +74 -0
  971. package/node_modules/three/src/core/EventDispatcher.js +87 -0
  972. package/node_modules/three/src/core/GLBufferAttribute.js +60 -0
  973. package/node_modules/three/src/core/InstancedBufferAttribute.js +39 -0
  974. package/node_modules/three/src/core/InstancedBufferGeometry.js +40 -0
  975. package/node_modules/three/src/core/InstancedInterleavedBuffer.js +48 -0
  976. package/node_modules/three/src/core/InterleavedBuffer.js +166 -0
  977. package/node_modules/three/src/core/InterleavedBufferAttribute.js +351 -0
  978. package/node_modules/three/src/core/Layers.js +60 -0
  979. package/node_modules/three/src/core/Object3D.js +1008 -0
  980. package/node_modules/three/src/core/Raycaster.js +110 -0
  981. package/node_modules/three/src/core/RenderTarget.js +131 -0
  982. package/node_modules/three/src/core/Uniform.js +17 -0
  983. package/node_modules/three/src/core/UniformsGroup.js +98 -0
  984. package/node_modules/three/src/extras/DataUtils.js +176 -0
  985. package/node_modules/three/src/extras/Earcut.js +789 -0
  986. package/node_modules/three/src/extras/ImageUtils.js +129 -0
  987. package/node_modules/three/src/extras/PMREMGenerator.js +906 -0
  988. package/node_modules/three/src/extras/ShapeUtils.js +92 -0
  989. package/node_modules/three/src/extras/core/Curve.js +416 -0
  990. package/node_modules/three/src/extras/core/CurvePath.js +255 -0
  991. package/node_modules/three/src/extras/core/Interpolations.js +79 -0
  992. package/node_modules/three/src/extras/core/Path.js +196 -0
  993. package/node_modules/three/src/extras/core/Shape.js +102 -0
  994. package/node_modules/three/src/extras/core/ShapePath.js +291 -0
  995. package/node_modules/three/src/extras/curves/ArcCurve.js +17 -0
  996. package/node_modules/three/src/extras/curves/CatmullRomCurve3.js +255 -0
  997. package/node_modules/three/src/extras/curves/CubicBezierCurve.js +78 -0
  998. package/node_modules/three/src/extras/curves/CubicBezierCurve3.js +79 -0
  999. package/node_modules/three/src/extras/curves/Curves.js +10 -0
  1000. package/node_modules/three/src/extras/curves/EllipseCurve.js +156 -0
  1001. package/node_modules/three/src/extras/curves/LineCurve.js +92 -0
  1002. package/node_modules/three/src/extras/curves/LineCurve3.js +92 -0
  1003. package/node_modules/three/src/extras/curves/QuadraticBezierCurve.js +74 -0
  1004. package/node_modules/three/src/extras/curves/QuadraticBezierCurve3.js +75 -0
  1005. package/node_modules/three/src/extras/curves/SplineCurve.js +97 -0
  1006. package/node_modules/three/src/geometries/BoxGeometry.js +180 -0
  1007. package/node_modules/three/src/geometries/CapsuleGeometry.js +33 -0
  1008. package/node_modules/three/src/geometries/CircleGeometry.js +101 -0
  1009. package/node_modules/three/src/geometries/ConeGeometry.js +31 -0
  1010. package/node_modules/three/src/geometries/CylinderGeometry.js +286 -0
  1011. package/node_modules/three/src/geometries/DodecahedronGeometry.js +66 -0
  1012. package/node_modules/three/src/geometries/EdgesGeometry.js +152 -0
  1013. package/node_modules/three/src/geometries/ExtrudeGeometry.js +814 -0
  1014. package/node_modules/three/src/geometries/Geometries.js +21 -0
  1015. package/node_modules/three/src/geometries/IcosahedronGeometry.js +42 -0
  1016. package/node_modules/three/src/geometries/LatheGeometry.js +189 -0
  1017. package/node_modules/three/src/geometries/OctahedronGeometry.js +37 -0
  1018. package/node_modules/three/src/geometries/PlaneGeometry.js +98 -0
  1019. package/node_modules/three/src/geometries/PolyhedronGeometry.js +319 -0
  1020. package/node_modules/three/src/geometries/RingGeometry.js +128 -0
  1021. package/node_modules/three/src/geometries/ShapeGeometry.js +195 -0
  1022. package/node_modules/three/src/geometries/SphereGeometry.js +137 -0
  1023. package/node_modules/three/src/geometries/TetrahedronGeometry.js +34 -0
  1024. package/node_modules/three/src/geometries/TorusGeometry.js +120 -0
  1025. package/node_modules/three/src/geometries/TorusKnotGeometry.js +167 -0
  1026. package/node_modules/three/src/geometries/TubeGeometry.js +203 -0
  1027. package/node_modules/three/src/geometries/WireframeGeometry.js +147 -0
  1028. package/node_modules/three/src/helpers/ArrowHelper.js +114 -0
  1029. package/node_modules/three/src/helpers/AxesHelper.js +68 -0
  1030. package/node_modules/three/src/helpers/Box3Helper.js +55 -0
  1031. package/node_modules/three/src/helpers/BoxHelper.js +113 -0
  1032. package/node_modules/three/src/helpers/CameraHelper.js +269 -0
  1033. package/node_modules/three/src/helpers/DirectionalLightHelper.js +93 -0
  1034. package/node_modules/three/src/helpers/GridHelper.js +56 -0
  1035. package/node_modules/three/src/helpers/HemisphereLightHelper.js +88 -0
  1036. package/node_modules/three/src/helpers/PlaneHelper.js +63 -0
  1037. package/node_modules/three/src/helpers/PointLightHelper.js +92 -0
  1038. package/node_modules/three/src/helpers/PolarGridHelper.js +96 -0
  1039. package/node_modules/three/src/helpers/SkeletonHelper.js +128 -0
  1040. package/node_modules/three/src/helpers/SpotLightHelper.js +94 -0
  1041. package/node_modules/three/src/lights/AmbientLight.js +17 -0
  1042. package/node_modules/three/src/lights/DirectionalLight.js +43 -0
  1043. package/node_modules/three/src/lights/DirectionalLightShadow.js +16 -0
  1044. package/node_modules/three/src/lights/HemisphereLight.js +34 -0
  1045. package/node_modules/three/src/lights/Light.js +58 -0
  1046. package/node_modules/three/src/lights/LightProbe.js +47 -0
  1047. package/node_modules/three/src/lights/LightShadow.js +147 -0
  1048. package/node_modules/three/src/lights/PointLight.js +57 -0
  1049. package/node_modules/three/src/lights/PointLightShadow.js +96 -0
  1050. package/node_modules/three/src/lights/RectAreaLight.js +56 -0
  1051. package/node_modules/three/src/lights/SpotLight.js +71 -0
  1052. package/node_modules/three/src/lights/SpotLightShadow.js +50 -0
  1053. package/node_modules/three/src/loaders/AnimationLoader.js +66 -0
  1054. package/node_modules/three/src/loaders/AudioLoader.js +66 -0
  1055. package/node_modules/three/src/loaders/BufferGeometryLoader.js +217 -0
  1056. package/node_modules/three/src/loaders/Cache.js +42 -0
  1057. package/node_modules/three/src/loaders/CompressedTextureLoader.js +134 -0
  1058. package/node_modules/three/src/loaders/CubeTextureLoader.js +58 -0
  1059. package/node_modules/three/src/loaders/DataTextureLoader.js +135 -0
  1060. package/node_modules/three/src/loaders/FileLoader.js +284 -0
  1061. package/node_modules/three/src/loaders/ImageBitmapLoader.js +123 -0
  1062. package/node_modules/three/src/loaders/ImageLoader.js +91 -0
  1063. package/node_modules/three/src/loaders/Loader.js +72 -0
  1064. package/node_modules/three/src/loaders/LoaderUtils.js +75 -0
  1065. package/node_modules/three/src/loaders/LoadingManager.js +142 -0
  1066. package/node_modules/three/src/loaders/MaterialLoader.js +372 -0
  1067. package/node_modules/three/src/loaders/ObjectLoader.js +1148 -0
  1068. package/node_modules/three/src/loaders/TextureLoader.js +41 -0
  1069. package/node_modules/three/src/materials/LineBasicMaterial.js +49 -0
  1070. package/node_modules/three/src/materials/LineDashedMaterial.js +35 -0
  1071. package/node_modules/three/src/materials/Material.js +522 -0
  1072. package/node_modules/three/src/materials/Materials.js +39 -0
  1073. package/node_modules/three/src/materials/MeshBasicMaterial.js +81 -0
  1074. package/node_modules/three/src/materials/MeshDepthMaterial.js +54 -0
  1075. package/node_modules/three/src/materials/MeshDistanceMaterial.js +43 -0
  1076. package/node_modules/three/src/materials/MeshLambertMaterial.js +116 -0
  1077. package/node_modules/three/src/materials/MeshMatcapMaterial.js +81 -0
  1078. package/node_modules/three/src/materials/MeshNormalMaterial.js +61 -0
  1079. package/node_modules/three/src/materials/MeshPhongMaterial.js +120 -0
  1080. package/node_modules/three/src/materials/MeshPhysicalMaterial.js +224 -0
  1081. package/node_modules/three/src/materials/MeshStandardMaterial.js +124 -0
  1082. package/node_modules/three/src/materials/MeshToonMaterial.js +102 -0
  1083. package/node_modules/three/src/materials/PointsMaterial.js +50 -0
  1084. package/node_modules/three/src/materials/RawShaderMaterial.js +17 -0
  1085. package/node_modules/three/src/materials/ShaderMaterial.js +189 -0
  1086. package/node_modules/three/src/materials/ShadowMaterial.js +37 -0
  1087. package/node_modules/three/src/materials/SpriteMaterial.js +54 -0
  1088. package/node_modules/three/src/math/Box2.js +204 -0
  1089. package/node_modules/three/src/math/Box3.js +534 -0
  1090. package/node_modules/three/src/math/Color.js +623 -0
  1091. package/node_modules/three/src/math/ColorManagement.js +139 -0
  1092. package/node_modules/three/src/math/Cylindrical.js +61 -0
  1093. package/node_modules/three/src/math/Euler.js +315 -0
  1094. package/node_modules/three/src/math/Frustum.js +186 -0
  1095. package/node_modules/three/src/math/Interpolant.js +241 -0
  1096. package/node_modules/three/src/math/Line3.js +115 -0
  1097. package/node_modules/three/src/math/MathUtils.js +363 -0
  1098. package/node_modules/three/src/math/Matrix3.js +388 -0
  1099. package/node_modules/three/src/math/Matrix4.js +915 -0
  1100. package/node_modules/three/src/math/Plane.js +205 -0
  1101. package/node_modules/three/src/math/Quaternion.js +685 -0
  1102. package/node_modules/three/src/math/Ray.js +493 -0
  1103. package/node_modules/three/src/math/Sphere.js +245 -0
  1104. package/node_modules/three/src/math/Spherical.js +86 -0
  1105. package/node_modules/three/src/math/SphericalHarmonics3.js +243 -0
  1106. package/node_modules/three/src/math/Triangle.js +311 -0
  1107. package/node_modules/three/src/math/Vector2.js +480 -0
  1108. package/node_modules/three/src/math/Vector3.js +724 -0
  1109. package/node_modules/three/src/math/Vector4.js +644 -0
  1110. package/node_modules/three/src/math/interpolants/CubicInterpolant.js +150 -0
  1111. package/node_modules/three/src/math/interpolants/DiscreteInterpolant.js +26 -0
  1112. package/node_modules/three/src/math/interpolants/LinearInterpolant.js +38 -0
  1113. package/node_modules/three/src/math/interpolants/QuaternionLinearInterpolant.js +39 -0
  1114. package/node_modules/three/src/objects/BatchedMesh.js +1019 -0
  1115. package/node_modules/three/src/objects/Bone.js +17 -0
  1116. package/node_modules/three/src/objects/Group.js +17 -0
  1117. package/node_modules/three/src/objects/InstancedMesh.js +214 -0
  1118. package/node_modules/three/src/objects/LOD.js +214 -0
  1119. package/node_modules/three/src/objects/Line.js +222 -0
  1120. package/node_modules/three/src/objects/LineLoop.js +17 -0
  1121. package/node_modules/three/src/objects/LineSegments.js +55 -0
  1122. package/node_modules/three/src/objects/Mesh.js +429 -0
  1123. package/node_modules/three/src/objects/Points.js +166 -0
  1124. package/node_modules/three/src/objects/Skeleton.js +277 -0
  1125. package/node_modules/three/src/objects/SkinnedMesh.js +257 -0
  1126. package/node_modules/three/src/objects/Sprite.js +181 -0
  1127. package/node_modules/three/src/renderers/WebGL1Renderer.js +7 -0
  1128. package/node_modules/three/src/renderers/WebGL3DRenderTarget.js +22 -0
  1129. package/node_modules/three/src/renderers/WebGLArrayRenderTarget.js +22 -0
  1130. package/node_modules/three/src/renderers/WebGLCubeRenderTarget.js +155 -0
  1131. package/node_modules/three/src/renderers/WebGLMultipleRenderTargets.js +82 -0
  1132. package/node_modules/three/src/renderers/WebGLRenderTarget.js +15 -0
  1133. package/node_modules/three/src/renderers/WebGLRenderer.js +2610 -0
  1134. package/node_modules/three/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
  1135. package/node_modules/three/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
  1136. package/node_modules/three/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -0
  1137. package/node_modules/three/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -0
  1138. package/node_modules/three/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -0
  1139. package/node_modules/three/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -0
  1140. package/node_modules/three/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -0
  1141. package/node_modules/three/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -0
  1142. package/node_modules/three/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +19 -0
  1143. package/node_modules/three/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
  1144. package/node_modules/three/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -0
  1145. package/node_modules/three/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -0
  1146. package/node_modules/three/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -0
  1147. package/node_modules/three/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -0
  1148. package/node_modules/three/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -0
  1149. package/node_modules/three/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -0
  1150. package/node_modules/three/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -0
  1151. package/node_modules/three/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -0
  1152. package/node_modules/three/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -0
  1153. package/node_modules/three/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -0
  1154. package/node_modules/three/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -0
  1155. package/node_modules/three/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +11 -0
  1156. package/node_modules/three/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +11 -0
  1157. package/node_modules/three/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +11 -0
  1158. package/node_modules/three/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +23 -0
  1159. package/node_modules/three/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -0
  1160. package/node_modules/three/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +44 -0
  1161. package/node_modules/three/src/renderers/shaders/ShaderChunk/common.glsl.js +147 -0
  1162. package/node_modules/three/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +186 -0
  1163. package/node_modules/three/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -0
  1164. package/node_modules/three/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -0
  1165. package/node_modules/three/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +63 -0
  1166. package/node_modules/three/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -0
  1167. package/node_modules/three/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -0
  1168. package/node_modules/three/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -0
  1169. package/node_modules/three/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -0
  1170. package/node_modules/three/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +9 -0
  1171. package/node_modules/three/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -0
  1172. package/node_modules/three/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +14 -0
  1173. package/node_modules/three/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +62 -0
  1174. package/node_modules/three/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -0
  1175. package/node_modules/three/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -0
  1176. package/node_modules/three/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +69 -0
  1177. package/node_modules/three/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -0
  1178. package/node_modules/three/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -0
  1179. package/node_modules/three/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -0
  1180. package/node_modules/three/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -0
  1181. package/node_modules/three/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -0
  1182. package/node_modules/three/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -0
  1183. package/node_modules/three/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -0
  1184. package/node_modules/three/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
  1185. package/node_modules/three/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +10 -0
  1186. package/node_modules/three/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -0
  1187. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +202 -0
  1188. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +13 -0
  1189. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +40 -0
  1190. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
  1191. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -0
  1192. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +228 -0
  1193. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -0
  1194. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -0
  1195. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +151 -0
  1196. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +562 -0
  1197. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -0
  1198. package/node_modules/three/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -0
  1199. package/node_modules/three/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -0
  1200. package/node_modules/three/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -0
  1201. package/node_modules/three/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +16 -0
  1202. package/node_modules/three/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +22 -0
  1203. package/node_modules/three/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +17 -0
  1204. package/node_modules/three/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +7 -0
  1205. package/node_modules/three/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -0
  1206. package/node_modules/three/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -0
  1207. package/node_modules/three/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -0
  1208. package/node_modules/three/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -0
  1209. package/node_modules/three/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -0
  1210. package/node_modules/three/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +27 -0
  1211. package/node_modules/three/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +38 -0
  1212. package/node_modules/three/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +36 -0
  1213. package/node_modules/three/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -0
  1214. package/node_modules/three/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +33 -0
  1215. package/node_modules/three/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -0
  1216. package/node_modules/three/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -0
  1217. package/node_modules/three/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +14 -0
  1218. package/node_modules/three/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -0
  1219. package/node_modules/three/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -0
  1220. package/node_modules/three/src/renderers/shaders/ShaderChunk/packing.glsl.js +68 -0
  1221. package/node_modules/three/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +8 -0
  1222. package/node_modules/three/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -0
  1223. package/node_modules/three/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -0
  1224. package/node_modules/three/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -0
  1225. package/node_modules/three/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +314 -0
  1226. package/node_modules/three/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +68 -0
  1227. package/node_modules/three/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +68 -0
  1228. package/node_modules/three/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +66 -0
  1229. package/node_modules/three/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -0
  1230. package/node_modules/three/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -0
  1231. package/node_modules/three/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -0
  1232. package/node_modules/three/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -0
  1233. package/node_modules/three/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -0
  1234. package/node_modules/three/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -0
  1235. package/node_modules/three/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -0
  1236. package/node_modules/three/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +169 -0
  1237. package/node_modules/three/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -0
  1238. package/node_modules/three/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +201 -0
  1239. package/node_modules/three/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +119 -0
  1240. package/node_modules/three/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +145 -0
  1241. package/node_modules/three/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +122 -0
  1242. package/node_modules/three/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -0
  1243. package/node_modules/three/src/renderers/shaders/ShaderChunk.js +270 -0
  1244. package/node_modules/three/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
  1245. package/node_modules/three/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +62 -0
  1246. package/node_modules/three/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -0
  1247. package/node_modules/three/src/renderers/shaders/ShaderLib/depth.glsl.js +95 -0
  1248. package/node_modules/three/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +76 -0
  1249. package/node_modules/three/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -0
  1250. package/node_modules/three/src/renderers/shaders/ShaderLib/linedashed.glsl.js +75 -0
  1251. package/node_modules/three/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +115 -0
  1252. package/node_modules/three/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +124 -0
  1253. package/node_modules/three/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +111 -0
  1254. package/node_modules/three/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +86 -0
  1255. package/node_modules/three/src/renderers/shaders/ShaderLib/meshphong.glsl.js +126 -0
  1256. package/node_modules/three/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +224 -0
  1257. package/node_modules/three/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +118 -0
  1258. package/node_modules/three/src/renderers/shaders/ShaderLib/points.glsl.js +86 -0
  1259. package/node_modules/three/src/renderers/shaders/ShaderLib/shadow.glsl.js +57 -0
  1260. package/node_modules/three/src/renderers/shaders/ShaderLib/sprite.glsl.js +81 -0
  1261. package/node_modules/three/src/renderers/shaders/ShaderLib/vsm.glsl.js +53 -0
  1262. package/node_modules/three/src/renderers/shaders/ShaderLib.js +359 -0
  1263. package/node_modules/three/src/renderers/shaders/UniformsLib.js +230 -0
  1264. package/node_modules/three/src/renderers/shaders/UniformsUtils.js +104 -0
  1265. package/node_modules/three/src/renderers/webgl/WebGLAnimation.js +53 -0
  1266. package/node_modules/three/src/renderers/webgl/WebGLAttributes.js +229 -0
  1267. package/node_modules/three/src/renderers/webgl/WebGLBackground.js +239 -0
  1268. package/node_modules/three/src/renderers/webgl/WebGLBindingStates.js +631 -0
  1269. package/node_modules/three/src/renderers/webgl/WebGLBufferRenderer.js +92 -0
  1270. package/node_modules/three/src/renderers/webgl/WebGLCapabilities.js +120 -0
  1271. package/node_modules/three/src/renderers/webgl/WebGLClipping.js +171 -0
  1272. package/node_modules/three/src/renderers/webgl/WebGLCubeMaps.js +99 -0
  1273. package/node_modules/three/src/renderers/webgl/WebGLCubeUVMaps.js +130 -0
  1274. package/node_modules/three/src/renderers/webgl/WebGLExtensions.js +97 -0
  1275. package/node_modules/three/src/renderers/webgl/WebGLGeometries.js +211 -0
  1276. package/node_modules/three/src/renderers/webgl/WebGLIndexedBufferRenderer.js +102 -0
  1277. package/node_modules/three/src/renderers/webgl/WebGLInfo.js +71 -0
  1278. package/node_modules/three/src/renderers/webgl/WebGLLights.js +590 -0
  1279. package/node_modules/three/src/renderers/webgl/WebGLMaterials.js +567 -0
  1280. package/node_modules/three/src/renderers/webgl/WebGLMorphtargets.js +300 -0
  1281. package/node_modules/three/src/renderers/webgl/WebGLObjects.js +92 -0
  1282. package/node_modules/three/src/renderers/webgl/WebGLProgram.js +1109 -0
  1283. package/node_modules/three/src/renderers/webgl/WebGLPrograms.js +661 -0
  1284. package/node_modules/three/src/renderers/webgl/WebGLProperties.js +48 -0
  1285. package/node_modules/three/src/renderers/webgl/WebGLRenderLists.js +238 -0
  1286. package/node_modules/three/src/renderers/webgl/WebGLRenderStates.js +107 -0
  1287. package/node_modules/three/src/renderers/webgl/WebGLShader.js +12 -0
  1288. package/node_modules/three/src/renderers/webgl/WebGLShaderCache.js +124 -0
  1289. package/node_modules/three/src/renderers/webgl/WebGLShadowMap.js +424 -0
  1290. package/node_modules/three/src/renderers/webgl/WebGLState.js +1328 -0
  1291. package/node_modules/three/src/renderers/webgl/WebGLTextures.js +2183 -0
  1292. package/node_modules/three/src/renderers/webgl/WebGLUniforms.js +1156 -0
  1293. package/node_modules/three/src/renderers/webgl/WebGLUniformsGroups.js +392 -0
  1294. package/node_modules/three/src/renderers/webgl/WebGLUtils.js +283 -0
  1295. package/node_modules/three/src/renderers/webxr/WebXRController.js +343 -0
  1296. package/node_modules/three/src/renderers/webxr/WebXRDepthSensing.js +105 -0
  1297. package/node_modules/three/src/renderers/webxr/WebXRManager.js +824 -0
  1298. package/node_modules/three/src/scenes/Fog.js +38 -0
  1299. package/node_modules/three/src/scenes/FogExp2.js +35 -0
  1300. package/node_modules/three/src/scenes/Scene.js +63 -0
  1301. package/node_modules/three/src/textures/CanvasTexture.js +17 -0
  1302. package/node_modules/three/src/textures/CompressedArrayTexture.js +18 -0
  1303. package/node_modules/three/src/textures/CompressedCubeTexture.js +19 -0
  1304. package/node_modules/three/src/textures/CompressedTexture.js +28 -0
  1305. package/node_modules/three/src/textures/CubeTexture.js +33 -0
  1306. package/node_modules/three/src/textures/Data3DTexture.js +35 -0
  1307. package/node_modules/three/src/textures/DataArrayTexture.js +27 -0
  1308. package/node_modules/three/src/textures/DataTexture.js +22 -0
  1309. package/node_modules/three/src/textures/DepthTexture.js +58 -0
  1310. package/node_modules/three/src/textures/FramebufferTexture.js +23 -0
  1311. package/node_modules/three/src/textures/Source.js +128 -0
  1312. package/node_modules/three/src/textures/Texture.js +338 -0
  1313. package/node_modules/three/src/textures/VideoTexture.js +55 -0
  1314. package/node_modules/three/src/utils.js +91 -0
  1315. package/package.json +63 -0
@@ -0,0 +1,3224 @@
1
+ import {
2
+ GridHelper,
3
+ EllipseCurve,
4
+ BufferGeometry,
5
+ Line,
6
+ LineBasicMaterial,
7
+ Raycaster,
8
+ Group,
9
+ Box3,
10
+ Sphere,
11
+ Quaternion,
12
+ Vector2,
13
+ Vector3,
14
+ Matrix4,
15
+ MathUtils,
16
+ EventDispatcher
17
+ } from 'three';
18
+
19
+ //trackball state
20
+ const STATE = {
21
+
22
+ IDLE: Symbol(),
23
+ ROTATE: Symbol(),
24
+ PAN: Symbol(),
25
+ SCALE: Symbol(),
26
+ FOV: Symbol(),
27
+ FOCUS: Symbol(),
28
+ ZROTATE: Symbol(),
29
+ TOUCH_MULTI: Symbol(),
30
+ ANIMATION_FOCUS: Symbol(),
31
+ ANIMATION_ROTATE: Symbol()
32
+
33
+ };
34
+
35
+ const INPUT = {
36
+
37
+ NONE: Symbol(),
38
+ ONE_FINGER: Symbol(),
39
+ ONE_FINGER_SWITCHED: Symbol(),
40
+ TWO_FINGER: Symbol(),
41
+ MULT_FINGER: Symbol(),
42
+ CURSOR: Symbol()
43
+
44
+ };
45
+
46
+ //cursor center coordinates
47
+ const _center = {
48
+
49
+ x: 0,
50
+ y: 0
51
+
52
+ };
53
+
54
+ //transformation matrices for gizmos and camera
55
+ const _transformation = {
56
+
57
+ camera: new Matrix4(),
58
+ gizmos: new Matrix4()
59
+
60
+ };
61
+
62
+ //events
63
+ const _changeEvent = { type: 'change' };
64
+ const _startEvent = { type: 'start' };
65
+ const _endEvent = { type: 'end' };
66
+
67
+ const _raycaster = new Raycaster();
68
+ const _offset = new Vector3();
69
+
70
+ const _gizmoMatrixStateTemp = new Matrix4();
71
+ const _cameraMatrixStateTemp = new Matrix4();
72
+ const _scalePointTemp = new Vector3();
73
+ /**
74
+ *
75
+ * @param {Camera} camera Virtual camera used in the scene
76
+ * @param {HTMLElement} domElement Renderer's dom element
77
+ * @param {Scene} scene The scene to be rendered
78
+ */
79
+ class ArcballControls extends EventDispatcher {
80
+
81
+ constructor( camera, domElement, scene = null ) {
82
+
83
+ super();
84
+ this.camera = null;
85
+ this.domElement = domElement;
86
+ this.scene = scene;
87
+ this.target = new Vector3();
88
+ this._currentTarget = new Vector3();
89
+ this.radiusFactor = 0.67;
90
+
91
+ this.mouseActions = [];
92
+ this._mouseOp = null;
93
+
94
+
95
+ //global vectors and matrices that are used in some operations to avoid creating new objects every time (e.g. every time cursor moves)
96
+ this._v2_1 = new Vector2();
97
+ this._v3_1 = new Vector3();
98
+ this._v3_2 = new Vector3();
99
+
100
+ this._m4_1 = new Matrix4();
101
+ this._m4_2 = new Matrix4();
102
+
103
+ this._quat = new Quaternion();
104
+
105
+ //transformation matrices
106
+ this._translationMatrix = new Matrix4(); //matrix for translation operation
107
+ this._rotationMatrix = new Matrix4(); //matrix for rotation operation
108
+ this._scaleMatrix = new Matrix4(); //matrix for scaling operation
109
+
110
+ this._rotationAxis = new Vector3(); //axis for rotate operation
111
+
112
+
113
+ //camera state
114
+ this._cameraMatrixState = new Matrix4();
115
+ this._cameraProjectionState = new Matrix4();
116
+
117
+ this._fovState = 1;
118
+ this._upState = new Vector3();
119
+ this._zoomState = 1;
120
+ this._nearPos = 0;
121
+ this._farPos = 0;
122
+
123
+ this._gizmoMatrixState = new Matrix4();
124
+
125
+ //initial values
126
+ this._up0 = new Vector3();
127
+ this._zoom0 = 1;
128
+ this._fov0 = 0;
129
+ this._initialNear = 0;
130
+ this._nearPos0 = 0;
131
+ this._initialFar = 0;
132
+ this._farPos0 = 0;
133
+ this._cameraMatrixState0 = new Matrix4();
134
+ this._gizmoMatrixState0 = new Matrix4();
135
+
136
+ //pointers array
137
+ this._button = - 1;
138
+ this._touchStart = [];
139
+ this._touchCurrent = [];
140
+ this._input = INPUT.NONE;
141
+
142
+ //two fingers touch interaction
143
+ this._switchSensibility = 32; //minimum movement to be performed to fire single pan start after the second finger has been released
144
+ this._startFingerDistance = 0; //distance between two fingers
145
+ this._currentFingerDistance = 0;
146
+ this._startFingerRotation = 0; //amount of rotation performed with two fingers
147
+ this._currentFingerRotation = 0;
148
+
149
+ //double tap
150
+ this._devPxRatio = 0;
151
+ this._downValid = true;
152
+ this._nclicks = 0;
153
+ this._downEvents = [];
154
+ this._downStart = 0; //pointerDown time
155
+ this._clickStart = 0; //first click time
156
+ this._maxDownTime = 250;
157
+ this._maxInterval = 300;
158
+ this._posThreshold = 24;
159
+ this._movementThreshold = 24;
160
+
161
+ //cursor positions
162
+ this._currentCursorPosition = new Vector3();
163
+ this._startCursorPosition = new Vector3();
164
+
165
+ //grid
166
+ this._grid = null; //grid to be visualized during pan operation
167
+ this._gridPosition = new Vector3();
168
+
169
+ //gizmos
170
+ this._gizmos = new Group();
171
+ this._curvePts = 128;
172
+
173
+
174
+ //animations
175
+ this._timeStart = - 1; //initial time
176
+ this._animationId = - 1;
177
+
178
+ //focus animation
179
+ this.focusAnimationTime = 500; //duration of focus animation in ms
180
+
181
+ //rotate animation
182
+ this._timePrev = 0; //time at which previous rotate operation has been detected
183
+ this._timeCurrent = 0; //time at which current rotate operation has been detected
184
+ this._anglePrev = 0; //angle of previous rotation
185
+ this._angleCurrent = 0; //angle of current rotation
186
+ this._cursorPosPrev = new Vector3(); //cursor position when previous rotate operation has been detected
187
+ this._cursorPosCurr = new Vector3();//cursor position when current rotate operation has been detected
188
+ this._wPrev = 0; //angular velocity of the previous rotate operation
189
+ this._wCurr = 0; //angular velocity of the current rotate operation
190
+
191
+
192
+ //parameters
193
+ this.adjustNearFar = false;
194
+ this.scaleFactor = 1.1; //zoom/distance multiplier
195
+ this.dampingFactor = 25;
196
+ this.wMax = 20; //maximum angular velocity allowed
197
+ this.enableAnimations = true; //if animations should be performed
198
+ this.enableGrid = false; //if grid should be showed during pan operation
199
+ this.cursorZoom = false; //if wheel zoom should be cursor centered
200
+ this.minFov = 5;
201
+ this.maxFov = 90;
202
+ this.rotateSpeed = 1;
203
+
204
+ this.enabled = true;
205
+ this.enablePan = true;
206
+ this.enableRotate = true;
207
+ this.enableZoom = true;
208
+ this.enableGizmos = true;
209
+
210
+ this.minDistance = 0;
211
+ this.maxDistance = Infinity;
212
+ this.minZoom = 0;
213
+ this.maxZoom = Infinity;
214
+
215
+ //trackball parameters
216
+ this._tbRadius = 1;
217
+
218
+ //FSA
219
+ this._state = STATE.IDLE;
220
+
221
+ this.setCamera( camera );
222
+
223
+ if ( this.scene != null ) {
224
+
225
+ this.scene.add( this._gizmos );
226
+
227
+ }
228
+
229
+ this.domElement.style.touchAction = 'none';
230
+ this._devPxRatio = window.devicePixelRatio;
231
+
232
+ this.initializeMouseActions();
233
+
234
+ this._onContextMenu = onContextMenu.bind( this );
235
+ this._onWheel = onWheel.bind( this );
236
+ this._onPointerUp = onPointerUp.bind( this );
237
+ this._onPointerMove = onPointerMove.bind( this );
238
+ this._onPointerDown = onPointerDown.bind( this );
239
+ this._onPointerCancel = onPointerCancel.bind( this );
240
+ this._onWindowResize = onWindowResize.bind( this );
241
+
242
+ this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
243
+ this.domElement.addEventListener( 'wheel', this._onWheel );
244
+ this.domElement.addEventListener( 'pointerdown', this._onPointerDown );
245
+ this.domElement.addEventListener( 'pointercancel', this._onPointerCancel );
246
+
247
+ window.addEventListener( 'resize', this._onWindowResize );
248
+
249
+ }
250
+
251
+ onSinglePanStart( event, operation ) {
252
+
253
+ if ( this.enabled ) {
254
+
255
+ this.dispatchEvent( _startEvent );
256
+
257
+ this.setCenter( event.clientX, event.clientY );
258
+
259
+ switch ( operation ) {
260
+
261
+ case 'PAN':
262
+
263
+ if ( ! this.enablePan ) {
264
+
265
+ return;
266
+
267
+ }
268
+
269
+ if ( this._animationId != - 1 ) {
270
+
271
+ cancelAnimationFrame( this._animationId );
272
+ this._animationId = - 1;
273
+ this._timeStart = - 1;
274
+
275
+ this.activateGizmos( false );
276
+ this.dispatchEvent( _changeEvent );
277
+
278
+ }
279
+
280
+ this.updateTbState( STATE.PAN, true );
281
+ this._startCursorPosition.copy( this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement ) );
282
+ if ( this.enableGrid ) {
283
+
284
+ this.drawGrid();
285
+ this.dispatchEvent( _changeEvent );
286
+
287
+ }
288
+
289
+ break;
290
+
291
+ case 'ROTATE':
292
+
293
+ if ( ! this.enableRotate ) {
294
+
295
+ return;
296
+
297
+ }
298
+
299
+ if ( this._animationId != - 1 ) {
300
+
301
+ cancelAnimationFrame( this._animationId );
302
+ this._animationId = - 1;
303
+ this._timeStart = - 1;
304
+
305
+ }
306
+
307
+ this.updateTbState( STATE.ROTATE, true );
308
+ this._startCursorPosition.copy( this.unprojectOnTbSurface( this.camera, _center.x, _center.y, this.domElement, this._tbRadius ) );
309
+ this.activateGizmos( true );
310
+ if ( this.enableAnimations ) {
311
+
312
+ this._timePrev = this._timeCurrent = performance.now();
313
+ this._angleCurrent = this._anglePrev = 0;
314
+ this._cursorPosPrev.copy( this._startCursorPosition );
315
+ this._cursorPosCurr.copy( this._cursorPosPrev );
316
+ this._wCurr = 0;
317
+ this._wPrev = this._wCurr;
318
+
319
+ }
320
+
321
+ this.dispatchEvent( _changeEvent );
322
+ break;
323
+
324
+ case 'FOV':
325
+
326
+ if ( ! this.camera.isPerspectiveCamera || ! this.enableZoom ) {
327
+
328
+ return;
329
+
330
+ }
331
+
332
+ if ( this._animationId != - 1 ) {
333
+
334
+ cancelAnimationFrame( this._animationId );
335
+ this._animationId = - 1;
336
+ this._timeStart = - 1;
337
+
338
+ this.activateGizmos( false );
339
+ this.dispatchEvent( _changeEvent );
340
+
341
+ }
342
+
343
+ this.updateTbState( STATE.FOV, true );
344
+ this._startCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 );
345
+ this._currentCursorPosition.copy( this._startCursorPosition );
346
+ break;
347
+
348
+ case 'ZOOM':
349
+
350
+ if ( ! this.enableZoom ) {
351
+
352
+ return;
353
+
354
+ }
355
+
356
+ if ( this._animationId != - 1 ) {
357
+
358
+ cancelAnimationFrame( this._animationId );
359
+ this._animationId = - 1;
360
+ this._timeStart = - 1;
361
+
362
+ this.activateGizmos( false );
363
+ this.dispatchEvent( _changeEvent );
364
+
365
+ }
366
+
367
+ this.updateTbState( STATE.SCALE, true );
368
+ this._startCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 );
369
+ this._currentCursorPosition.copy( this._startCursorPosition );
370
+ break;
371
+
372
+ }
373
+
374
+ }
375
+
376
+ }
377
+
378
+ onSinglePanMove( event, opState ) {
379
+
380
+ if ( this.enabled ) {
381
+
382
+ const restart = opState != this._state;
383
+ this.setCenter( event.clientX, event.clientY );
384
+
385
+ switch ( opState ) {
386
+
387
+ case STATE.PAN:
388
+
389
+ if ( this.enablePan ) {
390
+
391
+ if ( restart ) {
392
+
393
+ //switch to pan operation
394
+
395
+ this.dispatchEvent( _endEvent );
396
+ this.dispatchEvent( _startEvent );
397
+
398
+ this.updateTbState( opState, true );
399
+ this._startCursorPosition.copy( this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement ) );
400
+ if ( this.enableGrid ) {
401
+
402
+ this.drawGrid();
403
+
404
+ }
405
+
406
+ this.activateGizmos( false );
407
+
408
+ } else {
409
+
410
+ //continue with pan operation
411
+ this._currentCursorPosition.copy( this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement ) );
412
+ this.applyTransformMatrix( this.pan( this._startCursorPosition, this._currentCursorPosition ) );
413
+
414
+ }
415
+
416
+ }
417
+
418
+ break;
419
+
420
+ case STATE.ROTATE:
421
+
422
+ if ( this.enableRotate ) {
423
+
424
+ if ( restart ) {
425
+
426
+ //switch to rotate operation
427
+
428
+ this.dispatchEvent( _endEvent );
429
+ this.dispatchEvent( _startEvent );
430
+
431
+ this.updateTbState( opState, true );
432
+ this._startCursorPosition.copy( this.unprojectOnTbSurface( this.camera, _center.x, _center.y, this.domElement, this._tbRadius ) );
433
+
434
+ if ( this.enableGrid ) {
435
+
436
+ this.disposeGrid();
437
+
438
+ }
439
+
440
+ this.activateGizmos( true );
441
+
442
+ } else {
443
+
444
+ //continue with rotate operation
445
+ this._currentCursorPosition.copy( this.unprojectOnTbSurface( this.camera, _center.x, _center.y, this.domElement, this._tbRadius ) );
446
+
447
+ const distance = this._startCursorPosition.distanceTo( this._currentCursorPosition );
448
+ const angle = this._startCursorPosition.angleTo( this._currentCursorPosition );
449
+ const amount = Math.max( distance / this._tbRadius, angle ) * this.rotateSpeed; //effective rotation angle
450
+
451
+ this.applyTransformMatrix( this.rotate( this.calculateRotationAxis( this._startCursorPosition, this._currentCursorPosition ), amount ) );
452
+
453
+ if ( this.enableAnimations ) {
454
+
455
+ this._timePrev = this._timeCurrent;
456
+ this._timeCurrent = performance.now();
457
+ this._anglePrev = this._angleCurrent;
458
+ this._angleCurrent = amount;
459
+ this._cursorPosPrev.copy( this._cursorPosCurr );
460
+ this._cursorPosCurr.copy( this._currentCursorPosition );
461
+ this._wPrev = this._wCurr;
462
+ this._wCurr = this.calculateAngularSpeed( this._anglePrev, this._angleCurrent, this._timePrev, this._timeCurrent );
463
+
464
+ }
465
+
466
+ }
467
+
468
+ }
469
+
470
+ break;
471
+
472
+ case STATE.SCALE:
473
+
474
+ if ( this.enableZoom ) {
475
+
476
+ if ( restart ) {
477
+
478
+ //switch to zoom operation
479
+
480
+ this.dispatchEvent( _endEvent );
481
+ this.dispatchEvent( _startEvent );
482
+
483
+ this.updateTbState( opState, true );
484
+ this._startCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 );
485
+ this._currentCursorPosition.copy( this._startCursorPosition );
486
+
487
+ if ( this.enableGrid ) {
488
+
489
+ this.disposeGrid();
490
+
491
+ }
492
+
493
+ this.activateGizmos( false );
494
+
495
+ } else {
496
+
497
+ //continue with zoom operation
498
+ const screenNotches = 8; //how many wheel notches corresponds to a full screen pan
499
+ this._currentCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 );
500
+
501
+ const movement = this._currentCursorPosition.y - this._startCursorPosition.y;
502
+
503
+ let size = 1;
504
+
505
+ if ( movement < 0 ) {
506
+
507
+ size = 1 / ( Math.pow( this.scaleFactor, - movement * screenNotches ) );
508
+
509
+ } else if ( movement > 0 ) {
510
+
511
+ size = Math.pow( this.scaleFactor, movement * screenNotches );
512
+
513
+ }
514
+
515
+ this._v3_1.setFromMatrixPosition( this._gizmoMatrixState );
516
+
517
+ this.applyTransformMatrix( this.scale( size, this._v3_1 ) );
518
+
519
+ }
520
+
521
+ }
522
+
523
+ break;
524
+
525
+ case STATE.FOV:
526
+
527
+ if ( this.enableZoom && this.camera.isPerspectiveCamera ) {
528
+
529
+ if ( restart ) {
530
+
531
+ //switch to fov operation
532
+
533
+ this.dispatchEvent( _endEvent );
534
+ this.dispatchEvent( _startEvent );
535
+
536
+ this.updateTbState( opState, true );
537
+ this._startCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 );
538
+ this._currentCursorPosition.copy( this._startCursorPosition );
539
+
540
+ if ( this.enableGrid ) {
541
+
542
+ this.disposeGrid();
543
+
544
+ }
545
+
546
+ this.activateGizmos( false );
547
+
548
+ } else {
549
+
550
+ //continue with fov operation
551
+ const screenNotches = 8; //how many wheel notches corresponds to a full screen pan
552
+ this._currentCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 );
553
+
554
+ const movement = this._currentCursorPosition.y - this._startCursorPosition.y;
555
+
556
+ let size = 1;
557
+
558
+ if ( movement < 0 ) {
559
+
560
+ size = 1 / ( Math.pow( this.scaleFactor, - movement * screenNotches ) );
561
+
562
+ } else if ( movement > 0 ) {
563
+
564
+ size = Math.pow( this.scaleFactor, movement * screenNotches );
565
+
566
+ }
567
+
568
+ this._v3_1.setFromMatrixPosition( this._cameraMatrixState );
569
+ const x = this._v3_1.distanceTo( this._gizmos.position );
570
+ let xNew = x / size; //distance between camera and gizmos if scale(size, scalepoint) would be performed
571
+
572
+ //check min and max distance
573
+ xNew = MathUtils.clamp( xNew, this.minDistance, this.maxDistance );
574
+
575
+ const y = x * Math.tan( MathUtils.DEG2RAD * this._fovState * 0.5 );
576
+
577
+ //calculate new fov
578
+ let newFov = MathUtils.RAD2DEG * ( Math.atan( y / xNew ) * 2 );
579
+
580
+ //check min and max fov
581
+ newFov = MathUtils.clamp( newFov, this.minFov, this.maxFov );
582
+
583
+ const newDistance = y / Math.tan( MathUtils.DEG2RAD * ( newFov / 2 ) );
584
+ size = x / newDistance;
585
+ this._v3_2.setFromMatrixPosition( this._gizmoMatrixState );
586
+
587
+ this.setFov( newFov );
588
+ this.applyTransformMatrix( this.scale( size, this._v3_2, false ) );
589
+
590
+ //adjusting distance
591
+ _offset.copy( this._gizmos.position ).sub( this.camera.position ).normalize().multiplyScalar( newDistance / x );
592
+ this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
593
+
594
+ }
595
+
596
+ }
597
+
598
+ break;
599
+
600
+ }
601
+
602
+ this.dispatchEvent( _changeEvent );
603
+
604
+ }
605
+
606
+ }
607
+
608
+ onSinglePanEnd() {
609
+
610
+ if ( this._state == STATE.ROTATE ) {
611
+
612
+
613
+ if ( ! this.enableRotate ) {
614
+
615
+ return;
616
+
617
+ }
618
+
619
+ if ( this.enableAnimations ) {
620
+
621
+ //perform rotation animation
622
+ const deltaTime = ( performance.now() - this._timeCurrent );
623
+ if ( deltaTime < 120 ) {
624
+
625
+ const w = Math.abs( ( this._wPrev + this._wCurr ) / 2 );
626
+
627
+ const self = this;
628
+ this._animationId = window.requestAnimationFrame( function ( t ) {
629
+
630
+ self.updateTbState( STATE.ANIMATION_ROTATE, true );
631
+ const rotationAxis = self.calculateRotationAxis( self._cursorPosPrev, self._cursorPosCurr );
632
+
633
+ self.onRotationAnim( t, rotationAxis, Math.min( w, self.wMax ) );
634
+
635
+ } );
636
+
637
+ } else {
638
+
639
+ //cursor has been standing still for over 120 ms since last movement
640
+ this.updateTbState( STATE.IDLE, false );
641
+ this.activateGizmos( false );
642
+ this.dispatchEvent( _changeEvent );
643
+
644
+ }
645
+
646
+ } else {
647
+
648
+ this.updateTbState( STATE.IDLE, false );
649
+ this.activateGizmos( false );
650
+ this.dispatchEvent( _changeEvent );
651
+
652
+ }
653
+
654
+ } else if ( this._state == STATE.PAN || this._state == STATE.IDLE ) {
655
+
656
+ this.updateTbState( STATE.IDLE, false );
657
+
658
+ if ( this.enableGrid ) {
659
+
660
+ this.disposeGrid();
661
+
662
+ }
663
+
664
+ this.activateGizmos( false );
665
+ this.dispatchEvent( _changeEvent );
666
+
667
+
668
+ }
669
+
670
+ this.dispatchEvent( _endEvent );
671
+
672
+ }
673
+
674
+ onDoubleTap( event ) {
675
+
676
+ if ( this.enabled && this.enablePan && this.scene != null ) {
677
+
678
+ this.dispatchEvent( _startEvent );
679
+
680
+ this.setCenter( event.clientX, event.clientY );
681
+ const hitP = this.unprojectOnObj( this.getCursorNDC( _center.x, _center.y, this.domElement ), this.camera );
682
+
683
+ if ( hitP != null && this.enableAnimations ) {
684
+
685
+ const self = this;
686
+ if ( this._animationId != - 1 ) {
687
+
688
+ window.cancelAnimationFrame( this._animationId );
689
+
690
+ }
691
+
692
+ this._timeStart = - 1;
693
+ this._animationId = window.requestAnimationFrame( function ( t ) {
694
+
695
+ self.updateTbState( STATE.ANIMATION_FOCUS, true );
696
+ self.onFocusAnim( t, hitP, self._cameraMatrixState, self._gizmoMatrixState );
697
+
698
+ } );
699
+
700
+ } else if ( hitP != null && ! this.enableAnimations ) {
701
+
702
+ this.updateTbState( STATE.FOCUS, true );
703
+ this.focus( hitP, this.scaleFactor );
704
+ this.updateTbState( STATE.IDLE, false );
705
+ this.dispatchEvent( _changeEvent );
706
+
707
+ }
708
+
709
+ }
710
+
711
+ this.dispatchEvent( _endEvent );
712
+
713
+ }
714
+
715
+ onDoublePanStart() {
716
+
717
+ if ( this.enabled && this.enablePan ) {
718
+
719
+ this.dispatchEvent( _startEvent );
720
+
721
+ this.updateTbState( STATE.PAN, true );
722
+
723
+ this.setCenter( ( this._touchCurrent[ 0 ].clientX + this._touchCurrent[ 1 ].clientX ) / 2, ( this._touchCurrent[ 0 ].clientY + this._touchCurrent[ 1 ].clientY ) / 2 );
724
+ this._startCursorPosition.copy( this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement, true ) );
725
+ this._currentCursorPosition.copy( this._startCursorPosition );
726
+
727
+ this.activateGizmos( false );
728
+
729
+ }
730
+
731
+ }
732
+
733
+ onDoublePanMove() {
734
+
735
+ if ( this.enabled && this.enablePan ) {
736
+
737
+ this.setCenter( ( this._touchCurrent[ 0 ].clientX + this._touchCurrent[ 1 ].clientX ) / 2, ( this._touchCurrent[ 0 ].clientY + this._touchCurrent[ 1 ].clientY ) / 2 );
738
+
739
+ if ( this._state != STATE.PAN ) {
740
+
741
+ this.updateTbState( STATE.PAN, true );
742
+ this._startCursorPosition.copy( this._currentCursorPosition );
743
+
744
+ }
745
+
746
+ this._currentCursorPosition.copy( this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement, true ) );
747
+ this.applyTransformMatrix( this.pan( this._startCursorPosition, this._currentCursorPosition, true ) );
748
+ this.dispatchEvent( _changeEvent );
749
+
750
+ }
751
+
752
+ }
753
+
754
+ onDoublePanEnd() {
755
+
756
+ this.updateTbState( STATE.IDLE, false );
757
+ this.dispatchEvent( _endEvent );
758
+
759
+ }
760
+
761
+ onRotateStart() {
762
+
763
+ if ( this.enabled && this.enableRotate ) {
764
+
765
+ this.dispatchEvent( _startEvent );
766
+
767
+ this.updateTbState( STATE.ZROTATE, true );
768
+
769
+ //this._startFingerRotation = event.rotation;
770
+
771
+ this._startFingerRotation = this.getAngle( this._touchCurrent[ 1 ], this._touchCurrent[ 0 ] ) + this.getAngle( this._touchStart[ 1 ], this._touchStart[ 0 ] );
772
+ this._currentFingerRotation = this._startFingerRotation;
773
+
774
+ this.camera.getWorldDirection( this._rotationAxis ); //rotation axis
775
+
776
+ if ( ! this.enablePan && ! this.enableZoom ) {
777
+
778
+ this.activateGizmos( true );
779
+
780
+ }
781
+
782
+ }
783
+
784
+ }
785
+
786
+ onRotateMove() {
787
+
788
+ if ( this.enabled && this.enableRotate ) {
789
+
790
+ this.setCenter( ( this._touchCurrent[ 0 ].clientX + this._touchCurrent[ 1 ].clientX ) / 2, ( this._touchCurrent[ 0 ].clientY + this._touchCurrent[ 1 ].clientY ) / 2 );
791
+ let rotationPoint;
792
+
793
+ if ( this._state != STATE.ZROTATE ) {
794
+
795
+ this.updateTbState( STATE.ZROTATE, true );
796
+ this._startFingerRotation = this._currentFingerRotation;
797
+
798
+ }
799
+
800
+ //this._currentFingerRotation = event.rotation;
801
+ this._currentFingerRotation = this.getAngle( this._touchCurrent[ 1 ], this._touchCurrent[ 0 ] ) + this.getAngle( this._touchStart[ 1 ], this._touchStart[ 0 ] );
802
+
803
+ if ( ! this.enablePan ) {
804
+
805
+ rotationPoint = new Vector3().setFromMatrixPosition( this._gizmoMatrixState );
806
+
807
+ } else {
808
+
809
+ this._v3_2.setFromMatrixPosition( this._gizmoMatrixState );
810
+ rotationPoint = this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement ).applyQuaternion( this.camera.quaternion ).multiplyScalar( 1 / this.camera.zoom ).add( this._v3_2 );
811
+
812
+ }
813
+
814
+ const amount = MathUtils.DEG2RAD * ( this._startFingerRotation - this._currentFingerRotation );
815
+
816
+ this.applyTransformMatrix( this.zRotate( rotationPoint, amount ) );
817
+ this.dispatchEvent( _changeEvent );
818
+
819
+ }
820
+
821
+ }
822
+
823
+ onRotateEnd() {
824
+
825
+ this.updateTbState( STATE.IDLE, false );
826
+ this.activateGizmos( false );
827
+ this.dispatchEvent( _endEvent );
828
+
829
+ }
830
+
831
+ onPinchStart() {
832
+
833
+ if ( this.enabled && this.enableZoom ) {
834
+
835
+ this.dispatchEvent( _startEvent );
836
+ this.updateTbState( STATE.SCALE, true );
837
+
838
+ this._startFingerDistance = this.calculatePointersDistance( this._touchCurrent[ 0 ], this._touchCurrent[ 1 ] );
839
+ this._currentFingerDistance = this._startFingerDistance;
840
+
841
+ this.activateGizmos( false );
842
+
843
+ }
844
+
845
+ }
846
+
847
+ onPinchMove() {
848
+
849
+ if ( this.enabled && this.enableZoom ) {
850
+
851
+ this.setCenter( ( this._touchCurrent[ 0 ].clientX + this._touchCurrent[ 1 ].clientX ) / 2, ( this._touchCurrent[ 0 ].clientY + this._touchCurrent[ 1 ].clientY ) / 2 );
852
+ const minDistance = 12; //minimum distance between fingers (in css pixels)
853
+
854
+ if ( this._state != STATE.SCALE ) {
855
+
856
+ this._startFingerDistance = this._currentFingerDistance;
857
+ this.updateTbState( STATE.SCALE, true );
858
+
859
+ }
860
+
861
+ this._currentFingerDistance = Math.max( this.calculatePointersDistance( this._touchCurrent[ 0 ], this._touchCurrent[ 1 ] ), minDistance * this._devPxRatio );
862
+ const amount = this._currentFingerDistance / this._startFingerDistance;
863
+
864
+ let scalePoint;
865
+
866
+ if ( ! this.enablePan ) {
867
+
868
+ scalePoint = this._gizmos.position;
869
+
870
+ } else {
871
+
872
+ if ( this.camera.isOrthographicCamera ) {
873
+
874
+ scalePoint = this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement )
875
+ .applyQuaternion( this.camera.quaternion )
876
+ .multiplyScalar( 1 / this.camera.zoom )
877
+ .add( this._gizmos.position );
878
+
879
+ } else if ( this.camera.isPerspectiveCamera ) {
880
+
881
+ scalePoint = this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement )
882
+ .applyQuaternion( this.camera.quaternion )
883
+ .add( this._gizmos.position );
884
+
885
+ }
886
+
887
+ }
888
+
889
+ this.applyTransformMatrix( this.scale( amount, scalePoint ) );
890
+ this.dispatchEvent( _changeEvent );
891
+
892
+ }
893
+
894
+ }
895
+
896
+ onPinchEnd() {
897
+
898
+ this.updateTbState( STATE.IDLE, false );
899
+ this.dispatchEvent( _endEvent );
900
+
901
+ }
902
+
903
+ onTriplePanStart() {
904
+
905
+ if ( this.enabled && this.enableZoom ) {
906
+
907
+ this.dispatchEvent( _startEvent );
908
+
909
+ this.updateTbState( STATE.SCALE, true );
910
+
911
+ //const center = event.center;
912
+ let clientX = 0;
913
+ let clientY = 0;
914
+ const nFingers = this._touchCurrent.length;
915
+
916
+ for ( let i = 0; i < nFingers; i ++ ) {
917
+
918
+ clientX += this._touchCurrent[ i ].clientX;
919
+ clientY += this._touchCurrent[ i ].clientY;
920
+
921
+ }
922
+
923
+ this.setCenter( clientX / nFingers, clientY / nFingers );
924
+
925
+ this._startCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 );
926
+ this._currentCursorPosition.copy( this._startCursorPosition );
927
+
928
+ }
929
+
930
+ }
931
+
932
+ onTriplePanMove() {
933
+
934
+ if ( this.enabled && this.enableZoom ) {
935
+
936
+ // fov / 2
937
+ // |\
938
+ // | \
939
+ // | \
940
+ // x | \
941
+ // | \
942
+ // | \
943
+ // | _ _ _\
944
+ // y
945
+
946
+ //const center = event.center;
947
+ let clientX = 0;
948
+ let clientY = 0;
949
+ const nFingers = this._touchCurrent.length;
950
+
951
+ for ( let i = 0; i < nFingers; i ++ ) {
952
+
953
+ clientX += this._touchCurrent[ i ].clientX;
954
+ clientY += this._touchCurrent[ i ].clientY;
955
+
956
+ }
957
+
958
+ this.setCenter( clientX / nFingers, clientY / nFingers );
959
+
960
+ const screenNotches = 8; //how many wheel notches corresponds to a full screen pan
961
+ this._currentCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 );
962
+
963
+ const movement = this._currentCursorPosition.y - this._startCursorPosition.y;
964
+
965
+ let size = 1;
966
+
967
+ if ( movement < 0 ) {
968
+
969
+ size = 1 / ( Math.pow( this.scaleFactor, - movement * screenNotches ) );
970
+
971
+ } else if ( movement > 0 ) {
972
+
973
+ size = Math.pow( this.scaleFactor, movement * screenNotches );
974
+
975
+ }
976
+
977
+ this._v3_1.setFromMatrixPosition( this._cameraMatrixState );
978
+ const x = this._v3_1.distanceTo( this._gizmos.position );
979
+ let xNew = x / size; //distance between camera and gizmos if scale(size, scalepoint) would be performed
980
+
981
+ //check min and max distance
982
+ xNew = MathUtils.clamp( xNew, this.minDistance, this.maxDistance );
983
+
984
+ const y = x * Math.tan( MathUtils.DEG2RAD * this._fovState * 0.5 );
985
+
986
+ //calculate new fov
987
+ let newFov = MathUtils.RAD2DEG * ( Math.atan( y / xNew ) * 2 );
988
+
989
+ //check min and max fov
990
+ newFov = MathUtils.clamp( newFov, this.minFov, this.maxFov );
991
+
992
+ const newDistance = y / Math.tan( MathUtils.DEG2RAD * ( newFov / 2 ) );
993
+ size = x / newDistance;
994
+ this._v3_2.setFromMatrixPosition( this._gizmoMatrixState );
995
+
996
+ this.setFov( newFov );
997
+ this.applyTransformMatrix( this.scale( size, this._v3_2, false ) );
998
+
999
+ //adjusting distance
1000
+ _offset.copy( this._gizmos.position ).sub( this.camera.position ).normalize().multiplyScalar( newDistance / x );
1001
+ this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
1002
+
1003
+ this.dispatchEvent( _changeEvent );
1004
+
1005
+ }
1006
+
1007
+ }
1008
+
1009
+ onTriplePanEnd() {
1010
+
1011
+ this.updateTbState( STATE.IDLE, false );
1012
+ this.dispatchEvent( _endEvent );
1013
+ //this.dispatchEvent( _changeEvent );
1014
+
1015
+ }
1016
+
1017
+ /**
1018
+ * Set _center's x/y coordinates
1019
+ * @param {Number} clientX
1020
+ * @param {Number} clientY
1021
+ */
1022
+ setCenter( clientX, clientY ) {
1023
+
1024
+ _center.x = clientX;
1025
+ _center.y = clientY;
1026
+
1027
+ }
1028
+
1029
+ /**
1030
+ * Set default mouse actions
1031
+ */
1032
+ initializeMouseActions() {
1033
+
1034
+ this.setMouseAction( 'PAN', 0, 'CTRL' );
1035
+ this.setMouseAction( 'PAN', 2 );
1036
+
1037
+ this.setMouseAction( 'ROTATE', 0 );
1038
+
1039
+ this.setMouseAction( 'ZOOM', 'WHEEL' );
1040
+ this.setMouseAction( 'ZOOM', 1 );
1041
+
1042
+ this.setMouseAction( 'FOV', 'WHEEL', 'SHIFT' );
1043
+ this.setMouseAction( 'FOV', 1, 'SHIFT' );
1044
+
1045
+
1046
+ }
1047
+
1048
+ /**
1049
+ * Compare two mouse actions
1050
+ * @param {Object} action1
1051
+ * @param {Object} action2
1052
+ * @returns {Boolean} True if action1 and action 2 are the same mouse action, false otherwise
1053
+ */
1054
+ compareMouseAction( action1, action2 ) {
1055
+
1056
+ if ( action1.operation == action2.operation ) {
1057
+
1058
+ if ( action1.mouse == action2.mouse && action1.key == action2.key ) {
1059
+
1060
+ return true;
1061
+
1062
+ } else {
1063
+
1064
+ return false;
1065
+
1066
+ }
1067
+
1068
+ } else {
1069
+
1070
+ return false;
1071
+
1072
+ }
1073
+
1074
+ }
1075
+
1076
+ /**
1077
+ * Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one
1078
+ * @param {String} operation The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV)
1079
+ * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches
1080
+ * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed
1081
+ * @returns {Boolean} True if the mouse action has been successfully added, false otherwise
1082
+ */
1083
+ setMouseAction( operation, mouse, key = null ) {
1084
+
1085
+ const operationInput = [ 'PAN', 'ROTATE', 'ZOOM', 'FOV' ];
1086
+ const mouseInput = [ 0, 1, 2, 'WHEEL' ];
1087
+ const keyInput = [ 'CTRL', 'SHIFT', null ];
1088
+ let state;
1089
+
1090
+ if ( ! operationInput.includes( operation ) || ! mouseInput.includes( mouse ) || ! keyInput.includes( key ) ) {
1091
+
1092
+ //invalid parameters
1093
+ return false;
1094
+
1095
+ }
1096
+
1097
+ if ( mouse == 'WHEEL' ) {
1098
+
1099
+ if ( operation != 'ZOOM' && operation != 'FOV' ) {
1100
+
1101
+ //cannot associate 2D operation to 1D input
1102
+ return false;
1103
+
1104
+ }
1105
+
1106
+ }
1107
+
1108
+ switch ( operation ) {
1109
+
1110
+ case 'PAN':
1111
+
1112
+ state = STATE.PAN;
1113
+ break;
1114
+
1115
+ case 'ROTATE':
1116
+
1117
+ state = STATE.ROTATE;
1118
+ break;
1119
+
1120
+ case 'ZOOM':
1121
+
1122
+ state = STATE.SCALE;
1123
+ break;
1124
+
1125
+ case 'FOV':
1126
+
1127
+ state = STATE.FOV;
1128
+ break;
1129
+
1130
+ }
1131
+
1132
+ const action = {
1133
+
1134
+ operation: operation,
1135
+ mouse: mouse,
1136
+ key: key,
1137
+ state: state
1138
+
1139
+ };
1140
+
1141
+ for ( let i = 0; i < this.mouseActions.length; i ++ ) {
1142
+
1143
+ if ( this.mouseActions[ i ].mouse == action.mouse && this.mouseActions[ i ].key == action.key ) {
1144
+
1145
+ this.mouseActions.splice( i, 1, action );
1146
+ return true;
1147
+
1148
+ }
1149
+
1150
+ }
1151
+
1152
+ this.mouseActions.push( action );
1153
+ return true;
1154
+
1155
+ }
1156
+
1157
+ /**
1158
+ * Remove a mouse action by specifying its mouse/key combination
1159
+ * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches
1160
+ * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed
1161
+ * @returns {Boolean} True if the operation has been succesfully removed, false otherwise
1162
+ */
1163
+ unsetMouseAction( mouse, key = null ) {
1164
+
1165
+ for ( let i = 0; i < this.mouseActions.length; i ++ ) {
1166
+
1167
+ if ( this.mouseActions[ i ].mouse == mouse && this.mouseActions[ i ].key == key ) {
1168
+
1169
+ this.mouseActions.splice( i, 1 );
1170
+ return true;
1171
+
1172
+ }
1173
+
1174
+ }
1175
+
1176
+ return false;
1177
+
1178
+ }
1179
+
1180
+ /**
1181
+ * Return the operation associated to a mouse/keyboard combination
1182
+ * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches
1183
+ * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed
1184
+ * @returns The operation if it has been found, null otherwise
1185
+ */
1186
+ getOpFromAction( mouse, key ) {
1187
+
1188
+ let action;
1189
+
1190
+ for ( let i = 0; i < this.mouseActions.length; i ++ ) {
1191
+
1192
+ action = this.mouseActions[ i ];
1193
+ if ( action.mouse == mouse && action.key == key ) {
1194
+
1195
+ return action.operation;
1196
+
1197
+ }
1198
+
1199
+ }
1200
+
1201
+ if ( key != null ) {
1202
+
1203
+ for ( let i = 0; i < this.mouseActions.length; i ++ ) {
1204
+
1205
+ action = this.mouseActions[ i ];
1206
+ if ( action.mouse == mouse && action.key == null ) {
1207
+
1208
+ return action.operation;
1209
+
1210
+ }
1211
+
1212
+ }
1213
+
1214
+ }
1215
+
1216
+ return null;
1217
+
1218
+ }
1219
+
1220
+ /**
1221
+ * Get the operation associated to mouse and key combination and returns the corresponding FSA state
1222
+ * @param {Number} mouse Mouse button
1223
+ * @param {String} key Keyboard modifier
1224
+ * @returns The FSA state obtained from the operation associated to mouse/keyboard combination
1225
+ */
1226
+ getOpStateFromAction( mouse, key ) {
1227
+
1228
+ let action;
1229
+
1230
+ for ( let i = 0; i < this.mouseActions.length; i ++ ) {
1231
+
1232
+ action = this.mouseActions[ i ];
1233
+ if ( action.mouse == mouse && action.key == key ) {
1234
+
1235
+ return action.state;
1236
+
1237
+ }
1238
+
1239
+ }
1240
+
1241
+ if ( key != null ) {
1242
+
1243
+ for ( let i = 0; i < this.mouseActions.length; i ++ ) {
1244
+
1245
+ action = this.mouseActions[ i ];
1246
+ if ( action.mouse == mouse && action.key == null ) {
1247
+
1248
+ return action.state;
1249
+
1250
+ }
1251
+
1252
+ }
1253
+
1254
+ }
1255
+
1256
+ return null;
1257
+
1258
+ }
1259
+
1260
+ /**
1261
+ * Calculate the angle between two pointers
1262
+ * @param {PointerEvent} p1
1263
+ * @param {PointerEvent} p2
1264
+ * @returns {Number} The angle between two pointers in degrees
1265
+ */
1266
+ getAngle( p1, p2 ) {
1267
+
1268
+ return Math.atan2( p2.clientY - p1.clientY, p2.clientX - p1.clientX ) * 180 / Math.PI;
1269
+
1270
+ }
1271
+
1272
+ /**
1273
+ * Update a PointerEvent inside current pointerevents array
1274
+ * @param {PointerEvent} event
1275
+ */
1276
+ updateTouchEvent( event ) {
1277
+
1278
+ for ( let i = 0; i < this._touchCurrent.length; i ++ ) {
1279
+
1280
+ if ( this._touchCurrent[ i ].pointerId == event.pointerId ) {
1281
+
1282
+ this._touchCurrent.splice( i, 1, event );
1283
+ break;
1284
+
1285
+ }
1286
+
1287
+ }
1288
+
1289
+ }
1290
+
1291
+ /**
1292
+ * Apply a transformation matrix, to the camera and gizmos
1293
+ * @param {Object} transformation Object containing matrices to apply to camera and gizmos
1294
+ */
1295
+ applyTransformMatrix( transformation ) {
1296
+
1297
+ if ( transformation.camera != null ) {
1298
+
1299
+ this._m4_1.copy( this._cameraMatrixState ).premultiply( transformation.camera );
1300
+ this._m4_1.decompose( this.camera.position, this.camera.quaternion, this.camera.scale );
1301
+ this.camera.updateMatrix();
1302
+
1303
+ //update camera up vector
1304
+ if ( this._state == STATE.ROTATE || this._state == STATE.ZROTATE || this._state == STATE.ANIMATION_ROTATE ) {
1305
+
1306
+ this.camera.up.copy( this._upState ).applyQuaternion( this.camera.quaternion );
1307
+
1308
+ }
1309
+
1310
+ }
1311
+
1312
+ if ( transformation.gizmos != null ) {
1313
+
1314
+ this._m4_1.copy( this._gizmoMatrixState ).premultiply( transformation.gizmos );
1315
+ this._m4_1.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale );
1316
+ this._gizmos.updateMatrix();
1317
+
1318
+ }
1319
+
1320
+ if ( this._state == STATE.SCALE || this._state == STATE.FOCUS || this._state == STATE.ANIMATION_FOCUS ) {
1321
+
1322
+ this._tbRadius = this.calculateTbRadius( this.camera );
1323
+
1324
+ if ( this.adjustNearFar ) {
1325
+
1326
+ const cameraDistance = this.camera.position.distanceTo( this._gizmos.position );
1327
+
1328
+ const bb = new Box3();
1329
+ bb.setFromObject( this._gizmos );
1330
+ const sphere = new Sphere();
1331
+ bb.getBoundingSphere( sphere );
1332
+
1333
+ const adjustedNearPosition = Math.max( this._nearPos0, sphere.radius + sphere.center.length() );
1334
+ const regularNearPosition = cameraDistance - this._initialNear;
1335
+
1336
+ const minNearPos = Math.min( adjustedNearPosition, regularNearPosition );
1337
+ this.camera.near = cameraDistance - minNearPos;
1338
+
1339
+
1340
+ const adjustedFarPosition = Math.min( this._farPos0, - sphere.radius + sphere.center.length() );
1341
+ const regularFarPosition = cameraDistance - this._initialFar;
1342
+
1343
+ const minFarPos = Math.min( adjustedFarPosition, regularFarPosition );
1344
+ this.camera.far = cameraDistance - minFarPos;
1345
+
1346
+ this.camera.updateProjectionMatrix();
1347
+
1348
+ } else {
1349
+
1350
+ let update = false;
1351
+
1352
+ if ( this.camera.near != this._initialNear ) {
1353
+
1354
+ this.camera.near = this._initialNear;
1355
+ update = true;
1356
+
1357
+ }
1358
+
1359
+ if ( this.camera.far != this._initialFar ) {
1360
+
1361
+ this.camera.far = this._initialFar;
1362
+ update = true;
1363
+
1364
+ }
1365
+
1366
+ if ( update ) {
1367
+
1368
+ this.camera.updateProjectionMatrix();
1369
+
1370
+ }
1371
+
1372
+ }
1373
+
1374
+ }
1375
+
1376
+ }
1377
+
1378
+ /**
1379
+ * Calculate the angular speed
1380
+ * @param {Number} p0 Position at t0
1381
+ * @param {Number} p1 Position at t1
1382
+ * @param {Number} t0 Initial time in milliseconds
1383
+ * @param {Number} t1 Ending time in milliseconds
1384
+ */
1385
+ calculateAngularSpeed( p0, p1, t0, t1 ) {
1386
+
1387
+ const s = p1 - p0;
1388
+ const t = ( t1 - t0 ) / 1000;
1389
+ if ( t == 0 ) {
1390
+
1391
+ return 0;
1392
+
1393
+ }
1394
+
1395
+ return s / t;
1396
+
1397
+ }
1398
+
1399
+ /**
1400
+ * Calculate the distance between two pointers
1401
+ * @param {PointerEvent} p0 The first pointer
1402
+ * @param {PointerEvent} p1 The second pointer
1403
+ * @returns {number} The distance between the two pointers
1404
+ */
1405
+ calculatePointersDistance( p0, p1 ) {
1406
+
1407
+ return Math.sqrt( Math.pow( p1.clientX - p0.clientX, 2 ) + Math.pow( p1.clientY - p0.clientY, 2 ) );
1408
+
1409
+ }
1410
+
1411
+ /**
1412
+ * Calculate the rotation axis as the vector perpendicular between two vectors
1413
+ * @param {Vector3} vec1 The first vector
1414
+ * @param {Vector3} vec2 The second vector
1415
+ * @returns {Vector3} The normalized rotation axis
1416
+ */
1417
+ calculateRotationAxis( vec1, vec2 ) {
1418
+
1419
+ this._rotationMatrix.extractRotation( this._cameraMatrixState );
1420
+ this._quat.setFromRotationMatrix( this._rotationMatrix );
1421
+
1422
+ this._rotationAxis.crossVectors( vec1, vec2 ).applyQuaternion( this._quat );
1423
+ return this._rotationAxis.normalize().clone();
1424
+
1425
+ }
1426
+
1427
+ /**
1428
+ * Calculate the trackball radius so that gizmo's diamater will be 2/3 of the minimum side of the camera frustum
1429
+ * @param {Camera} camera
1430
+ * @returns {Number} The trackball radius
1431
+ */
1432
+ calculateTbRadius( camera ) {
1433
+
1434
+ const distance = camera.position.distanceTo( this._gizmos.position );
1435
+
1436
+ if ( camera.type == 'PerspectiveCamera' ) {
1437
+
1438
+ const halfFovV = MathUtils.DEG2RAD * camera.fov * 0.5; //vertical fov/2 in radians
1439
+ const halfFovH = Math.atan( ( camera.aspect ) * Math.tan( halfFovV ) ); //horizontal fov/2 in radians
1440
+ return Math.tan( Math.min( halfFovV, halfFovH ) ) * distance * this.radiusFactor;
1441
+
1442
+ } else if ( camera.type == 'OrthographicCamera' ) {
1443
+
1444
+ return Math.min( camera.top, camera.right ) * this.radiusFactor;
1445
+
1446
+ }
1447
+
1448
+ }
1449
+
1450
+ /**
1451
+ * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in
1452
+ * @param {Vector3} point The point of interest
1453
+ * @param {Number} size Scale factor
1454
+ * @param {Number} amount Amount of operation to be completed (used for focus animations, default is complete full operation)
1455
+ */
1456
+ focus( point, size, amount = 1 ) {
1457
+
1458
+ //move center of camera (along with gizmos) towards point of interest
1459
+ _offset.copy( point ).sub( this._gizmos.position ).multiplyScalar( amount );
1460
+ this._translationMatrix.makeTranslation( _offset.x, _offset.y, _offset.z );
1461
+
1462
+ _gizmoMatrixStateTemp.copy( this._gizmoMatrixState );
1463
+ this._gizmoMatrixState.premultiply( this._translationMatrix );
1464
+ this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale );
1465
+
1466
+ _cameraMatrixStateTemp.copy( this._cameraMatrixState );
1467
+ this._cameraMatrixState.premultiply( this._translationMatrix );
1468
+ this._cameraMatrixState.decompose( this.camera.position, this.camera.quaternion, this.camera.scale );
1469
+
1470
+ //apply zoom
1471
+ if ( this.enableZoom ) {
1472
+
1473
+ this.applyTransformMatrix( this.scale( size, this._gizmos.position ) );
1474
+
1475
+ }
1476
+
1477
+ this._gizmoMatrixState.copy( _gizmoMatrixStateTemp );
1478
+ this._cameraMatrixState.copy( _cameraMatrixStateTemp );
1479
+
1480
+ }
1481
+
1482
+ /**
1483
+ * Draw a grid and add it to the scene
1484
+ */
1485
+ drawGrid() {
1486
+
1487
+ if ( this.scene != null ) {
1488
+
1489
+ const color = 0x888888;
1490
+ const multiplier = 3;
1491
+ let size, divisions, maxLength, tick;
1492
+
1493
+ if ( this.camera.isOrthographicCamera ) {
1494
+
1495
+ const width = this.camera.right - this.camera.left;
1496
+ const height = this.camera.bottom - this.camera.top;
1497
+
1498
+ maxLength = Math.max( width, height );
1499
+ tick = maxLength / 20;
1500
+
1501
+ size = maxLength / this.camera.zoom * multiplier;
1502
+ divisions = size / tick * this.camera.zoom;
1503
+
1504
+ } else if ( this.camera.isPerspectiveCamera ) {
1505
+
1506
+ const distance = this.camera.position.distanceTo( this._gizmos.position );
1507
+ const halfFovV = MathUtils.DEG2RAD * this.camera.fov * 0.5;
1508
+ const halfFovH = Math.atan( ( this.camera.aspect ) * Math.tan( halfFovV ) );
1509
+
1510
+ maxLength = Math.tan( Math.max( halfFovV, halfFovH ) ) * distance * 2;
1511
+ tick = maxLength / 20;
1512
+
1513
+ size = maxLength * multiplier;
1514
+ divisions = size / tick;
1515
+
1516
+ }
1517
+
1518
+ if ( this._grid == null ) {
1519
+
1520
+ this._grid = new GridHelper( size, divisions, color, color );
1521
+ this._grid.position.copy( this._gizmos.position );
1522
+ this._gridPosition.copy( this._grid.position );
1523
+ this._grid.quaternion.copy( this.camera.quaternion );
1524
+ this._grid.rotateX( Math.PI * 0.5 );
1525
+
1526
+ this.scene.add( this._grid );
1527
+
1528
+ }
1529
+
1530
+ }
1531
+
1532
+ }
1533
+
1534
+ /**
1535
+ * Remove all listeners, stop animations and clean scene
1536
+ */
1537
+ dispose() {
1538
+
1539
+ if ( this._animationId != - 1 ) {
1540
+
1541
+ window.cancelAnimationFrame( this._animationId );
1542
+
1543
+ }
1544
+
1545
+ this.domElement.removeEventListener( 'pointerdown', this._onPointerDown );
1546
+ this.domElement.removeEventListener( 'pointercancel', this._onPointerCancel );
1547
+ this.domElement.removeEventListener( 'wheel', this._onWheel );
1548
+ this.domElement.removeEventListener( 'contextmenu', this._onContextMenu );
1549
+
1550
+ window.removeEventListener( 'pointermove', this._onPointerMove );
1551
+ window.removeEventListener( 'pointerup', this._onPointerUp );
1552
+
1553
+ window.removeEventListener( 'resize', this._onWindowResize );
1554
+
1555
+ if ( this.scene !== null ) this.scene.remove( this._gizmos );
1556
+ this.disposeGrid();
1557
+
1558
+ }
1559
+
1560
+ /**
1561
+ * remove the grid from the scene
1562
+ */
1563
+ disposeGrid() {
1564
+
1565
+ if ( this._grid != null && this.scene != null ) {
1566
+
1567
+ this.scene.remove( this._grid );
1568
+ this._grid = null;
1569
+
1570
+ }
1571
+
1572
+ }
1573
+
1574
+ /**
1575
+ * Compute the easing out cubic function for ease out effect in animation
1576
+ * @param {Number} t The absolute progress of the animation in the bound of 0 (beginning of the) and 1 (ending of animation)
1577
+ * @returns {Number} Result of easing out cubic at time t
1578
+ */
1579
+ easeOutCubic( t ) {
1580
+
1581
+ return 1 - Math.pow( 1 - t, 3 );
1582
+
1583
+ }
1584
+
1585
+ /**
1586
+ * Make rotation gizmos more or less visible
1587
+ * @param {Boolean} isActive If true, make gizmos more visible
1588
+ */
1589
+ activateGizmos( isActive ) {
1590
+
1591
+ const gizmoX = this._gizmos.children[ 0 ];
1592
+ const gizmoY = this._gizmos.children[ 1 ];
1593
+ const gizmoZ = this._gizmos.children[ 2 ];
1594
+
1595
+ if ( isActive ) {
1596
+
1597
+ gizmoX.material.setValues( { opacity: 1 } );
1598
+ gizmoY.material.setValues( { opacity: 1 } );
1599
+ gizmoZ.material.setValues( { opacity: 1 } );
1600
+
1601
+ } else {
1602
+
1603
+ gizmoX.material.setValues( { opacity: 0.6 } );
1604
+ gizmoY.material.setValues( { opacity: 0.6 } );
1605
+ gizmoZ.material.setValues( { opacity: 0.6 } );
1606
+
1607
+ }
1608
+
1609
+ }
1610
+
1611
+ /**
1612
+ * Calculate the cursor position in NDC
1613
+ * @param {number} x Cursor horizontal coordinate within the canvas
1614
+ * @param {number} y Cursor vertical coordinate within the canvas
1615
+ * @param {HTMLElement} canvas The canvas where the renderer draws its output
1616
+ * @returns {Vector2} Cursor normalized position inside the canvas
1617
+ */
1618
+ getCursorNDC( cursorX, cursorY, canvas ) {
1619
+
1620
+ const canvasRect = canvas.getBoundingClientRect();
1621
+ this._v2_1.setX( ( ( cursorX - canvasRect.left ) / canvasRect.width ) * 2 - 1 );
1622
+ this._v2_1.setY( ( ( canvasRect.bottom - cursorY ) / canvasRect.height ) * 2 - 1 );
1623
+ return this._v2_1.clone();
1624
+
1625
+ }
1626
+
1627
+ /**
1628
+ * Calculate the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas
1629
+ * @param {Number} x Cursor horizontal coordinate within the canvas
1630
+ * @param {Number} y Cursor vertical coordinate within the canvas
1631
+ * @param {HTMLElement} canvas The canvas where the renderer draws its output
1632
+ * @returns {Vector2} Cursor position inside the canvas
1633
+ */
1634
+ getCursorPosition( cursorX, cursorY, canvas ) {
1635
+
1636
+ this._v2_1.copy( this.getCursorNDC( cursorX, cursorY, canvas ) );
1637
+ this._v2_1.x *= ( this.camera.right - this.camera.left ) * 0.5;
1638
+ this._v2_1.y *= ( this.camera.top - this.camera.bottom ) * 0.5;
1639
+ return this._v2_1.clone();
1640
+
1641
+ }
1642
+
1643
+ /**
1644
+ * Set the camera to be controlled
1645
+ * @param {Camera} camera The virtual camera to be controlled
1646
+ */
1647
+ setCamera( camera ) {
1648
+
1649
+ camera.lookAt( this.target );
1650
+ camera.updateMatrix();
1651
+
1652
+ //setting state
1653
+ if ( camera.type == 'PerspectiveCamera' ) {
1654
+
1655
+ this._fov0 = camera.fov;
1656
+ this._fovState = camera.fov;
1657
+
1658
+ }
1659
+
1660
+ this._cameraMatrixState0.copy( camera.matrix );
1661
+ this._cameraMatrixState.copy( this._cameraMatrixState0 );
1662
+ this._cameraProjectionState.copy( camera.projectionMatrix );
1663
+ this._zoom0 = camera.zoom;
1664
+ this._zoomState = this._zoom0;
1665
+
1666
+ this._initialNear = camera.near;
1667
+ this._nearPos0 = camera.position.distanceTo( this.target ) - camera.near;
1668
+ this._nearPos = this._initialNear;
1669
+
1670
+ this._initialFar = camera.far;
1671
+ this._farPos0 = camera.position.distanceTo( this.target ) - camera.far;
1672
+ this._farPos = this._initialFar;
1673
+
1674
+ this._up0.copy( camera.up );
1675
+ this._upState.copy( camera.up );
1676
+
1677
+ this.camera = camera;
1678
+ this.camera.updateProjectionMatrix();
1679
+
1680
+ //making gizmos
1681
+ this._tbRadius = this.calculateTbRadius( camera );
1682
+ this.makeGizmos( this.target, this._tbRadius );
1683
+
1684
+ }
1685
+
1686
+ /**
1687
+ * Set gizmos visibility
1688
+ * @param {Boolean} value Value of gizmos visibility
1689
+ */
1690
+ setGizmosVisible( value ) {
1691
+
1692
+ this._gizmos.visible = value;
1693
+ this.dispatchEvent( _changeEvent );
1694
+
1695
+ }
1696
+
1697
+ /**
1698
+ * Set gizmos radius factor and redraws gizmos
1699
+ * @param {Float} value Value of radius factor
1700
+ */
1701
+ setTbRadius( value ) {
1702
+
1703
+ this.radiusFactor = value;
1704
+ this._tbRadius = this.calculateTbRadius( this.camera );
1705
+
1706
+ const curve = new EllipseCurve( 0, 0, this._tbRadius, this._tbRadius );
1707
+ const points = curve.getPoints( this._curvePts );
1708
+ const curveGeometry = new BufferGeometry().setFromPoints( points );
1709
+
1710
+
1711
+ for ( const gizmo in this._gizmos.children ) {
1712
+
1713
+ this._gizmos.children[ gizmo ].geometry = curveGeometry;
1714
+
1715
+ }
1716
+
1717
+ this.dispatchEvent( _changeEvent );
1718
+
1719
+ }
1720
+
1721
+ /**
1722
+ * Creates the rotation gizmos matching trackball center and radius
1723
+ * @param {Vector3} tbCenter The trackball center
1724
+ * @param {number} tbRadius The trackball radius
1725
+ */
1726
+ makeGizmos( tbCenter, tbRadius ) {
1727
+
1728
+ const curve = new EllipseCurve( 0, 0, tbRadius, tbRadius );
1729
+ const points = curve.getPoints( this._curvePts );
1730
+
1731
+ //geometry
1732
+ const curveGeometry = new BufferGeometry().setFromPoints( points );
1733
+
1734
+ //material
1735
+ const curveMaterialX = new LineBasicMaterial( { color: 0xff8080, fog: false, transparent: true, opacity: 0.6 } );
1736
+ const curveMaterialY = new LineBasicMaterial( { color: 0x80ff80, fog: false, transparent: true, opacity: 0.6 } );
1737
+ const curveMaterialZ = new LineBasicMaterial( { color: 0x8080ff, fog: false, transparent: true, opacity: 0.6 } );
1738
+
1739
+ //line
1740
+ const gizmoX = new Line( curveGeometry, curveMaterialX );
1741
+ const gizmoY = new Line( curveGeometry, curveMaterialY );
1742
+ const gizmoZ = new Line( curveGeometry, curveMaterialZ );
1743
+
1744
+ const rotation = Math.PI * 0.5;
1745
+ gizmoX.rotation.x = rotation;
1746
+ gizmoY.rotation.y = rotation;
1747
+
1748
+
1749
+ //setting state
1750
+ this._gizmoMatrixState0.identity().setPosition( tbCenter );
1751
+ this._gizmoMatrixState.copy( this._gizmoMatrixState0 );
1752
+
1753
+ if ( this.camera.zoom !== 1 ) {
1754
+
1755
+ //adapt gizmos size to camera zoom
1756
+ const size = 1 / this.camera.zoom;
1757
+ this._scaleMatrix.makeScale( size, size, size );
1758
+ this._translationMatrix.makeTranslation( - tbCenter.x, - tbCenter.y, - tbCenter.z );
1759
+
1760
+ this._gizmoMatrixState.premultiply( this._translationMatrix ).premultiply( this._scaleMatrix );
1761
+ this._translationMatrix.makeTranslation( tbCenter.x, tbCenter.y, tbCenter.z );
1762
+ this._gizmoMatrixState.premultiply( this._translationMatrix );
1763
+
1764
+ }
1765
+
1766
+ this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale );
1767
+
1768
+ //
1769
+
1770
+ this._gizmos.traverse( function ( object ) {
1771
+
1772
+ if ( object.isLine ) {
1773
+
1774
+ object.geometry.dispose();
1775
+ object.material.dispose();
1776
+
1777
+ }
1778
+
1779
+ } );
1780
+
1781
+ this._gizmos.clear();
1782
+
1783
+ //
1784
+
1785
+ this._gizmos.add( gizmoX );
1786
+ this._gizmos.add( gizmoY );
1787
+ this._gizmos.add( gizmoZ );
1788
+
1789
+ }
1790
+
1791
+ /**
1792
+ * Perform animation for focus operation
1793
+ * @param {Number} time Instant in which this function is called as performance.now()
1794
+ * @param {Vector3} point Point of interest for focus operation
1795
+ * @param {Matrix4} cameraMatrix Camera matrix
1796
+ * @param {Matrix4} gizmoMatrix Gizmos matrix
1797
+ */
1798
+ onFocusAnim( time, point, cameraMatrix, gizmoMatrix ) {
1799
+
1800
+ if ( this._timeStart == - 1 ) {
1801
+
1802
+ //animation start
1803
+ this._timeStart = time;
1804
+
1805
+ }
1806
+
1807
+ if ( this._state == STATE.ANIMATION_FOCUS ) {
1808
+
1809
+ const deltaTime = time - this._timeStart;
1810
+ const animTime = deltaTime / this.focusAnimationTime;
1811
+
1812
+ this._gizmoMatrixState.copy( gizmoMatrix );
1813
+
1814
+ if ( animTime >= 1 ) {
1815
+
1816
+ //animation end
1817
+
1818
+ this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale );
1819
+
1820
+ this.focus( point, this.scaleFactor );
1821
+
1822
+ this._timeStart = - 1;
1823
+ this.updateTbState( STATE.IDLE, false );
1824
+ this.activateGizmos( false );
1825
+
1826
+ this.dispatchEvent( _changeEvent );
1827
+
1828
+ } else {
1829
+
1830
+ const amount = this.easeOutCubic( animTime );
1831
+ const size = ( ( 1 - amount ) + ( this.scaleFactor * amount ) );
1832
+
1833
+ this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale );
1834
+ this.focus( point, size, amount );
1835
+
1836
+ this.dispatchEvent( _changeEvent );
1837
+ const self = this;
1838
+ this._animationId = window.requestAnimationFrame( function ( t ) {
1839
+
1840
+ self.onFocusAnim( t, point, cameraMatrix, gizmoMatrix.clone() );
1841
+
1842
+ } );
1843
+
1844
+ }
1845
+
1846
+ } else {
1847
+
1848
+ //interrupt animation
1849
+
1850
+ this._animationId = - 1;
1851
+ this._timeStart = - 1;
1852
+
1853
+ }
1854
+
1855
+ }
1856
+
1857
+ /**
1858
+ * Perform animation for rotation operation
1859
+ * @param {Number} time Instant in which this function is called as performance.now()
1860
+ * @param {Vector3} rotationAxis Rotation axis
1861
+ * @param {number} w0 Initial angular velocity
1862
+ */
1863
+ onRotationAnim( time, rotationAxis, w0 ) {
1864
+
1865
+ if ( this._timeStart == - 1 ) {
1866
+
1867
+ //animation start
1868
+ this._anglePrev = 0;
1869
+ this._angleCurrent = 0;
1870
+ this._timeStart = time;
1871
+
1872
+ }
1873
+
1874
+ if ( this._state == STATE.ANIMATION_ROTATE ) {
1875
+
1876
+ //w = w0 + alpha * t
1877
+ const deltaTime = ( time - this._timeStart ) / 1000;
1878
+ const w = w0 + ( ( - this.dampingFactor ) * deltaTime );
1879
+
1880
+ if ( w > 0 ) {
1881
+
1882
+ //tetha = 0.5 * alpha * t^2 + w0 * t + tetha0
1883
+ this._angleCurrent = 0.5 * ( - this.dampingFactor ) * Math.pow( deltaTime, 2 ) + w0 * deltaTime + 0;
1884
+ this.applyTransformMatrix( this.rotate( rotationAxis, this._angleCurrent ) );
1885
+ this.dispatchEvent( _changeEvent );
1886
+ const self = this;
1887
+ this._animationId = window.requestAnimationFrame( function ( t ) {
1888
+
1889
+ self.onRotationAnim( t, rotationAxis, w0 );
1890
+
1891
+ } );
1892
+
1893
+ } else {
1894
+
1895
+ this._animationId = - 1;
1896
+ this._timeStart = - 1;
1897
+
1898
+ this.updateTbState( STATE.IDLE, false );
1899
+ this.activateGizmos( false );
1900
+
1901
+ this.dispatchEvent( _changeEvent );
1902
+
1903
+ }
1904
+
1905
+ } else {
1906
+
1907
+ //interrupt animation
1908
+
1909
+ this._animationId = - 1;
1910
+ this._timeStart = - 1;
1911
+
1912
+ if ( this._state != STATE.ROTATE ) {
1913
+
1914
+ this.activateGizmos( false );
1915
+ this.dispatchEvent( _changeEvent );
1916
+
1917
+ }
1918
+
1919
+ }
1920
+
1921
+ }
1922
+
1923
+
1924
+ /**
1925
+ * Perform pan operation moving camera between two points
1926
+ * @param {Vector3} p0 Initial point
1927
+ * @param {Vector3} p1 Ending point
1928
+ * @param {Boolean} adjust If movement should be adjusted considering camera distance (Perspective only)
1929
+ */
1930
+ pan( p0, p1, adjust = false ) {
1931
+
1932
+ const movement = p0.clone().sub( p1 );
1933
+
1934
+ if ( this.camera.isOrthographicCamera ) {
1935
+
1936
+ //adjust movement amount
1937
+ movement.multiplyScalar( 1 / this.camera.zoom );
1938
+
1939
+ } else if ( this.camera.isPerspectiveCamera && adjust ) {
1940
+
1941
+ //adjust movement amount
1942
+ this._v3_1.setFromMatrixPosition( this._cameraMatrixState0 ); //camera's initial position
1943
+ this._v3_2.setFromMatrixPosition( this._gizmoMatrixState0 ); //gizmo's initial position
1944
+ const distanceFactor = this._v3_1.distanceTo( this._v3_2 ) / this.camera.position.distanceTo( this._gizmos.position );
1945
+ movement.multiplyScalar( 1 / distanceFactor );
1946
+
1947
+ }
1948
+
1949
+ this._v3_1.set( movement.x, movement.y, 0 ).applyQuaternion( this.camera.quaternion );
1950
+
1951
+ this._m4_1.makeTranslation( this._v3_1.x, this._v3_1.y, this._v3_1.z );
1952
+
1953
+ this.setTransformationMatrices( this._m4_1, this._m4_1 );
1954
+ return _transformation;
1955
+
1956
+ }
1957
+
1958
+ /**
1959
+ * Reset trackball
1960
+ */
1961
+ reset() {
1962
+
1963
+ this.camera.zoom = this._zoom0;
1964
+
1965
+ if ( this.camera.isPerspectiveCamera ) {
1966
+
1967
+ this.camera.fov = this._fov0;
1968
+
1969
+ }
1970
+
1971
+ this.camera.near = this._nearPos;
1972
+ this.camera.far = this._farPos;
1973
+ this._cameraMatrixState.copy( this._cameraMatrixState0 );
1974
+ this._cameraMatrixState.decompose( this.camera.position, this.camera.quaternion, this.camera.scale );
1975
+ this.camera.up.copy( this._up0 );
1976
+
1977
+ this.camera.updateMatrix();
1978
+ this.camera.updateProjectionMatrix();
1979
+
1980
+ this._gizmoMatrixState.copy( this._gizmoMatrixState0 );
1981
+ this._gizmoMatrixState0.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale );
1982
+ this._gizmos.updateMatrix();
1983
+
1984
+ this._tbRadius = this.calculateTbRadius( this.camera );
1985
+ this.makeGizmos( this._gizmos.position, this._tbRadius );
1986
+
1987
+ this.camera.lookAt( this._gizmos.position );
1988
+
1989
+ this.updateTbState( STATE.IDLE, false );
1990
+
1991
+ this.dispatchEvent( _changeEvent );
1992
+
1993
+ }
1994
+
1995
+ /**
1996
+ * Rotate the camera around an axis passing by trackball's center
1997
+ * @param {Vector3} axis Rotation axis
1998
+ * @param {number} angle Angle in radians
1999
+ * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera
2000
+ */
2001
+ rotate( axis, angle ) {
2002
+
2003
+ const point = this._gizmos.position; //rotation center
2004
+ this._translationMatrix.makeTranslation( - point.x, - point.y, - point.z );
2005
+ this._rotationMatrix.makeRotationAxis( axis, - angle );
2006
+
2007
+ //rotate camera
2008
+ this._m4_1.makeTranslation( point.x, point.y, point.z );
2009
+ this._m4_1.multiply( this._rotationMatrix );
2010
+ this._m4_1.multiply( this._translationMatrix );
2011
+
2012
+ this.setTransformationMatrices( this._m4_1 );
2013
+
2014
+ return _transformation;
2015
+
2016
+ }
2017
+
2018
+ copyState() {
2019
+
2020
+ let state;
2021
+ if ( this.camera.isOrthographicCamera ) {
2022
+
2023
+ state = JSON.stringify( { arcballState: {
2024
+
2025
+ cameraFar: this.camera.far,
2026
+ cameraMatrix: this.camera.matrix,
2027
+ cameraNear: this.camera.near,
2028
+ cameraUp: this.camera.up,
2029
+ cameraZoom: this.camera.zoom,
2030
+ gizmoMatrix: this._gizmos.matrix
2031
+
2032
+ } } );
2033
+
2034
+ } else if ( this.camera.isPerspectiveCamera ) {
2035
+
2036
+ state = JSON.stringify( { arcballState: {
2037
+ cameraFar: this.camera.far,
2038
+ cameraFov: this.camera.fov,
2039
+ cameraMatrix: this.camera.matrix,
2040
+ cameraNear: this.camera.near,
2041
+ cameraUp: this.camera.up,
2042
+ cameraZoom: this.camera.zoom,
2043
+ gizmoMatrix: this._gizmos.matrix
2044
+
2045
+ } } );
2046
+
2047
+ }
2048
+
2049
+ navigator.clipboard.writeText( state );
2050
+
2051
+ }
2052
+
2053
+ pasteState() {
2054
+
2055
+ const self = this;
2056
+ navigator.clipboard.readText().then( function resolved( value ) {
2057
+
2058
+ self.setStateFromJSON( value );
2059
+
2060
+ } );
2061
+
2062
+ }
2063
+
2064
+ /**
2065
+ * Save the current state of the control. This can later be recover with .reset
2066
+ */
2067
+ saveState() {
2068
+
2069
+ this._cameraMatrixState0.copy( this.camera.matrix );
2070
+ this._gizmoMatrixState0.copy( this._gizmos.matrix );
2071
+ this._nearPos = this.camera.near;
2072
+ this._farPos = this.camera.far;
2073
+ this._zoom0 = this.camera.zoom;
2074
+ this._up0.copy( this.camera.up );
2075
+
2076
+ if ( this.camera.isPerspectiveCamera ) {
2077
+
2078
+ this._fov0 = this.camera.fov;
2079
+
2080
+ }
2081
+
2082
+ }
2083
+
2084
+ /**
2085
+ * Perform uniform scale operation around a given point
2086
+ * @param {Number} size Scale factor
2087
+ * @param {Vector3} point Point around which scale
2088
+ * @param {Boolean} scaleGizmos If gizmos should be scaled (Perspective only)
2089
+ * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos
2090
+ */
2091
+ scale( size, point, scaleGizmos = true ) {
2092
+
2093
+ _scalePointTemp.copy( point );
2094
+ let sizeInverse = 1 / size;
2095
+
2096
+ if ( this.camera.isOrthographicCamera ) {
2097
+
2098
+ //camera zoom
2099
+ this.camera.zoom = this._zoomState;
2100
+ this.camera.zoom *= size;
2101
+
2102
+ //check min and max zoom
2103
+ if ( this.camera.zoom > this.maxZoom ) {
2104
+
2105
+ this.camera.zoom = this.maxZoom;
2106
+ sizeInverse = this._zoomState / this.maxZoom;
2107
+
2108
+ } else if ( this.camera.zoom < this.minZoom ) {
2109
+
2110
+ this.camera.zoom = this.minZoom;
2111
+ sizeInverse = this._zoomState / this.minZoom;
2112
+
2113
+ }
2114
+
2115
+ this.camera.updateProjectionMatrix();
2116
+
2117
+ this._v3_1.setFromMatrixPosition( this._gizmoMatrixState ); //gizmos position
2118
+
2119
+ //scale gizmos so they appear in the same spot having the same dimension
2120
+ this._scaleMatrix.makeScale( sizeInverse, sizeInverse, sizeInverse );
2121
+ this._translationMatrix.makeTranslation( - this._v3_1.x, - this._v3_1.y, - this._v3_1.z );
2122
+
2123
+ this._m4_2.makeTranslation( this._v3_1.x, this._v3_1.y, this._v3_1.z ).multiply( this._scaleMatrix );
2124
+ this._m4_2.multiply( this._translationMatrix );
2125
+
2126
+
2127
+ //move camera and gizmos to obtain pinch effect
2128
+ _scalePointTemp.sub( this._v3_1 );
2129
+
2130
+ const amount = _scalePointTemp.clone().multiplyScalar( sizeInverse );
2131
+ _scalePointTemp.sub( amount );
2132
+
2133
+ this._m4_1.makeTranslation( _scalePointTemp.x, _scalePointTemp.y, _scalePointTemp.z );
2134
+ this._m4_2.premultiply( this._m4_1 );
2135
+
2136
+ this.setTransformationMatrices( this._m4_1, this._m4_2 );
2137
+ return _transformation;
2138
+
2139
+ } else if ( this.camera.isPerspectiveCamera ) {
2140
+
2141
+ this._v3_1.setFromMatrixPosition( this._cameraMatrixState );
2142
+ this._v3_2.setFromMatrixPosition( this._gizmoMatrixState );
2143
+
2144
+ //move camera
2145
+ let distance = this._v3_1.distanceTo( _scalePointTemp );
2146
+ let amount = distance - ( distance * sizeInverse );
2147
+
2148
+ //check min and max distance
2149
+ const newDistance = distance - amount;
2150
+ if ( newDistance < this.minDistance ) {
2151
+
2152
+ sizeInverse = this.minDistance / distance;
2153
+ amount = distance - ( distance * sizeInverse );
2154
+
2155
+ } else if ( newDistance > this.maxDistance ) {
2156
+
2157
+ sizeInverse = this.maxDistance / distance;
2158
+ amount = distance - ( distance * sizeInverse );
2159
+
2160
+ }
2161
+
2162
+ _offset.copy( _scalePointTemp ).sub( this._v3_1 ).normalize().multiplyScalar( amount );
2163
+
2164
+ this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
2165
+
2166
+
2167
+ if ( scaleGizmos ) {
2168
+
2169
+ //scale gizmos so they appear in the same spot having the same dimension
2170
+ const pos = this._v3_2;
2171
+
2172
+ distance = pos.distanceTo( _scalePointTemp );
2173
+ amount = distance - ( distance * sizeInverse );
2174
+ _offset.copy( _scalePointTemp ).sub( this._v3_2 ).normalize().multiplyScalar( amount );
2175
+
2176
+ this._translationMatrix.makeTranslation( pos.x, pos.y, pos.z );
2177
+ this._scaleMatrix.makeScale( sizeInverse, sizeInverse, sizeInverse );
2178
+
2179
+ this._m4_2.makeTranslation( _offset.x, _offset.y, _offset.z ).multiply( this._translationMatrix );
2180
+ this._m4_2.multiply( this._scaleMatrix );
2181
+
2182
+ this._translationMatrix.makeTranslation( - pos.x, - pos.y, - pos.z );
2183
+
2184
+ this._m4_2.multiply( this._translationMatrix );
2185
+ this.setTransformationMatrices( this._m4_1, this._m4_2 );
2186
+
2187
+
2188
+ } else {
2189
+
2190
+ this.setTransformationMatrices( this._m4_1 );
2191
+
2192
+ }
2193
+
2194
+ return _transformation;
2195
+
2196
+ }
2197
+
2198
+ }
2199
+
2200
+ /**
2201
+ * Set camera fov
2202
+ * @param {Number} value fov to be setted
2203
+ */
2204
+ setFov( value ) {
2205
+
2206
+ if ( this.camera.isPerspectiveCamera ) {
2207
+
2208
+ this.camera.fov = MathUtils.clamp( value, this.minFov, this.maxFov );
2209
+ this.camera.updateProjectionMatrix();
2210
+
2211
+ }
2212
+
2213
+ }
2214
+
2215
+ /**
2216
+ * Set values in transformation object
2217
+ * @param {Matrix4} camera Transformation to be applied to the camera
2218
+ * @param {Matrix4} gizmos Transformation to be applied to gizmos
2219
+ */
2220
+ setTransformationMatrices( camera = null, gizmos = null ) {
2221
+
2222
+ if ( camera != null ) {
2223
+
2224
+ if ( _transformation.camera != null ) {
2225
+
2226
+ _transformation.camera.copy( camera );
2227
+
2228
+ } else {
2229
+
2230
+ _transformation.camera = camera.clone();
2231
+
2232
+ }
2233
+
2234
+ } else {
2235
+
2236
+ _transformation.camera = null;
2237
+
2238
+ }
2239
+
2240
+ if ( gizmos != null ) {
2241
+
2242
+ if ( _transformation.gizmos != null ) {
2243
+
2244
+ _transformation.gizmos.copy( gizmos );
2245
+
2246
+ } else {
2247
+
2248
+ _transformation.gizmos = gizmos.clone();
2249
+
2250
+ }
2251
+
2252
+ } else {
2253
+
2254
+ _transformation.gizmos = null;
2255
+
2256
+ }
2257
+
2258
+ }
2259
+
2260
+ /**
2261
+ * Rotate camera around its direction axis passing by a given point by a given angle
2262
+ * @param {Vector3} point The point where the rotation axis is passing trough
2263
+ * @param {Number} angle Angle in radians
2264
+ * @returns The computed transormation matix
2265
+ */
2266
+ zRotate( point, angle ) {
2267
+
2268
+ this._rotationMatrix.makeRotationAxis( this._rotationAxis, angle );
2269
+ this._translationMatrix.makeTranslation( - point.x, - point.y, - point.z );
2270
+
2271
+ this._m4_1.makeTranslation( point.x, point.y, point.z );
2272
+ this._m4_1.multiply( this._rotationMatrix );
2273
+ this._m4_1.multiply( this._translationMatrix );
2274
+
2275
+ this._v3_1.setFromMatrixPosition( this._gizmoMatrixState ).sub( point ); //vector from rotation center to gizmos position
2276
+ this._v3_2.copy( this._v3_1 ).applyAxisAngle( this._rotationAxis, angle ); //apply rotation
2277
+ this._v3_2.sub( this._v3_1 );
2278
+
2279
+ this._m4_2.makeTranslation( this._v3_2.x, this._v3_2.y, this._v3_2.z );
2280
+
2281
+ this.setTransformationMatrices( this._m4_1, this._m4_2 );
2282
+ return _transformation;
2283
+
2284
+ }
2285
+
2286
+
2287
+ getRaycaster() {
2288
+
2289
+ return _raycaster;
2290
+
2291
+ }
2292
+
2293
+
2294
+ /**
2295
+ * Unproject the cursor on the 3D object surface
2296
+ * @param {Vector2} cursor Cursor coordinates in NDC
2297
+ * @param {Camera} camera Virtual camera
2298
+ * @returns {Vector3} The point of intersection with the model, if exist, null otherwise
2299
+ */
2300
+ unprojectOnObj( cursor, camera ) {
2301
+
2302
+ const raycaster = this.getRaycaster();
2303
+ raycaster.near = camera.near;
2304
+ raycaster.far = camera.far;
2305
+ raycaster.setFromCamera( cursor, camera );
2306
+
2307
+ const intersect = raycaster.intersectObjects( this.scene.children, true );
2308
+
2309
+ for ( let i = 0; i < intersect.length; i ++ ) {
2310
+
2311
+ if ( intersect[ i ].object.uuid != this._gizmos.uuid && intersect[ i ].face != null ) {
2312
+
2313
+ return intersect[ i ].point.clone();
2314
+
2315
+ }
2316
+
2317
+ }
2318
+
2319
+ return null;
2320
+
2321
+ }
2322
+
2323
+ /**
2324
+ * Unproject the cursor on the trackball surface
2325
+ * @param {Camera} camera The virtual camera
2326
+ * @param {Number} cursorX Cursor horizontal coordinate on screen
2327
+ * @param {Number} cursorY Cursor vertical coordinate on screen
2328
+ * @param {HTMLElement} canvas The canvas where the renderer draws its output
2329
+ * @param {number} tbRadius The trackball radius
2330
+ * @returns {Vector3} The unprojected point on the trackball surface
2331
+ */
2332
+ unprojectOnTbSurface( camera, cursorX, cursorY, canvas, tbRadius ) {
2333
+
2334
+ if ( camera.type == 'OrthographicCamera' ) {
2335
+
2336
+ this._v2_1.copy( this.getCursorPosition( cursorX, cursorY, canvas ) );
2337
+ this._v3_1.set( this._v2_1.x, this._v2_1.y, 0 );
2338
+
2339
+ const x2 = Math.pow( this._v2_1.x, 2 );
2340
+ const y2 = Math.pow( this._v2_1.y, 2 );
2341
+ const r2 = Math.pow( this._tbRadius, 2 );
2342
+
2343
+ if ( x2 + y2 <= r2 * 0.5 ) {
2344
+
2345
+ //intersection with sphere
2346
+ this._v3_1.setZ( Math.sqrt( r2 - ( x2 + y2 ) ) );
2347
+
2348
+ } else {
2349
+
2350
+ //intersection with hyperboloid
2351
+ this._v3_1.setZ( ( r2 * 0.5 ) / ( Math.sqrt( x2 + y2 ) ) );
2352
+
2353
+ }
2354
+
2355
+ return this._v3_1;
2356
+
2357
+ } else if ( camera.type == 'PerspectiveCamera' ) {
2358
+
2359
+ //unproject cursor on the near plane
2360
+ this._v2_1.copy( this.getCursorNDC( cursorX, cursorY, canvas ) );
2361
+
2362
+ this._v3_1.set( this._v2_1.x, this._v2_1.y, - 1 );
2363
+ this._v3_1.applyMatrix4( camera.projectionMatrixInverse );
2364
+
2365
+ const rayDir = this._v3_1.clone().normalize(); //unprojected ray direction
2366
+ const cameraGizmoDistance = camera.position.distanceTo( this._gizmos.position );
2367
+ const radius2 = Math.pow( tbRadius, 2 );
2368
+
2369
+ // camera
2370
+ // |\
2371
+ // | \
2372
+ // | \
2373
+ // h | \
2374
+ // | \
2375
+ // | \
2376
+ // _ _ | _ _ _\ _ _ near plane
2377
+ // l
2378
+
2379
+ const h = this._v3_1.z;
2380
+ const l = Math.sqrt( Math.pow( this._v3_1.x, 2 ) + Math.pow( this._v3_1.y, 2 ) );
2381
+
2382
+ if ( l == 0 ) {
2383
+
2384
+ //ray aligned with camera
2385
+ rayDir.set( this._v3_1.x, this._v3_1.y, tbRadius );
2386
+ return rayDir;
2387
+
2388
+ }
2389
+
2390
+ const m = h / l;
2391
+ const q = cameraGizmoDistance;
2392
+
2393
+ /*
2394
+ * calculate intersection point between unprojected ray and trackball surface
2395
+ *|y = m * x + q
2396
+ *|x^2 + y^2 = r^2
2397
+ *
2398
+ * (m^2 + 1) * x^2 + (2 * m * q) * x + q^2 - r^2 = 0
2399
+ */
2400
+ let a = Math.pow( m, 2 ) + 1;
2401
+ let b = 2 * m * q;
2402
+ let c = Math.pow( q, 2 ) - radius2;
2403
+ let delta = Math.pow( b, 2 ) - ( 4 * a * c );
2404
+
2405
+ if ( delta >= 0 ) {
2406
+
2407
+ //intersection with sphere
2408
+ this._v2_1.setX( ( - b - Math.sqrt( delta ) ) / ( 2 * a ) );
2409
+ this._v2_1.setY( m * this._v2_1.x + q );
2410
+
2411
+ const angle = MathUtils.RAD2DEG * this._v2_1.angle();
2412
+
2413
+ if ( angle >= 45 ) {
2414
+
2415
+ //if angle between intersection point and X' axis is >= 45°, return that point
2416
+ //otherwise, calculate intersection point with hyperboloid
2417
+
2418
+ const rayLength = Math.sqrt( Math.pow( this._v2_1.x, 2 ) + Math.pow( ( cameraGizmoDistance - this._v2_1.y ), 2 ) );
2419
+ rayDir.multiplyScalar( rayLength );
2420
+ rayDir.z += cameraGizmoDistance;
2421
+ return rayDir;
2422
+
2423
+ }
2424
+
2425
+ }
2426
+
2427
+ //intersection with hyperboloid
2428
+ /*
2429
+ *|y = m * x + q
2430
+ *|y = (1 / x) * (r^2 / 2)
2431
+ *
2432
+ * m * x^2 + q * x - r^2 / 2 = 0
2433
+ */
2434
+
2435
+ a = m;
2436
+ b = q;
2437
+ c = - radius2 * 0.5;
2438
+ delta = Math.pow( b, 2 ) - ( 4 * a * c );
2439
+ this._v2_1.setX( ( - b - Math.sqrt( delta ) ) / ( 2 * a ) );
2440
+ this._v2_1.setY( m * this._v2_1.x + q );
2441
+
2442
+ const rayLength = Math.sqrt( Math.pow( this._v2_1.x, 2 ) + Math.pow( ( cameraGizmoDistance - this._v2_1.y ), 2 ) );
2443
+
2444
+ rayDir.multiplyScalar( rayLength );
2445
+ rayDir.z += cameraGizmoDistance;
2446
+ return rayDir;
2447
+
2448
+ }
2449
+
2450
+ }
2451
+
2452
+
2453
+ /**
2454
+ * Unproject the cursor on the plane passing through the center of the trackball orthogonal to the camera
2455
+ * @param {Camera} camera The virtual camera
2456
+ * @param {Number} cursorX Cursor horizontal coordinate on screen
2457
+ * @param {Number} cursorY Cursor vertical coordinate on screen
2458
+ * @param {HTMLElement} canvas The canvas where the renderer draws its output
2459
+ * @param {Boolean} initialDistance If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only)
2460
+ * @returns {Vector3} The unprojected point on the trackball plane
2461
+ */
2462
+ unprojectOnTbPlane( camera, cursorX, cursorY, canvas, initialDistance = false ) {
2463
+
2464
+ if ( camera.type == 'OrthographicCamera' ) {
2465
+
2466
+ this._v2_1.copy( this.getCursorPosition( cursorX, cursorY, canvas ) );
2467
+ this._v3_1.set( this._v2_1.x, this._v2_1.y, 0 );
2468
+
2469
+ return this._v3_1.clone();
2470
+
2471
+ } else if ( camera.type == 'PerspectiveCamera' ) {
2472
+
2473
+ this._v2_1.copy( this.getCursorNDC( cursorX, cursorY, canvas ) );
2474
+
2475
+ //unproject cursor on the near plane
2476
+ this._v3_1.set( this._v2_1.x, this._v2_1.y, - 1 );
2477
+ this._v3_1.applyMatrix4( camera.projectionMatrixInverse );
2478
+
2479
+ const rayDir = this._v3_1.clone().normalize(); //unprojected ray direction
2480
+
2481
+ // camera
2482
+ // |\
2483
+ // | \
2484
+ // | \
2485
+ // h | \
2486
+ // | \
2487
+ // | \
2488
+ // _ _ | _ _ _\ _ _ near plane
2489
+ // l
2490
+
2491
+ const h = this._v3_1.z;
2492
+ const l = Math.sqrt( Math.pow( this._v3_1.x, 2 ) + Math.pow( this._v3_1.y, 2 ) );
2493
+ let cameraGizmoDistance;
2494
+
2495
+ if ( initialDistance ) {
2496
+
2497
+ cameraGizmoDistance = this._v3_1.setFromMatrixPosition( this._cameraMatrixState0 ).distanceTo( this._v3_2.setFromMatrixPosition( this._gizmoMatrixState0 ) );
2498
+
2499
+ } else {
2500
+
2501
+ cameraGizmoDistance = camera.position.distanceTo( this._gizmos.position );
2502
+
2503
+ }
2504
+
2505
+ /*
2506
+ * calculate intersection point between unprojected ray and the plane
2507
+ *|y = mx + q
2508
+ *|y = 0
2509
+ *
2510
+ * x = -q/m
2511
+ */
2512
+ if ( l == 0 ) {
2513
+
2514
+ //ray aligned with camera
2515
+ rayDir.set( 0, 0, 0 );
2516
+ return rayDir;
2517
+
2518
+ }
2519
+
2520
+ const m = h / l;
2521
+ const q = cameraGizmoDistance;
2522
+ const x = - q / m;
2523
+
2524
+ const rayLength = Math.sqrt( Math.pow( q, 2 ) + Math.pow( x, 2 ) );
2525
+ rayDir.multiplyScalar( rayLength );
2526
+ rayDir.z = 0;
2527
+ return rayDir;
2528
+
2529
+ }
2530
+
2531
+ }
2532
+
2533
+ /**
2534
+ * Update camera and gizmos state
2535
+ */
2536
+ updateMatrixState() {
2537
+
2538
+ //update camera and gizmos state
2539
+ this._cameraMatrixState.copy( this.camera.matrix );
2540
+ this._gizmoMatrixState.copy( this._gizmos.matrix );
2541
+
2542
+ if ( this.camera.isOrthographicCamera ) {
2543
+
2544
+ this._cameraProjectionState.copy( this.camera.projectionMatrix );
2545
+ this.camera.updateProjectionMatrix();
2546
+ this._zoomState = this.camera.zoom;
2547
+
2548
+ } else if ( this.camera.isPerspectiveCamera ) {
2549
+
2550
+ this._fovState = this.camera.fov;
2551
+
2552
+ }
2553
+
2554
+ }
2555
+
2556
+ /**
2557
+ * Update the trackball FSA
2558
+ * @param {STATE} newState New state of the FSA
2559
+ * @param {Boolean} updateMatrices If matriices state should be updated
2560
+ */
2561
+ updateTbState( newState, updateMatrices ) {
2562
+
2563
+ this._state = newState;
2564
+ if ( updateMatrices ) {
2565
+
2566
+ this.updateMatrixState();
2567
+
2568
+ }
2569
+
2570
+ }
2571
+
2572
+ update() {
2573
+
2574
+ const EPS = 0.000001;
2575
+
2576
+ if ( this.target.equals( this._currentTarget ) === false ) {
2577
+
2578
+ this._gizmos.position.copy( this.target ); //for correct radius calculation
2579
+ this._tbRadius = this.calculateTbRadius( this.camera );
2580
+ this.makeGizmos( this.target, this._tbRadius );
2581
+ this._currentTarget.copy( this.target );
2582
+
2583
+ }
2584
+
2585
+ //check min/max parameters
2586
+ if ( this.camera.isOrthographicCamera ) {
2587
+
2588
+ //check zoom
2589
+ if ( this.camera.zoom > this.maxZoom || this.camera.zoom < this.minZoom ) {
2590
+
2591
+ const newZoom = MathUtils.clamp( this.camera.zoom, this.minZoom, this.maxZoom );
2592
+ this.applyTransformMatrix( this.scale( newZoom / this.camera.zoom, this._gizmos.position, true ) );
2593
+
2594
+ }
2595
+
2596
+ } else if ( this.camera.isPerspectiveCamera ) {
2597
+
2598
+ //check distance
2599
+ const distance = this.camera.position.distanceTo( this._gizmos.position );
2600
+
2601
+ if ( distance > this.maxDistance + EPS || distance < this.minDistance - EPS ) {
2602
+
2603
+ const newDistance = MathUtils.clamp( distance, this.minDistance, this.maxDistance );
2604
+ this.applyTransformMatrix( this.scale( newDistance / distance, this._gizmos.position ) );
2605
+ this.updateMatrixState();
2606
+
2607
+ }
2608
+
2609
+ //check fov
2610
+ if ( this.camera.fov < this.minFov || this.camera.fov > this.maxFov ) {
2611
+
2612
+ this.camera.fov = MathUtils.clamp( this.camera.fov, this.minFov, this.maxFov );
2613
+ this.camera.updateProjectionMatrix();
2614
+
2615
+ }
2616
+
2617
+ const oldRadius = this._tbRadius;
2618
+ this._tbRadius = this.calculateTbRadius( this.camera );
2619
+
2620
+ if ( oldRadius < this._tbRadius - EPS || oldRadius > this._tbRadius + EPS ) {
2621
+
2622
+ const scale = ( this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z ) / 3;
2623
+ const newRadius = this._tbRadius / scale;
2624
+ const curve = new EllipseCurve( 0, 0, newRadius, newRadius );
2625
+ const points = curve.getPoints( this._curvePts );
2626
+ const curveGeometry = new BufferGeometry().setFromPoints( points );
2627
+
2628
+ for ( const gizmo in this._gizmos.children ) {
2629
+
2630
+ this._gizmos.children[ gizmo ].geometry = curveGeometry;
2631
+
2632
+ }
2633
+
2634
+ }
2635
+
2636
+ }
2637
+
2638
+ this.camera.lookAt( this._gizmos.position );
2639
+
2640
+ }
2641
+
2642
+ setStateFromJSON( json ) {
2643
+
2644
+ const state = JSON.parse( json );
2645
+
2646
+ if ( state.arcballState != undefined ) {
2647
+
2648
+ this._cameraMatrixState.fromArray( state.arcballState.cameraMatrix.elements );
2649
+ this._cameraMatrixState.decompose( this.camera.position, this.camera.quaternion, this.camera.scale );
2650
+
2651
+ this.camera.up.copy( state.arcballState.cameraUp );
2652
+ this.camera.near = state.arcballState.cameraNear;
2653
+ this.camera.far = state.arcballState.cameraFar;
2654
+
2655
+ this.camera.zoom = state.arcballState.cameraZoom;
2656
+
2657
+ if ( this.camera.isPerspectiveCamera ) {
2658
+
2659
+ this.camera.fov = state.arcballState.cameraFov;
2660
+
2661
+ }
2662
+
2663
+ this._gizmoMatrixState.fromArray( state.arcballState.gizmoMatrix.elements );
2664
+ this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale );
2665
+
2666
+ this.camera.updateMatrix();
2667
+ this.camera.updateProjectionMatrix();
2668
+
2669
+ this._gizmos.updateMatrix();
2670
+
2671
+ this._tbRadius = this.calculateTbRadius( this.camera );
2672
+ const gizmoTmp = new Matrix4().copy( this._gizmoMatrixState0 );
2673
+ this.makeGizmos( this._gizmos.position, this._tbRadius );
2674
+ this._gizmoMatrixState0.copy( gizmoTmp );
2675
+
2676
+ this.camera.lookAt( this._gizmos.position );
2677
+ this.updateTbState( STATE.IDLE, false );
2678
+
2679
+ this.dispatchEvent( _changeEvent );
2680
+
2681
+ }
2682
+
2683
+ }
2684
+
2685
+ }
2686
+
2687
+ //listeners
2688
+
2689
+ function onWindowResize() {
2690
+
2691
+ const scale = ( this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z ) / 3;
2692
+ this._tbRadius = this.calculateTbRadius( this.camera );
2693
+
2694
+ const newRadius = this._tbRadius / scale;
2695
+ const curve = new EllipseCurve( 0, 0, newRadius, newRadius );
2696
+ const points = curve.getPoints( this._curvePts );
2697
+ const curveGeometry = new BufferGeometry().setFromPoints( points );
2698
+
2699
+
2700
+ for ( const gizmo in this._gizmos.children ) {
2701
+
2702
+ this._gizmos.children[ gizmo ].geometry = curveGeometry;
2703
+
2704
+ }
2705
+
2706
+ this.dispatchEvent( _changeEvent );
2707
+
2708
+ }
2709
+
2710
+ function onContextMenu( event ) {
2711
+
2712
+ if ( ! this.enabled ) {
2713
+
2714
+ return;
2715
+
2716
+ }
2717
+
2718
+ for ( let i = 0; i < this.mouseActions.length; i ++ ) {
2719
+
2720
+ if ( this.mouseActions[ i ].mouse == 2 ) {
2721
+
2722
+ //prevent only if button 2 is actually used
2723
+ event.preventDefault();
2724
+ break;
2725
+
2726
+ }
2727
+
2728
+ }
2729
+
2730
+ }
2731
+
2732
+ function onPointerCancel() {
2733
+
2734
+ this._touchStart.splice( 0, this._touchStart.length );
2735
+ this._touchCurrent.splice( 0, this._touchCurrent.length );
2736
+ this._input = INPUT.NONE;
2737
+
2738
+ }
2739
+
2740
+ function onPointerDown( event ) {
2741
+
2742
+ if ( event.button == 0 && event.isPrimary ) {
2743
+
2744
+ this._downValid = true;
2745
+ this._downEvents.push( event );
2746
+ this._downStart = performance.now();
2747
+
2748
+ } else {
2749
+
2750
+ this._downValid = false;
2751
+
2752
+ }
2753
+
2754
+ if ( event.pointerType == 'touch' && this._input != INPUT.CURSOR ) {
2755
+
2756
+ this._touchStart.push( event );
2757
+ this._touchCurrent.push( event );
2758
+
2759
+ switch ( this._input ) {
2760
+
2761
+ case INPUT.NONE:
2762
+
2763
+ //singleStart
2764
+ this._input = INPUT.ONE_FINGER;
2765
+ this.onSinglePanStart( event, 'ROTATE' );
2766
+
2767
+ window.addEventListener( 'pointermove', this._onPointerMove );
2768
+ window.addEventListener( 'pointerup', this._onPointerUp );
2769
+
2770
+ break;
2771
+
2772
+ case INPUT.ONE_FINGER:
2773
+ case INPUT.ONE_FINGER_SWITCHED:
2774
+
2775
+ //doubleStart
2776
+ this._input = INPUT.TWO_FINGER;
2777
+
2778
+ this.onRotateStart();
2779
+ this.onPinchStart();
2780
+ this.onDoublePanStart();
2781
+
2782
+ break;
2783
+
2784
+ case INPUT.TWO_FINGER:
2785
+
2786
+ //multipleStart
2787
+ this._input = INPUT.MULT_FINGER;
2788
+ this.onTriplePanStart( event );
2789
+ break;
2790
+
2791
+ }
2792
+
2793
+ } else if ( event.pointerType != 'touch' && this._input == INPUT.NONE ) {
2794
+
2795
+ let modifier = null;
2796
+
2797
+ if ( event.ctrlKey || event.metaKey ) {
2798
+
2799
+ modifier = 'CTRL';
2800
+
2801
+ } else if ( event.shiftKey ) {
2802
+
2803
+ modifier = 'SHIFT';
2804
+
2805
+ }
2806
+
2807
+ this._mouseOp = this.getOpFromAction( event.button, modifier );
2808
+ if ( this._mouseOp != null ) {
2809
+
2810
+ window.addEventListener( 'pointermove', this._onPointerMove );
2811
+ window.addEventListener( 'pointerup', this._onPointerUp );
2812
+
2813
+ //singleStart
2814
+ this._input = INPUT.CURSOR;
2815
+ this._button = event.button;
2816
+ this.onSinglePanStart( event, this._mouseOp );
2817
+
2818
+ }
2819
+
2820
+ }
2821
+
2822
+ }
2823
+
2824
+ function onPointerMove( event ) {
2825
+
2826
+ if ( event.pointerType == 'touch' && this._input != INPUT.CURSOR ) {
2827
+
2828
+ switch ( this._input ) {
2829
+
2830
+ case INPUT.ONE_FINGER:
2831
+
2832
+ //singleMove
2833
+ this.updateTouchEvent( event );
2834
+
2835
+ this.onSinglePanMove( event, STATE.ROTATE );
2836
+ break;
2837
+
2838
+ case INPUT.ONE_FINGER_SWITCHED:
2839
+
2840
+ const movement = this.calculatePointersDistance( this._touchCurrent[ 0 ], event ) * this._devPxRatio;
2841
+
2842
+ if ( movement >= this._switchSensibility ) {
2843
+
2844
+ //singleMove
2845
+ this._input = INPUT.ONE_FINGER;
2846
+ this.updateTouchEvent( event );
2847
+
2848
+ this.onSinglePanStart( event, 'ROTATE' );
2849
+ break;
2850
+
2851
+ }
2852
+
2853
+ break;
2854
+
2855
+ case INPUT.TWO_FINGER:
2856
+
2857
+ //rotate/pan/pinchMove
2858
+ this.updateTouchEvent( event );
2859
+
2860
+ this.onRotateMove();
2861
+ this.onPinchMove();
2862
+ this.onDoublePanMove();
2863
+
2864
+ break;
2865
+
2866
+ case INPUT.MULT_FINGER:
2867
+
2868
+ //multMove
2869
+ this.updateTouchEvent( event );
2870
+
2871
+ this.onTriplePanMove( event );
2872
+ break;
2873
+
2874
+ }
2875
+
2876
+ } else if ( event.pointerType != 'touch' && this._input == INPUT.CURSOR ) {
2877
+
2878
+ let modifier = null;
2879
+
2880
+ if ( event.ctrlKey || event.metaKey ) {
2881
+
2882
+ modifier = 'CTRL';
2883
+
2884
+ } else if ( event.shiftKey ) {
2885
+
2886
+ modifier = 'SHIFT';
2887
+
2888
+ }
2889
+
2890
+ const mouseOpState = this.getOpStateFromAction( this._button, modifier );
2891
+
2892
+ if ( mouseOpState != null ) {
2893
+
2894
+ this.onSinglePanMove( event, mouseOpState );
2895
+
2896
+ }
2897
+
2898
+ }
2899
+
2900
+ //checkDistance
2901
+ if ( this._downValid ) {
2902
+
2903
+ const movement = this.calculatePointersDistance( this._downEvents[ this._downEvents.length - 1 ], event ) * this._devPxRatio;
2904
+ if ( movement > this._movementThreshold ) {
2905
+
2906
+ this._downValid = false;
2907
+
2908
+ }
2909
+
2910
+ }
2911
+
2912
+ }
2913
+
2914
+ function onPointerUp( event ) {
2915
+
2916
+ if ( event.pointerType == 'touch' && this._input != INPUT.CURSOR ) {
2917
+
2918
+ const nTouch = this._touchCurrent.length;
2919
+
2920
+ for ( let i = 0; i < nTouch; i ++ ) {
2921
+
2922
+ if ( this._touchCurrent[ i ].pointerId == event.pointerId ) {
2923
+
2924
+ this._touchCurrent.splice( i, 1 );
2925
+ this._touchStart.splice( i, 1 );
2926
+ break;
2927
+
2928
+ }
2929
+
2930
+ }
2931
+
2932
+ switch ( this._input ) {
2933
+
2934
+ case INPUT.ONE_FINGER:
2935
+ case INPUT.ONE_FINGER_SWITCHED:
2936
+
2937
+ //singleEnd
2938
+ window.removeEventListener( 'pointermove', this._onPointerMove );
2939
+ window.removeEventListener( 'pointerup', this._onPointerUp );
2940
+
2941
+ this._input = INPUT.NONE;
2942
+ this.onSinglePanEnd();
2943
+
2944
+ break;
2945
+
2946
+ case INPUT.TWO_FINGER:
2947
+
2948
+ //doubleEnd
2949
+ this.onDoublePanEnd( event );
2950
+ this.onPinchEnd( event );
2951
+ this.onRotateEnd( event );
2952
+
2953
+ //switching to singleStart
2954
+ this._input = INPUT.ONE_FINGER_SWITCHED;
2955
+
2956
+ break;
2957
+
2958
+ case INPUT.MULT_FINGER:
2959
+
2960
+ if ( this._touchCurrent.length == 0 ) {
2961
+
2962
+ window.removeEventListener( 'pointermove', this._onPointerMove );
2963
+ window.removeEventListener( 'pointerup', this._onPointerUp );
2964
+
2965
+ //multCancel
2966
+ this._input = INPUT.NONE;
2967
+ this.onTriplePanEnd();
2968
+
2969
+ }
2970
+
2971
+ break;
2972
+
2973
+ }
2974
+
2975
+ } else if ( event.pointerType != 'touch' && this._input == INPUT.CURSOR ) {
2976
+
2977
+ window.removeEventListener( 'pointermove', this._onPointerMove );
2978
+ window.removeEventListener( 'pointerup', this._onPointerUp );
2979
+
2980
+ this._input = INPUT.NONE;
2981
+ this.onSinglePanEnd();
2982
+ this._button = - 1;
2983
+
2984
+ }
2985
+
2986
+ if ( event.isPrimary ) {
2987
+
2988
+ if ( this._downValid ) {
2989
+
2990
+ const downTime = event.timeStamp - this._downEvents[ this._downEvents.length - 1 ].timeStamp;
2991
+
2992
+ if ( downTime <= this._maxDownTime ) {
2993
+
2994
+ if ( this._nclicks == 0 ) {
2995
+
2996
+ //first valid click detected
2997
+ this._nclicks = 1;
2998
+ this._clickStart = performance.now();
2999
+
3000
+ } else {
3001
+
3002
+ const clickInterval = event.timeStamp - this._clickStart;
3003
+ const movement = this.calculatePointersDistance( this._downEvents[ 1 ], this._downEvents[ 0 ] ) * this._devPxRatio;
3004
+
3005
+ if ( clickInterval <= this._maxInterval && movement <= this._posThreshold ) {
3006
+
3007
+ //second valid click detected
3008
+ //fire double tap and reset values
3009
+ this._nclicks = 0;
3010
+ this._downEvents.splice( 0, this._downEvents.length );
3011
+ this.onDoubleTap( event );
3012
+
3013
+ } else {
3014
+
3015
+ //new 'first click'
3016
+ this._nclicks = 1;
3017
+ this._downEvents.shift();
3018
+ this._clickStart = performance.now();
3019
+
3020
+ }
3021
+
3022
+ }
3023
+
3024
+ } else {
3025
+
3026
+ this._downValid = false;
3027
+ this._nclicks = 0;
3028
+ this._downEvents.splice( 0, this._downEvents.length );
3029
+
3030
+ }
3031
+
3032
+ } else {
3033
+
3034
+ this._nclicks = 0;
3035
+ this._downEvents.splice( 0, this._downEvents.length );
3036
+
3037
+ }
3038
+
3039
+ }
3040
+
3041
+ }
3042
+
3043
+ function onWheel( event ) {
3044
+
3045
+ if ( this.enabled && this.enableZoom ) {
3046
+
3047
+ let modifier = null;
3048
+
3049
+ if ( event.ctrlKey || event.metaKey ) {
3050
+
3051
+ modifier = 'CTRL';
3052
+
3053
+ } else if ( event.shiftKey ) {
3054
+
3055
+ modifier = 'SHIFT';
3056
+
3057
+ }
3058
+
3059
+ const mouseOp = this.getOpFromAction( 'WHEEL', modifier );
3060
+
3061
+ if ( mouseOp != null ) {
3062
+
3063
+ event.preventDefault();
3064
+ this.dispatchEvent( _startEvent );
3065
+
3066
+ const notchDeltaY = 125; //distance of one notch of mouse wheel
3067
+ let sgn = event.deltaY / notchDeltaY;
3068
+
3069
+ let size = 1;
3070
+
3071
+ if ( sgn > 0 ) {
3072
+
3073
+ size = 1 / this.scaleFactor;
3074
+
3075
+ } else if ( sgn < 0 ) {
3076
+
3077
+ size = this.scaleFactor;
3078
+
3079
+ }
3080
+
3081
+ switch ( mouseOp ) {
3082
+
3083
+ case 'ZOOM':
3084
+
3085
+ this.updateTbState( STATE.SCALE, true );
3086
+
3087
+ if ( sgn > 0 ) {
3088
+
3089
+ size = 1 / ( Math.pow( this.scaleFactor, sgn ) );
3090
+
3091
+ } else if ( sgn < 0 ) {
3092
+
3093
+ size = Math.pow( this.scaleFactor, - sgn );
3094
+
3095
+ }
3096
+
3097
+ if ( this.cursorZoom && this.enablePan ) {
3098
+
3099
+ let scalePoint;
3100
+
3101
+ if ( this.camera.isOrthographicCamera ) {
3102
+
3103
+ scalePoint = this.unprojectOnTbPlane( this.camera, event.clientX, event.clientY, this.domElement ).applyQuaternion( this.camera.quaternion ).multiplyScalar( 1 / this.camera.zoom ).add( this._gizmos.position );
3104
+
3105
+ } else if ( this.camera.isPerspectiveCamera ) {
3106
+
3107
+ scalePoint = this.unprojectOnTbPlane( this.camera, event.clientX, event.clientY, this.domElement ).applyQuaternion( this.camera.quaternion ).add( this._gizmos.position );
3108
+
3109
+ }
3110
+
3111
+ this.applyTransformMatrix( this.scale( size, scalePoint ) );
3112
+
3113
+ } else {
3114
+
3115
+ this.applyTransformMatrix( this.scale( size, this._gizmos.position ) );
3116
+
3117
+ }
3118
+
3119
+ if ( this._grid != null ) {
3120
+
3121
+ this.disposeGrid();
3122
+ this.drawGrid();
3123
+
3124
+ }
3125
+
3126
+ this.updateTbState( STATE.IDLE, false );
3127
+
3128
+ this.dispatchEvent( _changeEvent );
3129
+ this.dispatchEvent( _endEvent );
3130
+
3131
+ break;
3132
+
3133
+ case 'FOV':
3134
+
3135
+ if ( this.camera.isPerspectiveCamera ) {
3136
+
3137
+ this.updateTbState( STATE.FOV, true );
3138
+
3139
+
3140
+ //Vertigo effect
3141
+
3142
+ // fov / 2
3143
+ // |\
3144
+ // | \
3145
+ // | \
3146
+ // x | \
3147
+ // | \
3148
+ // | \
3149
+ // | _ _ _\
3150
+ // y
3151
+
3152
+ //check for iOs shift shortcut
3153
+ if ( event.deltaX != 0 ) {
3154
+
3155
+ sgn = event.deltaX / notchDeltaY;
3156
+
3157
+ size = 1;
3158
+
3159
+ if ( sgn > 0 ) {
3160
+
3161
+ size = 1 / ( Math.pow( this.scaleFactor, sgn ) );
3162
+
3163
+ } else if ( sgn < 0 ) {
3164
+
3165
+ size = Math.pow( this.scaleFactor, - sgn );
3166
+
3167
+ }
3168
+
3169
+ }
3170
+
3171
+ this._v3_1.setFromMatrixPosition( this._cameraMatrixState );
3172
+ const x = this._v3_1.distanceTo( this._gizmos.position );
3173
+ let xNew = x / size; //distance between camera and gizmos if scale(size, scalepoint) would be performed
3174
+
3175
+ //check min and max distance
3176
+ xNew = MathUtils.clamp( xNew, this.minDistance, this.maxDistance );
3177
+
3178
+ const y = x * Math.tan( MathUtils.DEG2RAD * this.camera.fov * 0.5 );
3179
+
3180
+ //calculate new fov
3181
+ let newFov = MathUtils.RAD2DEG * ( Math.atan( y / xNew ) * 2 );
3182
+
3183
+ //check min and max fov
3184
+ if ( newFov > this.maxFov ) {
3185
+
3186
+ newFov = this.maxFov;
3187
+
3188
+ } else if ( newFov < this.minFov ) {
3189
+
3190
+ newFov = this.minFov;
3191
+
3192
+ }
3193
+
3194
+ const newDistance = y / Math.tan( MathUtils.DEG2RAD * ( newFov / 2 ) );
3195
+ size = x / newDistance;
3196
+
3197
+ this.setFov( newFov );
3198
+ this.applyTransformMatrix( this.scale( size, this._gizmos.position, false ) );
3199
+
3200
+ }
3201
+
3202
+ if ( this._grid != null ) {
3203
+
3204
+ this.disposeGrid();
3205
+ this.drawGrid();
3206
+
3207
+ }
3208
+
3209
+ this.updateTbState( STATE.IDLE, false );
3210
+
3211
+ this.dispatchEvent( _changeEvent );
3212
+ this.dispatchEvent( _endEvent );
3213
+
3214
+ break;
3215
+
3216
+ }
3217
+
3218
+ }
3219
+
3220
+ }
3221
+
3222
+ }
3223
+
3224
+ export { ArcballControls };