@vyr/three 0.0.10 → 0.0.11

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 (379) hide show
  1. package/build/actor/ComposerServiceActor.d.ts +23 -0
  2. package/build/actor/ComposerServiceActor.js +93 -0
  3. package/build/actor/ComposerServiceActor.js.map +1 -0
  4. package/build/actor/GeometryActor.d.ts +7 -0
  5. package/build/actor/GeometryActor.js +10 -0
  6. package/build/actor/GeometryActor.js.map +1 -0
  7. package/build/actor/HTMLConvertActor.d.ts +14 -0
  8. package/build/actor/HTMLConvertActor.js +52 -0
  9. package/build/actor/HTMLConvertActor.js.map +1 -0
  10. package/build/actor/MaterialActor.d.ts +7 -0
  11. package/build/actor/MaterialActor.js +10 -0
  12. package/build/actor/MaterialActor.js.map +1 -0
  13. package/build/actor/NodeActor.d.ts +9 -0
  14. package/build/actor/NodeActor.js +21 -0
  15. package/build/actor/NodeActor.js.map +1 -0
  16. package/build/actor/OrbitControllerActor.d.ts +20 -0
  17. package/build/actor/OrbitControllerActor.js +103 -0
  18. package/build/actor/OrbitControllerActor.js.map +1 -0
  19. package/build/actor/PassActor.d.ts +8 -0
  20. package/build/actor/PassActor.js +16 -0
  21. package/build/actor/PassActor.js.map +1 -0
  22. package/build/actor/SceneServiceActor.d.ts +21 -0
  23. package/build/actor/SceneServiceActor.js +112 -0
  24. package/build/actor/SceneServiceActor.js.map +1 -0
  25. package/build/actor/TextureActor.d.ts +7 -0
  26. package/build/actor/TextureActor.js +10 -0
  27. package/build/actor/TextureActor.js.map +1 -0
  28. package/build/actor/TransformControllerActor.d.ts +10 -0
  29. package/build/actor/TransformControllerActor.js +19 -0
  30. package/build/actor/TransformControllerActor.js.map +1 -0
  31. package/build/actor/index.d.ts +8 -0
  32. package/build/actor/index.js +11 -0
  33. package/build/actor/index.js.map +1 -0
  34. package/build/asset/index.d.ts +1 -0
  35. package/build/asset/index.js +219 -0
  36. package/build/asset/index.js.map +1 -0
  37. package/build/controls/CameraControls.d.ts +647 -0
  38. package/build/controls/CameraControls.js +2332 -0
  39. package/build/controls/CameraControls.js.map +1 -0
  40. package/build/controls/TransformControls.d.ts +72 -0
  41. package/build/controls/TransformControls.js +1359 -0
  42. package/build/controls/TransformControls.js.map +1 -0
  43. package/build/controls/index.d.ts +2 -0
  44. package/build/controls/index.js +3 -0
  45. package/build/controls/index.js.map +1 -0
  46. package/build/descriptor/ComposerServiceDescriptor.d.ts +33 -0
  47. package/build/descriptor/ComposerServiceDescriptor.js +42 -0
  48. package/build/descriptor/ComposerServiceDescriptor.js.map +1 -0
  49. package/build/descriptor/GeoMapDescriptor.d.ts +12 -0
  50. package/build/descriptor/GeoMapDescriptor.js +22 -0
  51. package/build/descriptor/GeoMapDescriptor.js.map +1 -0
  52. package/build/descriptor/HTMLConvertDescriptor.d.ts +6 -0
  53. package/build/descriptor/HTMLConvertDescriptor.js +10 -0
  54. package/build/descriptor/HTMLConvertDescriptor.js.map +1 -0
  55. package/build/descriptor/InstancedMeshDescriptor.d.ts +12 -0
  56. package/build/descriptor/InstancedMeshDescriptor.js +12 -0
  57. package/build/descriptor/InstancedMeshDescriptor.js.map +1 -0
  58. package/build/descriptor/MeshDescriptor.d.ts +8 -0
  59. package/build/descriptor/MeshDescriptor.js +14 -0
  60. package/build/descriptor/MeshDescriptor.js.map +1 -0
  61. package/build/descriptor/ModelDescriptor.d.ts +7 -0
  62. package/build/descriptor/ModelDescriptor.js +12 -0
  63. package/build/descriptor/ModelDescriptor.js.map +1 -0
  64. package/build/descriptor/OrbitControllerDescriptor.d.ts +54 -0
  65. package/build/descriptor/OrbitControllerDescriptor.js +73 -0
  66. package/build/descriptor/OrbitControllerDescriptor.js.map +1 -0
  67. package/build/descriptor/OrthographicCameraDescriptor.d.ts +6 -0
  68. package/build/descriptor/OrthographicCameraDescriptor.js +10 -0
  69. package/build/descriptor/OrthographicCameraDescriptor.js.map +1 -0
  70. package/build/descriptor/ParticleDescriptor.d.ts +55 -0
  71. package/build/descriptor/ParticleDescriptor.js +85 -0
  72. package/build/descriptor/ParticleDescriptor.js.map +1 -0
  73. package/build/descriptor/PassDescriptor.d.ts +16 -0
  74. package/build/descriptor/PassDescriptor.js +23 -0
  75. package/build/descriptor/PassDescriptor.js.map +1 -0
  76. package/build/descriptor/PerspectiveCameraDescriptor.d.ts +7 -0
  77. package/build/descriptor/PerspectiveCameraDescriptor.js +12 -0
  78. package/build/descriptor/PerspectiveCameraDescriptor.js.map +1 -0
  79. package/build/descriptor/PointsDescriptor.d.ts +8 -0
  80. package/build/descriptor/PointsDescriptor.js +14 -0
  81. package/build/descriptor/PointsDescriptor.js.map +1 -0
  82. package/build/descriptor/SceneServiceDescriptor.d.ts +20 -0
  83. package/build/descriptor/SceneServiceDescriptor.js +35 -0
  84. package/build/descriptor/SceneServiceDescriptor.js.map +1 -0
  85. package/build/descriptor/SpriteDescriptor.d.ts +8 -0
  86. package/build/descriptor/SpriteDescriptor.js +14 -0
  87. package/build/descriptor/SpriteDescriptor.js.map +1 -0
  88. package/build/descriptor/TextDescriptor.d.ts +21 -0
  89. package/build/descriptor/TextDescriptor.js +37 -0
  90. package/build/descriptor/TextDescriptor.js.map +1 -0
  91. package/build/descriptor/TransformControllerDescriptor.d.ts +20 -0
  92. package/build/descriptor/TransformControllerDescriptor.js +22 -0
  93. package/build/descriptor/TransformControllerDescriptor.js.map +1 -0
  94. package/build/descriptor/animation/AnimationActionDescriptor.d.ts +27 -0
  95. package/build/descriptor/animation/AnimationActionDescriptor.js +46 -0
  96. package/build/descriptor/animation/AnimationActionDescriptor.js.map +1 -0
  97. package/build/descriptor/geometry/BoxGeometryDescriptor.d.ts +14 -0
  98. package/build/descriptor/geometry/BoxGeometryDescriptor.js +23 -0
  99. package/build/descriptor/geometry/BoxGeometryDescriptor.js.map +1 -0
  100. package/build/descriptor/geometry/BufferGeometryDescriptor.d.ts +8 -0
  101. package/build/descriptor/geometry/BufferGeometryDescriptor.js +12 -0
  102. package/build/descriptor/geometry/BufferGeometryDescriptor.js.map +1 -0
  103. package/build/descriptor/geometry/CircleGeometryDescriptor.d.ts +12 -0
  104. package/build/descriptor/geometry/CircleGeometryDescriptor.js +19 -0
  105. package/build/descriptor/geometry/CircleGeometryDescriptor.js.map +1 -0
  106. package/build/descriptor/geometry/CylinderGeometryDescriptor.d.ts +16 -0
  107. package/build/descriptor/geometry/CylinderGeometryDescriptor.js +27 -0
  108. package/build/descriptor/geometry/CylinderGeometryDescriptor.js.map +1 -0
  109. package/build/descriptor/geometry/ExtrudeGeometryDescriptor.d.ts +18 -0
  110. package/build/descriptor/geometry/ExtrudeGeometryDescriptor.js +33 -0
  111. package/build/descriptor/geometry/ExtrudeGeometryDescriptor.js.map +1 -0
  112. package/build/descriptor/geometry/GeometryDescriptor.d.ts +5 -0
  113. package/build/descriptor/geometry/GeometryDescriptor.js +7 -0
  114. package/build/descriptor/geometry/GeometryDescriptor.js.map +1 -0
  115. package/build/descriptor/geometry/PlaneGeometryDescriptor.d.ts +12 -0
  116. package/build/descriptor/geometry/PlaneGeometryDescriptor.js +19 -0
  117. package/build/descriptor/geometry/PlaneGeometryDescriptor.js.map +1 -0
  118. package/build/descriptor/geometry/RingGeometryDescriptor.d.ts +14 -0
  119. package/build/descriptor/geometry/RingGeometryDescriptor.js +23 -0
  120. package/build/descriptor/geometry/RingGeometryDescriptor.js.map +1 -0
  121. package/build/descriptor/geometry/SphereGeometryDescriptor.d.ts +14 -0
  122. package/build/descriptor/geometry/SphereGeometryDescriptor.js +24 -0
  123. package/build/descriptor/geometry/SphereGeometryDescriptor.js.map +1 -0
  124. package/build/descriptor/geometry/SurfaceGeometryDescriptor.d.ts +8 -0
  125. package/build/descriptor/geometry/SurfaceGeometryDescriptor.js +12 -0
  126. package/build/descriptor/geometry/SurfaceGeometryDescriptor.js.map +1 -0
  127. package/build/descriptor/geometry/TubeGeometryDescriptor.d.ts +13 -0
  128. package/build/descriptor/geometry/TubeGeometryDescriptor.js +23 -0
  129. package/build/descriptor/geometry/TubeGeometryDescriptor.js.map +1 -0
  130. package/build/descriptor/helper/AxesHelperDescriptor.d.ts +5 -0
  131. package/build/descriptor/helper/AxesHelperDescriptor.js +7 -0
  132. package/build/descriptor/helper/AxesHelperDescriptor.js.map +1 -0
  133. package/build/descriptor/index.d.ts +43 -0
  134. package/build/descriptor/index.js +46 -0
  135. package/build/descriptor/index.js.map +1 -0
  136. package/build/descriptor/light/AmbientLightDescriptor.d.ts +5 -0
  137. package/build/descriptor/light/AmbientLightDescriptor.js +7 -0
  138. package/build/descriptor/light/AmbientLightDescriptor.js.map +1 -0
  139. package/build/descriptor/light/DirectionalLightDescriptor.d.ts +20 -0
  140. package/build/descriptor/light/DirectionalLightDescriptor.js +21 -0
  141. package/build/descriptor/light/DirectionalLightDescriptor.js.map +1 -0
  142. package/build/descriptor/light/HemisphereLightDescriptor.d.ts +8 -0
  143. package/build/descriptor/light/HemisphereLightDescriptor.js +12 -0
  144. package/build/descriptor/light/HemisphereLightDescriptor.js.map +1 -0
  145. package/build/descriptor/light/LightDescriptor.d.ts +8 -0
  146. package/build/descriptor/light/LightDescriptor.js +14 -0
  147. package/build/descriptor/light/LightDescriptor.js.map +1 -0
  148. package/build/descriptor/light/PointLightDescriptor.d.ts +15 -0
  149. package/build/descriptor/light/PointLightDescriptor.js +21 -0
  150. package/build/descriptor/light/PointLightDescriptor.js.map +1 -0
  151. package/build/descriptor/light/RectAreaLightDescriptor.d.ts +10 -0
  152. package/build/descriptor/light/RectAreaLightDescriptor.js +16 -0
  153. package/build/descriptor/light/RectAreaLightDescriptor.js.map +1 -0
  154. package/build/descriptor/light/SpotLightDescriptor.d.ts +18 -0
  155. package/build/descriptor/light/SpotLightDescriptor.js +27 -0
  156. package/build/descriptor/light/SpotLightDescriptor.js.map +1 -0
  157. package/build/descriptor/material/MaterialDescriptor.d.ts +54 -0
  158. package/build/descriptor/material/MaterialDescriptor.js +73 -0
  159. package/build/descriptor/material/MaterialDescriptor.js.map +1 -0
  160. package/build/descriptor/material/MeshBasicMaterialDescriptor.d.ts +35 -0
  161. package/build/descriptor/material/MeshBasicMaterialDescriptor.js +51 -0
  162. package/build/descriptor/material/MeshBasicMaterialDescriptor.js.map +1 -0
  163. package/build/descriptor/material/MeshPhongMaterialDescriptor.d.ts +65 -0
  164. package/build/descriptor/material/MeshPhongMaterialDescriptor.js +98 -0
  165. package/build/descriptor/material/MeshPhongMaterialDescriptor.js.map +1 -0
  166. package/build/descriptor/material/MeshStandardMaterialDescriptor.d.ts +63 -0
  167. package/build/descriptor/material/MeshStandardMaterialDescriptor.js +95 -0
  168. package/build/descriptor/material/MeshStandardMaterialDescriptor.js.map +1 -0
  169. package/build/descriptor/material/PointsMaterialDescriptor.d.ts +19 -0
  170. package/build/descriptor/material/PointsMaterialDescriptor.js +29 -0
  171. package/build/descriptor/material/PointsMaterialDescriptor.js.map +1 -0
  172. package/build/descriptor/material/ShaderMaterialDescriptor.d.ts +24 -0
  173. package/build/descriptor/material/ShaderMaterialDescriptor.js +26 -0
  174. package/build/descriptor/material/ShaderMaterialDescriptor.js.map +1 -0
  175. package/build/descriptor/material/ShadowMaterialDescriptor.d.ts +11 -0
  176. package/build/descriptor/material/ShadowMaterialDescriptor.js +17 -0
  177. package/build/descriptor/material/ShadowMaterialDescriptor.js.map +1 -0
  178. package/build/descriptor/material/SpriteMaterialDescriptor.d.ts +19 -0
  179. package/build/descriptor/material/SpriteMaterialDescriptor.js +29 -0
  180. package/build/descriptor/material/SpriteMaterialDescriptor.js.map +1 -0
  181. package/build/descriptor/texture/TextureDescriptor.d.ts +80 -0
  182. package/build/descriptor/texture/TextureDescriptor.js +103 -0
  183. package/build/descriptor/texture/TextureDescriptor.js.map +1 -0
  184. package/build/index.d.ts +9 -0
  185. package/build/index.js +10 -0
  186. package/build/index.js.map +1 -0
  187. package/build/interpreter/ComposerServiceInterpreter.d.ts +0 -0
  188. package/build/interpreter/ComposerServiceInterpreter.js +22 -0
  189. package/build/interpreter/ComposerServiceInterpreter.js.map +1 -0
  190. package/build/interpreter/GeoMapInterpreter.d.ts +36 -0
  191. package/build/interpreter/GeoMapInterpreter.js +216 -0
  192. package/build/interpreter/GeoMapInterpreter.js.map +1 -0
  193. package/build/interpreter/HTMLConvertInterpreter.d.ts +12 -0
  194. package/build/interpreter/HTMLConvertInterpreter.js +25 -0
  195. package/build/interpreter/HTMLConvertInterpreter.js.map +1 -0
  196. package/build/interpreter/InstancedMeshInterpreter.d.ts +19 -0
  197. package/build/interpreter/InstancedMeshInterpreter.js +67 -0
  198. package/build/interpreter/InstancedMeshInterpreter.js.map +1 -0
  199. package/build/interpreter/MeshInterpreter.d.ts +9 -0
  200. package/build/interpreter/MeshInterpreter.js +21 -0
  201. package/build/interpreter/MeshInterpreter.js.map +1 -0
  202. package/build/interpreter/ModelInterpreter.d.ts +16 -0
  203. package/build/interpreter/ModelInterpreter.js +52 -0
  204. package/build/interpreter/ModelInterpreter.js.map +1 -0
  205. package/build/interpreter/NodeInterpreter.d.ts +18 -0
  206. package/build/interpreter/NodeInterpreter.js +53 -0
  207. package/build/interpreter/NodeInterpreter.js.map +1 -0
  208. package/build/interpreter/OrbitControllerInterpreter.d.ts +13 -0
  209. package/build/interpreter/OrbitControllerInterpreter.js +38 -0
  210. package/build/interpreter/OrbitControllerInterpreter.js.map +1 -0
  211. package/build/interpreter/OrthographicCameraInterpreter.d.ts +8 -0
  212. package/build/interpreter/OrthographicCameraInterpreter.js +9 -0
  213. package/build/interpreter/OrthographicCameraInterpreter.js.map +1 -0
  214. package/build/interpreter/ParticleInterpreter.d.ts +24 -0
  215. package/build/interpreter/ParticleInterpreter.js +180 -0
  216. package/build/interpreter/ParticleInterpreter.js.map +1 -0
  217. package/build/interpreter/PassInterpreter.d.ts +0 -0
  218. package/build/interpreter/PassInterpreter.js +36 -0
  219. package/build/interpreter/PassInterpreter.js.map +1 -0
  220. package/build/interpreter/PerspectiveCameraInterpreter.d.ts +13 -0
  221. package/build/interpreter/PerspectiveCameraInterpreter.js +26 -0
  222. package/build/interpreter/PerspectiveCameraInterpreter.js.map +1 -0
  223. package/build/interpreter/PointsInterpreter.d.ts +17 -0
  224. package/build/interpreter/PointsInterpreter.js +54 -0
  225. package/build/interpreter/PointsInterpreter.js.map +1 -0
  226. package/build/interpreter/SceneServiceInterpreter.d.ts +27 -0
  227. package/build/interpreter/SceneServiceInterpreter.js +95 -0
  228. package/build/interpreter/SceneServiceInterpreter.js.map +1 -0
  229. package/build/interpreter/ServiceSchedulerInterpreter.d.ts +9 -0
  230. package/build/interpreter/ServiceSchedulerInterpreter.js +19 -0
  231. package/build/interpreter/ServiceSchedulerInterpreter.js.map +1 -0
  232. package/build/interpreter/SpriteInterpreter.d.ts +14 -0
  233. package/build/interpreter/SpriteInterpreter.js +38 -0
  234. package/build/interpreter/SpriteInterpreter.js.map +1 -0
  235. package/build/interpreter/TextInterpreter.d.ts +16 -0
  236. package/build/interpreter/TextInterpreter.js +68 -0
  237. package/build/interpreter/TextInterpreter.js.map +1 -0
  238. package/build/interpreter/TransformControllerInterpreter.d.ts +12 -0
  239. package/build/interpreter/TransformControllerInterpreter.js +36 -0
  240. package/build/interpreter/TransformControllerInterpreter.js.map +1 -0
  241. package/build/interpreter/animation/AnimationActionInterpreter.d.ts +13 -0
  242. package/build/interpreter/animation/AnimationActionInterpreter.js +57 -0
  243. package/build/interpreter/animation/AnimationActionInterpreter.js.map +1 -0
  244. package/build/interpreter/geometry/BoxGeometryInterpreter.d.ts +12 -0
  245. package/build/interpreter/geometry/BoxGeometryInterpreter.js +29 -0
  246. package/build/interpreter/geometry/BoxGeometryInterpreter.js.map +1 -0
  247. package/build/interpreter/geometry/BufferGeometryInterpreter.d.ts +13 -0
  248. package/build/interpreter/geometry/BufferGeometryInterpreter.js +43 -0
  249. package/build/interpreter/geometry/BufferGeometryInterpreter.js.map +1 -0
  250. package/build/interpreter/geometry/CircleGeometryInterpreter.d.ts +12 -0
  251. package/build/interpreter/geometry/CircleGeometryInterpreter.js +29 -0
  252. package/build/interpreter/geometry/CircleGeometryInterpreter.js.map +1 -0
  253. package/build/interpreter/geometry/CylinderGeometryInterpreter.d.ts +12 -0
  254. package/build/interpreter/geometry/CylinderGeometryInterpreter.js +29 -0
  255. package/build/interpreter/geometry/CylinderGeometryInterpreter.js.map +1 -0
  256. package/build/interpreter/geometry/ExtrudeGeometryInterpreter.d.ts +13 -0
  257. package/build/interpreter/geometry/ExtrudeGeometryInterpreter.js +48 -0
  258. package/build/interpreter/geometry/ExtrudeGeometryInterpreter.js.map +1 -0
  259. package/build/interpreter/geometry/PlaneGeometryInterpreter.d.ts +12 -0
  260. package/build/interpreter/geometry/PlaneGeometryInterpreter.js +29 -0
  261. package/build/interpreter/geometry/PlaneGeometryInterpreter.js.map +1 -0
  262. package/build/interpreter/geometry/RingGeometryInterpreter.d.ts +12 -0
  263. package/build/interpreter/geometry/RingGeometryInterpreter.js +29 -0
  264. package/build/interpreter/geometry/RingGeometryInterpreter.js.map +1 -0
  265. package/build/interpreter/geometry/SphereGeometryInterpreter.d.ts +12 -0
  266. package/build/interpreter/geometry/SphereGeometryInterpreter.js +29 -0
  267. package/build/interpreter/geometry/SphereGeometryInterpreter.js.map +1 -0
  268. package/build/interpreter/geometry/SurfaceGeometryInterpreter.d.ts +16 -0
  269. package/build/interpreter/geometry/SurfaceGeometryInterpreter.js +29 -0
  270. package/build/interpreter/geometry/SurfaceGeometryInterpreter.js.map +1 -0
  271. package/build/interpreter/geometry/TubeGeometryInterpreter.d.ts +13 -0
  272. package/build/interpreter/geometry/TubeGeometryInterpreter.js +36 -0
  273. package/build/interpreter/geometry/TubeGeometryInterpreter.js.map +1 -0
  274. package/build/interpreter/helper/AxesHelperInterpreter.d.ts +12 -0
  275. package/build/interpreter/helper/AxesHelperInterpreter.js +32 -0
  276. package/build/interpreter/helper/AxesHelperInterpreter.js.map +1 -0
  277. package/build/interpreter/index.d.ts +43 -0
  278. package/build/interpreter/index.js +46 -0
  279. package/build/interpreter/index.js.map +1 -0
  280. package/build/interpreter/light/AmbientLightInterpreter.d.ts +13 -0
  281. package/build/interpreter/light/AmbientLightInterpreter.js +24 -0
  282. package/build/interpreter/light/AmbientLightInterpreter.js.map +1 -0
  283. package/build/interpreter/light/DirectionalLightInterpreter.d.ts +16 -0
  284. package/build/interpreter/light/DirectionalLightInterpreter.js +75 -0
  285. package/build/interpreter/light/DirectionalLightInterpreter.js.map +1 -0
  286. package/build/interpreter/light/HemisphereLightInterpreter.d.ts +13 -0
  287. package/build/interpreter/light/HemisphereLightInterpreter.js +25 -0
  288. package/build/interpreter/light/HemisphereLightInterpreter.js.map +1 -0
  289. package/build/interpreter/light/PointLightInterpreter.d.ts +14 -0
  290. package/build/interpreter/light/PointLightInterpreter.js +37 -0
  291. package/build/interpreter/light/PointLightInterpreter.js.map +1 -0
  292. package/build/interpreter/light/RectAreaLightInterpreter.d.ts +13 -0
  293. package/build/interpreter/light/RectAreaLightInterpreter.js +27 -0
  294. package/build/interpreter/light/RectAreaLightInterpreter.js.map +1 -0
  295. package/build/interpreter/light/SpotLightInterpreter.d.ts +15 -0
  296. package/build/interpreter/light/SpotLightInterpreter.js +63 -0
  297. package/build/interpreter/light/SpotLightInterpreter.js.map +1 -0
  298. package/build/interpreter/material/MaterialInterpreter.d.ts +9 -0
  299. package/build/interpreter/material/MaterialInterpreter.js +28 -0
  300. package/build/interpreter/material/MaterialInterpreter.js.map +1 -0
  301. package/build/interpreter/material/MeshBasicMaterialInterpreter.d.ts +11 -0
  302. package/build/interpreter/material/MeshBasicMaterialInterpreter.js +37 -0
  303. package/build/interpreter/material/MeshBasicMaterialInterpreter.js.map +1 -0
  304. package/build/interpreter/material/MeshPhongMaterialInterpreter.d.ts +11 -0
  305. package/build/interpreter/material/MeshPhongMaterialInterpreter.js +56 -0
  306. package/build/interpreter/material/MeshPhongMaterialInterpreter.js.map +1 -0
  307. package/build/interpreter/material/MeshStandardMaterialInterpreter.d.ts +11 -0
  308. package/build/interpreter/material/MeshStandardMaterialInterpreter.js +52 -0
  309. package/build/interpreter/material/MeshStandardMaterialInterpreter.js.map +1 -0
  310. package/build/interpreter/material/PointsMaterialInterpreter.d.ts +11 -0
  311. package/build/interpreter/material/PointsMaterialInterpreter.js +30 -0
  312. package/build/interpreter/material/PointsMaterialInterpreter.js.map +1 -0
  313. package/build/interpreter/material/ShaderMaterialInterpreter.d.ts +14 -0
  314. package/build/interpreter/material/ShaderMaterialInterpreter.js +46 -0
  315. package/build/interpreter/material/ShaderMaterialInterpreter.js.map +1 -0
  316. package/build/interpreter/material/ShadowMaterialInterpreter.d.ts +11 -0
  317. package/build/interpreter/material/ShadowMaterialInterpreter.js +25 -0
  318. package/build/interpreter/material/ShadowMaterialInterpreter.js.map +1 -0
  319. package/build/interpreter/material/SpriteMaterialInterpreter.d.ts +11 -0
  320. package/build/interpreter/material/SpriteMaterialInterpreter.js +30 -0
  321. package/build/interpreter/material/SpriteMaterialInterpreter.js.map +1 -0
  322. package/build/interpreter/texture/TextureInterpreter.d.ts +13 -0
  323. package/build/interpreter/texture/TextureInterpreter.js +54 -0
  324. package/build/interpreter/texture/TextureInterpreter.js.map +1 -0
  325. package/build/locale/Language.d.ts +3 -0
  326. package/build/locale/Language.js +6 -0
  327. package/build/locale/Language.js.map +1 -0
  328. package/build/locale/LanguageProvider.d.ts +6 -0
  329. package/build/locale/LanguageProvider.js +7 -0
  330. package/build/locale/LanguageProvider.js.map +1 -0
  331. package/build/locale/index.d.ts +2 -0
  332. package/build/locale/index.js +3 -0
  333. package/build/locale/index.js.map +1 -0
  334. package/build/preset/execute/GeoMap/drilldown.d.ts +16 -0
  335. package/build/preset/execute/GeoMap/drilldown.js +45 -0
  336. package/build/preset/execute/GeoMap/drilldown.js.map +1 -0
  337. package/build/preset/execute/GeoMap/index.d.ts +1 -0
  338. package/build/preset/execute/GeoMap/index.js +2 -0
  339. package/build/preset/execute/GeoMap/index.js.map +1 -0
  340. package/build/preset/execute/index.d.ts +1 -0
  341. package/build/preset/execute/index.js +2 -0
  342. package/build/preset/execute/index.js.map +1 -0
  343. package/build/preset/index.d.ts +3 -0
  344. package/build/preset/index.js +4 -0
  345. package/build/preset/index.js.map +1 -0
  346. package/build/preset/interaction/GeoMap/drilldown.d.ts +5 -0
  347. package/build/preset/interaction/GeoMap/drilldown.js +19 -0
  348. package/build/preset/interaction/GeoMap/drilldown.js.map +1 -0
  349. package/build/preset/interaction/GeoMap/index.d.ts +1 -0
  350. package/build/preset/interaction/GeoMap/index.js +2 -0
  351. package/build/preset/interaction/GeoMap/index.js.map +1 -0
  352. package/build/preset/interaction/index.d.ts +1 -0
  353. package/build/preset/interaction/index.js +2 -0
  354. package/build/preset/interaction/index.js.map +1 -0
  355. package/build/utils/dispose/index.d.ts +3 -0
  356. package/build/utils/dispose/index.js +22 -0
  357. package/build/utils/dispose/index.js.map +1 -0
  358. package/build/utils/geometry/index.d.ts +19 -0
  359. package/build/utils/geometry/index.js +61 -0
  360. package/build/utils/geometry/index.js.map +1 -0
  361. package/build/utils/index.d.ts +7 -0
  362. package/build/utils/index.js +8 -0
  363. package/build/utils/index.js.map +1 -0
  364. package/build/utils/material/index.d.ts +7 -0
  365. package/build/utils/material/index.js +46 -0
  366. package/build/utils/material/index.js.map +1 -0
  367. package/build/utils/pickup/index.d.ts +5 -0
  368. package/build/utils/pickup/index.js +14 -0
  369. package/build/utils/pickup/index.js.map +1 -0
  370. package/build/utils/random/index.d.ts +2 -0
  371. package/build/utils/random/index.js +5 -0
  372. package/build/utils/random/index.js.map +1 -0
  373. package/build/utils/text/index.d.ts +98 -0
  374. package/build/utils/text/index.js +379 -0
  375. package/build/utils/text/index.js.map +1 -0
  376. package/build/utils/texture/index.d.ts +4 -0
  377. package/build/utils/texture/index.js +17 -0
  378. package/build/utils/texture/index.js.map +1 -0
  379. package/package.json +27 -1
@@ -0,0 +1,1359 @@
1
+ //@ts-nocheck
2
+ import { BoxGeometry, BufferGeometry, CylinderGeometry, DoubleSide, Euler, Float32BufferAttribute, Line, LineBasicMaterial, Matrix4, Mesh, MeshBasicMaterial, Object3D, OctahedronGeometry, PlaneGeometry, Quaternion, Raycaster, SphereGeometry, TorusGeometry, Vector3, } from 'three';
3
+ import { Asset } from '@vyr/engine';
4
+ import { SceneServiceDescriptor } from '../descriptor';
5
+ import { NodeActor } from '../actor';
6
+ const _raycaster = new Raycaster();
7
+ const _tempVector = new Vector3();
8
+ const _tempVector2 = new Vector3();
9
+ const _tempQuaternion = new Quaternion();
10
+ const _unit = {
11
+ X: new Vector3(1, 0, 0),
12
+ Y: new Vector3(0, 1, 0),
13
+ Z: new Vector3(0, 0, 1),
14
+ };
15
+ // mouse / touch event handlers
16
+ function getPointer(event) {
17
+ if (this.domElement.ownerDocument.pointerLockElement) {
18
+ return {
19
+ x: 0,
20
+ y: 0,
21
+ button: event.button,
22
+ };
23
+ }
24
+ else {
25
+ const rect = this.domElement.getBoundingClientRect();
26
+ return {
27
+ x: ((event.clientX - rect.left) / rect.width) * 2 - 1,
28
+ y: (-(event.clientY - rect.top) / rect.height) * 2 + 1,
29
+ button: event.button,
30
+ };
31
+ }
32
+ }
33
+ function onPointerHover(event) {
34
+ if (this.enabled === false)
35
+ return;
36
+ switch (event.pointerType) {
37
+ case 'mouse':
38
+ case 'pen':
39
+ this.pointerHover(this._getPointer(event));
40
+ break;
41
+ }
42
+ }
43
+ function onPointerDown(event) {
44
+ if (this.enabled === false)
45
+ return;
46
+ this.domElement.addEventListener('pointermove', this._onPointerMove);
47
+ this.pointerHover(this._getPointer(event));
48
+ this.pointerDown(this._getPointer(event));
49
+ }
50
+ function onPointerMove(event) {
51
+ if (this.enabled === false)
52
+ return;
53
+ this.pointerMove(this._getPointer(event));
54
+ }
55
+ function onPointerUp(event) {
56
+ if (this.enabled === false)
57
+ return;
58
+ this.domElement.removeEventListener('pointermove', this._onPointerMove);
59
+ this.pointerUp(this._getPointer(event));
60
+ }
61
+ function intersectObjectWithRay(object, raycaster, includeInvisible = false) {
62
+ const allIntersections = raycaster.intersectObject(object, true);
63
+ for (let i = 0; i < allIntersections.length; i++) {
64
+ if (allIntersections[i].object.visible || includeInvisible) {
65
+ return allIntersections[i];
66
+ }
67
+ }
68
+ return false;
69
+ }
70
+ //
71
+ // Reusable utility variables
72
+ const _tempEuler = new Euler();
73
+ const _alignVector = new Vector3(0, 1, 0);
74
+ const _zeroVector = new Vector3(0, 0, 0);
75
+ const _lookAtMatrix = new Matrix4();
76
+ const _tempQuaternion2 = new Quaternion();
77
+ const _idActorQuaternion = new Quaternion();
78
+ const _dirVector = new Vector3();
79
+ const _tempMatrix = new Matrix4();
80
+ const _unitX = new Vector3(1, 0, 0);
81
+ const _unitY = new Vector3(0, 1, 0);
82
+ const _unitZ = new Vector3(0, 0, 1);
83
+ const _v1 = new Vector3();
84
+ const _v2 = new Vector3();
85
+ const _v3 = new Vector3();
86
+ class TransformControlsGizmo extends Object3D {
87
+ isTransformControlsGizmo;
88
+ gizmo;
89
+ picker;
90
+ helper;
91
+ type;
92
+ constructor() {
93
+ super();
94
+ this.isTransformControlsGizmo = true;
95
+ this.type = 'TransformControlsGizmo';
96
+ // shared materials
97
+ const gizmoMaterial = new MeshBasicMaterial({
98
+ depthTest: false,
99
+ depthWrite: false,
100
+ fog: false,
101
+ toneMapped: false,
102
+ transparent: true,
103
+ });
104
+ const gizmoLineMaterial = new LineBasicMaterial({
105
+ depthTest: false,
106
+ depthWrite: false,
107
+ fog: false,
108
+ toneMapped: false,
109
+ transparent: true,
110
+ });
111
+ // Make unique material for each axis/color
112
+ const matInvisible = gizmoMaterial.clone();
113
+ matInvisible.opacity = 0.15;
114
+ const matHelper = gizmoLineMaterial.clone();
115
+ matHelper.opacity = 0.5;
116
+ const matRed = gizmoMaterial.clone();
117
+ matRed.color.setHex(0xff0000);
118
+ const matGreen = gizmoMaterial.clone();
119
+ matGreen.color.setHex(0x00ff00);
120
+ const matBlue = gizmoMaterial.clone();
121
+ matBlue.color.setHex(0x0000ff);
122
+ const matRedTransparent = gizmoMaterial.clone();
123
+ matRedTransparent.color.setHex(0xff0000);
124
+ matRedTransparent.opacity = 0.5;
125
+ const matGreenTransparent = gizmoMaterial.clone();
126
+ matGreenTransparent.color.setHex(0x00ff00);
127
+ matGreenTransparent.opacity = 0.5;
128
+ const matBlueTransparent = gizmoMaterial.clone();
129
+ matBlueTransparent.color.setHex(0x0000ff);
130
+ matBlueTransparent.opacity = 0.5;
131
+ const matWhiteTransparent = gizmoMaterial.clone();
132
+ matWhiteTransparent.opacity = 0.25;
133
+ const matYellowTransparent = gizmoMaterial.clone();
134
+ matYellowTransparent.color.setHex(0xffff00);
135
+ matYellowTransparent.opacity = 0.25;
136
+ const matYellow = gizmoMaterial.clone();
137
+ matYellow.color.setHex(0xffff00);
138
+ const matGray = gizmoMaterial.clone();
139
+ matGray.color.setHex(0x787878);
140
+ // reusable geometry
141
+ const arrowGeometry = new CylinderGeometry(0, 0.04, 0.1, 12);
142
+ arrowGeometry.translate(0, 0.05, 0);
143
+ const scaleHandleGeometry = new BoxGeometry(0.08, 0.08, 0.08);
144
+ scaleHandleGeometry.translate(0, 0.04, 0);
145
+ const lineGeometry = new BufferGeometry();
146
+ lineGeometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3));
147
+ const lineGeometry2 = new CylinderGeometry(0.0075, 0.0075, 0.5, 3);
148
+ lineGeometry2.translate(0, 0.25, 0);
149
+ function CircleGeometry(radius, arc) {
150
+ const geometry = new TorusGeometry(radius, 0.0075, 3, 64, arc * Math.PI * 2);
151
+ geometry.rotateY(Math.PI / 2);
152
+ geometry.rotateX(Math.PI / 2);
153
+ return geometry;
154
+ }
155
+ // Special geometry for transform helper. If scaled with position vector it spans from [0,0,0] to position
156
+ function TranslateHelperGeometry() {
157
+ const geometry = new BufferGeometry();
158
+ geometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3));
159
+ return geometry;
160
+ }
161
+ // Gizmo definitions - custom hierarchy definitions for setupGizmo() function
162
+ const gizmoTranslate = {
163
+ X: [
164
+ [new Mesh(arrowGeometry, matRed), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
165
+ [new Mesh(arrowGeometry, matRed), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
166
+ [new Mesh(lineGeometry2, matRed), [0, 0, 0], [0, 0, -Math.PI / 2]],
167
+ ],
168
+ Y: [
169
+ [new Mesh(arrowGeometry, matGreen), [0, 0.5, 0]],
170
+ [new Mesh(arrowGeometry, matGreen), [0, -0.5, 0], [Math.PI, 0, 0]],
171
+ [new Mesh(lineGeometry2, matGreen)],
172
+ ],
173
+ Z: [
174
+ [new Mesh(arrowGeometry, matBlue), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
175
+ [new Mesh(arrowGeometry, matBlue), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
176
+ [new Mesh(lineGeometry2, matBlue), null, [Math.PI / 2, 0, 0]],
177
+ ],
178
+ XYZ: [
179
+ [
180
+ new Mesh(new OctahedronGeometry(0.1, 0), matWhiteTransparent.clone()),
181
+ [0, 0, 0],
182
+ ],
183
+ ],
184
+ XY: [
185
+ [
186
+ new Mesh(new BoxGeometry(0.15, 0.15, 0.01), matBlueTransparent.clone()),
187
+ [0.15, 0.15, 0],
188
+ ],
189
+ ],
190
+ YZ: [
191
+ [
192
+ new Mesh(new BoxGeometry(0.15, 0.15, 0.01), matRedTransparent.clone()),
193
+ [0, 0.15, 0.15],
194
+ [0, Math.PI / 2, 0],
195
+ ],
196
+ ],
197
+ XZ: [
198
+ [
199
+ new Mesh(new BoxGeometry(0.15, 0.15, 0.01), matGreenTransparent.clone()),
200
+ [0.15, 0, 0.15],
201
+ [-Math.PI / 2, 0, 0],
202
+ ],
203
+ ],
204
+ };
205
+ const pickerTranslate = {
206
+ X: [
207
+ [
208
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
209
+ [0.3, 0, 0],
210
+ [0, 0, -Math.PI / 2],
211
+ ],
212
+ [
213
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
214
+ [-0.3, 0, 0],
215
+ [0, 0, Math.PI / 2],
216
+ ],
217
+ ],
218
+ Y: [
219
+ [
220
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
221
+ [0, 0.3, 0],
222
+ ],
223
+ [
224
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
225
+ [0, -0.3, 0],
226
+ [0, 0, Math.PI],
227
+ ],
228
+ ],
229
+ Z: [
230
+ [
231
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
232
+ [0, 0, 0.3],
233
+ [Math.PI / 2, 0, 0],
234
+ ],
235
+ [
236
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
237
+ [0, 0, -0.3],
238
+ [-Math.PI / 2, 0, 0],
239
+ ],
240
+ ],
241
+ XYZ: [[new Mesh(new OctahedronGeometry(0.2, 0), matInvisible)]],
242
+ XY: [
243
+ [
244
+ new Mesh(new BoxGeometry(0.2, 0.2, 0.01), matInvisible),
245
+ [0.15, 0.15, 0],
246
+ ],
247
+ ],
248
+ YZ: [
249
+ [
250
+ new Mesh(new BoxGeometry(0.2, 0.2, 0.01), matInvisible),
251
+ [0, 0.15, 0.15],
252
+ [0, Math.PI / 2, 0],
253
+ ],
254
+ ],
255
+ XZ: [
256
+ [
257
+ new Mesh(new BoxGeometry(0.2, 0.2, 0.01), matInvisible),
258
+ [0.15, 0, 0.15],
259
+ [-Math.PI / 2, 0, 0],
260
+ ],
261
+ ],
262
+ };
263
+ const helperTranslate = {
264
+ START: [
265
+ [
266
+ new Mesh(new OctahedronGeometry(0.01, 2), matHelper),
267
+ null,
268
+ null,
269
+ null,
270
+ 'helper',
271
+ ],
272
+ ],
273
+ END: [
274
+ [
275
+ new Mesh(new OctahedronGeometry(0.01, 2), matHelper),
276
+ null,
277
+ null,
278
+ null,
279
+ 'helper',
280
+ ],
281
+ ],
282
+ DELTA: [
283
+ [
284
+ new Line(TranslateHelperGeometry(), matHelper),
285
+ null,
286
+ null,
287
+ null,
288
+ 'helper',
289
+ ],
290
+ ],
291
+ X: [
292
+ [
293
+ new Line(lineGeometry, matHelper.clone()),
294
+ [-1e3, 0, 0],
295
+ null,
296
+ [1e6, 1, 1],
297
+ 'helper',
298
+ ],
299
+ ],
300
+ Y: [
301
+ [
302
+ new Line(lineGeometry, matHelper.clone()),
303
+ [0, -1e3, 0],
304
+ [0, 0, Math.PI / 2],
305
+ [1e6, 1, 1],
306
+ 'helper',
307
+ ],
308
+ ],
309
+ Z: [
310
+ [
311
+ new Line(lineGeometry, matHelper.clone()),
312
+ [0, 0, -1e3],
313
+ [0, -Math.PI / 2, 0],
314
+ [1e6, 1, 1],
315
+ 'helper',
316
+ ],
317
+ ],
318
+ };
319
+ const gizmoRotate = {
320
+ XYZE: [
321
+ [new Mesh(CircleGeometry(0.5, 1), matGray), null, [0, Math.PI / 2, 0]],
322
+ ],
323
+ X: [[new Mesh(CircleGeometry(0.5, 0.5), matRed)]],
324
+ Y: [
325
+ [
326
+ new Mesh(CircleGeometry(0.5, 0.5), matGreen),
327
+ null,
328
+ [0, 0, -Math.PI / 2],
329
+ ],
330
+ ],
331
+ Z: [
332
+ [
333
+ new Mesh(CircleGeometry(0.5, 0.5), matBlue),
334
+ null,
335
+ [0, Math.PI / 2, 0],
336
+ ],
337
+ ],
338
+ E: [
339
+ [
340
+ new Mesh(CircleGeometry(0.75, 1), matYellowTransparent),
341
+ null,
342
+ [0, Math.PI / 2, 0],
343
+ ],
344
+ ],
345
+ };
346
+ const helperRotate = {
347
+ AXIS: [
348
+ [
349
+ new Line(lineGeometry, matHelper.clone()),
350
+ [-1e3, 0, 0],
351
+ null,
352
+ [1e6, 1, 1],
353
+ 'helper',
354
+ ],
355
+ ],
356
+ };
357
+ const pickerRotate = {
358
+ XYZE: [[new Mesh(new SphereGeometry(0.25, 10, 8), matInvisible)]],
359
+ X: [
360
+ [
361
+ new Mesh(new TorusGeometry(0.5, 0.1, 4, 24), matInvisible),
362
+ [0, 0, 0],
363
+ [0, -Math.PI / 2, -Math.PI / 2],
364
+ ],
365
+ ],
366
+ Y: [
367
+ [
368
+ new Mesh(new TorusGeometry(0.5, 0.1, 4, 24), matInvisible),
369
+ [0, 0, 0],
370
+ [Math.PI / 2, 0, 0],
371
+ ],
372
+ ],
373
+ Z: [
374
+ [
375
+ new Mesh(new TorusGeometry(0.5, 0.1, 4, 24), matInvisible),
376
+ [0, 0, 0],
377
+ [0, 0, -Math.PI / 2],
378
+ ],
379
+ ],
380
+ E: [[new Mesh(new TorusGeometry(0.75, 0.1, 2, 24), matInvisible)]],
381
+ };
382
+ const gizmoScale = {
383
+ X: [
384
+ [
385
+ new Mesh(scaleHandleGeometry, matRed),
386
+ [0.5, 0, 0],
387
+ [0, 0, -Math.PI / 2],
388
+ ],
389
+ [new Mesh(lineGeometry2, matRed), [0, 0, 0], [0, 0, -Math.PI / 2]],
390
+ [
391
+ new Mesh(scaleHandleGeometry, matRed),
392
+ [-0.5, 0, 0],
393
+ [0, 0, Math.PI / 2],
394
+ ],
395
+ ],
396
+ Y: [
397
+ [new Mesh(scaleHandleGeometry, matGreen), [0, 0.5, 0]],
398
+ [new Mesh(lineGeometry2, matGreen)],
399
+ [
400
+ new Mesh(scaleHandleGeometry, matGreen),
401
+ [0, -0.5, 0],
402
+ [0, 0, Math.PI],
403
+ ],
404
+ ],
405
+ Z: [
406
+ [
407
+ new Mesh(scaleHandleGeometry, matBlue),
408
+ [0, 0, 0.5],
409
+ [Math.PI / 2, 0, 0],
410
+ ],
411
+ [new Mesh(lineGeometry2, matBlue), [0, 0, 0], [Math.PI / 2, 0, 0]],
412
+ [
413
+ new Mesh(scaleHandleGeometry, matBlue),
414
+ [0, 0, -0.5],
415
+ [-Math.PI / 2, 0, 0],
416
+ ],
417
+ ],
418
+ XY: [
419
+ [
420
+ new Mesh(new BoxGeometry(0.15, 0.15, 0.01), matBlueTransparent),
421
+ [0.15, 0.15, 0],
422
+ ],
423
+ ],
424
+ YZ: [
425
+ [
426
+ new Mesh(new BoxGeometry(0.15, 0.15, 0.01), matRedTransparent),
427
+ [0, 0.15, 0.15],
428
+ [0, Math.PI / 2, 0],
429
+ ],
430
+ ],
431
+ XZ: [
432
+ [
433
+ new Mesh(new BoxGeometry(0.15, 0.15, 0.01), matGreenTransparent),
434
+ [0.15, 0, 0.15],
435
+ [-Math.PI / 2, 0, 0],
436
+ ],
437
+ ],
438
+ XYZ: [
439
+ [new Mesh(new BoxGeometry(0.1, 0.1, 0.1), matWhiteTransparent.clone())],
440
+ ],
441
+ };
442
+ const pickerScale = {
443
+ X: [
444
+ [
445
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
446
+ [0.3, 0, 0],
447
+ [0, 0, -Math.PI / 2],
448
+ ],
449
+ [
450
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
451
+ [-0.3, 0, 0],
452
+ [0, 0, Math.PI / 2],
453
+ ],
454
+ ],
455
+ Y: [
456
+ [
457
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
458
+ [0, 0.3, 0],
459
+ ],
460
+ [
461
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
462
+ [0, -0.3, 0],
463
+ [0, 0, Math.PI],
464
+ ],
465
+ ],
466
+ Z: [
467
+ [
468
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
469
+ [0, 0, 0.3],
470
+ [Math.PI / 2, 0, 0],
471
+ ],
472
+ [
473
+ new Mesh(new CylinderGeometry(0.2, 0, 0.6, 4), matInvisible),
474
+ [0, 0, -0.3],
475
+ [-Math.PI / 2, 0, 0],
476
+ ],
477
+ ],
478
+ XY: [
479
+ [
480
+ new Mesh(new BoxGeometry(0.2, 0.2, 0.01), matInvisible),
481
+ [0.15, 0.15, 0],
482
+ ],
483
+ ],
484
+ YZ: [
485
+ [
486
+ new Mesh(new BoxGeometry(0.2, 0.2, 0.01), matInvisible),
487
+ [0, 0.15, 0.15],
488
+ [0, Math.PI / 2, 0],
489
+ ],
490
+ ],
491
+ XZ: [
492
+ [
493
+ new Mesh(new BoxGeometry(0.2, 0.2, 0.01), matInvisible),
494
+ [0.15, 0, 0.15],
495
+ [-Math.PI / 2, 0, 0],
496
+ ],
497
+ ],
498
+ XYZ: [
499
+ [new Mesh(new BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 0, 0]],
500
+ ],
501
+ };
502
+ const helperScale = {
503
+ X: [
504
+ [
505
+ new Line(lineGeometry, matHelper.clone()),
506
+ [-1e3, 0, 0],
507
+ null,
508
+ [1e6, 1, 1],
509
+ 'helper',
510
+ ],
511
+ ],
512
+ Y: [
513
+ [
514
+ new Line(lineGeometry, matHelper.clone()),
515
+ [0, -1e3, 0],
516
+ [0, 0, Math.PI / 2],
517
+ [1e6, 1, 1],
518
+ 'helper',
519
+ ],
520
+ ],
521
+ Z: [
522
+ [
523
+ new Line(lineGeometry, matHelper.clone()),
524
+ [0, 0, -1e3],
525
+ [0, -Math.PI / 2, 0],
526
+ [1e6, 1, 1],
527
+ 'helper',
528
+ ],
529
+ ],
530
+ };
531
+ // Creates an Object3D with gizmos described in custom hierarchy definition.
532
+ function setupGizmo(gizmoMap) {
533
+ const gizmo = new Object3D();
534
+ for (const name in gizmoMap) {
535
+ for (let i = gizmoMap[name].length; i--;) {
536
+ const object = gizmoMap[name][i][0].clone();
537
+ const position = gizmoMap[name][i][1];
538
+ const rotation = gizmoMap[name][i][2];
539
+ const scale = gizmoMap[name][i][3];
540
+ const tag = gizmoMap[name][i][4];
541
+ // name and tag properties are essential for picking and updating logic.
542
+ object.name = name;
543
+ object.tag = tag;
544
+ if (position) {
545
+ object.position.set(position[0], position[1], position[2]);
546
+ }
547
+ if (rotation) {
548
+ object.rotation.set(rotation[0], rotation[1], rotation[2]);
549
+ }
550
+ if (scale) {
551
+ object.scale.set(scale[0], scale[1], scale[2]);
552
+ }
553
+ object.updateMatrix();
554
+ const tempGeometry = object.geometry.clone();
555
+ tempGeometry.applyMatrix4(object.matrix);
556
+ object.geometry = tempGeometry;
557
+ object.renderOrder = Infinity;
558
+ object.position.set(0, 0, 0);
559
+ object.rotation.set(0, 0, 0);
560
+ object.scale.set(1, 1, 1);
561
+ gizmo.add(object);
562
+ }
563
+ }
564
+ return gizmo;
565
+ }
566
+ // Gizmo creation
567
+ this.gizmo = {};
568
+ this.picker = {};
569
+ this.helper = {};
570
+ this.add((this.gizmo['translate'] = setupGizmo(gizmoTranslate)));
571
+ this.add((this.gizmo['rotate'] = setupGizmo(gizmoRotate)));
572
+ this.add((this.gizmo['scale'] = setupGizmo(gizmoScale)));
573
+ this.add((this.picker['translate'] = setupGizmo(pickerTranslate)));
574
+ this.add((this.picker['rotate'] = setupGizmo(pickerRotate)));
575
+ this.add((this.picker['scale'] = setupGizmo(pickerScale)));
576
+ this.add((this.helper['translate'] = setupGizmo(helperTranslate)));
577
+ this.add((this.helper['rotate'] = setupGizmo(helperRotate)));
578
+ this.add((this.helper['scale'] = setupGizmo(helperScale)));
579
+ // Pickers should be hidden always
580
+ this.picker['translate'].visible = false;
581
+ this.picker['rotate'].visible = false;
582
+ this.picker['scale'].visible = false;
583
+ }
584
+ // updateMatrixWorld will update transformations and appearance of individual handles
585
+ updateMatrixWorld(force) {
586
+ const space = this.mode === 'scale' ? 'local' : this.space; // scale always oriented to local rotation
587
+ const quaternion = space === 'local' ? this.worldQuaternion : _idActorQuaternion;
588
+ // Show only gizmos for current transform mode
589
+ this.gizmo['translate'].visible = this.mode === 'translate';
590
+ this.gizmo['rotate'].visible = this.mode === 'rotate';
591
+ this.gizmo['scale'].visible = this.mode === 'scale';
592
+ this.helper['translate'].visible = this.mode === 'translate';
593
+ this.helper['rotate'].visible = this.mode === 'rotate';
594
+ this.helper['scale'].visible = this.mode === 'scale';
595
+ let handles = [];
596
+ handles = handles.concat(this.picker[this.mode].children);
597
+ handles = handles.concat(this.gizmo[this.mode].children);
598
+ handles = handles.concat(this.helper[this.mode].children);
599
+ for (let i = 0; i < handles.length; i++) {
600
+ const handle = handles[i];
601
+ // hide aligned to camera
602
+ handle.visible = true;
603
+ handle.rotation.set(0, 0, 0);
604
+ handle.position.copy(this.worldPosition);
605
+ let factor;
606
+ if (this.camera.isOrthographicCamera) {
607
+ factor = (this.camera.top - this.camera.bottom) / this.camera.zoom;
608
+ }
609
+ else {
610
+ factor =
611
+ this.worldPosition.distanceTo(this.cameraPosition) *
612
+ Math.min((1.9 * Math.tan((Math.PI * this.camera.fov) / 360)) /
613
+ this.camera.zoom, 7);
614
+ }
615
+ handle.scale.set(1, 1, 1).multiplyScalar((factor * this.size) / 4);
616
+ if (handle.tag === 'helper') {
617
+ handle.visible = false;
618
+ if (handle.name === 'AXIS') {
619
+ handle.visible = !!this.axis;
620
+ if (this.axis === 'X') {
621
+ _tempQuaternion.setFromEuler(_tempEuler.set(0, 0, 0));
622
+ handle.quaternion.copy(quaternion).multiply(_tempQuaternion);
623
+ if (Math.abs(_alignVector
624
+ .copy(_unitX)
625
+ .applyQuaternion(quaternion)
626
+ .dot(this.eye)) > 0.9) {
627
+ handle.visible = false;
628
+ }
629
+ }
630
+ if (this.axis === 'Y') {
631
+ _tempQuaternion.setFromEuler(_tempEuler.set(0, 0, Math.PI / 2));
632
+ handle.quaternion.copy(quaternion).multiply(_tempQuaternion);
633
+ if (Math.abs(_alignVector
634
+ .copy(_unitY)
635
+ .applyQuaternion(quaternion)
636
+ .dot(this.eye)) > 0.9) {
637
+ handle.visible = false;
638
+ }
639
+ }
640
+ if (this.axis === 'Z') {
641
+ _tempQuaternion.setFromEuler(_tempEuler.set(0, Math.PI / 2, 0));
642
+ handle.quaternion.copy(quaternion).multiply(_tempQuaternion);
643
+ if (Math.abs(_alignVector
644
+ .copy(_unitZ)
645
+ .applyQuaternion(quaternion)
646
+ .dot(this.eye)) > 0.9) {
647
+ handle.visible = false;
648
+ }
649
+ }
650
+ if (this.axis === 'XYZE') {
651
+ _tempQuaternion.setFromEuler(_tempEuler.set(0, Math.PI / 2, 0));
652
+ _alignVector.copy(this.rotationAxis);
653
+ handle.quaternion.setFromRotationMatrix(_lookAtMatrix.lookAt(_zeroVector, _alignVector, _unitY));
654
+ handle.quaternion.multiply(_tempQuaternion);
655
+ handle.visible = this.dragging;
656
+ }
657
+ if (this.axis === 'E') {
658
+ handle.visible = false;
659
+ }
660
+ }
661
+ else if (handle.name === 'START') {
662
+ handle.position.copy(this.worldPositionStart);
663
+ handle.visible = this.dragging;
664
+ }
665
+ else if (handle.name === 'END') {
666
+ handle.position.copy(this.worldPosition);
667
+ handle.visible = this.dragging;
668
+ }
669
+ else if (handle.name === 'DELTA') {
670
+ handle.position.copy(this.worldPositionStart);
671
+ handle.quaternion.copy(this.worldQuaternionStart);
672
+ _tempVector
673
+ .set(1e-10, 1e-10, 1e-10)
674
+ .add(this.worldPositionStart)
675
+ .sub(this.worldPosition)
676
+ .multiplyScalar(-1);
677
+ _tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert());
678
+ handle.scale.copy(_tempVector);
679
+ handle.visible = this.dragging;
680
+ }
681
+ else {
682
+ handle.quaternion.copy(quaternion);
683
+ if (this.dragging) {
684
+ handle.position.copy(this.worldPositionStart);
685
+ }
686
+ else {
687
+ handle.position.copy(this.worldPosition);
688
+ }
689
+ if (this.axis) {
690
+ handle.visible = this.axis.search(handle.name) !== -1;
691
+ }
692
+ }
693
+ // If updating helper, skip rest of the loop
694
+ continue;
695
+ }
696
+ // Align handles to current local or world rotation
697
+ handle.quaternion.copy(quaternion);
698
+ if (this.mode === 'translate' || this.mode === 'scale') {
699
+ // Hide translate and scale axis facing the camera
700
+ const AXIS_HIDE_THRESHOLD = 0.99;
701
+ const PLANE_HIDE_THRESHOLD = 0.2;
702
+ if (handle.name === 'X') {
703
+ if (Math.abs(_alignVector
704
+ .copy(_unitX)
705
+ .applyQuaternion(quaternion)
706
+ .dot(this.eye)) > AXIS_HIDE_THRESHOLD) {
707
+ handle.scale.set(1e-10, 1e-10, 1e-10);
708
+ handle.visible = false;
709
+ }
710
+ }
711
+ if (handle.name === 'Y') {
712
+ if (Math.abs(_alignVector
713
+ .copy(_unitY)
714
+ .applyQuaternion(quaternion)
715
+ .dot(this.eye)) > AXIS_HIDE_THRESHOLD) {
716
+ handle.scale.set(1e-10, 1e-10, 1e-10);
717
+ handle.visible = false;
718
+ }
719
+ }
720
+ if (handle.name === 'Z') {
721
+ if (Math.abs(_alignVector
722
+ .copy(_unitZ)
723
+ .applyQuaternion(quaternion)
724
+ .dot(this.eye)) > AXIS_HIDE_THRESHOLD) {
725
+ handle.scale.set(1e-10, 1e-10, 1e-10);
726
+ handle.visible = false;
727
+ }
728
+ }
729
+ if (handle.name === 'XY') {
730
+ if (Math.abs(_alignVector
731
+ .copy(_unitZ)
732
+ .applyQuaternion(quaternion)
733
+ .dot(this.eye)) < PLANE_HIDE_THRESHOLD) {
734
+ handle.scale.set(1e-10, 1e-10, 1e-10);
735
+ handle.visible = false;
736
+ }
737
+ }
738
+ if (handle.name === 'YZ') {
739
+ if (Math.abs(_alignVector
740
+ .copy(_unitX)
741
+ .applyQuaternion(quaternion)
742
+ .dot(this.eye)) < PLANE_HIDE_THRESHOLD) {
743
+ handle.scale.set(1e-10, 1e-10, 1e-10);
744
+ handle.visible = false;
745
+ }
746
+ }
747
+ if (handle.name === 'XZ') {
748
+ if (Math.abs(_alignVector
749
+ .copy(_unitY)
750
+ .applyQuaternion(quaternion)
751
+ .dot(this.eye)) < PLANE_HIDE_THRESHOLD) {
752
+ handle.scale.set(1e-10, 1e-10, 1e-10);
753
+ handle.visible = false;
754
+ }
755
+ }
756
+ }
757
+ else if (this.mode === 'rotate') {
758
+ // Align handles to current local or world rotation
759
+ _tempQuaternion2.copy(quaternion);
760
+ _alignVector
761
+ .copy(this.eye)
762
+ .applyQuaternion(_tempQuaternion.copy(quaternion).invert());
763
+ if (handle.name.search('E') !== -1) {
764
+ handle.quaternion.setFromRotationMatrix(_lookAtMatrix.lookAt(this.eye, _zeroVector, _unitY));
765
+ }
766
+ if (handle.name === 'X') {
767
+ _tempQuaternion.setFromAxisAngle(_unitX, Math.atan2(-_alignVector.y, _alignVector.z));
768
+ _tempQuaternion.multiplyQuaternions(_tempQuaternion2, _tempQuaternion);
769
+ handle.quaternion.copy(_tempQuaternion);
770
+ }
771
+ if (handle.name === 'Y') {
772
+ _tempQuaternion.setFromAxisAngle(_unitY, Math.atan2(_alignVector.x, _alignVector.z));
773
+ _tempQuaternion.multiplyQuaternions(_tempQuaternion2, _tempQuaternion);
774
+ handle.quaternion.copy(_tempQuaternion);
775
+ }
776
+ if (handle.name === 'Z') {
777
+ _tempQuaternion.setFromAxisAngle(_unitZ, Math.atan2(_alignVector.y, _alignVector.x));
778
+ _tempQuaternion.multiplyQuaternions(_tempQuaternion2, _tempQuaternion);
779
+ handle.quaternion.copy(_tempQuaternion);
780
+ }
781
+ }
782
+ // Hide disabled axes
783
+ handle.visible =
784
+ handle.visible && (handle.name.indexOf('X') === -1 || this.showX);
785
+ handle.visible =
786
+ handle.visible && (handle.name.indexOf('Y') === -1 || this.showY);
787
+ handle.visible =
788
+ handle.visible && (handle.name.indexOf('Z') === -1 || this.showZ);
789
+ handle.visible =
790
+ handle.visible &&
791
+ (handle.name.indexOf('E') === -1 ||
792
+ (this.showX && this.showY && this.showZ));
793
+ // highlight selected axis
794
+ handle.material._color =
795
+ handle.material._color || handle.material.color.clone();
796
+ handle.material._opacity =
797
+ handle.material._opacity || handle.material.opacity;
798
+ handle.material.color.copy(handle.material._color);
799
+ handle.material.opacity = handle.material._opacity;
800
+ if (this.enabled === true && this.axis) {
801
+ if (handle.name === this.axis) {
802
+ handle.material.color.setHex(0xffff00);
803
+ handle.material.opacity = 1.0;
804
+ }
805
+ else if (this.axis.split('').some(function (a) {
806
+ return handle.name === a;
807
+ })) {
808
+ handle.material.color.setHex(0xffff00);
809
+ handle.material.opacity = 1.0;
810
+ }
811
+ }
812
+ }
813
+ super.updateMatrixWorld(force);
814
+ }
815
+ }
816
+ class TransformControlsPlane extends Mesh {
817
+ constructor() {
818
+ super(new PlaneGeometry(100000, 100000, 2, 2), new MeshBasicMaterial({
819
+ visible: false,
820
+ wireframe: true,
821
+ side: DoubleSide,
822
+ transparent: true,
823
+ opacity: 0.1,
824
+ toneMapped: false,
825
+ }));
826
+ this.isTransformControlsPlane = true;
827
+ this.type = 'TransformControlsPlane';
828
+ }
829
+ updateMatrixWorld(force) {
830
+ let space = this.space;
831
+ this.position.copy(this.worldPosition);
832
+ if (this.mode === 'scale')
833
+ space = 'local'; // scale always oriented to local rotation
834
+ _v1
835
+ .copy(_unitX)
836
+ .applyQuaternion(space === 'local' ? this.worldQuaternion : _idActorQuaternion);
837
+ _v2
838
+ .copy(_unitY)
839
+ .applyQuaternion(space === 'local' ? this.worldQuaternion : _idActorQuaternion);
840
+ _v3
841
+ .copy(_unitZ)
842
+ .applyQuaternion(space === 'local' ? this.worldQuaternion : _idActorQuaternion);
843
+ // Align the plane for current transform mode, axis and space.
844
+ _alignVector.copy(_v2);
845
+ switch (this.mode) {
846
+ case 'translate':
847
+ case 'scale':
848
+ switch (this.axis) {
849
+ case 'X':
850
+ _alignVector.copy(this.eye).cross(_v1);
851
+ _dirVector.copy(_v1).cross(_alignVector);
852
+ break;
853
+ case 'Y':
854
+ _alignVector.copy(this.eye).cross(_v2);
855
+ _dirVector.copy(_v2).cross(_alignVector);
856
+ break;
857
+ case 'Z':
858
+ _alignVector.copy(this.eye).cross(_v3);
859
+ _dirVector.copy(_v3).cross(_alignVector);
860
+ break;
861
+ case 'XY':
862
+ _dirVector.copy(_v3);
863
+ break;
864
+ case 'YZ':
865
+ _dirVector.copy(_v1);
866
+ break;
867
+ case 'XZ':
868
+ _alignVector.copy(_v3);
869
+ _dirVector.copy(_v2);
870
+ break;
871
+ case 'XYZ':
872
+ case 'E':
873
+ _dirVector.set(0, 0, 0);
874
+ break;
875
+ }
876
+ break;
877
+ case 'rotate':
878
+ default:
879
+ // special case for rotate
880
+ _dirVector.set(0, 0, 0);
881
+ }
882
+ if (_dirVector.length() === 0) {
883
+ // If in rotate mode, make the plane parallel to camera
884
+ this.quaternion.copy(this.cameraQuaternion);
885
+ }
886
+ else {
887
+ _tempMatrix.lookAt(_tempVector.set(0, 0, 0), _dirVector, _alignVector);
888
+ this.quaternion.setFromRotationMatrix(_tempMatrix);
889
+ }
890
+ super.updateMatrixWorld(force);
891
+ }
892
+ }
893
+ class TransformControls extends Object3D {
894
+ events = [];
895
+ camera;
896
+ scriptable;
897
+ sourceTarget;
898
+ object;
899
+ args;
900
+ descriptor;
901
+ graphics;
902
+ domElement;
903
+ isTransformControls;
904
+ _gizmo;
905
+ _plane;
906
+ _offset = new Vector3();
907
+ _startNorm = new Vector3();
908
+ _endNorm = new Vector3();
909
+ _cameraScale = new Vector3();
910
+ mode = 'translate';
911
+ space = 'world';
912
+ axis = null;
913
+ dragging = false;
914
+ worldPosition = new Vector3();
915
+ worldQuaternion = new Quaternion();
916
+ cameraPosition = new Vector3();
917
+ cameraQuaternion = new Quaternion();
918
+ eye = new Vector3();
919
+ showX = true;
920
+ showY = true;
921
+ showZ = true;
922
+ size = 1;
923
+ _parentPosition = new Vector3();
924
+ _parentQuaternion = new Quaternion();
925
+ _parentQuaternionInv = new Quaternion();
926
+ _parentScale = new Vector3();
927
+ _worldScaleStart = new Vector3();
928
+ _worldQuaternionInv = new Quaternion();
929
+ _worldScale = new Vector3();
930
+ _positionStart = new Vector3();
931
+ _quaternionStart = new Quaternion();
932
+ _scaleStart = new Vector3();
933
+ _getPointer = getPointer.bind(this);
934
+ _onPointerDown = onPointerDown.bind(this);
935
+ _onPointerHover = onPointerHover.bind(this);
936
+ _onPointerMove = onPointerMove.bind(this);
937
+ _onPointerUp = onPointerUp.bind(this);
938
+ constructor() {
939
+ super();
940
+ this.isTransformControls = true;
941
+ this.visible = false;
942
+ const _gizmo = new TransformControlsGizmo();
943
+ this._gizmo = _gizmo;
944
+ this.add(_gizmo);
945
+ const _plane = new TransformControlsPlane();
946
+ this._plane = _plane;
947
+ this.add(_plane);
948
+ this.setCustomProperty('object', undefined);
949
+ this.setCustomProperty('enabled', false);
950
+ this.setCustomProperty('axis', null);
951
+ this.setCustomProperty('mode', 'translate');
952
+ this.setCustomProperty('translationSnap', null);
953
+ this.setCustomProperty('rotationSnap', null);
954
+ this.setCustomProperty('scaleSnap', null);
955
+ this.setCustomProperty('space', 'world');
956
+ this.setCustomProperty('size', 1);
957
+ this.setCustomProperty('dragging', false);
958
+ this.setCustomProperty('showX', true);
959
+ this.setCustomProperty('showY', true);
960
+ this.setCustomProperty('showZ', true);
961
+ // Reusable utility variables
962
+ const worldPosition = new Vector3();
963
+ const worldPositionStart = new Vector3();
964
+ const worldQuaternion = new Quaternion();
965
+ const worldQuaternionStart = new Quaternion();
966
+ const cameraPosition = new Vector3();
967
+ const cameraQuaternion = new Quaternion();
968
+ const pointStart = new Vector3();
969
+ const pointEnd = new Vector3();
970
+ const rotationAxis = new Vector3();
971
+ const rotationAngle = 0;
972
+ const eye = new Vector3();
973
+ this.setCustomProperty('worldPosition', worldPosition);
974
+ this.setCustomProperty('worldPositionStart', worldPositionStart);
975
+ this.setCustomProperty('worldQuaternion', worldQuaternion);
976
+ this.setCustomProperty('worldQuaternionStart', worldQuaternionStart);
977
+ this.setCustomProperty('cameraPosition', cameraPosition);
978
+ this.setCustomProperty('cameraQuaternion', cameraQuaternion);
979
+ this.setCustomProperty('pointStart', pointStart);
980
+ this.setCustomProperty('pointEnd', pointEnd);
981
+ this.setCustomProperty('rotationAxis', rotationAxis);
982
+ this.setCustomProperty('rotationAngle', rotationAngle);
983
+ this.setCustomProperty('eye', eye);
984
+ }
985
+ change(type = 'change') {
986
+ if (!this.scriptable)
987
+ return;
988
+ this.sourceTarget.position.x = this.object.position.x;
989
+ this.sourceTarget.position.y = this.object.position.y;
990
+ this.sourceTarget.position.z = this.object.position.z;
991
+ this.sourceTarget.scale.x = this.object.scale.x;
992
+ this.sourceTarget.scale.y = this.object.scale.y;
993
+ this.sourceTarget.scale.z = this.object.scale.z;
994
+ this.sourceTarget.rotation.x = this.object.rotation.x;
995
+ this.sourceTarget.rotation.y = this.object.rotation.y;
996
+ this.sourceTarget.rotation.z = this.object.rotation.z;
997
+ const _args = { event: { type, target: this.descriptor.target }, trigger: this.sourceTarget };
998
+ this.scriptable.execute(this.graphics, _args);
999
+ }
1000
+ listen(descriptor, graphics) {
1001
+ this.unlisten(graphics);
1002
+ const sourceTarget = graphics.variableProxy.get(descriptor.target, graphics);
1003
+ if (sourceTarget === null)
1004
+ return;
1005
+ const sourceTargetActor = graphics.getActor(sourceTarget);
1006
+ if (sourceTargetActor instanceof NodeActor) {
1007
+ const camera = graphics.variableProxy.get(graphics.scheduler.camera, graphics);
1008
+ const actor = graphics.getActor(camera);
1009
+ const scriptable = Asset.get(descriptor.event);
1010
+ this.setCustomProperty('camera', actor.object);
1011
+ this.setCustomProperty('graphics', graphics);
1012
+ this.setCustomProperty('args');
1013
+ this.setCustomProperty('descriptor', descriptor);
1014
+ this.setCustomProperty('mode', descriptor.mode);
1015
+ this.setCustomProperty('scriptable', scriptable);
1016
+ this.setCustomProperty('sourceTarget', sourceTarget);
1017
+ this.setCustomProperty('enabled', true);
1018
+ this.attach(sourceTargetActor.object);
1019
+ this.domElement = this.getWrapper(descriptor, graphics);
1020
+ this.events.push(graphics.engine.inputSystem.listen('pointerdown', this._onPointerDown, { target: this.domElement }));
1021
+ this.events.push(graphics.engine.inputSystem.listen('pointerdown', this._onPointerDown, { target: this.domElement }));
1022
+ this.events.push(graphics.engine.inputSystem.listen('pointerup', this._onPointerUp, { target: this.domElement }));
1023
+ }
1024
+ }
1025
+ unlisten(graphics) {
1026
+ this.unbind(graphics);
1027
+ this.detach();
1028
+ this.setCustomProperty('args', undefined);
1029
+ this.setCustomProperty('descriptor', undefined);
1030
+ this.setCustomProperty('camera', undefined);
1031
+ this.setCustomProperty('scriptable', undefined);
1032
+ this.setCustomProperty('sourceTarget', undefined);
1033
+ this.setCustomProperty('enabled', false);
1034
+ }
1035
+ unbind(graphics) {
1036
+ for (const e of this.events)
1037
+ graphics.engine.inputSystem.unlisten(e);
1038
+ this.events.length = 0;
1039
+ }
1040
+ dispose(graphics) {
1041
+ this.unbind(graphics);
1042
+ this.traverse(function (child) {
1043
+ //@ts-ignore
1044
+ if (child.geometry)
1045
+ child.geometry.dispose();
1046
+ //@ts-ignore
1047
+ if (child.material)
1048
+ child.material.dispose();
1049
+ });
1050
+ }
1051
+ getWrapper(descriptor, graphics) {
1052
+ let wrapper;
1053
+ const service = graphics.traceService(descriptor);
1054
+ if (service instanceof SceneServiceDescriptor) {
1055
+ const interpreter = graphics.getInterpreter(service);
1056
+ const actor = interpreter.getActor(service);
1057
+ wrapper = actor.getWrapper();
1058
+ }
1059
+ return wrapper;
1060
+ }
1061
+ setCustomProperty(propName, defaultValue) {
1062
+ const scope = this;
1063
+ scope[propName] = defaultValue;
1064
+ scope._plane[propName] = defaultValue;
1065
+ scope._gizmo[propName] = defaultValue;
1066
+ }
1067
+ // updateMatrixWorld updates key transformation variables
1068
+ updateMatrixWorld() {
1069
+ if (this.enabled === false)
1070
+ return;
1071
+ if (this.object !== undefined) {
1072
+ this.object.updateMatrixWorld();
1073
+ if (this.object.parent === null) {
1074
+ console.error('TransformControllerActor: The attached 3D object must be a part of the scene graph.');
1075
+ }
1076
+ else {
1077
+ this.object.parent.matrixWorld.decompose(this._parentPosition, this._parentQuaternion, this._parentScale);
1078
+ }
1079
+ this.object.matrixWorld.decompose(this.worldPosition, this.worldQuaternion, this._worldScale);
1080
+ this._parentQuaternionInv.copy(this._parentQuaternion).invert();
1081
+ this._worldQuaternionInv.copy(this.worldQuaternion).invert();
1082
+ }
1083
+ this.camera.updateMatrixWorld();
1084
+ this.camera.matrixWorld.decompose(this.cameraPosition, this.cameraQuaternion, this._cameraScale);
1085
+ //@ts-ignore
1086
+ if (this.camera.isOrthographicCamera) {
1087
+ this.camera.getWorldDirection(this.eye).negate();
1088
+ }
1089
+ else {
1090
+ this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize();
1091
+ }
1092
+ super.updateMatrixWorld(this);
1093
+ }
1094
+ pointerHover(pointer) {
1095
+ if (this.object === undefined || this.dragging === true)
1096
+ return;
1097
+ _raycaster.setFromCamera(pointer, this.camera);
1098
+ const intersect = intersectObjectWithRay(this._gizmo.picker[this.mode], _raycaster);
1099
+ if (intersect) {
1100
+ this.axis = intersect.object.name;
1101
+ }
1102
+ else {
1103
+ this.axis = null;
1104
+ }
1105
+ }
1106
+ pointerDown(pointer) {
1107
+ if (this.object === undefined ||
1108
+ this.dragging === true ||
1109
+ pointer.button !== 0)
1110
+ return;
1111
+ if (this.axis !== null) {
1112
+ _raycaster.setFromCamera(pointer, this.camera);
1113
+ const planeIntersect = intersectObjectWithRay(this._plane, _raycaster, true);
1114
+ if (planeIntersect) {
1115
+ this.object.updateMatrixWorld();
1116
+ this.object.parent.updateMatrixWorld();
1117
+ this._positionStart.copy(this.object.position);
1118
+ this._quaternionStart.copy(this.object.quaternion);
1119
+ this._scaleStart.copy(this.object.scale);
1120
+ this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart);
1121
+ this.pointStart.copy(planeIntersect.point).sub(this.worldPositionStart);
1122
+ }
1123
+ this.dragging = true;
1124
+ this.change('mousedown');
1125
+ }
1126
+ }
1127
+ pointerMove(pointer) {
1128
+ const axis = this.axis;
1129
+ const mode = this.mode;
1130
+ const object = this.object;
1131
+ let space = this.space;
1132
+ if (mode === 'scale') {
1133
+ space = 'local';
1134
+ }
1135
+ else if (axis === 'E' || axis === 'XYZE' || axis === 'XYZ') {
1136
+ space = 'world';
1137
+ }
1138
+ if (object === undefined ||
1139
+ axis === null ||
1140
+ this.dragging === false ||
1141
+ pointer.button !== -1)
1142
+ return;
1143
+ _raycaster.setFromCamera(pointer, this.camera);
1144
+ const planeIntersect = intersectObjectWithRay(this._plane, _raycaster, true);
1145
+ if (!planeIntersect)
1146
+ return;
1147
+ this.pointEnd.copy(planeIntersect.point).sub(this.worldPositionStart);
1148
+ if (mode === 'translate') {
1149
+ // Apply translate
1150
+ this._offset.copy(this.pointEnd).sub(this.pointStart);
1151
+ if (space === 'local' && axis !== 'XYZ') {
1152
+ this._offset.applyQuaternion(this._worldQuaternionInv);
1153
+ }
1154
+ if (axis.indexOf('X') === -1)
1155
+ this._offset.x = 0;
1156
+ if (axis.indexOf('Y') === -1)
1157
+ this._offset.y = 0;
1158
+ if (axis.indexOf('Z') === -1)
1159
+ this._offset.z = 0;
1160
+ if (space === 'local' && axis !== 'XYZ') {
1161
+ this._offset
1162
+ .applyQuaternion(this._quaternionStart)
1163
+ .divide(this._parentScale);
1164
+ }
1165
+ else {
1166
+ this._offset
1167
+ .applyQuaternion(this._parentQuaternionInv)
1168
+ .divide(this._parentScale);
1169
+ }
1170
+ object.position.copy(this._offset).add(this._positionStart);
1171
+ // Apply translation snap
1172
+ if (this.translationSnap) {
1173
+ if (space === 'local') {
1174
+ object.position.applyQuaternion(_tempQuaternion.copy(this._quaternionStart).invert());
1175
+ if (axis.search('X') !== -1) {
1176
+ object.position.x =
1177
+ Math.round(object.position.x / this.translationSnap) *
1178
+ this.translationSnap;
1179
+ }
1180
+ if (axis.search('Y') !== -1) {
1181
+ object.position.y =
1182
+ Math.round(object.position.y / this.translationSnap) *
1183
+ this.translationSnap;
1184
+ }
1185
+ if (axis.search('Z') !== -1) {
1186
+ object.position.z =
1187
+ Math.round(object.position.z / this.translationSnap) *
1188
+ this.translationSnap;
1189
+ }
1190
+ object.position.applyQuaternion(this._quaternionStart);
1191
+ }
1192
+ if (space === 'world') {
1193
+ if (object.parent) {
1194
+ object.position.add(_tempVector.setFromMatrixPosition(object.parent.matrixWorld));
1195
+ }
1196
+ if (axis.search('X') !== -1) {
1197
+ object.position.x =
1198
+ Math.round(object.position.x / this.translationSnap) *
1199
+ this.translationSnap;
1200
+ }
1201
+ if (axis.search('Y') !== -1) {
1202
+ object.position.y =
1203
+ Math.round(object.position.y / this.translationSnap) *
1204
+ this.translationSnap;
1205
+ }
1206
+ if (axis.search('Z') !== -1) {
1207
+ object.position.z =
1208
+ Math.round(object.position.z / this.translationSnap) *
1209
+ this.translationSnap;
1210
+ }
1211
+ if (object.parent) {
1212
+ object.position.sub(_tempVector.setFromMatrixPosition(object.parent.matrixWorld));
1213
+ }
1214
+ }
1215
+ }
1216
+ }
1217
+ else if (mode === 'scale') {
1218
+ if (axis.search('XYZ') !== -1) {
1219
+ let d = this.pointEnd.length() / this.pointStart.length();
1220
+ if (this.pointEnd.dot(this.pointStart) < 0)
1221
+ d *= -1;
1222
+ _tempVector2.set(d, d, d);
1223
+ }
1224
+ else {
1225
+ _tempVector.copy(this.pointStart);
1226
+ _tempVector2.copy(this.pointEnd);
1227
+ _tempVector.applyQuaternion(this._worldQuaternionInv);
1228
+ _tempVector2.applyQuaternion(this._worldQuaternionInv);
1229
+ _tempVector2.divide(_tempVector);
1230
+ if (axis.search('X') === -1) {
1231
+ _tempVector2.x = 1;
1232
+ }
1233
+ if (axis.search('Y') === -1) {
1234
+ _tempVector2.y = 1;
1235
+ }
1236
+ if (axis.search('Z') === -1) {
1237
+ _tempVector2.z = 1;
1238
+ }
1239
+ }
1240
+ // Apply scale
1241
+ object.scale.copy(this._scaleStart).multiply(_tempVector2);
1242
+ if (this.scaleSnap) {
1243
+ if (axis.search('X') !== -1) {
1244
+ object.scale.x =
1245
+ Math.round(object.scale.x / this.scaleSnap) * this.scaleSnap ||
1246
+ this.scaleSnap;
1247
+ }
1248
+ if (axis.search('Y') !== -1) {
1249
+ object.scale.y =
1250
+ Math.round(object.scale.y / this.scaleSnap) * this.scaleSnap ||
1251
+ this.scaleSnap;
1252
+ }
1253
+ if (axis.search('Z') !== -1) {
1254
+ object.scale.z =
1255
+ Math.round(object.scale.z / this.scaleSnap) * this.scaleSnap ||
1256
+ this.scaleSnap;
1257
+ }
1258
+ }
1259
+ }
1260
+ else if (mode === 'rotate') {
1261
+ this._offset.copy(this.pointEnd).sub(this.pointStart);
1262
+ const ROTATION_SPEED = 20 /
1263
+ this.worldPosition.distanceTo(_tempVector.setFromMatrixPosition(this.camera.matrixWorld));
1264
+ if (axis === 'E') {
1265
+ this.rotationAxis.copy(this.eye);
1266
+ this.rotationAngle = this.pointEnd.angleTo(this.pointStart);
1267
+ this._startNorm.copy(this.pointStart).normalize();
1268
+ this._endNorm.copy(this.pointEnd).normalize();
1269
+ this.rotationAngle *=
1270
+ this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1;
1271
+ }
1272
+ else if (axis === 'XYZE') {
1273
+ this.rotationAxis.copy(this._offset).cross(this.eye).normalize();
1274
+ this.rotationAngle =
1275
+ this._offset.dot(_tempVector.copy(this.rotationAxis).cross(this.eye)) * ROTATION_SPEED;
1276
+ }
1277
+ else if (axis === 'X' || axis === 'Y' || axis === 'Z') {
1278
+ this.rotationAxis.copy(_unit[axis]);
1279
+ _tempVector.copy(_unit[axis]);
1280
+ if (space === 'local') {
1281
+ _tempVector.applyQuaternion(this.worldQuaternion);
1282
+ }
1283
+ this.rotationAngle =
1284
+ this._offset.dot(_tempVector.cross(this.eye).normalize()) *
1285
+ ROTATION_SPEED;
1286
+ }
1287
+ // Apply rotation snap
1288
+ if (this.rotationSnap)
1289
+ this.rotationAngle =
1290
+ Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap;
1291
+ // Apply rotate
1292
+ if (space === 'local' && axis !== 'E' && axis !== 'XYZE') {
1293
+ object.quaternion.copy(this._quaternionStart);
1294
+ object.quaternion
1295
+ .multiply(_tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle))
1296
+ .normalize();
1297
+ }
1298
+ else {
1299
+ this.rotationAxis.applyQuaternion(this._parentQuaternionInv);
1300
+ object.quaternion.copy(_tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle));
1301
+ object.quaternion.multiply(this._quaternionStart).normalize();
1302
+ }
1303
+ }
1304
+ this.change();
1305
+ }
1306
+ pointerUp(pointer) {
1307
+ if (pointer.button !== 0)
1308
+ return;
1309
+ if (this.dragging && this.axis !== null) {
1310
+ this.change('mouseup');
1311
+ }
1312
+ this.dragging = false;
1313
+ this.axis = null;
1314
+ }
1315
+ // Set current object
1316
+ attach(object) {
1317
+ this.object = object;
1318
+ this.visible = true;
1319
+ return this;
1320
+ }
1321
+ // Detach from object
1322
+ detach() {
1323
+ this.object = undefined;
1324
+ this.visible = false;
1325
+ this.axis = null;
1326
+ return this;
1327
+ }
1328
+ reset() {
1329
+ if (this.enabled === false)
1330
+ return;
1331
+ if (this.dragging) {
1332
+ this.object.position.copy(this._positionStart);
1333
+ this.object.quaternion.copy(this._quaternionStart);
1334
+ this.object.scale.copy(this._scaleStart);
1335
+ this.change();
1336
+ this.pointStart.copy(this.pointEnd);
1337
+ }
1338
+ }
1339
+ getRaycaster() {
1340
+ return _raycaster;
1341
+ }
1342
+ setTranslationSnap(translationSnap) {
1343
+ this.translationSnap = translationSnap;
1344
+ }
1345
+ setRotationSnap(rotationSnap) {
1346
+ this.rotationSnap = rotationSnap;
1347
+ }
1348
+ setScaleSnap(scaleSnap) {
1349
+ this.scaleSnap = scaleSnap;
1350
+ }
1351
+ setSize(size) {
1352
+ this.size = size;
1353
+ }
1354
+ setSpace(space) {
1355
+ this.space = space;
1356
+ }
1357
+ }
1358
+ export { TransformControls };
1359
+ //# sourceMappingURL=TransformControls.js.map