angular-three-soba 1.13.0 → 1.14.0

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 (257) hide show
  1. package/abstractions/lib/billboard/billboard.d.ts +1 -1
  2. package/abstractions/lib/catmull-rom-line/catmull-rom-line.d.ts +1 -1
  3. package/abstractions/lib/cubic-bezier-line/cubic-bezier-line.d.ts +1 -1
  4. package/abstractions/lib/edges/edges.d.ts +2 -2
  5. package/abstractions/lib/gizmo-helper/gizmo-helper.d.ts +1 -1
  6. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +1 -1
  7. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +2 -2
  8. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +1 -1
  9. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +1 -1
  10. package/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +2 -2
  11. package/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +1 -1
  12. package/abstractions/lib/line/line-input.d.ts +1 -1
  13. package/abstractions/lib/line/line.d.ts +1 -1
  14. package/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.d.ts +1 -1
  15. package/abstractions/lib/text/text.d.ts +1 -1
  16. package/abstractions/lib/text-3d/text-3d.d.ts +1 -1
  17. package/cameras/lib/camera/camera-content.d.ts +1 -1
  18. package/cameras/lib/camera/camera.d.ts +1 -1
  19. package/cameras/lib/cube-camera/cube-camera.d.ts +1 -1
  20. package/cameras/lib/orthographic-camera/orthographic-camera.d.ts +1 -1
  21. package/controls/lib/orbit-controls/orbit-controls.d.ts +1 -1
  22. package/esm2022/abstractions/lib/billboard/billboard.mjs +74 -0
  23. package/esm2022/abstractions/lib/catmull-rom-line/catmull-rom-line.mjs +120 -0
  24. package/esm2022/abstractions/lib/cubic-bezier-line/cubic-bezier-line.mjs +99 -0
  25. package/esm2022/abstractions/lib/edges/edges.mjs +96 -0
  26. package/esm2022/abstractions/lib/gizmo-helper/gizmo-helper.mjs +213 -0
  27. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +92 -0
  28. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +184 -0
  29. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +46 -0
  30. package/{esm2020 → esm2022}/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +8 -7
  31. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +195 -0
  32. package/{esm2020 → esm2022}/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +8 -7
  33. package/esm2022/abstractions/lib/line/line-input.mjs +76 -0
  34. package/esm2022/abstractions/lib/line/line.mjs +133 -0
  35. package/esm2022/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.mjs +128 -0
  36. package/esm2022/abstractions/lib/text/text.mjs +115 -0
  37. package/esm2022/abstractions/lib/text-3d/text-3d.mjs +145 -0
  38. package/esm2022/cameras/lib/camera/camera-content.mjs +21 -0
  39. package/esm2022/cameras/lib/camera/camera.mjs +75 -0
  40. package/esm2022/cameras/lib/cube-camera/cube-camera.mjs +131 -0
  41. package/esm2022/cameras/lib/orthographic-camera/orthographic-camera.mjs +93 -0
  42. package/{esm2020 → esm2022}/cameras/lib/perspective-camera/perspective-camera.mjs +8 -7
  43. package/esm2022/controls/lib/orbit-controls/orbit-controls.mjs +147 -0
  44. package/{esm2020 → esm2022}/loaders/lib/cube-texture-loader/cube-texture-loader.mjs +3 -3
  45. package/esm2022/loaders/lib/loader/loader.mjs +134 -0
  46. package/esm2022/materials/lib/mesh-distort-material/mesh-distort-material.mjs +75 -0
  47. package/esm2022/materials/lib/mesh-reflector-material/mesh-reflector-material.mjs +328 -0
  48. package/esm2022/materials/lib/mesh-refraction-material/mesh-refraction-material.mjs +158 -0
  49. package/esm2022/materials/lib/mesh-transmission-material/mesh-transmission-material.mjs +238 -0
  50. package/esm2022/materials/lib/mesh-wobble-material/mesh-wobble-material.mjs +68 -0
  51. package/esm2022/misc/lib/bake-shadows/bake-shadows.mjs +26 -0
  52. package/esm2022/performance/lib/adaptive/adaptive-dpr.mjs +47 -0
  53. package/esm2022/performance/lib/adaptive/adaptive-events.mjs +37 -0
  54. package/esm2022/performance/lib/detailed/detailed.mjs +54 -0
  55. package/esm2022/performance/lib/stats/stats.mjs +80 -0
  56. package/esm2022/shaders/lib/blur-pass/blur-pass.mjs +61 -0
  57. package/esm2022/staging/lib/accumulative-shadows/accumulative-shadows.mjs +249 -0
  58. package/esm2022/staging/lib/accumulative-shadows/randomized-lights.mjs +201 -0
  59. package/{esm2020 → esm2022}/staging/lib/bounds/bounds.mjs +8 -7
  60. package/esm2022/staging/lib/camera-shake/camera-shake.mjs +122 -0
  61. package/esm2022/staging/lib/caustics/caustics.mjs +364 -0
  62. package/esm2022/staging/lib/center/center.mjs +143 -0
  63. package/esm2022/staging/lib/cloud/cloud.mjs +160 -0
  64. package/esm2022/staging/lib/contact-shadows/contact-shadows.mjs +228 -0
  65. package/esm2022/staging/lib/environment/environment-cube.mjs +41 -0
  66. package/esm2022/staging/lib/environment/environment-ground.mjs +67 -0
  67. package/esm2022/staging/lib/environment/environment-inputs.mjs +87 -0
  68. package/esm2022/staging/lib/environment/environment-map.mjs +39 -0
  69. package/esm2022/staging/lib/environment/environment-portal.mjs +111 -0
  70. package/{esm2020 → esm2022}/staging/lib/environment/environment.mjs +13 -11
  71. package/esm2022/staging/lib/float/float.mjs +77 -0
  72. package/esm2022/staging/lib/sky/sky.mjs +109 -0
  73. package/esm2022/staging/lib/sparkles/sparkles.mjs +210 -0
  74. package/esm2022/staging/lib/spot-light/shadow-mesh-input.mjs +51 -0
  75. package/esm2022/staging/lib/spot-light/spot-light-input.mjs +62 -0
  76. package/esm2022/staging/lib/spot-light/spot-light-shadow-no-shader.mjs +74 -0
  77. package/esm2022/staging/lib/spot-light/spot-light-shadow-shader.mjs +126 -0
  78. package/{esm2020 → esm2022}/staging/lib/spot-light/spot-light-shadow.mjs +8 -7
  79. package/esm2022/staging/lib/spot-light/spot-light.mjs +117 -0
  80. package/esm2022/staging/lib/spot-light/volumetric-mesh.mjs +86 -0
  81. package/{esm2020 → esm2022}/staging/lib/stage/stage.mjs +13 -11
  82. package/esm2022/staging/lib/stars/stars.mjs +140 -0
  83. package/{fesm2020 → fesm2022}/angular-three-soba-abstractions.mjs +89 -89
  84. package/{fesm2015 → fesm2022}/angular-three-soba-abstractions.mjs.map +1 -1
  85. package/{fesm2015 → fesm2022}/angular-three-soba-cameras.mjs +21 -21
  86. package/{fesm2015 → fesm2022}/angular-three-soba-cameras.mjs.map +1 -1
  87. package/{fesm2020 → fesm2022}/angular-three-soba-controls.mjs +5 -5
  88. package/fesm2022/angular-three-soba-controls.mjs.map +1 -0
  89. package/{fesm2020 → fesm2022}/angular-three-soba-loaders.mjs +7 -7
  90. package/{fesm2020 → fesm2022}/angular-three-soba-loaders.mjs.map +1 -1
  91. package/{fesm2020 → fesm2022}/angular-three-soba-materials.mjs +25 -25
  92. package/{fesm2020 → fesm2022}/angular-three-soba-materials.mjs.map +1 -1
  93. package/{fesm2020 → fesm2022}/angular-three-soba-misc.mjs +3 -3
  94. package/{fesm2020 → fesm2022}/angular-three-soba-misc.mjs.map +1 -1
  95. package/{fesm2020 → fesm2022}/angular-three-soba-performance.mjs +14 -14
  96. package/{fesm2020 → fesm2022}/angular-three-soba-performance.mjs.map +1 -1
  97. package/{fesm2020 → fesm2022}/angular-three-soba-shaders.mjs +2 -2
  98. package/fesm2022/angular-three-soba-shaders.mjs.map +1 -0
  99. package/{fesm2020 → fesm2022}/angular-three-soba-staging.mjs +139 -139
  100. package/{fesm2020 → fesm2022}/angular-three-soba-staging.mjs.map +1 -1
  101. package/loaders/lib/loader/loader.d.ts +1 -1
  102. package/materials/lib/mesh-distort-material/mesh-distort-material.d.ts +1 -1
  103. package/materials/lib/mesh-reflector-material/mesh-reflector-material.d.ts +1 -1
  104. package/materials/lib/mesh-refraction-material/mesh-refraction-material.d.ts +1 -1
  105. package/materials/lib/mesh-transmission-material/mesh-transmission-material.d.ts +1 -1
  106. package/materials/lib/mesh-wobble-material/mesh-wobble-material.d.ts +1 -1
  107. package/package.json +43 -68
  108. package/performance/lib/adaptive/adaptive-dpr.d.ts +1 -1
  109. package/performance/lib/detailed/detailed.d.ts +1 -1
  110. package/performance/lib/stats/stats.d.ts +1 -1
  111. package/plugin/package.json +1 -1
  112. package/plugin/src/generators/init/compat.js +1 -1
  113. package/plugin/src/generators/init/compat.js.map +1 -1
  114. package/plugin/src/generators/init/init.d.ts +1 -1
  115. package/plugin/src/generators/init/init.js +1 -1
  116. package/plugin/src/generators/init/init.js.map +1 -1
  117. package/staging/lib/accumulative-shadows/accumulative-shadows.d.ts +2 -2
  118. package/staging/lib/accumulative-shadows/randomized-lights.d.ts +1 -1
  119. package/staging/lib/bounds/bounds.d.ts +1 -1
  120. package/staging/lib/camera-shake/camera-shake.d.ts +1 -1
  121. package/staging/lib/caustics/caustics.d.ts +2 -2
  122. package/staging/lib/center/center.d.ts +1 -1
  123. package/staging/lib/cloud/cloud.d.ts +1 -1
  124. package/staging/lib/contact-shadows/contact-shadows.d.ts +1 -1
  125. package/staging/lib/environment/environment-inputs.d.ts +1 -1
  126. package/staging/lib/float/float.d.ts +1 -1
  127. package/staging/lib/sky/sky.d.ts +1 -1
  128. package/staging/lib/sparkles/sparkles.d.ts +2 -2
  129. package/staging/lib/spot-light/shadow-mesh-input.d.ts +1 -1
  130. package/staging/lib/spot-light/spot-light-input.d.ts +1 -1
  131. package/staging/lib/spot-light/spot-light-shadow-no-shader.d.ts +1 -1
  132. package/staging/lib/spot-light/spot-light-shadow-shader.d.ts +1 -1
  133. package/staging/lib/spot-light/spot-light.d.ts +1 -1
  134. package/staging/lib/spot-light/volumetric-mesh.d.ts +1 -1
  135. package/staging/lib/stage/stage.d.ts +2 -2
  136. package/staging/lib/stars/stars.d.ts +2 -2
  137. package/esm2020/abstractions/lib/billboard/billboard.mjs +0 -73
  138. package/esm2020/abstractions/lib/catmull-rom-line/catmull-rom-line.mjs +0 -119
  139. package/esm2020/abstractions/lib/cubic-bezier-line/cubic-bezier-line.mjs +0 -98
  140. package/esm2020/abstractions/lib/edges/edges.mjs +0 -95
  141. package/esm2020/abstractions/lib/gizmo-helper/gizmo-helper.mjs +0 -211
  142. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +0 -91
  143. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +0 -182
  144. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +0 -45
  145. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +0 -193
  146. package/esm2020/abstractions/lib/line/line-input.mjs +0 -75
  147. package/esm2020/abstractions/lib/line/line.mjs +0 -132
  148. package/esm2020/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.mjs +0 -127
  149. package/esm2020/abstractions/lib/text/text.mjs +0 -114
  150. package/esm2020/abstractions/lib/text-3d/text-3d.mjs +0 -144
  151. package/esm2020/cameras/lib/camera/camera-content.mjs +0 -20
  152. package/esm2020/cameras/lib/camera/camera.mjs +0 -74
  153. package/esm2020/cameras/lib/cube-camera/cube-camera.mjs +0 -130
  154. package/esm2020/cameras/lib/orthographic-camera/orthographic-camera.mjs +0 -92
  155. package/esm2020/controls/lib/orbit-controls/orbit-controls.mjs +0 -146
  156. package/esm2020/loaders/lib/loader/loader.mjs +0 -133
  157. package/esm2020/materials/lib/mesh-distort-material/mesh-distort-material.mjs +0 -74
  158. package/esm2020/materials/lib/mesh-reflector-material/mesh-reflector-material.mjs +0 -327
  159. package/esm2020/materials/lib/mesh-refraction-material/mesh-refraction-material.mjs +0 -157
  160. package/esm2020/materials/lib/mesh-transmission-material/mesh-transmission-material.mjs +0 -237
  161. package/esm2020/materials/lib/mesh-wobble-material/mesh-wobble-material.mjs +0 -67
  162. package/esm2020/misc/lib/bake-shadows/bake-shadows.mjs +0 -25
  163. package/esm2020/performance/lib/adaptive/adaptive-dpr.mjs +0 -46
  164. package/esm2020/performance/lib/adaptive/adaptive-events.mjs +0 -36
  165. package/esm2020/performance/lib/detailed/detailed.mjs +0 -53
  166. package/esm2020/performance/lib/stats/stats.mjs +0 -79
  167. package/esm2020/shaders/lib/blur-pass/blur-pass.mjs +0 -61
  168. package/esm2020/staging/lib/accumulative-shadows/accumulative-shadows.mjs +0 -247
  169. package/esm2020/staging/lib/accumulative-shadows/randomized-lights.mjs +0 -199
  170. package/esm2020/staging/lib/camera-shake/camera-shake.mjs +0 -121
  171. package/esm2020/staging/lib/caustics/caustics.mjs +0 -363
  172. package/esm2020/staging/lib/center/center.mjs +0 -142
  173. package/esm2020/staging/lib/cloud/cloud.mjs +0 -159
  174. package/esm2020/staging/lib/contact-shadows/contact-shadows.mjs +0 -227
  175. package/esm2020/staging/lib/environment/environment-cube.mjs +0 -40
  176. package/esm2020/staging/lib/environment/environment-ground.mjs +0 -66
  177. package/esm2020/staging/lib/environment/environment-inputs.mjs +0 -86
  178. package/esm2020/staging/lib/environment/environment-map.mjs +0 -38
  179. package/esm2020/staging/lib/environment/environment-portal.mjs +0 -110
  180. package/esm2020/staging/lib/float/float.mjs +0 -76
  181. package/esm2020/staging/lib/sky/sky.mjs +0 -108
  182. package/esm2020/staging/lib/sparkles/sparkles.mjs +0 -209
  183. package/esm2020/staging/lib/spot-light/shadow-mesh-input.mjs +0 -50
  184. package/esm2020/staging/lib/spot-light/spot-light-input.mjs +0 -61
  185. package/esm2020/staging/lib/spot-light/spot-light-shadow-no-shader.mjs +0 -73
  186. package/esm2020/staging/lib/spot-light/spot-light-shadow-shader.mjs +0 -125
  187. package/esm2020/staging/lib/spot-light/spot-light.mjs +0 -116
  188. package/esm2020/staging/lib/spot-light/volumetric-mesh.mjs +0 -85
  189. package/esm2020/staging/lib/stars/stars.mjs +0 -139
  190. package/fesm2015/angular-three-soba-abstractions.mjs +0 -2048
  191. package/fesm2015/angular-three-soba-controls.mjs +0 -153
  192. package/fesm2015/angular-three-soba-controls.mjs.map +0 -1
  193. package/fesm2015/angular-three-soba-loaders.mjs +0 -229
  194. package/fesm2015/angular-three-soba-loaders.mjs.map +0 -1
  195. package/fesm2015/angular-three-soba-materials.mjs +0 -851
  196. package/fesm2015/angular-three-soba-materials.mjs.map +0 -1
  197. package/fesm2015/angular-three-soba-misc.mjs +0 -148
  198. package/fesm2015/angular-three-soba-misc.mjs.map +0 -1
  199. package/fesm2015/angular-three-soba-performance.mjs +0 -210
  200. package/fesm2015/angular-three-soba-performance.mjs.map +0 -1
  201. package/fesm2015/angular-three-soba-shaders.mjs +0 -1239
  202. package/fesm2015/angular-three-soba-shaders.mjs.map +0 -1
  203. package/fesm2015/angular-three-soba-staging.mjs +0 -3772
  204. package/fesm2015/angular-three-soba-staging.mjs.map +0 -1
  205. package/fesm2020/angular-three-soba-abstractions.mjs.map +0 -1
  206. package/fesm2020/angular-three-soba-cameras.mjs +0 -347
  207. package/fesm2020/angular-three-soba-cameras.mjs.map +0 -1
  208. package/fesm2020/angular-three-soba-controls.mjs.map +0 -1
  209. package/fesm2020/angular-three-soba-shaders.mjs.map +0 -1
  210. package/fesm2020/angular-three-soba.mjs +0 -6
  211. package/fesm2020/angular-three-soba.mjs.map +0 -1
  212. /package/{esm2020 → esm2022}/abstractions/angular-three-soba-abstractions.mjs +0 -0
  213. /package/{esm2020 → esm2022}/abstractions/index.mjs +0 -0
  214. /package/{esm2020 → esm2022}/abstractions/lib/gizmo-helper/gizmo-viewcube/constants.mjs +0 -0
  215. /package/{esm2020 → esm2022}/angular-three-soba.mjs +0 -0
  216. /package/{esm2020 → esm2022}/cameras/angular-three-soba-cameras.mjs +0 -0
  217. /package/{esm2020 → esm2022}/cameras/index.mjs +0 -0
  218. /package/{esm2020 → esm2022}/controls/angular-three-soba-controls.mjs +0 -0
  219. /package/{esm2020 → esm2022}/controls/index.mjs +0 -0
  220. /package/{esm2020 → esm2022}/index.mjs +0 -0
  221. /package/{esm2020 → esm2022}/loaders/angular-three-soba-loaders.mjs +0 -0
  222. /package/{esm2020 → esm2022}/loaders/index.mjs +0 -0
  223. /package/{esm2020 → esm2022}/loaders/lib/gltf-loader/gltf-loader.mjs +0 -0
  224. /package/{esm2020 → esm2022}/loaders/lib/progress/progress.mjs +0 -0
  225. /package/{esm2020 → esm2022}/loaders/lib/texture-loader/texture-loader.mjs +0 -0
  226. /package/{esm2020 → esm2022}/materials/angular-three-soba-materials.mjs +0 -0
  227. /package/{esm2020 → esm2022}/materials/index.mjs +0 -0
  228. /package/{esm2020 → esm2022}/misc/angular-three-soba-misc.mjs +0 -0
  229. /package/{esm2020 → esm2022}/misc/index.mjs +0 -0
  230. /package/{esm2020 → esm2022}/misc/lib/animations/animations.mjs +0 -0
  231. /package/{esm2020 → esm2022}/misc/lib/depth-buffer/depth-buffer.mjs +0 -0
  232. /package/{esm2020 → esm2022}/misc/lib/fbo/fbo.mjs +0 -0
  233. /package/{esm2020 → esm2022}/performance/angular-three-soba-performance.mjs +0 -0
  234. /package/{esm2020 → esm2022}/performance/index.mjs +0 -0
  235. /package/{esm2020 → esm2022}/shaders/angular-three-soba-shaders.mjs +0 -0
  236. /package/{esm2020 → esm2022}/shaders/index.mjs +0 -0
  237. /package/{esm2020 → esm2022}/shaders/lib/caustics-material/caustics-material.mjs +0 -0
  238. /package/{esm2020 → esm2022}/shaders/lib/caustics-projection-material/caustics-projection-material.mjs +0 -0
  239. /package/{esm2020 → esm2022}/shaders/lib/convolution-material/convolution-material.mjs +0 -0
  240. /package/{esm2020 → esm2022}/shaders/lib/discard-material/discard-material.mjs +0 -0
  241. /package/{esm2020 → esm2022}/shaders/lib/mesh-distort-material/mesh-distort-material.mjs +0 -0
  242. /package/{esm2020 → esm2022}/shaders/lib/mesh-reflector-material/mesh-reflector-material.mjs +0 -0
  243. /package/{esm2020 → esm2022}/shaders/lib/mesh-refraction-material/mesh-refraction-material.mjs +0 -0
  244. /package/{esm2020 → esm2022}/shaders/lib/mesh-transmission-material/mesh-transmission-material.mjs +0 -0
  245. /package/{esm2020 → esm2022}/shaders/lib/mesh-wobble-material/mesh-wobble-material.mjs +0 -0
  246. /package/{esm2020 → esm2022}/shaders/lib/shader-material/shader-material.mjs +0 -0
  247. /package/{esm2020 → esm2022}/shaders/lib/soft-shadow-material/soft-shadow-material.mjs +0 -0
  248. /package/{esm2020 → esm2022}/shaders/lib/spot-light-material/spot-light-material.mjs +0 -0
  249. /package/{esm2020 → esm2022}/shaders/lib/star-field-material/star-field-material.mjs +0 -0
  250. /package/{esm2020 → esm2022}/staging/angular-three-soba-staging.mjs +0 -0
  251. /package/{esm2020 → esm2022}/staging/index.mjs +0 -0
  252. /package/{esm2020 → esm2022}/staging/lib/accumulative-shadows/progressive-light-map.mjs +0 -0
  253. /package/{esm2020 → esm2022}/staging/lib/environment/assets.mjs +0 -0
  254. /package/{esm2020 → esm2022}/staging/lib/environment/utils.mjs +0 -0
  255. /package/{esm2020 → esm2022}/staging/lib/spot-light/common.mjs +0 -0
  256. /package/{fesm2015 → fesm2022}/angular-three-soba.mjs +0 -0
  257. /package/{fesm2015 → fesm2022}/angular-three-soba.mjs.map +0 -0
@@ -1,2048 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Component, CUSTOM_ELEMENTS_SCHEMA, Input, Directive, inject, InjectionToken, EventEmitter, TemplateRef, Output, ContentChild } from '@angular/core';
3
- import { extend, NgtRxStore, injectNgtRef, NgtStore, startWithUndefined, NgtArgs, NgtPortal, NgtPortalContent, NgtRepeat, NgtPush } from 'angular-three';
4
- import * as THREE from 'three';
5
- import { Group, CatmullRomCurve3, LineSegments, LineBasicMaterial, Vector3, Quaternion, Object3D, Matrix4, Mesh, BoxGeometry, MeshBasicMaterial, MeshLambertMaterial, CanvasTexture, AmbientLight, PointLight, Sprite, SpriteMaterial } from 'three';
6
- import { combineLatest, map, switchMap, of } from 'rxjs';
7
- import { LineMaterial, LineSegmentsGeometry, LineGeometry, LineSegments2, Line2, TextGeometry, FontLoader } from 'three-stdlib';
8
- import { NgIf, NgTemplateOutlet, DOCUMENT, NgFor } from '@angular/common';
9
- import { NgtsOrthographicCamera } from 'angular-three-soba/cameras';
10
- import { RxActionFactory } from '@rx-angular/state/actions';
11
- import { Text, preloadFont } from 'troika-three-text';
12
-
13
- extend({ Group });
14
- class NgtsBillboard extends NgtRxStore {
15
- constructor() {
16
- super(...arguments);
17
- this.billboardRef = injectNgtRef();
18
- }
19
- set follow(follow) {
20
- this.set({ follow });
21
- }
22
- set lockX(lockX) {
23
- this.set({ lockX });
24
- }
25
- set lockY(lockY) {
26
- this.set({ lockY });
27
- }
28
- set lockZ(lockZ) {
29
- this.set({ lockZ });
30
- }
31
- initialize() {
32
- super.initialize();
33
- this.set({ follow: true, lockX: false, lockY: false, lockZ: false });
34
- }
35
- onBeforeRender({ state, object }) {
36
- const { follow, lockX, lockY, lockZ } = this.get();
37
- if (!follow)
38
- return;
39
- // save prev rotation in case we're locking axises
40
- const prevRotation = object.rotation.clone();
41
- // always face the camera
42
- state.camera.getWorldQuaternion(object.quaternion);
43
- // readjust any axis that is locked
44
- if (lockX)
45
- object.rotation.x = prevRotation.x;
46
- if (lockY)
47
- object.rotation.y = prevRotation.y;
48
- if (lockZ)
49
- object.rotation.z = prevRotation.z;
50
- }
51
- }
52
- NgtsBillboard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsBillboard, deps: null, target: i0.ɵɵFactoryTarget.Component });
53
- NgtsBillboard.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsBillboard, isStandalone: true, selector: "ngts-billboard", inputs: { billboardRef: "billboardRef", follow: "follow", lockX: "lockX", lockY: "lockY", lockZ: "lockZ" }, usesInheritance: true, ngImport: i0, template: `
54
- <ngt-group ngtCompound [ref]="billboardRef" (beforeRender)="onBeforeRender($any($event))">
55
- <ng-content />
56
- </ngt-group>
57
- `, isInline: true });
58
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsBillboard, decorators: [{
59
- type: Component,
60
- args: [{
61
- selector: 'ngts-billboard',
62
- standalone: true,
63
- template: `
64
- <ngt-group ngtCompound [ref]="billboardRef" (beforeRender)="onBeforeRender($any($event))">
65
- <ng-content />
66
- </ngt-group>
67
- `,
68
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
69
- }]
70
- }], propDecorators: { billboardRef: [{
71
- type: Input
72
- }], follow: [{
73
- type: Input
74
- }], lockX: [{
75
- type: Input
76
- }], lockY: [{
77
- type: Input
78
- }], lockZ: [{
79
- type: Input
80
- }] } });
81
-
82
- class NgtsLineInput extends NgtRxStore {
83
- set vertexColors(vertexColors) {
84
- this.set({ vertexColors });
85
- }
86
- set lineWidth(lineWidth) {
87
- this.set({ lineWidth });
88
- }
89
- set alphaToCoverage(alphaToCoverage) {
90
- this.set({ alphaToCoverage });
91
- }
92
- set color(color) {
93
- this.set({ color });
94
- }
95
- set dashed(dashed) {
96
- this.set({ dashed });
97
- }
98
- set dashScale(dashScale) {
99
- this.set({ dashScale });
100
- }
101
- set dashSize(dashSize) {
102
- this.set({ dashSize });
103
- }
104
- set dashOffset(dashOffset) {
105
- this.set({ dashOffset });
106
- }
107
- set gapSize(gapSize) {
108
- this.set({ gapSize });
109
- }
110
- set resolution(resolution) {
111
- this.set({ resolution });
112
- }
113
- set wireframe(wireframe) {
114
- this.set({ wireframe });
115
- }
116
- set worldUnits(worldUnits) {
117
- this.set({ worldUnits });
118
- }
119
- initialize() {
120
- super.initialize();
121
- this.set({ color: 'black' });
122
- }
123
- }
124
- NgtsLineInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsLineInput, deps: null, target: i0.ɵɵFactoryTarget.Directive });
125
- NgtsLineInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.5", type: NgtsLineInput, inputs: { vertexColors: "vertexColors", lineWidth: "lineWidth", alphaToCoverage: "alphaToCoverage", color: "color", dashed: "dashed", dashScale: "dashScale", dashSize: "dashSize", dashOffset: "dashOffset", gapSize: "gapSize", resolution: "resolution", wireframe: "wireframe", worldUnits: "worldUnits" }, usesInheritance: true, ngImport: i0 });
126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsLineInput, decorators: [{
127
- type: Directive
128
- }], propDecorators: { vertexColors: [{
129
- type: Input
130
- }], lineWidth: [{
131
- type: Input
132
- }], alphaToCoverage: [{
133
- type: Input
134
- }], color: [{
135
- type: Input
136
- }], dashed: [{
137
- type: Input
138
- }], dashScale: [{
139
- type: Input
140
- }], dashSize: [{
141
- type: Input
142
- }], dashOffset: [{
143
- type: Input
144
- }], gapSize: [{
145
- type: Input
146
- }], resolution: [{
147
- type: Input
148
- }], wireframe: [{
149
- type: Input
150
- }], worldUnits: [{
151
- type: Input
152
- }] } });
153
-
154
- class NgtsLine extends NgtsLineInput {
155
- constructor() {
156
- super(...arguments);
157
- this.Boolean = Boolean;
158
- this.lineMaterial = new LineMaterial();
159
- this.store = inject(NgtStore);
160
- this.line = null;
161
- this.lineRef = injectNgtRef();
162
- }
163
- set points(points) {
164
- this.set({ points });
165
- }
166
- set segments(segments) {
167
- this.set({ segments });
168
- }
169
- onAfterAttach({ parent }) {
170
- parent.computeLineDistances();
171
- }
172
- initialize() {
173
- super.initialize();
174
- this.set({ segments: false });
175
- this.connect('lineGeometry', combineLatest([
176
- this.select('points'),
177
- this.select('segments'),
178
- this.select('vertexColors').pipe(startWithUndefined()),
179
- ]).pipe(map(([points, segments, vertexColors]) => {
180
- const geometry = segments ? new LineSegmentsGeometry() : new LineGeometry();
181
- const pValues = points.map((p) => {
182
- const isArray = Array.isArray(p);
183
- return p instanceof THREE.Vector3
184
- ? [p.x, p.y, p.z]
185
- : p instanceof THREE.Vector2
186
- ? [p.x, p.y, 0]
187
- : isArray && p.length === 3
188
- ? [p[0], p[1], p[2]]
189
- : isArray && p.length === 2
190
- ? [p[0], p[1], 0]
191
- : p;
192
- });
193
- geometry.setPositions(pValues.flat());
194
- if (vertexColors) {
195
- const cValues = vertexColors.map((c) => c instanceof THREE.Color ? c.toArray() : c);
196
- geometry.setColors(cValues.flat());
197
- }
198
- return geometry;
199
- })));
200
- }
201
- ngOnInit() {
202
- this.connect('materialResolution', combineLatest([this.store.select('size'), this.select('resolution').pipe(startWithUndefined())]).pipe(map(([size, resolution]) => resolution !== null && resolution !== void 0 ? resolution : [size.width, size.height])));
203
- this.line = this.get('segments') ? new LineSegments2() : new Line2();
204
- this.disposeGeometry();
205
- }
206
- disposeGeometry() {
207
- this.effect(this.select('lineGeometry'), (lineGeometry) => {
208
- return () => lineGeometry.dispose();
209
- });
210
- }
211
- }
212
- NgtsLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
213
- NgtsLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsLine, isStandalone: true, selector: "ngts-line[points]", inputs: { lineRef: "lineRef", points: "points", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
214
- <ngt-primitive *args="[line]" [ref]="lineRef" ngtCompound>
215
- <ngt-primitive
216
- *args="[get('lineGeometry')]"
217
- attach="geometry"
218
- (afterAttach)="onAfterAttach($any($event))"
219
- />
220
- <ngt-primitive
221
- *args="[lineMaterial]"
222
- attach="material"
223
- [color]="get('color')"
224
- [vertexColors]="Boolean(get('vertexColors'))"
225
- [resolution]="get('materialResolution')"
226
- [linewidth]="get('lineWidth')"
227
- [alphaToCoverage]="get('alphaToCoverage')"
228
- [dashed]="get('dashed')"
229
- [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
230
- [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
231
- [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
232
- [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
233
- [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
234
- [worldUnits]="get('worldUnits')"
235
- />
236
- </ngt-primitive>
237
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
238
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsLine, decorators: [{
239
- type: Component,
240
- args: [{
241
- selector: 'ngts-line[points]',
242
- standalone: true,
243
- template: `
244
- <ngt-primitive *args="[line]" [ref]="lineRef" ngtCompound>
245
- <ngt-primitive
246
- *args="[get('lineGeometry')]"
247
- attach="geometry"
248
- (afterAttach)="onAfterAttach($any($event))"
249
- />
250
- <ngt-primitive
251
- *args="[lineMaterial]"
252
- attach="material"
253
- [color]="get('color')"
254
- [vertexColors]="Boolean(get('vertexColors'))"
255
- [resolution]="get('materialResolution')"
256
- [linewidth]="get('lineWidth')"
257
- [alphaToCoverage]="get('alphaToCoverage')"
258
- [dashed]="get('dashed')"
259
- [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
260
- [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
261
- [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
262
- [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
263
- [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
264
- [worldUnits]="get('worldUnits')"
265
- />
266
- </ngt-primitive>
267
- `,
268
- imports: [NgtArgs],
269
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
270
- }]
271
- }], propDecorators: { lineRef: [{
272
- type: Input
273
- }], points: [{
274
- type: Input
275
- }], segments: [{
276
- type: Input
277
- }] } });
278
-
279
- class NgtsCatmullRomLine extends NgtsLineInput {
280
- constructor() {
281
- super(...arguments);
282
- this.lineRef = injectNgtRef();
283
- }
284
- set points(points) {
285
- this.set({ points });
286
- }
287
- set closed(closed) {
288
- this.set({ closed });
289
- }
290
- set curveType(curveType) {
291
- this.set({ curveType });
292
- }
293
- set tension(tension) {
294
- this.set({ tension });
295
- }
296
- set segments(segments) {
297
- this.set({ segments });
298
- }
299
- initialize() {
300
- super.initialize();
301
- this.set({ closed: false, curveType: 'centripetal', tension: 0.5, segments: 64 });
302
- this.connect('curve', combineLatest([
303
- this.select('points'),
304
- this.select('closed'),
305
- this.select('curveType'),
306
- this.select('tension'),
307
- ]).pipe(map(([points, closed, curveType, tension]) => {
308
- const mappedPoints = points.map((p) => p instanceof THREE.Vector3 ? p : new THREE.Vector3(...p));
309
- return new CatmullRomCurve3(mappedPoints, closed, curveType, tension);
310
- })));
311
- this.connect('segmentedPoints', combineLatest([this.select('curve'), this.select('segments')]).pipe(map(([curve, segments]) => curve.getPoints(segments))));
312
- this.connect('interpolatedVertexColors', combineLatest([this.select('vertexColors').pipe(startWithUndefined()), this.select('segments')]).pipe(map(([vertexColors, segments]) => {
313
- if (!vertexColors || vertexColors.length < 2)
314
- return undefined;
315
- if (vertexColors.length === segments + 1)
316
- return vertexColors;
317
- const mappedColors = vertexColors.map((color) => color instanceof THREE.Color ? color : new THREE.Color(...color));
318
- if (this.get('closed'))
319
- mappedColors.push(mappedColors[0].clone());
320
- const iColors = [mappedColors[0]];
321
- const divisions = segments / (mappedColors.length - 1);
322
- for (let i = 0; i < segments; i++) {
323
- const alpha = (i % divisions) / divisions;
324
- const colorIndex = Math.floor(i / divisions);
325
- iColors.push(mappedColors[colorIndex].clone().lerp(mappedColors[colorIndex + 1], alpha));
326
- }
327
- iColors.push(mappedColors[mappedColors.length - 1]);
328
- })));
329
- }
330
- }
331
- NgtsCatmullRomLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsCatmullRomLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
332
- NgtsCatmullRomLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsCatmullRomLine, isStandalone: true, selector: "ngts-catmull-rom-line[points]", inputs: { lineRef: "lineRef", points: "points", closed: "closed", curveType: "curveType", tension: "tension", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
333
- <ngts-line
334
- [lineRef]="lineRef"
335
- [points]="get('segmentedPoints')"
336
- [color]="get('color')"
337
- [vertexColors]="get('interpolatedVertexColors')"
338
- [resolution]="get('resolution')"
339
- [lineWidth]="get('lineWidth')"
340
- [alphaToCoverage]="get('alphaToCoverage')"
341
- [dashed]="get('dashed')"
342
- [dashScale]="get('dashScale')"
343
- [dashOffset]="get('dashOffset')"
344
- [dashSize]="get('dashSize')"
345
- [gapSize]="get('gapSize')"
346
- [wireframe]="get('wireframe')"
347
- [worldUnits]="get('worldUnits')"
348
- />
349
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
350
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsCatmullRomLine, decorators: [{
351
- type: Component,
352
- args: [{
353
- selector: 'ngts-catmull-rom-line[points]',
354
- standalone: true,
355
- template: `
356
- <ngts-line
357
- [lineRef]="lineRef"
358
- [points]="get('segmentedPoints')"
359
- [color]="get('color')"
360
- [vertexColors]="get('interpolatedVertexColors')"
361
- [resolution]="get('resolution')"
362
- [lineWidth]="get('lineWidth')"
363
- [alphaToCoverage]="get('alphaToCoverage')"
364
- [dashed]="get('dashed')"
365
- [dashScale]="get('dashScale')"
366
- [dashOffset]="get('dashOffset')"
367
- [dashSize]="get('dashSize')"
368
- [gapSize]="get('gapSize')"
369
- [wireframe]="get('wireframe')"
370
- [worldUnits]="get('worldUnits')"
371
- />
372
- `,
373
- imports: [NgtsLine],
374
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
375
- }]
376
- }], propDecorators: { lineRef: [{
377
- type: Input
378
- }], points: [{
379
- type: Input
380
- }], closed: [{
381
- type: Input
382
- }], curveType: [{
383
- type: Input
384
- }], tension: [{
385
- type: Input
386
- }], segments: [{
387
- type: Input
388
- }] } });
389
-
390
- class NgtsCubicBezierLine extends NgtsLineInput {
391
- constructor() {
392
- super(...arguments);
393
- this.lineRef = injectNgtRef();
394
- }
395
- set start(start) {
396
- this.set({ start });
397
- }
398
- set end(end) {
399
- this.set({ end });
400
- }
401
- set midA(midA) {
402
- this.set({ midA });
403
- }
404
- set midB(midB) {
405
- this.set({ midB });
406
- }
407
- set segments(segments) {
408
- this.set({ segments });
409
- }
410
- initialize() {
411
- super.initialize();
412
- this.set({ segments: 10 });
413
- this.connect('points', this.select(['start', 'end', 'midA', 'midB', 'segments'], ({ start, end, midA, midB, segments }) => {
414
- const startV = start instanceof THREE.Vector3 ? start : new THREE.Vector3(...start);
415
- const endV = end instanceof THREE.Vector3 ? end : new THREE.Vector3(...end);
416
- const midAV = midA instanceof THREE.Vector3 ? midA : new THREE.Vector3(...midA);
417
- const midBV = midB instanceof THREE.Vector3 ? midB : new THREE.Vector3(...midB);
418
- return new THREE.CubicBezierCurve3(startV, midAV, midBV, endV).getPoints(segments);
419
- }));
420
- }
421
- }
422
- NgtsCubicBezierLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsCubicBezierLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
423
- NgtsCubicBezierLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsCubicBezierLine, isStandalone: true, selector: "ngts-cubic-bezier-line[start][end][midA][midB]", inputs: { lineRef: "lineRef", start: "start", end: "end", midA: "midA", midB: "midB", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
424
- <ngts-line
425
- [lineRef]="lineRef"
426
- [points]="get('points')"
427
- [color]="get('color')"
428
- [vertexColors]="get('vertexColors')"
429
- [resolution]="get('resolution')"
430
- [lineWidth]="get('lineWidth')"
431
- [alphaToCoverage]="get('alphaToCoverage')"
432
- [dashed]="get('dashed')"
433
- [dashScale]="get('dashScale')"
434
- [dashSize]="get('dashSize')"
435
- [dashOffset]="get('dashOffset')"
436
- [gapSize]="get('gapSize')"
437
- [wireframe]="get('wireframe')"
438
- [worldUnits]="get('worldUnits')"
439
- />
440
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
441
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsCubicBezierLine, decorators: [{
442
- type: Component,
443
- args: [{
444
- selector: 'ngts-cubic-bezier-line[start][end][midA][midB]',
445
- standalone: true,
446
- template: `
447
- <ngts-line
448
- [lineRef]="lineRef"
449
- [points]="get('points')"
450
- [color]="get('color')"
451
- [vertexColors]="get('vertexColors')"
452
- [resolution]="get('resolution')"
453
- [lineWidth]="get('lineWidth')"
454
- [alphaToCoverage]="get('alphaToCoverage')"
455
- [dashed]="get('dashed')"
456
- [dashScale]="get('dashScale')"
457
- [dashSize]="get('dashSize')"
458
- [dashOffset]="get('dashOffset')"
459
- [gapSize]="get('gapSize')"
460
- [wireframe]="get('wireframe')"
461
- [worldUnits]="get('worldUnits')"
462
- />
463
- `,
464
- imports: [NgtsLine, NgIf],
465
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
466
- }]
467
- }], propDecorators: { lineRef: [{
468
- type: Input
469
- }], start: [{
470
- type: Input
471
- }], end: [{
472
- type: Input
473
- }], midA: [{
474
- type: Input
475
- }], midB: [{
476
- type: Input
477
- }], segments: [{
478
- type: Input
479
- }] } });
480
-
481
- extend({ LineSegments, LineBasicMaterial });
482
- class NgtsEdges extends NgtRxStore {
483
- constructor() {
484
- super(...arguments);
485
- this.edgesRef = injectNgtRef();
486
- this.withChildren = false;
487
- this.noop = () => null;
488
- }
489
- set threshold(threshold) {
490
- this.set({ threshold });
491
- }
492
- set color(color) {
493
- this.set({ color });
494
- }
495
- set geometry(geometry) {
496
- this.set({ geometry });
497
- }
498
- set userData(userData) {
499
- this.set({ userData });
500
- }
501
- initialize() {
502
- super.initialize();
503
- this.set({
504
- threshold: 15,
505
- color: 'black',
506
- userData: {},
507
- });
508
- }
509
- ngOnInit() {
510
- this.setupGeometry();
511
- }
512
- setupGeometry() {
513
- this.hold(this.edgesRef.$, (segments) => {
514
- const parent = segments.parent;
515
- if (parent) {
516
- const geom = this.get('geometry') || parent.geometry;
517
- const threshold = this.get('threshold');
518
- if (geom !== segments.userData['currentGeom'] || threshold !== segments.userData['currentThreshold']) {
519
- segments.userData['currentGeom'] = geom;
520
- segments.userData['currentThreshold'] = threshold;
521
- segments.geometry = new THREE.EdgesGeometry(geom, threshold);
522
- }
523
- }
524
- });
525
- }
526
- }
527
- NgtsEdges.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsEdges, deps: null, target: i0.ɵɵFactoryTarget.Component });
528
- NgtsEdges.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsEdges, isStandalone: true, selector: "ngts-edges", inputs: { edgesRef: "edgesRef", threshold: "threshold", color: "color", geometry: "geometry", userData: "userData", withChildren: "withChildren" }, usesInheritance: true, ngImport: i0, template: `
529
- <ngt-line-segments [ref]="edgesRef" [raycast]="noop" ngtCompound>
530
- <ng-container *ngIf="withChildren; else noChildren">
531
- <ng-content />
532
- </ng-container>
533
- <ng-template #noChildren>
534
- <ngt-line-basic-material [color]="color" />
535
- </ng-template>
536
- </ngt-line-segments>
537
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
538
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsEdges, decorators: [{
539
- type: Component,
540
- args: [{
541
- selector: 'ngts-edges',
542
- standalone: true,
543
- template: `
544
- <ngt-line-segments [ref]="edgesRef" [raycast]="noop" ngtCompound>
545
- <ng-container *ngIf="withChildren; else noChildren">
546
- <ng-content />
547
- </ng-container>
548
- <ng-template #noChildren>
549
- <ngt-line-basic-material [color]="color" />
550
- </ng-template>
551
- </ngt-line-segments>
552
- `,
553
- imports: [NgIf],
554
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
555
- }]
556
- }], propDecorators: { edgesRef: [{
557
- type: Input
558
- }], threshold: [{
559
- type: Input
560
- }], color: [{
561
- type: Input
562
- }], geometry: [{
563
- type: Input
564
- }], userData: [{
565
- type: Input
566
- }], withChildren: [{
567
- type: Input
568
- }] } });
569
-
570
- const isOrbitControls = (controls) => {
571
- return 'minPolarAngle' in controls;
572
- };
573
- const NGTS_GIZMO_HELPER_API = new InjectionToken('NgtsGizmoHelper API');
574
- function gizmoHelperApiFactory(gizmo) {
575
- const store = inject(NgtStore);
576
- return {
577
- tweenCamera: (direction) => {
578
- const { controls, camera, invalidate } = store.get();
579
- const defaultControls = controls;
580
- gizmo.animating = true;
581
- if (defaultControls)
582
- gizmo.focusPoint = defaultControls.target;
583
- gizmo.radius = camera.position.distanceTo(gizmo.target);
584
- // rotate from current camera orientation
585
- gizmo.q1.copy(camera.quaternion);
586
- // to new current camera orientation
587
- gizmo.targetPosition.copy(direction).multiplyScalar(gizmo.radius).add(gizmo.target);
588
- gizmo.dummy.lookAt(gizmo.targetPosition);
589
- gizmo.q2.copy(gizmo.dummy.quaternion);
590
- invalidate();
591
- },
592
- };
593
- }
594
- extend({ Group });
595
- class NgtsGizmoHelperContent {
596
- }
597
- NgtsGizmoHelperContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoHelperContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
598
- NgtsGizmoHelperContent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.5", type: NgtsGizmoHelperContent, isStandalone: true, selector: "ng-template[ngtsGizmoHelperContent]", ngImport: i0 });
599
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoHelperContent, decorators: [{
600
- type: Directive,
601
- args: [{
602
- selector: 'ng-template[ngtsGizmoHelperContent]',
603
- standalone: true,
604
- }]
605
- }] });
606
- class NgtsGizmoHelper extends NgtRxStore {
607
- constructor() {
608
- super(...arguments);
609
- this.store = inject(NgtStore);
610
- this.gizmoRef = injectNgtRef();
611
- this.virtualCameraRef = injectNgtRef();
612
- this.animating = false;
613
- this.radius = 0;
614
- this.focusPoint = new Vector3(0, 0, 0);
615
- this.q1 = new Quaternion();
616
- this.q2 = new Quaternion();
617
- this.target = new Vector3();
618
- this.targetPosition = new Vector3();
619
- this.dummy = new Object3D();
620
- this.defaultUp = new Vector3(0, 0, 0);
621
- this.turnRate = 2 * Math.PI; // turn rate in angles per sec
622
- this.matrix = new Matrix4();
623
- this.updated = new EventEmitter();
624
- }
625
- set alignment(alignment) {
626
- this.set({ alignment });
627
- }
628
- set margin(margin) {
629
- this.set({ margin });
630
- }
631
- set renderPriority(renderPriority) {
632
- this.set({ renderPriority });
633
- }
634
- set autoClear(autoClear) {
635
- this.set({ autoClear });
636
- }
637
- initialize() {
638
- super.initialize();
639
- this.set({ alignment: 'bottom-right', margin: [80, 80], renderPriority: 1 });
640
- }
641
- ngOnInit() {
642
- this.updateDefaultUp();
643
- this.setGizmoPosition();
644
- }
645
- onBeforeRender(delta) {
646
- if (this.virtualCameraRef.nativeElement && this.gizmoRef.nativeElement) {
647
- const { controls, camera: mainCamera, invalidate } = this.store.get();
648
- const defaultControls = controls;
649
- // Animate step
650
- if (this.animating) {
651
- if (this.q1.angleTo(this.q2) < 0.01) {
652
- this.animating = false;
653
- // Orbit controls uses UP vector as the orbit axes,
654
- // so we need to reset it after the animation is done
655
- // moving it around for the controls to work correctly
656
- if (isOrbitControls(defaultControls)) {
657
- mainCamera.up.copy(this.defaultUp);
658
- }
659
- }
660
- else {
661
- const step = delta * this.turnRate;
662
- // animate position by doing a slerp and then scaling the position on the unit sphere
663
- this.q1.rotateTowards(this.q2, step);
664
- // animate orientation
665
- mainCamera.position
666
- .set(0, 0, 1)
667
- .applyQuaternion(this.q1)
668
- .multiplyScalar(this.radius)
669
- .add(this.focusPoint);
670
- mainCamera.up.set(0, 1, 0).applyQuaternion(this.q1).normalize();
671
- mainCamera.quaternion.copy(this.q1);
672
- if (this.updated.observed)
673
- this.updated.emit();
674
- else if (defaultControls) {
675
- defaultControls.update();
676
- }
677
- invalidate();
678
- }
679
- }
680
- // Sync Gizmo with main camera orientation
681
- this.matrix.copy(mainCamera.matrix).invert();
682
- this.gizmoRef.nativeElement.quaternion.setFromRotationMatrix(this.matrix);
683
- }
684
- }
685
- setGizmoPosition() {
686
- this.connect('gizmoPosition', combineLatest([
687
- this.store.select('size'),
688
- combineLatest({
689
- alignment: this.select('alignment'),
690
- margin: this.select('margin'),
691
- }),
692
- ]).pipe(map(([size, { alignment, margin }]) => {
693
- const [marginX, marginY] = margin;
694
- const x = alignment.endsWith('-center')
695
- ? 0
696
- : alignment.endsWith('-left')
697
- ? -size.width / 2 + marginX
698
- : size.width / 2 - marginX;
699
- const y = alignment.startsWith('center-')
700
- ? 0
701
- : alignment.startsWith('top-')
702
- ? size.height / 2 - marginY
703
- : -size.height / 2 + marginY;
704
- return [x, y, 0];
705
- })));
706
- }
707
- updateDefaultUp() {
708
- this.hold(this.store.select('camera'), (camera) => {
709
- this.defaultUp.copy(camera.up);
710
- });
711
- }
712
- }
713
- NgtsGizmoHelper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoHelper, deps: null, target: i0.ɵɵFactoryTarget.Component });
714
- NgtsGizmoHelper.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsGizmoHelper, isStandalone: true, selector: "ngts-gizmo-helper", inputs: { alignment: "alignment", margin: "margin", renderPriority: "renderPriority", autoClear: "autoClear" }, outputs: { updated: "updated" }, providers: [{ provide: NGTS_GIZMO_HELPER_API, useFactory: gizmoHelperApiFactory, deps: [NgtsGizmoHelper] }], queries: [{ propertyName: "gizmoHelperContent", first: true, predicate: NgtsGizmoHelperContent, descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: `
715
- <ngt-portal [renderPriority]="get('renderPriority')">
716
- <ng-template ngtPortalContent>
717
- <ngts-orthographic-camera
718
- [cameraRef]="virtualCameraRef"
719
- [makeDefault]="true"
720
- [position]="[0, 0, 200]"
721
- />
722
- <ngt-group
723
- [ref]="gizmoRef"
724
- [position]="get('gizmoPosition')"
725
- (beforeRender)="onBeforeRender($any($event).state.delta)"
726
- >
727
- <ng-container *ngTemplateOutlet="gizmoHelperContent" />
728
- </ngt-group>
729
- </ng-template>
730
- </ngt-portal>
731
- `, isInline: true, dependencies: [{ kind: "component", type: NgtPortal, selector: "ngt-portal", inputs: ["container", "state", "autoRender", "autoRenderPriority"], outputs: ["beforeRender"] }, { kind: "directive", type: NgtPortalContent, selector: "ng-template[ngtPortalContent]" }, { kind: "component", type: NgtsOrthographicCamera, selector: "ngts-orthographic-camera", inputs: ["left", "right", "top", "bottom"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
732
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoHelper, decorators: [{
733
- type: Component,
734
- args: [{
735
- selector: 'ngts-gizmo-helper',
736
- standalone: true,
737
- template: `
738
- <ngt-portal [renderPriority]="get('renderPriority')">
739
- <ng-template ngtPortalContent>
740
- <ngts-orthographic-camera
741
- [cameraRef]="virtualCameraRef"
742
- [makeDefault]="true"
743
- [position]="[0, 0, 200]"
744
- />
745
- <ngt-group
746
- [ref]="gizmoRef"
747
- [position]="get('gizmoPosition')"
748
- (beforeRender)="onBeforeRender($any($event).state.delta)"
749
- >
750
- <ng-container *ngTemplateOutlet="gizmoHelperContent" />
751
- </ngt-group>
752
- </ng-template>
753
- </ngt-portal>
754
- `,
755
- imports: [NgtPortal, NgtPortalContent, NgtsOrthographicCamera, NgTemplateOutlet],
756
- providers: [{ provide: NGTS_GIZMO_HELPER_API, useFactory: gizmoHelperApiFactory, deps: [NgtsGizmoHelper] }],
757
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
758
- }]
759
- }], propDecorators: { alignment: [{
760
- type: Input
761
- }], margin: [{
762
- type: Input
763
- }], renderPriority: [{
764
- type: Input
765
- }], autoClear: [{
766
- type: Input
767
- }], updated: [{
768
- type: Output
769
- }], gizmoHelperContent: [{
770
- type: ContentChild,
771
- args: [NgtsGizmoHelperContent, { static: true, read: TemplateRef }]
772
- }] } });
773
-
774
- const colors = { bg: '#f0f0f0', hover: '#999', text: 'black', stroke: 'black' };
775
- const defaultFaces = ['Right', 'Left', 'Top', 'Bottom', 'Front', 'Back'];
776
- const makePositionVector = (xyz) => new THREE.Vector3(...xyz).multiplyScalar(0.38);
777
- const corners = [
778
- [1, 1, 1],
779
- [1, 1, -1],
780
- [1, -1, 1],
781
- [1, -1, -1],
782
- [-1, 1, 1],
783
- [-1, 1, -1],
784
- [-1, -1, 1],
785
- [-1, -1, -1],
786
- ].map(makePositionVector);
787
- const cornerDimensions = [0.25, 0.25, 0.25];
788
- const edges = [
789
- [1, 1, 0],
790
- [1, 0, 1],
791
- [1, 0, -1],
792
- [1, -1, 0],
793
- [0, 1, 1],
794
- [0, 1, -1],
795
- [0, -1, 1],
796
- [0, -1, -1],
797
- [-1, 1, 0],
798
- [-1, 0, 1],
799
- [-1, 0, -1],
800
- [-1, -1, 0],
801
- ].map(makePositionVector);
802
- const edgeDimensions = edges.map((edge) => edge.toArray().map((axis) => (axis == 0 ? 0.5 : 0.25)));
803
-
804
- class NgtsGizmoViewcubeInputs extends NgtRxStore {
805
- constructor() {
806
- super(...arguments);
807
- this.store = inject(NgtStore);
808
- }
809
- set opacity(opacity) {
810
- this.set({ opacity });
811
- }
812
- set hoverColor(hoverColor) {
813
- this.set({ hoverColor });
814
- }
815
- set textColor(textColor) {
816
- this.set({ textColor });
817
- }
818
- set strokeColor(strokeColor) {
819
- this.set({ strokeColor });
820
- }
821
- set faces(faces) {
822
- this.set({ faces });
823
- }
824
- set clickEmitter(clickEmitter) {
825
- this.set({ clickEmitter });
826
- }
827
- }
828
- NgtsGizmoViewcubeInputs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewcubeInputs, deps: null, target: i0.ɵɵFactoryTarget.Directive });
829
- NgtsGizmoViewcubeInputs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.5", type: NgtsGizmoViewcubeInputs, inputs: { opacity: "opacity", hoverColor: "hoverColor", textColor: "textColor", strokeColor: "strokeColor", faces: "faces", clickEmitter: "clickEmitter" }, usesInheritance: true, ngImport: i0 });
830
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewcubeInputs, decorators: [{
831
- type: Directive
832
- }], propDecorators: { opacity: [{
833
- type: Input
834
- }], hoverColor: [{
835
- type: Input
836
- }], textColor: [{
837
- type: Input
838
- }], strokeColor: [{
839
- type: Input
840
- }], faces: [{
841
- type: Input
842
- }], clickEmitter: [{
843
- type: Input
844
- }] } });
845
-
846
- extend({ Mesh, BoxGeometry, MeshBasicMaterial });
847
- class NgtsGizmoViewcubeEdgeCube extends NgtsGizmoViewcubeInputs {
848
- constructor() {
849
- super(...arguments);
850
- this.gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
851
- this.hover = false;
852
- }
853
- set dimensions(dimensions) {
854
- this.set({ dimensions });
855
- }
856
- set position(position) {
857
- this.set({ position });
858
- }
859
- initialize() {
860
- super.initialize();
861
- this.set({ hoverColor: colors.hover });
862
- }
863
- onPointerMove(event) {
864
- event.stopPropagation();
865
- this.hover = true;
866
- }
867
- onPointerOut(event) {
868
- event.stopPropagation();
869
- this.hover = false;
870
- }
871
- onClick(event) {
872
- var _a;
873
- if ((_a = this.get('clickEmitter')) === null || _a === void 0 ? void 0 : _a.observed) {
874
- this.get('clickEmitter').emit(event);
875
- }
876
- else {
877
- event.stopPropagation();
878
- this.gizmoHelperApi.tweenCamera(this.get('position'));
879
- }
880
- }
881
- }
882
- NgtsGizmoViewcubeEdgeCube.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewcubeEdgeCube, deps: null, target: i0.ɵɵFactoryTarget.Component });
883
- NgtsGizmoViewcubeEdgeCube.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsGizmoViewcubeEdgeCube, isStandalone: true, selector: "ngts-gizmo-viewcube-edge-cube[dimensions][position]", inputs: { dimensions: "dimensions", position: "position" }, usesInheritance: true, ngImport: i0, template: `
884
- <ngt-mesh
885
- [scale]="1.01"
886
- [position]="get('position')"
887
- (pointermove)="onPointerMove($any($event))"
888
- (pointerout)="onPointerOut($any($event))"
889
- (click)="onClick($any($event))"
890
- >
891
- <ngt-box-geometry *args="get('dimensions')" />
892
- <ngt-mesh-basic-material
893
- [color]="hover ? get('hoverColor') : 'white'"
894
- [transparent]="true"
895
- [opacity]="0.6"
896
- [visible]="hover"
897
- />
898
- </ngt-mesh>
899
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
900
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewcubeEdgeCube, decorators: [{
901
- type: Component,
902
- args: [{
903
- selector: 'ngts-gizmo-viewcube-edge-cube[dimensions][position]',
904
- standalone: true,
905
- template: `
906
- <ngt-mesh
907
- [scale]="1.01"
908
- [position]="get('position')"
909
- (pointermove)="onPointerMove($any($event))"
910
- (pointerout)="onPointerOut($any($event))"
911
- (click)="onClick($any($event))"
912
- >
913
- <ngt-box-geometry *args="get('dimensions')" />
914
- <ngt-mesh-basic-material
915
- [color]="hover ? get('hoverColor') : 'white'"
916
- [transparent]="true"
917
- [opacity]="0.6"
918
- [visible]="hover"
919
- />
920
- </ngt-mesh>
921
- `,
922
- imports: [NgtArgs],
923
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
924
- }]
925
- }], propDecorators: { dimensions: [{
926
- type: Input
927
- }], position: [{
928
- type: Input
929
- }] } });
930
-
931
- extend({ MeshLambertMaterial, Mesh, BoxGeometry });
932
- class NgtsGizmoViewcubeFaceMaterial extends NgtsGizmoViewcubeInputs {
933
- constructor() {
934
- super(...arguments);
935
- this.document = inject(DOCUMENT);
936
- }
937
- set index(index) {
938
- this.set({ index });
939
- }
940
- set hover(hover) {
941
- this.set({ hover });
942
- }
943
- set font(font) {
944
- this.set({ font });
945
- }
946
- set color(color) {
947
- this.set({ color });
948
- }
949
- initialize() {
950
- super.initialize();
951
- this.set({
952
- font: '20px Inter var, Arial, sans-serif',
953
- faces: defaultFaces,
954
- color: colors.bg,
955
- hoverColor: colors.hover,
956
- textColor: colors.text,
957
- strokeColor: colors.stroke,
958
- opacity: 1,
959
- });
960
- this.connect('texture', this.select(['index', 'faces', 'color', 'font', 'textColor', 'strokeColor'], ({ index, faces, color, font, textColor, strokeColor }) => {
961
- const canvas = this.document.createElement('canvas');
962
- canvas.width = 128;
963
- canvas.height = 128;
964
- const context = canvas.getContext('2d');
965
- context.fillStyle = color;
966
- context.fillRect(0, 0, canvas.width, canvas.height);
967
- context.strokeStyle = strokeColor;
968
- context.strokeRect(0, 0, canvas.width, canvas.height);
969
- context.font = font;
970
- context.textAlign = 'center';
971
- context.fillStyle = textColor;
972
- context.fillText(faces[index].toUpperCase(), 64, 76);
973
- return new CanvasTexture(canvas);
974
- }));
975
- }
976
- }
977
- NgtsGizmoViewcubeFaceMaterial.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewcubeFaceMaterial, deps: null, target: i0.ɵɵFactoryTarget.Component });
978
- NgtsGizmoViewcubeFaceMaterial.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsGizmoViewcubeFaceMaterial, isStandalone: true, selector: "ngts-gizmo-viewcube-face-material[hover][index]", inputs: { index: "index", hover: "hover", font: "font", color: "color" }, usesInheritance: true, ngImport: i0, template: `
979
- <ngt-mesh-lambert-material
980
- [attach]="['material', get('index')]"
981
- [map]="get('texture')"
982
- [color]="get('hover') ? get('hoverColor') : get('color')"
983
- [opacity]="get('opacity')"
984
- [transparent]="true"
985
- >
986
- <ngt-value [rawValue]="store.get('gl').outputEncoding" attach="map.encoding" />
987
- <ngt-value [rawValue]="store.get('gl').capabilities.getMaxAnisotropy() || 1" attach="map.anisotrophy" />
988
- </ngt-mesh-lambert-material>
989
- `, isInline: true });
990
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewcubeFaceMaterial, decorators: [{
991
- type: Component,
992
- args: [{
993
- selector: 'ngts-gizmo-viewcube-face-material[hover][index]',
994
- standalone: true,
995
- template: `
996
- <ngt-mesh-lambert-material
997
- [attach]="['material', get('index')]"
998
- [map]="get('texture')"
999
- [color]="get('hover') ? get('hoverColor') : get('color')"
1000
- [opacity]="get('opacity')"
1001
- [transparent]="true"
1002
- >
1003
- <ngt-value [rawValue]="store.get('gl').outputEncoding" attach="map.encoding" />
1004
- <ngt-value [rawValue]="store.get('gl').capabilities.getMaxAnisotropy() || 1" attach="map.anisotrophy" />
1005
- </ngt-mesh-lambert-material>
1006
- `,
1007
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1008
- }]
1009
- }], propDecorators: { index: [{
1010
- type: Input
1011
- }], hover: [{
1012
- type: Input
1013
- }], font: [{
1014
- type: Input
1015
- }], color: [{
1016
- type: Input
1017
- }] } });
1018
- class NgtsGizmoViewcubeFaceCube extends NgtsGizmoViewcubeInputs {
1019
- constructor() {
1020
- super(...arguments);
1021
- this.gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
1022
- this.hover = -1;
1023
- }
1024
- set font(font) {
1025
- this.set({ font });
1026
- }
1027
- set color(color) {
1028
- this.set({ color });
1029
- }
1030
- onPointerMove(event) {
1031
- event.stopPropagation();
1032
- this.hover = Math.floor(event.faceIndex / 2);
1033
- }
1034
- onPointerOut(event) {
1035
- event.stopPropagation();
1036
- this.hover = -1;
1037
- }
1038
- onClick(event) {
1039
- var _a;
1040
- if ((_a = this.get('clickEmitter')) === null || _a === void 0 ? void 0 : _a.observed) {
1041
- this.get('clickEmitter').emit(event);
1042
- }
1043
- else {
1044
- event.stopPropagation();
1045
- this.gizmoHelperApi.tweenCamera(event.face.normal);
1046
- }
1047
- }
1048
- }
1049
- NgtsGizmoViewcubeFaceCube.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewcubeFaceCube, deps: null, target: i0.ɵɵFactoryTarget.Component });
1050
- NgtsGizmoViewcubeFaceCube.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsGizmoViewcubeFaceCube, isStandalone: true, selector: "ngts-gizmo-viewcube-face-cube", inputs: { font: "font", color: "color" }, usesInheritance: true, ngImport: i0, template: `
1051
- <ngt-mesh
1052
- (pointermove)="onPointerMove($any($event))"
1053
- (pointerout)="onPointerOut($any($event))"
1054
- (click)="onClick($any($event))"
1055
- >
1056
- <ngt-box-geometry />
1057
- <ngts-gizmo-viewcube-face-material
1058
- *ngFor="let i; repeat: 6"
1059
- [hover]="hover === i"
1060
- [index]="i"
1061
- [font]="get('font')"
1062
- [color]="get('color')"
1063
- [opacity]="get('opacity')"
1064
- [hoverColor]="get('hoverColor')"
1065
- [textColor]="get('textColor')"
1066
- [strokeColor]="get('strokeColor')"
1067
- [faces]="get('faces')"
1068
- />
1069
- </ngt-mesh>
1070
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewcubeFaceMaterial, selector: "ngts-gizmo-viewcube-face-material[hover][index]", inputs: ["index", "hover", "font", "color"] }, { kind: "directive", type: NgtRepeat, selector: "[ngFor][ngForRepeat]", inputs: ["ngForRepeat"] }] });
1071
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewcubeFaceCube, decorators: [{
1072
- type: Component,
1073
- args: [{
1074
- selector: 'ngts-gizmo-viewcube-face-cube',
1075
- standalone: true,
1076
- template: `
1077
- <ngt-mesh
1078
- (pointermove)="onPointerMove($any($event))"
1079
- (pointerout)="onPointerOut($any($event))"
1080
- (click)="onClick($any($event))"
1081
- >
1082
- <ngt-box-geometry />
1083
- <ngts-gizmo-viewcube-face-material
1084
- *ngFor="let i; repeat: 6"
1085
- [hover]="hover === i"
1086
- [index]="i"
1087
- [font]="get('font')"
1088
- [color]="get('color')"
1089
- [opacity]="get('opacity')"
1090
- [hoverColor]="get('hoverColor')"
1091
- [textColor]="get('textColor')"
1092
- [strokeColor]="get('strokeColor')"
1093
- [faces]="get('faces')"
1094
- />
1095
- </ngt-mesh>
1096
- `,
1097
- imports: [NgtsGizmoViewcubeFaceMaterial, NgtRepeat],
1098
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1099
- }]
1100
- }], propDecorators: { font: [{
1101
- type: Input
1102
- }], color: [{
1103
- type: Input
1104
- }] } });
1105
-
1106
- extend({ Group, AmbientLight, PointLight });
1107
- class NgtsGizmoViewcube extends NgtsGizmoViewcubeInputs {
1108
- constructor() {
1109
- super(...arguments);
1110
- this.edges = edges;
1111
- this.edgeDimensions = edgeDimensions;
1112
- this.corners = corners;
1113
- this.cornerDimensions = cornerDimensions;
1114
- this.clicked = new EventEmitter();
1115
- }
1116
- set font(font) {
1117
- this.set({ font });
1118
- }
1119
- set color(color) {
1120
- this.set({ color });
1121
- }
1122
- }
1123
- NgtsGizmoViewcube.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewcube, deps: null, target: i0.ɵɵFactoryTarget.Component });
1124
- NgtsGizmoViewcube.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsGizmoViewcube, isStandalone: true, selector: "ngts-gizmo-viewcube", inputs: { font: "font", color: "color" }, outputs: { clicked: "clicked" }, usesInheritance: true, ngImport: i0, template: `
1125
- <ngt-group [scale]="60">
1126
- <ngts-gizmo-viewcube-face-cube
1127
- [font]="get('font')"
1128
- [color]="get('color')"
1129
- [opacity]="get('opacity')"
1130
- [hoverColor]="get('hoverColor')"
1131
- [textColor]="get('textColor')"
1132
- [strokeColor]="get('strokeColor')"
1133
- [faces]="get('faces')"
1134
- [clickEmitter]="clicked"
1135
- />
1136
-
1137
- <ngts-gizmo-viewcube-edge-cube
1138
- *ngFor="let edge of edges; let i = index"
1139
- [position]="edge"
1140
- [dimensions]="edgeDimensions[i]"
1141
- [font]="get('font')"
1142
- [color]="get('color')"
1143
- [opacity]="get('opacity')"
1144
- [hoverColor]="get('hoverColor')"
1145
- [textColor]="get('textColor')"
1146
- [strokeColor]="get('strokeColor')"
1147
- [faces]="get('faces')"
1148
- [clickEmitter]="clicked"
1149
- />
1150
-
1151
- <ngts-gizmo-viewcube-edge-cube
1152
- *ngFor="let corner of corners"
1153
- [position]="corner"
1154
- [dimensions]="cornerDimensions"
1155
- [font]="get('font')"
1156
- [color]="get('color')"
1157
- [opacity]="get('opacity')"
1158
- [hoverColor]="get('hoverColor')"
1159
- [textColor]="get('textColor')"
1160
- [strokeColor]="get('strokeColor')"
1161
- [faces]="get('faces')"
1162
- [clickEmitter]="clicked"
1163
- />
1164
-
1165
- <ngt-ambient-light [intensity]="0.5" />
1166
- <ngt-point-light [position]="10" [intensity]="0.5" />
1167
- </ngt-group>
1168
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewcubeEdgeCube, selector: "ngts-gizmo-viewcube-edge-cube[dimensions][position]", inputs: ["dimensions", "position"] }, { kind: "component", type: NgtsGizmoViewcubeFaceCube, selector: "ngts-gizmo-viewcube-face-cube", inputs: ["font", "color"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1169
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewcube, decorators: [{
1170
- type: Component,
1171
- args: [{
1172
- selector: 'ngts-gizmo-viewcube',
1173
- standalone: true,
1174
- template: `
1175
- <ngt-group [scale]="60">
1176
- <ngts-gizmo-viewcube-face-cube
1177
- [font]="get('font')"
1178
- [color]="get('color')"
1179
- [opacity]="get('opacity')"
1180
- [hoverColor]="get('hoverColor')"
1181
- [textColor]="get('textColor')"
1182
- [strokeColor]="get('strokeColor')"
1183
- [faces]="get('faces')"
1184
- [clickEmitter]="clicked"
1185
- />
1186
-
1187
- <ngts-gizmo-viewcube-edge-cube
1188
- *ngFor="let edge of edges; let i = index"
1189
- [position]="edge"
1190
- [dimensions]="edgeDimensions[i]"
1191
- [font]="get('font')"
1192
- [color]="get('color')"
1193
- [opacity]="get('opacity')"
1194
- [hoverColor]="get('hoverColor')"
1195
- [textColor]="get('textColor')"
1196
- [strokeColor]="get('strokeColor')"
1197
- [faces]="get('faces')"
1198
- [clickEmitter]="clicked"
1199
- />
1200
-
1201
- <ngts-gizmo-viewcube-edge-cube
1202
- *ngFor="let corner of corners"
1203
- [position]="corner"
1204
- [dimensions]="cornerDimensions"
1205
- [font]="get('font')"
1206
- [color]="get('color')"
1207
- [opacity]="get('opacity')"
1208
- [hoverColor]="get('hoverColor')"
1209
- [textColor]="get('textColor')"
1210
- [strokeColor]="get('strokeColor')"
1211
- [faces]="get('faces')"
1212
- [clickEmitter]="clicked"
1213
- />
1214
-
1215
- <ngt-ambient-light [intensity]="0.5" />
1216
- <ngt-point-light [position]="10" [intensity]="0.5" />
1217
- </ngt-group>
1218
- `,
1219
- imports: [NgtsGizmoViewcubeEdgeCube, NgtsGizmoViewcubeFaceCube, NgFor],
1220
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1221
- }]
1222
- }], propDecorators: { font: [{
1223
- type: Input
1224
- }], color: [{
1225
- type: Input
1226
- }], clicked: [{
1227
- type: Output
1228
- }] } });
1229
-
1230
- extend({ Group, Mesh, BoxGeometry, MeshBasicMaterial, Sprite, SpriteMaterial });
1231
- class NgtsGizmoViewportAxis extends NgtRxStore {
1232
- set color(color) {
1233
- this.set({ color });
1234
- }
1235
- set rotation(rotation) {
1236
- this.set({ rotation });
1237
- }
1238
- set scale(scale) {
1239
- this.set({ scale: scale === undefined ? this.get('scale') : scale });
1240
- }
1241
- initialize() {
1242
- super.initialize();
1243
- this.set({ scale: [0.8, 0.05, 0.05] });
1244
- }
1245
- }
1246
- NgtsGizmoViewportAxis.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewportAxis, deps: null, target: i0.ɵɵFactoryTarget.Component });
1247
- NgtsGizmoViewportAxis.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsGizmoViewportAxis, isStandalone: true, selector: "ngts-gizmo-viewport-axis[color][rotation]", inputs: { color: "color", rotation: "rotation", scale: "scale" }, usesInheritance: true, ngImport: i0, template: `
1248
- <ngt-group [rotation]="get('rotation')">
1249
- <ngt-mesh [position]="[0.4, 0, 0]">
1250
- <ngt-box-geometry *args="get('scale')" />
1251
- <ngt-mesh-basic-material [color]="get('color')" [toneMapped]="false" />
1252
- </ngt-mesh>
1253
- </ngt-group>
1254
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
1255
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewportAxis, decorators: [{
1256
- type: Component,
1257
- args: [{
1258
- selector: 'ngts-gizmo-viewport-axis[color][rotation]',
1259
- standalone: true,
1260
- template: `
1261
- <ngt-group [rotation]="get('rotation')">
1262
- <ngt-mesh [position]="[0.4, 0, 0]">
1263
- <ngt-box-geometry *args="get('scale')" />
1264
- <ngt-mesh-basic-material [color]="get('color')" [toneMapped]="false" />
1265
- </ngt-mesh>
1266
- </ngt-group>
1267
- `,
1268
- imports: [NgtArgs],
1269
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1270
- }]
1271
- }], propDecorators: { color: [{
1272
- type: Input
1273
- }], rotation: [{
1274
- type: Input
1275
- }], scale: [{
1276
- type: Input
1277
- }] } });
1278
- class NgtsGizmoViewportAxisHead extends NgtRxStore {
1279
- constructor() {
1280
- super(...arguments);
1281
- this.document = inject(DOCUMENT);
1282
- this.store = inject(NgtStore);
1283
- this.gl = this.store.get('gl');
1284
- }
1285
- set arcStyle(arcStyle) {
1286
- this.set({ arcStyle });
1287
- }
1288
- set label(label) {
1289
- this.set({ label });
1290
- }
1291
- set labelColor(labelColor) {
1292
- this.set({ labelColor });
1293
- }
1294
- set axisHeadScale(axisHeadScale) {
1295
- this.set({ axisHeadScale });
1296
- }
1297
- set disabled(disabled) {
1298
- this.set({ disabled });
1299
- }
1300
- set font(font) {
1301
- this.set({ font });
1302
- }
1303
- set clickEmitter(clickEmitter) {
1304
- this.set({ clickEmitter });
1305
- }
1306
- initialize() {
1307
- super.initialize();
1308
- this.set({ axisHeadScale: 1, active: false });
1309
- this.connect('texture', combineLatest([
1310
- this.select('arcStyle'),
1311
- this.select('labelColor'),
1312
- this.select('font'),
1313
- this.select('label').pipe(startWithUndefined()),
1314
- ]).pipe(map(([arcStyle, labelColor, font, label]) => {
1315
- const canvas = this.document.createElement('canvas');
1316
- canvas.width = 64;
1317
- canvas.height = 64;
1318
- const context = canvas.getContext('2d');
1319
- context.beginPath();
1320
- context.arc(32, 32, 16, 0, 2 * Math.PI);
1321
- context.closePath();
1322
- context.fillStyle = arcStyle;
1323
- context.fill();
1324
- if (label) {
1325
- context.font = font;
1326
- context.textAlign = 'center';
1327
- context.fillStyle = labelColor;
1328
- context.fillText(label, 32, 41);
1329
- }
1330
- return new CanvasTexture(canvas);
1331
- })));
1332
- this.connect('scale', combineLatest([
1333
- this.select('active'),
1334
- this.select('axisHeadScale'),
1335
- this.select('label').pipe(startWithUndefined()),
1336
- ]).pipe(map(([active, axisHeadScale, label]) => (label ? 1 : 0.75) * (active ? 1.2 : 1) * axisHeadScale)));
1337
- }
1338
- onPointerOver(event) {
1339
- if (!this.get('disabled')) {
1340
- event.stopPropagation();
1341
- this.set({ active: true });
1342
- }
1343
- }
1344
- onPointerOut(event) {
1345
- var _a;
1346
- if (!this.get('disabled')) {
1347
- if ((_a = this.get('clickEmitter')) === null || _a === void 0 ? void 0 : _a.observed) {
1348
- this.get('clickEmitter').emit(event);
1349
- }
1350
- else {
1351
- event.stopPropagation();
1352
- this.set({ active: false });
1353
- }
1354
- }
1355
- }
1356
- }
1357
- NgtsGizmoViewportAxisHead.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewportAxisHead, deps: null, target: i0.ɵɵFactoryTarget.Component });
1358
- NgtsGizmoViewportAxisHead.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsGizmoViewportAxisHead, isStandalone: true, selector: "ngts-gizmo-viewport-axis-head", inputs: { arcStyle: "arcStyle", label: "label", labelColor: "labelColor", axisHeadScale: "axisHeadScale", disabled: "disabled", font: "font", clickEmitter: "clickEmitter" }, usesInheritance: true, ngImport: i0, template: `
1359
- <ngt-sprite
1360
- ngtCompound
1361
- [scale]="get('scale')"
1362
- (pointerover)="onPointerOver($any($event))"
1363
- (pointerout)="onPointerOut($any($event))"
1364
- >
1365
- <ngt-sprite-material
1366
- [map]="get('texture')"
1367
- [opacity]="get('label') ? 1 : 0.75"
1368
- [alphaTest]="0.3"
1369
- [toneMapped]="false"
1370
- >
1371
- <ngt-value [rawValue]="gl.outputEncoding" attach="map.encoding" />
1372
- <ngt-value [rawValue]="gl.capabilities.getMaxAnisotropy() || 1" attach="map.anisotropy" />
1373
- </ngt-sprite-material>
1374
- </ngt-sprite>
1375
- `, isInline: true });
1376
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewportAxisHead, decorators: [{
1377
- type: Component,
1378
- args: [{
1379
- selector: 'ngts-gizmo-viewport-axis-head',
1380
- standalone: true,
1381
- template: `
1382
- <ngt-sprite
1383
- ngtCompound
1384
- [scale]="get('scale')"
1385
- (pointerover)="onPointerOver($any($event))"
1386
- (pointerout)="onPointerOut($any($event))"
1387
- >
1388
- <ngt-sprite-material
1389
- [map]="get('texture')"
1390
- [opacity]="get('label') ? 1 : 0.75"
1391
- [alphaTest]="0.3"
1392
- [toneMapped]="false"
1393
- >
1394
- <ngt-value [rawValue]="gl.outputEncoding" attach="map.encoding" />
1395
- <ngt-value [rawValue]="gl.capabilities.getMaxAnisotropy() || 1" attach="map.anisotropy" />
1396
- </ngt-sprite-material>
1397
- </ngt-sprite>
1398
- `,
1399
- imports: [NgtArgs],
1400
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1401
- }]
1402
- }], propDecorators: { arcStyle: [{
1403
- type: Input
1404
- }], label: [{
1405
- type: Input
1406
- }], labelColor: [{
1407
- type: Input
1408
- }], axisHeadScale: [{
1409
- type: Input
1410
- }], disabled: [{
1411
- type: Input
1412
- }], font: [{
1413
- type: Input
1414
- }], clickEmitter: [{
1415
- type: Input
1416
- }] } });
1417
-
1418
- extend({ Group, AmbientLight, PointLight });
1419
- class NgtsGizmoViewport extends NgtRxStore {
1420
- constructor() {
1421
- super(...arguments);
1422
- this.gizmoHelperApi = inject(NGTS_GIZMO_HELPER_API);
1423
- this.Math = Math;
1424
- this.clicked = new EventEmitter();
1425
- }
1426
- set axisColors(axisColors) {
1427
- this.set({ axisColors });
1428
- }
1429
- set axisScale(axisScale) {
1430
- this.set({ axisScale });
1431
- }
1432
- set labels(labels) {
1433
- this.set({ labels });
1434
- }
1435
- set axisHeadScale(axisHeadScale) {
1436
- this.set({ axisHeadScale });
1437
- }
1438
- set labelColor(labelColor) {
1439
- this.set({ labelColor });
1440
- }
1441
- set hideNegativeAxes(hideNegativeAxes) {
1442
- this.set({ hideNegativeAxes });
1443
- }
1444
- set hideAxisHeads(hideAxisHeads) {
1445
- this.set({ hideAxisHeads });
1446
- }
1447
- set disabled(disabled) {
1448
- this.set({ disabled });
1449
- }
1450
- set font(font) {
1451
- this.set({ font });
1452
- }
1453
- initialize() {
1454
- super.initialize();
1455
- this.set({
1456
- font: '18px Inter var, Arial, sans-serif',
1457
- axisColors: ['#ff2060', '#20df80', '#2080ff'],
1458
- axisHeadScale: 1,
1459
- labels: ['X', 'Y', 'Z'],
1460
- labelColor: '#000',
1461
- });
1462
- }
1463
- onPointerDown(event) {
1464
- if (!this.get('disabled')) {
1465
- event.stopPropagation();
1466
- this.gizmoHelperApi.tweenCamera(event.object.position);
1467
- }
1468
- }
1469
- }
1470
- NgtsGizmoViewport.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewport, deps: null, target: i0.ɵɵFactoryTarget.Component });
1471
- NgtsGizmoViewport.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsGizmoViewport, isStandalone: true, selector: "ngts-gizmo-viewport", inputs: { axisColors: "axisColors", axisScale: "axisScale", labels: "labels", axisHeadScale: "axisHeadScale", labelColor: "labelColor", hideNegativeAxes: "hideNegativeAxes", hideAxisHeads: "hideAxisHeads", disabled: "disabled", font: "font" }, outputs: { clicked: "clicked" }, usesInheritance: true, ngImport: i0, template: `
1472
- <ngt-group ngtCompound [scale]="40">
1473
- <ngts-gizmo-viewport-axis
1474
- [color]="get('axisColors')[0]"
1475
- [rotation]="[0, 0, 0]"
1476
- [scale]="get('axisScale')"
1477
- ></ngts-gizmo-viewport-axis>
1478
- <ngts-gizmo-viewport-axis
1479
- [color]="get('axisColors')[1]"
1480
- [rotation]="[0, 0, Math.PI / 2]"
1481
- [scale]="get('axisScale')"
1482
- ></ngts-gizmo-viewport-axis>
1483
- <ngts-gizmo-viewport-axis
1484
- [color]="get('axisColors')[2]"
1485
- [rotation]="[0, -Math.PI / 2, 0]"
1486
- [scale]="get('axisScale')"
1487
- ></ngts-gizmo-viewport-axis>
1488
- <ng-container *ngIf="!get('hideAxisHeads')">
1489
- <ngts-gizmo-viewport-axis-head
1490
- [arcStyle]="get('axisColors')[0]"
1491
- [position]="[1, 0, 0]"
1492
- [label]="get('labels')[0]"
1493
- [font]="get('font')"
1494
- [disabled]="get('disabled')"
1495
- [labelColor]="get('labelColor')"
1496
- [clickEmitter]="clicked"
1497
- [axisHeadScale]="get('axisHeadScale')"
1498
- (pointerdown)="onPointerDown($any($event))"
1499
- ></ngts-gizmo-viewport-axis-head>
1500
- <ngts-gizmo-viewport-axis-head
1501
- [arcStyle]="get('axisColors')[1]"
1502
- [position]="[0, 1, 0]"
1503
- [label]="get('labels')[1]"
1504
- [font]="get('font')"
1505
- [disabled]="get('disabled')"
1506
- [labelColor]="get('labelColor')"
1507
- [clickEmitter]="clicked"
1508
- [axisHeadScale]="get('axisHeadScale')"
1509
- (pointerdown)="onPointerDown($any($event))"
1510
- ></ngts-gizmo-viewport-axis-head>
1511
- <ngts-gizmo-viewport-axis-head
1512
- [arcStyle]="get('axisColors')[2]"
1513
- [position]="[0, 0, 1]"
1514
- [label]="get('labels')[2]"
1515
- [font]="get('font')"
1516
- [disabled]="get('disabled')"
1517
- [labelColor]="get('labelColor')"
1518
- [clickEmitter]="clicked"
1519
- [axisHeadScale]="get('axisHeadScale')"
1520
- (pointerdown)="onPointerDown($any($event))"
1521
- ></ngts-gizmo-viewport-axis-head>
1522
- <ng-container *ngIf="!get('hideNegativeAxes')">
1523
- <ngts-gizmo-viewport-axis-head
1524
- [arcStyle]="get('axisColors')[0]"
1525
- [position]="[-1, 0, 0]"
1526
- [font]="get('font')"
1527
- [disabled]="get('disabled')"
1528
- [labelColor]="get('labelColor')"
1529
- [clickEmitter]="clicked"
1530
- [axisHeadScale]="get('axisHeadScale')"
1531
- (pointerdown)="onPointerDown($any($event))"
1532
- ></ngts-gizmo-viewport-axis-head>
1533
- <ngts-gizmo-viewport-axis-head
1534
- [arcStyle]="get('axisColors')[1]"
1535
- [position]="[0, -1, 0]"
1536
- [font]="get('font')"
1537
- [disabled]="get('disabled')"
1538
- [labelColor]="get('labelColor')"
1539
- [clickEmitter]="clicked"
1540
- [axisHeadScale]="get('axisHeadScale')"
1541
- (pointerdown)="onPointerDown($any($event))"
1542
- ></ngts-gizmo-viewport-axis-head>
1543
- <ngts-gizmo-viewport-axis-head
1544
- [arcStyle]="get('axisColors')[2]"
1545
- [position]="[0, 0, -1]"
1546
- [font]="get('font')"
1547
- [disabled]="get('disabled')"
1548
- [labelColor]="get('labelColor')"
1549
- [clickEmitter]="clicked"
1550
- [axisHeadScale]="get('axisHeadScale')"
1551
- (pointerdown)="onPointerDown($any($event))"
1552
- ></ngts-gizmo-viewport-axis-head>
1553
- </ng-container>
1554
- </ng-container>
1555
- <ngt-ambient-light intensity="0.5"></ngt-ambient-light>
1556
- <ngt-point-light position="10" intensity="0.5"></ngt-point-light>
1557
- </ngt-group>
1558
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsGizmoViewportAxis, selector: "ngts-gizmo-viewport-axis[color][rotation]", inputs: ["color", "rotation", "scale"] }, { kind: "component", type: NgtsGizmoViewportAxisHead, selector: "ngts-gizmo-viewport-axis-head", inputs: ["arcStyle", "label", "labelColor", "axisHeadScale", "disabled", "font", "clickEmitter"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1559
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsGizmoViewport, decorators: [{
1560
- type: Component,
1561
- args: [{
1562
- selector: 'ngts-gizmo-viewport',
1563
- standalone: true,
1564
- template: `
1565
- <ngt-group ngtCompound [scale]="40">
1566
- <ngts-gizmo-viewport-axis
1567
- [color]="get('axisColors')[0]"
1568
- [rotation]="[0, 0, 0]"
1569
- [scale]="get('axisScale')"
1570
- ></ngts-gizmo-viewport-axis>
1571
- <ngts-gizmo-viewport-axis
1572
- [color]="get('axisColors')[1]"
1573
- [rotation]="[0, 0, Math.PI / 2]"
1574
- [scale]="get('axisScale')"
1575
- ></ngts-gizmo-viewport-axis>
1576
- <ngts-gizmo-viewport-axis
1577
- [color]="get('axisColors')[2]"
1578
- [rotation]="[0, -Math.PI / 2, 0]"
1579
- [scale]="get('axisScale')"
1580
- ></ngts-gizmo-viewport-axis>
1581
- <ng-container *ngIf="!get('hideAxisHeads')">
1582
- <ngts-gizmo-viewport-axis-head
1583
- [arcStyle]="get('axisColors')[0]"
1584
- [position]="[1, 0, 0]"
1585
- [label]="get('labels')[0]"
1586
- [font]="get('font')"
1587
- [disabled]="get('disabled')"
1588
- [labelColor]="get('labelColor')"
1589
- [clickEmitter]="clicked"
1590
- [axisHeadScale]="get('axisHeadScale')"
1591
- (pointerdown)="onPointerDown($any($event))"
1592
- ></ngts-gizmo-viewport-axis-head>
1593
- <ngts-gizmo-viewport-axis-head
1594
- [arcStyle]="get('axisColors')[1]"
1595
- [position]="[0, 1, 0]"
1596
- [label]="get('labels')[1]"
1597
- [font]="get('font')"
1598
- [disabled]="get('disabled')"
1599
- [labelColor]="get('labelColor')"
1600
- [clickEmitter]="clicked"
1601
- [axisHeadScale]="get('axisHeadScale')"
1602
- (pointerdown)="onPointerDown($any($event))"
1603
- ></ngts-gizmo-viewport-axis-head>
1604
- <ngts-gizmo-viewport-axis-head
1605
- [arcStyle]="get('axisColors')[2]"
1606
- [position]="[0, 0, 1]"
1607
- [label]="get('labels')[2]"
1608
- [font]="get('font')"
1609
- [disabled]="get('disabled')"
1610
- [labelColor]="get('labelColor')"
1611
- [clickEmitter]="clicked"
1612
- [axisHeadScale]="get('axisHeadScale')"
1613
- (pointerdown)="onPointerDown($any($event))"
1614
- ></ngts-gizmo-viewport-axis-head>
1615
- <ng-container *ngIf="!get('hideNegativeAxes')">
1616
- <ngts-gizmo-viewport-axis-head
1617
- [arcStyle]="get('axisColors')[0]"
1618
- [position]="[-1, 0, 0]"
1619
- [font]="get('font')"
1620
- [disabled]="get('disabled')"
1621
- [labelColor]="get('labelColor')"
1622
- [clickEmitter]="clicked"
1623
- [axisHeadScale]="get('axisHeadScale')"
1624
- (pointerdown)="onPointerDown($any($event))"
1625
- ></ngts-gizmo-viewport-axis-head>
1626
- <ngts-gizmo-viewport-axis-head
1627
- [arcStyle]="get('axisColors')[1]"
1628
- [position]="[0, -1, 0]"
1629
- [font]="get('font')"
1630
- [disabled]="get('disabled')"
1631
- [labelColor]="get('labelColor')"
1632
- [clickEmitter]="clicked"
1633
- [axisHeadScale]="get('axisHeadScale')"
1634
- (pointerdown)="onPointerDown($any($event))"
1635
- ></ngts-gizmo-viewport-axis-head>
1636
- <ngts-gizmo-viewport-axis-head
1637
- [arcStyle]="get('axisColors')[2]"
1638
- [position]="[0, 0, -1]"
1639
- [font]="get('font')"
1640
- [disabled]="get('disabled')"
1641
- [labelColor]="get('labelColor')"
1642
- [clickEmitter]="clicked"
1643
- [axisHeadScale]="get('axisHeadScale')"
1644
- (pointerdown)="onPointerDown($any($event))"
1645
- ></ngts-gizmo-viewport-axis-head>
1646
- </ng-container>
1647
- </ng-container>
1648
- <ngt-ambient-light intensity="0.5"></ngt-ambient-light>
1649
- <ngt-point-light position="10" intensity="0.5"></ngt-point-light>
1650
- </ngt-group>
1651
- `,
1652
- imports: [NgtsGizmoViewportAxis, NgtsGizmoViewportAxisHead, NgIf],
1653
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1654
- }]
1655
- }], propDecorators: { axisColors: [{
1656
- type: Input
1657
- }], axisScale: [{
1658
- type: Input
1659
- }], labels: [{
1660
- type: Input
1661
- }], axisHeadScale: [{
1662
- type: Input
1663
- }], labelColor: [{
1664
- type: Input
1665
- }], hideNegativeAxes: [{
1666
- type: Input
1667
- }], hideAxisHeads: [{
1668
- type: Input
1669
- }], disabled: [{
1670
- type: Input
1671
- }], font: [{
1672
- type: Input
1673
- }], clicked: [{
1674
- type: Output
1675
- }] } });
1676
-
1677
- const v = new THREE.Vector3();
1678
- class NgtsQuadraticBezierLine extends NgtsLineInput {
1679
- constructor() {
1680
- super(...arguments);
1681
- this.curve = new THREE.QuadraticBezierCurve3(undefined, undefined, undefined);
1682
- this.lineRef = injectNgtRef();
1683
- }
1684
- set start(start) {
1685
- this.set({ start });
1686
- }
1687
- set end(end) {
1688
- this.set({ end });
1689
- }
1690
- set mid(mid) {
1691
- this.set({ mid });
1692
- }
1693
- set segments(segments) {
1694
- this.set({ segments });
1695
- }
1696
- initialize() {
1697
- super.initialize();
1698
- this.set({ start: [0, 0, 0], end: [0, 0, 0], segments: 20 });
1699
- }
1700
- ngOnInit() {
1701
- this.connect('points', combineLatest([
1702
- this.select('start'),
1703
- this.select('end'),
1704
- this.select('mid').pipe(startWithUndefined()),
1705
- this.select('segments'),
1706
- ]).pipe(map(([start, end, mid, segments]) => this.getPoints(start, end, mid, segments))));
1707
- this.replaceSetPoints();
1708
- }
1709
- replaceSetPoints() {
1710
- this.hold(this.lineRef.$, (line) => {
1711
- line.setPoints = (start, end, mid) => {
1712
- const points = this.getPoints(start, end, mid);
1713
- if (this.lineRef.nativeElement.geometry) {
1714
- this.lineRef.nativeElement.geometry.setPositions(points.map((p) => p.toArray()).flat());
1715
- }
1716
- };
1717
- });
1718
- }
1719
- getPoints(start, end, mid, segments = 20) {
1720
- if (start instanceof THREE.Vector3)
1721
- this.curve.v0.copy(start);
1722
- else
1723
- this.curve.v0.set(...start);
1724
- if (end instanceof THREE.Vector3)
1725
- this.curve.v2.copy(end);
1726
- else
1727
- this.curve.v2.set(...end);
1728
- if (mid instanceof THREE.Vector3) {
1729
- this.curve.v1.copy(mid);
1730
- }
1731
- else {
1732
- this.curve.v1.copy(this.curve.v0
1733
- .clone()
1734
- .add(this.curve.v2.clone().sub(this.curve.v0))
1735
- .add(v.set(0, this.curve.v0.y - this.curve.v2.y, 0)));
1736
- }
1737
- return this.curve.getPoints(segments);
1738
- }
1739
- }
1740
- NgtsQuadraticBezierLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsQuadraticBezierLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
1741
- NgtsQuadraticBezierLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsQuadraticBezierLine, isStandalone: true, selector: "ngts-quadratic-bezier-line", inputs: { lineRef: "lineRef", start: "start", end: "end", mid: "mid", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
1742
- <ngts-line
1743
- [lineRef]="lineRef"
1744
- [points]="get('points')"
1745
- [color]="get('color')"
1746
- [vertexColors]="get('vertexColors')"
1747
- [resolution]="get('resolution')"
1748
- [lineWidth]="get('lineWidth')"
1749
- [alphaToCoverage]="get('alphaToCoverage')"
1750
- [dashed]="get('dashed')"
1751
- [dashScale]="get('dashScale')"
1752
- [dashSize]="get('dashSize')"
1753
- [dashOffset]="get('dashOffset')"
1754
- [gapSize]="get('gapSize')"
1755
- [wireframe]="get('wireframe')"
1756
- [worldUnits]="get('worldUnits')"
1757
- />
1758
- `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
1759
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsQuadraticBezierLine, decorators: [{
1760
- type: Component,
1761
- args: [{
1762
- selector: 'ngts-quadratic-bezier-line',
1763
- standalone: true,
1764
- template: `
1765
- <ngts-line
1766
- [lineRef]="lineRef"
1767
- [points]="get('points')"
1768
- [color]="get('color')"
1769
- [vertexColors]="get('vertexColors')"
1770
- [resolution]="get('resolution')"
1771
- [lineWidth]="get('lineWidth')"
1772
- [alphaToCoverage]="get('alphaToCoverage')"
1773
- [dashed]="get('dashed')"
1774
- [dashScale]="get('dashScale')"
1775
- [dashSize]="get('dashSize')"
1776
- [dashOffset]="get('dashOffset')"
1777
- [gapSize]="get('gapSize')"
1778
- [wireframe]="get('wireframe')"
1779
- [worldUnits]="get('worldUnits')"
1780
- />
1781
- `,
1782
- imports: [NgtsLine],
1783
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1784
- }]
1785
- }], propDecorators: { lineRef: [{
1786
- type: Input
1787
- }], start: [{
1788
- type: Input
1789
- }], end: [{
1790
- type: Input
1791
- }], mid: [{
1792
- type: Input
1793
- }], segments: [{
1794
- type: Input
1795
- }] } });
1796
-
1797
- extend({ Mesh, TextGeometry });
1798
- class NgtsText3D extends NgtRxStore {
1799
- constructor() {
1800
- super(...arguments);
1801
- this.font$ = this.select('font').pipe(switchMap((font) => {
1802
- if (typeof font === 'string')
1803
- return fetch(font).then((res) => res.json());
1804
- return of(font);
1805
- }), map((fontData) => new FontLoader().parse(fontData)));
1806
- this.geometryArgs$ = combineLatest([
1807
- this.font$,
1808
- this.select('text'),
1809
- this.select('size'),
1810
- this.select('height'),
1811
- this.select('bevelThickness'),
1812
- this.select('bevelSize'),
1813
- this.select('bevelEnabled'),
1814
- this.select('bevelSegments'),
1815
- this.select('bevelOffset'),
1816
- this.select('curveSegments'),
1817
- this.select('letterSpacing'),
1818
- this.select('lineHeight'),
1819
- ]).pipe(map(([font, text, size, height, bevelThickness, bevelSize, bevelEnabled, bevelSegments, bevelOffset, curveSegments, letterSpacing, lineHeight,]) => [
1820
- text,
1821
- {
1822
- font,
1823
- size,
1824
- height,
1825
- bevelThickness,
1826
- bevelSize,
1827
- bevelSegments,
1828
- bevelEnabled,
1829
- bevelOffset,
1830
- curveSegments,
1831
- letterSpacing,
1832
- lineHeight,
1833
- },
1834
- ]));
1835
- }
1836
- set font(font) {
1837
- this.set({ font });
1838
- }
1839
- set text(text) {
1840
- this.set({ text });
1841
- }
1842
- set bevelEnabled(bevelEnabled) {
1843
- this.set({ bevelEnabled });
1844
- }
1845
- set bevelOffset(bevelOffset) {
1846
- this.set({ bevelOffset });
1847
- }
1848
- set bevelSize(bevelSize) {
1849
- this.set({ bevelSize });
1850
- }
1851
- set bevelThickness(bevelThickness) {
1852
- this.set({ bevelThickness });
1853
- }
1854
- set curveSegments(curveSegments) {
1855
- this.set({ curveSegments });
1856
- }
1857
- set bevelSegments(bevelSegments) {
1858
- this.set({ bevelSegments });
1859
- }
1860
- set height(height) {
1861
- this.set({ height });
1862
- }
1863
- set size(size) {
1864
- this.set({ size });
1865
- }
1866
- set lineHeight(lineHeight) {
1867
- this.set({ lineHeight });
1868
- }
1869
- set letterSpacing(letterSpacing) {
1870
- this.set({ letterSpacing });
1871
- }
1872
- initialize() {
1873
- super.initialize();
1874
- this.set({
1875
- letterSpacing: 0,
1876
- lineHeight: 1,
1877
- size: 1,
1878
- height: 0.2,
1879
- bevelThickness: 0.1,
1880
- bevelSize: 0.01,
1881
- bevelEnabled: false,
1882
- bevelOffset: 0,
1883
- bevelSegments: 4,
1884
- curveSegments: 8,
1885
- });
1886
- }
1887
- }
1888
- NgtsText3D.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsText3D, deps: null, target: i0.ɵɵFactoryTarget.Component });
1889
- NgtsText3D.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsText3D, isStandalone: true, selector: "ngts-text-3d[font]", inputs: { font: "font", text: "text", bevelEnabled: "bevelEnabled", bevelOffset: "bevelOffset", bevelSize: "bevelSize", bevelThickness: "bevelThickness", curveSegments: "curveSegments", bevelSegments: "bevelSegments", height: "height", size: "size", lineHeight: "lineHeight", letterSpacing: "letterSpacing" }, usesInheritance: true, ngImport: i0, template: `
1890
- <ngt-mesh ngtCompound>
1891
- <ngt-text-geometry *args="geometryArgs$ | ngtPush : null" />
1892
- <ng-content />
1893
- </ngt-mesh>
1894
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }, { kind: "pipe", type: NgtPush, name: "ngtPush" }] });
1895
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsText3D, decorators: [{
1896
- type: Component,
1897
- args: [{
1898
- selector: 'ngts-text-3d[font]',
1899
- standalone: true,
1900
- template: `
1901
- <ngt-mesh ngtCompound>
1902
- <ngt-text-geometry *args="geometryArgs$ | ngtPush : null" />
1903
- <ng-content />
1904
- </ngt-mesh>
1905
- `,
1906
- imports: [NgtArgs, NgtPush],
1907
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
1908
- }]
1909
- }], propDecorators: { font: [{
1910
- type: Input
1911
- }], text: [{
1912
- type: Input
1913
- }], bevelEnabled: [{
1914
- type: Input
1915
- }], bevelOffset: [{
1916
- type: Input
1917
- }], bevelSize: [{
1918
- type: Input
1919
- }], bevelThickness: [{
1920
- type: Input
1921
- }], curveSegments: [{
1922
- type: Input
1923
- }], bevelSegments: [{
1924
- type: Input
1925
- }], height: [{
1926
- type: Input
1927
- }], size: [{
1928
- type: Input
1929
- }], lineHeight: [{
1930
- type: Input
1931
- }], letterSpacing: [{
1932
- type: Input
1933
- }] } });
1934
-
1935
- class NgtsText extends NgtRxStore {
1936
- constructor() {
1937
- super(...arguments);
1938
- this.textRef = injectNgtRef();
1939
- this.sync = new EventEmitter();
1940
- this.store = inject(NgtStore);
1941
- this.troikaText = new Text();
1942
- }
1943
- set text(text) {
1944
- this.set({ text });
1945
- }
1946
- set characters(characters) {
1947
- this.set({ characters });
1948
- }
1949
- set font(font) {
1950
- this.set({ font });
1951
- }
1952
- set anchorX(anchorX) {
1953
- this.set({ anchorX });
1954
- }
1955
- set anchorY(anchorY) {
1956
- this.set({ anchorY });
1957
- }
1958
- initialize() {
1959
- super.initialize();
1960
- this.set({ anchorX: 'center', anchorY: 'middle', text: '' });
1961
- }
1962
- ngOnInit() {
1963
- this.preloadFont();
1964
- this.syncText();
1965
- }
1966
- ngOnDestroy() {
1967
- this.troikaText.dispose();
1968
- super.ngOnDestroy();
1969
- }
1970
- preloadFont() {
1971
- const { font, characters } = this.get();
1972
- if (font && characters) {
1973
- preloadFont({ font, characters });
1974
- }
1975
- }
1976
- syncText() {
1977
- this.hold(this.select(), () => {
1978
- const invalidate = this.store.get('invalidate');
1979
- this.troikaText.sync(() => {
1980
- invalidate();
1981
- if (this.sync.observed)
1982
- this.sync.next(this.troikaText);
1983
- });
1984
- });
1985
- }
1986
- }
1987
- NgtsText.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsText, deps: null, target: i0.ɵɵFactoryTarget.Component });
1988
- NgtsText.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsText, isStandalone: true, selector: "ngts-text[text]", inputs: { textRef: "textRef", text: "text", characters: "characters", font: "font", anchorX: "anchorX", anchorY: "anchorY" }, outputs: { sync: "sync" }, providers: [RxActionFactory], usesInheritance: true, ngImport: i0, template: `
1989
- <ng-container>
1990
- <ngt-primitive
1991
- ngtCompound
1992
- *args="[troikaText]"
1993
- [ref]="textRef"
1994
- [text]="get('text')"
1995
- [anchorX]="get('anchorX')"
1996
- [anchorY]="get('anchorY')"
1997
- [font]="get('font')"
1998
- >
1999
- <ng-content />
2000
- </ngt-primitive>
2001
- </ng-container>
2002
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
2003
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsText, decorators: [{
2004
- type: Component,
2005
- args: [{
2006
- selector: 'ngts-text[text]',
2007
- standalone: true,
2008
- template: `
2009
- <ng-container>
2010
- <ngt-primitive
2011
- ngtCompound
2012
- *args="[troikaText]"
2013
- [ref]="textRef"
2014
- [text]="get('text')"
2015
- [anchorX]="get('anchorX')"
2016
- [anchorY]="get('anchorY')"
2017
- [font]="get('font')"
2018
- >
2019
- <ng-content />
2020
- </ngt-primitive>
2021
- </ng-container>
2022
- `,
2023
- imports: [NgtArgs],
2024
- providers: [RxActionFactory],
2025
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
2026
- }]
2027
- }], propDecorators: { textRef: [{
2028
- type: Input
2029
- }], text: [{
2030
- type: Input
2031
- }], characters: [{
2032
- type: Input
2033
- }], font: [{
2034
- type: Input
2035
- }], anchorX: [{
2036
- type: Input
2037
- }], anchorY: [{
2038
- type: Input
2039
- }], sync: [{
2040
- type: Output
2041
- }] } });
2042
-
2043
- /**
2044
- * Generated bundle index. Do not edit.
2045
- */
2046
-
2047
- export { NGTS_GIZMO_HELPER_API, NgtsBillboard, NgtsCatmullRomLine, NgtsCubicBezierLine, NgtsEdges, NgtsGizmoHelper, NgtsGizmoHelperContent, NgtsGizmoViewcube, NgtsGizmoViewport, NgtsLine, NgtsQuadraticBezierLine, NgtsText, NgtsText3D };
2048
- //# sourceMappingURL=angular-three-soba-abstractions.mjs.map