angular-three-soba 2.0.0-beta.7 → 2.0.0-beta.8

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 (296) hide show
  1. package/abstractions/billboard/billboard.d.ts +11 -7
  2. package/abstractions/detailed/detailed.d.ts +26 -0
  3. package/abstractions/edges/edges.d.ts +23 -11
  4. package/abstractions/grid/grid.d.ts +41 -50
  5. package/abstractions/index.d.ts +1 -7
  6. package/abstractions/text/text.d.ts +10 -4
  7. package/abstractions/text-3d/text-3d.d.ts +47 -40
  8. package/cameras/camera/camera-content.d.ts +1 -1
  9. package/cameras/camera/camera.d.ts +16 -13
  10. package/cameras/cube-camera/cube-camera.d.ts +50 -23
  11. package/cameras/index.d.ts +0 -1
  12. package/cameras/orthographic-camera/orthographic-camera.d.ts +29 -18
  13. package/cameras/perspective-camera/perspective-camera.d.ts +10 -1
  14. package/controls/orbit-controls/orbit-controls.d.ts +30 -13
  15. package/esm2022/abstractions/billboard/billboard.mjs +36 -33
  16. package/esm2022/abstractions/detailed/detailed.mjs +64 -0
  17. package/esm2022/abstractions/edges/edges.mjs +58 -63
  18. package/esm2022/abstractions/grid/grid.mjs +140 -110
  19. package/esm2022/abstractions/index.mjs +2 -8
  20. package/esm2022/abstractions/text/text.mjs +123 -122
  21. package/esm2022/abstractions/text-3d/text-3d.mjs +119 -121
  22. package/esm2022/cameras/camera/camera-content.mjs +5 -6
  23. package/esm2022/cameras/camera/camera.mjs +48 -42
  24. package/esm2022/cameras/cube-camera/cube-camera.mjs +129 -99
  25. package/esm2022/cameras/index.mjs +1 -2
  26. package/esm2022/cameras/orthographic-camera/orthographic-camera.mjs +78 -75
  27. package/esm2022/cameras/perspective-camera/perspective-camera.mjs +25 -26
  28. package/esm2022/controls/orbit-controls/orbit-controls.mjs +94 -90
  29. package/esm2022/loaders/gltf-loader/gltf-loader.mjs +3 -6
  30. package/esm2022/loaders/loader/loader.mjs +92 -87
  31. package/esm2022/loaders/progress/progress.mjs +1 -1
  32. package/esm2022/loaders/texture-loader/texture-loader.mjs +4 -4
  33. package/esm2022/materials/index.mjs +2 -1
  34. package/esm2022/materials/mesh-distort-material/mesh-distort-material.mjs +60 -51
  35. package/esm2022/materials/mesh-reflector-material/mesh-reflector-material.mjs +239 -255
  36. package/esm2022/materials/mesh-refraction-material/mesh-refraction-material.mjs +99 -97
  37. package/esm2022/materials/mesh-transmission-material/mesh-transmission-material.mjs +167 -146
  38. package/esm2022/materials/mesh-wobble-material/mesh-wobble-material.mjs +44 -42
  39. package/esm2022/materials/point-material/point-material.mjs +46 -0
  40. package/esm2022/misc/animations/animations.mjs +20 -16
  41. package/esm2022/misc/bake-shadows/bake-shadows.mjs +13 -13
  42. package/esm2022/misc/caustics/caustics.mjs +387 -0
  43. package/esm2022/misc/decal/decal.mjs +187 -0
  44. package/esm2022/misc/depth-buffer/depth-buffer.mjs +33 -35
  45. package/esm2022/misc/example/example.mjs +160 -0
  46. package/esm2022/misc/fbo/fbo.mjs +35 -35
  47. package/esm2022/misc/html/html-wrapper.mjs +478 -0
  48. package/esm2022/misc/html/html.mjs +304 -0
  49. package/esm2022/misc/index.mjs +10 -1
  50. package/esm2022/misc/sampler/sampler.mjs +142 -0
  51. package/esm2022/misc/shadow/shadow.mjs +111 -0
  52. package/esm2022/misc/stats-gl/stats-gl.mjs +61 -0
  53. package/esm2022/misc/trail/trail.mjs +209 -0
  54. package/esm2022/misc/trail-texture/inject-trail-texture.mjs +17 -0
  55. package/esm2022/misc/trail-texture/trail-texture.mjs +106 -0
  56. package/esm2022/modifiers/angular-three-soba-modifiers.mjs +5 -0
  57. package/esm2022/modifiers/curve-modifier/curve-modifier.mjs +64 -0
  58. package/esm2022/modifiers/index.mjs +2 -0
  59. package/esm2022/performances/adaptive-dpr/adaptive-dpr.mjs +44 -0
  60. package/esm2022/performances/adaptive-events/adaptive-events.mjs +27 -0
  61. package/esm2022/performances/angular-three-soba-performances.mjs +5 -0
  62. package/esm2022/performances/index.mjs +6 -0
  63. package/esm2022/performances/points/points-input.mjs +64 -0
  64. package/esm2022/performances/points/points.mjs +329 -0
  65. package/esm2022/performances/points/position-point.mjs +54 -0
  66. package/esm2022/performances/segments/segment-object.mjs +9 -0
  67. package/esm2022/performances/segments/segments.mjs +182 -0
  68. package/esm2022/shaders/blur-pass/blur-pass.mjs +1 -1
  69. package/esm2022/shaders/caustics/caustics-material.mjs +130 -0
  70. package/esm2022/shaders/caustics/caustics-projection-material.mjs +31 -0
  71. package/esm2022/shaders/convolution-material/convolution-material.mjs +1 -1
  72. package/esm2022/shaders/discard-material/discard-material.mjs +1 -1
  73. package/esm2022/shaders/grid-material/grid-material.mjs +29 -14
  74. package/esm2022/shaders/index.mjs +5 -3
  75. package/esm2022/shaders/mesh-distort-material/mesh-distort-material.mjs +42 -41
  76. package/esm2022/shaders/mesh-reflector-material/mesh-reflector-material.mjs +1 -1
  77. package/esm2022/shaders/mesh-refraction-material/mesh-refraction-material.mjs +2 -2
  78. package/esm2022/shaders/mesh-transmission-material/mesh-transmission-material.mjs +4 -4
  79. package/esm2022/shaders/mesh-wobble-material/mesh-wobble-material.mjs +1 -1
  80. package/esm2022/shaders/shader-material/shader-material.mjs +1 -1
  81. package/esm2022/shaders/soft-shadow-material/soft-shadow-material.mjs +17 -25
  82. package/esm2022/shaders/sparkles-material/sparkles-material.mjs +32 -46
  83. package/esm2022/shaders/spot-light-material/spot-light-material.mjs +7 -7
  84. package/esm2022/shaders/star-field-material/star-field-material.mjs +3 -2
  85. package/esm2022/shaders/wireframe-material/wireframe-material.mjs +247 -0
  86. package/esm2022/staging/accumulative-shadows/accumulative-shadows.mjs +160 -176
  87. package/esm2022/staging/accumulative-shadows/progressive-light-map.mjs +1 -1
  88. package/esm2022/staging/accumulative-shadows/randomized-lights.mjs +126 -128
  89. package/esm2022/staging/backdrop/backdrop.mjs +77 -0
  90. package/esm2022/staging/bb-anchor/bb-anchor.mjs +70 -0
  91. package/esm2022/staging/bounds/bounds.mjs +144 -143
  92. package/esm2022/staging/camera-shake/camera-shake.mjs +86 -80
  93. package/esm2022/staging/center/center.mjs +106 -91
  94. package/esm2022/staging/cloud/cloud.mjs +118 -124
  95. package/esm2022/staging/contact-shadows/contact-shadows.mjs +131 -134
  96. package/esm2022/staging/environment/assets.mjs +12 -12
  97. package/esm2022/staging/environment/environment-cube.mjs +28 -30
  98. package/esm2022/staging/environment/environment-ground.mjs +18 -20
  99. package/esm2022/staging/environment/environment-input.mjs +97 -84
  100. package/esm2022/staging/environment/environment-map.mjs +33 -33
  101. package/esm2022/staging/environment/environment-portal.mjs +75 -97
  102. package/esm2022/staging/environment/environment.mjs +34 -51
  103. package/esm2022/staging/environment/utils.mjs +35 -14
  104. package/esm2022/staging/float/float.mjs +70 -58
  105. package/esm2022/staging/index.mjs +7 -3
  106. package/esm2022/staging/matcap-texture/matcap-texture.mjs +64 -0
  107. package/esm2022/staging/normal-texture/normal-texture.mjs +53 -0
  108. package/esm2022/staging/sky/sky.mjs +85 -80
  109. package/esm2022/staging/sparkles/sparkles.mjs +108 -105
  110. package/esm2022/staging/spot-light/shadow-mesh-input.mjs +63 -0
  111. package/esm2022/staging/spot-light/shadow-mesh.mjs +266 -0
  112. package/esm2022/staging/spot-light/spot-light-input.mjs +67 -58
  113. package/esm2022/staging/spot-light/spot-light.mjs +51 -64
  114. package/esm2022/staging/spot-light/volumetric-mesh.mjs +61 -78
  115. package/esm2022/staging/stage/stage.mjs +304 -290
  116. package/esm2022/staging/stars/stars.mjs +101 -102
  117. package/esm2022/staging/wireframe/wireframe-input.mjs +191 -0
  118. package/esm2022/staging/wireframe/wireframe.mjs +224 -0
  119. package/esm2022/utils/angular-three-soba-utils.mjs +5 -0
  120. package/esm2022/utils/content/content.mjs +15 -0
  121. package/esm2022/utils/index.mjs +2 -0
  122. package/fesm2022/angular-three-soba-abstractions.mjs +505 -2087
  123. package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
  124. package/fesm2022/angular-three-soba-cameras.mjs +302 -259
  125. package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
  126. package/fesm2022/angular-three-soba-controls.mjs +93 -88
  127. package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
  128. package/fesm2022/angular-three-soba-loaders.mjs +94 -90
  129. package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
  130. package/fesm2022/angular-three-soba-materials.mjs +655 -590
  131. package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
  132. package/fesm2022/angular-three-soba-misc.mjs +2198 -89
  133. package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
  134. package/fesm2022/angular-three-soba-modifiers.mjs +71 -0
  135. package/fesm2022/angular-three-soba-modifiers.mjs.map +1 -0
  136. package/fesm2022/angular-three-soba-performances.mjs +697 -0
  137. package/fesm2022/angular-three-soba-performances.mjs.map +1 -0
  138. package/fesm2022/angular-three-soba-shaders.mjs +501 -264
  139. package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
  140. package/fesm2022/angular-three-soba-staging.mjs +2870 -2555
  141. package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
  142. package/fesm2022/angular-three-soba-utils.mjs +22 -0
  143. package/fesm2022/angular-three-soba-utils.mjs.map +1 -0
  144. package/loaders/gltf-loader/gltf-loader.d.ts +4 -3
  145. package/loaders/loader/loader.d.ts +19 -17
  146. package/loaders/progress/progress.d.ts +1 -1
  147. package/loaders/texture-loader/texture-loader.d.ts +2 -2
  148. package/materials/index.d.ts +1 -0
  149. package/materials/mesh-distort-material/mesh-distort-material.d.ts +25 -15
  150. package/materials/mesh-reflector-material/mesh-reflector-material.d.ts +74 -56
  151. package/materials/mesh-refraction-material/mesh-refraction-material.d.ts +33 -21
  152. package/materials/mesh-transmission-material/mesh-transmission-material.d.ts +55 -39
  153. package/materials/mesh-wobble-material/mesh-wobble-material.d.ts +19 -10
  154. package/materials/point-material/point-material.d.ts +24 -0
  155. package/metadata.json +1 -0
  156. package/misc/animations/animations.d.ts +6 -4
  157. package/misc/caustics/caustics.d.ts +87 -0
  158. package/misc/decal/decal.d.ts +49 -0
  159. package/misc/depth-buffer/depth-buffer.d.ts +2 -2
  160. package/misc/example/example.d.ts +81 -0
  161. package/misc/fbo/fbo.d.ts +2 -2
  162. package/misc/html/html-wrapper.d.ts +559 -0
  163. package/misc/html/html.d.ts +214 -0
  164. package/misc/index.d.ts +9 -0
  165. package/misc/sampler/sampler.d.ts +67 -0
  166. package/misc/shadow/shadow.d.ts +37 -0
  167. package/misc/stats-gl/stats-gl.d.ts +24 -0
  168. package/misc/trail/trail.d.ts +57 -0
  169. package/misc/trail-texture/inject-trail-texture.d.ts +9 -0
  170. package/misc/trail-texture/trail-texture.d.ts +50 -0
  171. package/modifiers/README.md +3 -0
  172. package/modifiers/curve-modifier/curve-modifier.d.ts +23 -0
  173. package/modifiers/index.d.ts +1 -0
  174. package/package.json +30 -22
  175. package/performances/README.md +3 -0
  176. package/performances/adaptive-dpr/adaptive-dpr.d.ts +14 -0
  177. package/{performance/adaptive → performances/adaptive-events}/adaptive-events.d.ts +3 -0
  178. package/performances/index.d.ts +5 -0
  179. package/performances/points/points-input.d.ts +32 -0
  180. package/performances/points/points.d.ts +92 -0
  181. package/{performance/instances/position-mesh.d.ts → performances/points/position-point.d.ts} +4 -3
  182. package/performances/segments/segment-object.d.ts +7 -0
  183. package/performances/segments/segments.d.ts +124 -0
  184. package/shaders/grid-material/grid-material.d.ts +33 -0
  185. package/shaders/index.d.ts +4 -2
  186. package/shaders/mesh-distort-material/mesh-distort-material.d.ts +146 -1
  187. package/shaders/mesh-transmission-material/mesh-transmission-material.d.ts +1 -1
  188. package/shaders/shader-material/shader-material.d.ts +2 -2
  189. package/shaders/soft-shadow-material/soft-shadow-material.d.ts +10 -1
  190. package/shaders/sparkles-material/sparkles-material.d.ts +15 -1
  191. package/shaders/spot-light-material/spot-light-material.d.ts +11 -2
  192. package/shaders/star-field-material/star-field-material.d.ts +11 -1
  193. package/shaders/wireframe-material/wireframe-material.d.ts +58 -0
  194. package/staging/accumulative-shadows/accumulative-shadows.d.ts +89 -39
  195. package/staging/accumulative-shadows/randomized-lights.d.ts +40 -27
  196. package/staging/backdrop/backdrop.d.ts +30 -0
  197. package/staging/bb-anchor/bb-anchor.d.ts +27 -0
  198. package/staging/bounds/bounds.d.ts +100 -24
  199. package/staging/camera-shake/camera-shake.d.ts +30 -19
  200. package/staging/center/center.d.ts +43 -35
  201. package/staging/cloud/cloud.d.ts +26 -23
  202. package/staging/contact-shadows/contact-shadows.d.ts +41 -28
  203. package/staging/environment/assets.d.ts +9 -9
  204. package/staging/environment/environment-cube.d.ts +9 -5
  205. package/staging/environment/environment-ground.d.ts +7 -7
  206. package/staging/environment/environment-input.d.ts +36 -36
  207. package/staging/environment/environment-map.d.ts +10 -5
  208. package/staging/environment/environment-portal.d.ts +10 -5
  209. package/staging/environment/environment.d.ts +0 -4
  210. package/staging/environment/utils.d.ts +2 -2
  211. package/staging/float/float.d.ts +14 -10
  212. package/staging/index.d.ts +6 -2
  213. package/staging/matcap-texture/matcap-texture.d.ts +13 -0
  214. package/staging/normal-texture/normal-texture.d.ts +16 -0
  215. package/staging/sky/sky.d.ts +28 -21
  216. package/staging/sparkles/sparkles.d.ts +35 -21
  217. package/staging/spot-light/shadow-mesh-input.d.ts +29 -0
  218. package/staging/spot-light/shadow-mesh.d.ts +37 -0
  219. package/staging/spot-light/spot-light-input.d.ts +25 -25
  220. package/staging/spot-light/spot-light.d.ts +31 -15
  221. package/staging/spot-light/volumetric-mesh.d.ts +15 -9
  222. package/staging/stage/stage.d.ts +88 -63
  223. package/staging/stars/stars.d.ts +27 -16
  224. package/staging/wireframe/wireframe-input.d.ts +65 -0
  225. package/staging/wireframe/wireframe.d.ts +28 -0
  226. package/utils/README.md +3 -0
  227. package/utils/content/content.d.ts +8 -0
  228. package/utils/index.d.ts +1 -0
  229. package/web-types.json +1 -0
  230. package/abstractions/catmull-rom-line/catmull-rom-line.d.ts +0 -25
  231. package/abstractions/cubic-bezier-line/cubic-bezier-line.d.ts +0 -25
  232. package/abstractions/gizmo-helper/gizmo-helper.d.ts +0 -34
  233. package/abstractions/gizmo-helper/gizmo-viewcube/constants.d.ts +0 -12
  234. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +0 -22
  235. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +0 -30
  236. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +0 -32
  237. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +0 -14
  238. package/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +0 -47
  239. package/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +0 -40
  240. package/abstractions/line/line-input.d.ts +0 -42
  241. package/abstractions/line/line.d.ts +0 -35
  242. package/abstractions/quadratic-bezier-line/quadratic-bezier-line.d.ts +0 -23
  243. package/esm2022/abstractions/catmull-rom-line/catmull-rom-line.mjs +0 -131
  244. package/esm2022/abstractions/cubic-bezier-line/cubic-bezier-line.mjs +0 -113
  245. package/esm2022/abstractions/gizmo-helper/gizmo-helper.mjs +0 -210
  246. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/constants.mjs +0 -31
  247. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +0 -95
  248. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +0 -155
  249. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +0 -62
  250. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +0 -80
  251. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +0 -206
  252. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +0 -273
  253. package/esm2022/abstractions/line/line-input.mjs +0 -113
  254. package/esm2022/abstractions/line/line.mjs +0 -165
  255. package/esm2022/abstractions/quadratic-bezier-line/quadratic-bezier-line.mjs +0 -128
  256. package/esm2022/performance/adaptive/adaptive-dpr.mjs +0 -46
  257. package/esm2022/performance/adaptive/adaptive-events.mjs +0 -31
  258. package/esm2022/performance/angular-three-soba-performance.mjs +0 -5
  259. package/esm2022/performance/detailed/detailed.mjs +0 -61
  260. package/esm2022/performance/index.mjs +0 -7
  261. package/esm2022/performance/instances/instance.mjs +0 -48
  262. package/esm2022/performance/instances/instances.mjs +0 -189
  263. package/esm2022/performance/instances/position-mesh.mjs +0 -52
  264. package/esm2022/performance/stats/stats.mjs +0 -79
  265. package/esm2022/shaders/caustics-material/caustics-material.mjs +0 -128
  266. package/esm2022/shaders/caustics-material/caustics-projection-material.mjs +0 -33
  267. package/esm2022/staging/caustics/caustisc.mjs +0 -384
  268. package/esm2022/staging/spot-light/spot-light-shadow-mesh-input.mjs +0 -57
  269. package/esm2022/staging/spot-light/spot-light-shadow-mesh.mjs +0 -258
  270. package/fesm2022/angular-three-soba-performance.mjs +0 -487
  271. package/fesm2022/angular-three-soba-performance.mjs.map +0 -1
  272. package/performance/README.md +0 -3
  273. package/performance/adaptive/adaptive-dpr.d.ts +0 -8
  274. package/performance/detailed/detailed.d.ts +0 -20
  275. package/performance/index.d.ts +0 -6
  276. package/performance/instances/instance.d.ts +0 -9
  277. package/performance/instances/instances.d.ts +0 -35
  278. package/performance/stats/stats.d.ts +0 -18
  279. package/plugin/generators.json +0 -19
  280. package/plugin/libs/plugin/README.md +0 -11
  281. package/plugin/package.json +0 -9
  282. package/plugin/src/generators/init/compat.d.ts +0 -2
  283. package/plugin/src/generators/init/compat.js +0 -6
  284. package/plugin/src/generators/init/compat.js.map +0 -1
  285. package/plugin/src/generators/init/init.d.ts +0 -7
  286. package/plugin/src/generators/init/init.js +0 -28
  287. package/plugin/src/generators/init/init.js.map +0 -1
  288. package/plugin/src/generators/init/schema.json +0 -6
  289. package/plugin/src/index.d.ts +0 -1
  290. package/plugin/src/index.js +0 -6
  291. package/plugin/src/index.js.map +0 -1
  292. package/staging/caustics/caustisc.d.ts +0 -70
  293. package/staging/spot-light/spot-light-shadow-mesh-input.d.ts +0 -29
  294. package/staging/spot-light/spot-light-shadow-mesh.d.ts +0 -38
  295. /package/shaders/{caustics-material → caustics}/caustics-material.d.ts +0 -0
  296. /package/shaders/{caustics-material → caustics}/caustics-projection-material.d.ts +0 -0
@@ -0,0 +1,697 @@
1
+ import * as i0 from '@angular/core';
2
+ import { signal, effect, untracked, Directive, Input, computed, ElementRef, forwardRef, inject, Injector, Component, CUSTOM_ELEMENTS_SCHEMA, NgZone, TemplateRef, ContentChild } from '@angular/core';
3
+ import { injectNgtStore, signalStore, injectNgtRef, extend, createInjectionToken, checkUpdate, injectBeforeRender, is, NgtArgs } from 'angular-three';
4
+ import { NgIf, NgTemplateOutlet } from '@angular/common';
5
+ import { NgtsSobaContent } from 'angular-three-soba/utils';
6
+ import * as THREE from 'three';
7
+ import { Points, BufferGeometry, BufferAttribute } from 'three';
8
+ import { Line2, LineMaterial, LineSegmentsGeometry } from 'three-stdlib';
9
+
10
+ class NgtsAdaptiveDpr {
11
+ set _pixelated(pixelated) {
12
+ this.pixelated.set(pixelated);
13
+ }
14
+ constructor() {
15
+ this.pixelated = signal(false);
16
+ this.store = injectNgtStore();
17
+ this.current = this.store.select('performance', 'current');
18
+ this.active = this.store.get('internal', 'active');
19
+ this.setDpr = this.store.get('setDpr');
20
+ this.initialDpr = this.store.get('viewport', 'initialDpr');
21
+ this.domElement = this.store.get('gl', 'domElement');
22
+ effect((onCleanup) => {
23
+ onCleanup(() => {
24
+ if (this.active) {
25
+ this.setDpr(this.initialDpr);
26
+ }
27
+ if (this.pixelated() && this.domElement) {
28
+ this.domElement.style.imageRendering = 'auto';
29
+ }
30
+ });
31
+ });
32
+ effect(() => {
33
+ const current = this.current();
34
+ this.setDpr(current * this.initialDpr);
35
+ if (untracked(this.pixelated) && this.domElement) {
36
+ this.domElement.style.imageRendering = current === 1 ? 'auto' : 'pixelated';
37
+ }
38
+ });
39
+ }
40
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsAdaptiveDpr, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
41
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.7", type: NgtsAdaptiveDpr, isStandalone: true, selector: "ngts-adaptive-dpr", inputs: { _pixelated: ["pixelated", "_pixelated"] }, ngImport: i0 }); }
42
+ }
43
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsAdaptiveDpr, decorators: [{
44
+ type: Directive,
45
+ args: [{ selector: 'ngts-adaptive-dpr', standalone: true }]
46
+ }], ctorParameters: function () { return []; }, propDecorators: { _pixelated: [{
47
+ type: Input,
48
+ args: [{ alias: 'pixelated' }]
49
+ }] } });
50
+
51
+ class NgtsAdaptiveEvents {
52
+ constructor() {
53
+ this.store = injectNgtStore();
54
+ this.setEvents = this.store.get('setEvents');
55
+ this.current = this.store.select('performance', 'current');
56
+ effect((onCleanup) => {
57
+ const enabled = this.store.get('events', 'enabled');
58
+ onCleanup(() => {
59
+ this.setEvents({ enabled });
60
+ });
61
+ });
62
+ effect(() => {
63
+ const current = this.current();
64
+ this.setEvents({ enabled: current === 1 });
65
+ });
66
+ }
67
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsAdaptiveEvents, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
68
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.7", type: NgtsAdaptiveEvents, isStandalone: true, selector: "ngts-adaptive-events", ngImport: i0 }); }
69
+ }
70
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsAdaptiveEvents, decorators: [{
71
+ type: Directive,
72
+ args: [{ selector: 'ngts-adaptive-events', standalone: true }]
73
+ }], ctorParameters: function () { return []; } });
74
+
75
+ class NgtsPointsInput {
76
+ constructor() {
77
+ this.inputs = signalStore({
78
+ stride: 3,
79
+ limit: 1000,
80
+ });
81
+ this.pointsRef = injectNgtRef();
82
+ this.limit = this.inputs.select('limit');
83
+ this.range = this.inputs.select('range');
84
+ this.positions = this.inputs.select('positions');
85
+ this.colors = this.inputs.select('colors');
86
+ this.colorsLength = computed(() => this.colors()?.length || 0);
87
+ this.sizes = this.inputs.select('sizes');
88
+ this.sizesLength = computed(() => this.sizes()?.length || 0);
89
+ this.stride = this.inputs.select('stride');
90
+ }
91
+ set _range(range) {
92
+ this.inputs.set({ range });
93
+ }
94
+ set _limit(limit) {
95
+ this.inputs.set({ limit });
96
+ }
97
+ set _positions(positions) {
98
+ this.inputs.set({ positions });
99
+ }
100
+ set _colors(colors) {
101
+ this.inputs.set({ colors });
102
+ }
103
+ set _sizes(sizes) {
104
+ this.inputs.set({ sizes });
105
+ }
106
+ set _stride(stride) {
107
+ this.inputs.set({ stride });
108
+ }
109
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPointsInput, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
110
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.7", type: NgtsPointsInput, inputs: { pointsRef: "pointsRef", _range: ["range", "_range"], _limit: ["limit", "_limit"], _positions: ["positions", "_positions"], _colors: ["colors", "_colors"], _sizes: ["sizes", "_sizes"], _stride: ["stride", "_stride"] }, ngImport: i0 }); }
111
+ }
112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPointsInput, decorators: [{
113
+ type: Directive
114
+ }], propDecorators: { pointsRef: [{
115
+ type: Input
116
+ }], _range: [{
117
+ type: Input,
118
+ args: [{ alias: 'range' }]
119
+ }], _limit: [{
120
+ type: Input,
121
+ args: [{ alias: 'limit' }]
122
+ }], _positions: [{
123
+ type: Input,
124
+ args: [{ alias: 'positions' }]
125
+ }], _colors: [{
126
+ type: Input,
127
+ args: [{ alias: 'colors' }]
128
+ }], _sizes: [{
129
+ type: Input,
130
+ args: [{ alias: 'sizes' }]
131
+ }], _stride: [{
132
+ type: Input,
133
+ args: [{ alias: 'stride' }]
134
+ }] } });
135
+
136
+ const _inverseMatrix = /*@__PURE__*/ new THREE.Matrix4();
137
+ const _ray = /*@__PURE__*/ new THREE.Ray();
138
+ const _sphere = /*@__PURE__*/ new THREE.Sphere();
139
+ const _position = /*@__PURE__*/ new THREE.Vector3();
140
+ class PositionPoint extends THREE.Group {
141
+ constructor() {
142
+ super();
143
+ this.size = 0;
144
+ this.color = new THREE.Color('white');
145
+ this.instance = new ElementRef(undefined);
146
+ this.instanceKey = new ElementRef(undefined);
147
+ }
148
+ // This will allow the virtual instance have bounds
149
+ get geometry() {
150
+ return this.instance.nativeElement?.geometry;
151
+ }
152
+ raycast(raycaster, intersects) {
153
+ const parent = this.instance.nativeElement;
154
+ if (!parent || !parent.geometry)
155
+ return;
156
+ const instanceId = parent.userData['instances'].indexOf(this.instanceKey);
157
+ // If the instance wasn't found or exceeds the parents draw range, bail out
158
+ if (instanceId === -1 || instanceId > parent.geometry.drawRange.count)
159
+ return;
160
+ const threshold = raycaster.params.Points?.threshold ?? 1;
161
+ _sphere.set(this.getWorldPosition(_position), threshold);
162
+ if (raycaster.ray.intersectsSphere(_sphere) === false)
163
+ return;
164
+ _inverseMatrix.copy(parent.matrixWorld).invert();
165
+ _ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);
166
+ const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);
167
+ const localThresholdSq = localThreshold * localThreshold;
168
+ const rayPointDistanceSq = _ray.distanceSqToPoint(this.position);
169
+ if (rayPointDistanceSq < localThresholdSq) {
170
+ const intersectPoint = new THREE.Vector3();
171
+ _ray.closestPointToPoint(this.position, intersectPoint);
172
+ intersectPoint.applyMatrix4(this.matrixWorld);
173
+ const distance = raycaster.ray.origin.distanceTo(intersectPoint);
174
+ if (distance < raycaster.near || distance > raycaster.far)
175
+ return;
176
+ intersects.push({
177
+ distance: distance,
178
+ distanceToRay: Math.sqrt(rayPointDistanceSq),
179
+ point: intersectPoint,
180
+ index: instanceId,
181
+ face: null,
182
+ object: this,
183
+ });
184
+ }
185
+ }
186
+ }
187
+
188
+ extend({ Points, BufferGeometry, BufferAttribute, PositionPoint });
189
+ const [injectNgtsPointsInstanceApi, provideNgtsPointsInstancesApi] = createInjectionToken(function pointsInstancesApi(instances) {
190
+ return instances.api;
191
+ }, { isRoot: false, deps: [forwardRef(() => NgtsPointsInstances)] });
192
+ class NgtsPointsInstances {
193
+ constructor() {
194
+ this.nullRaycast = () => null;
195
+ this.DynamicDrawUsage = THREE.DynamicDrawUsage;
196
+ this.pointsInput = inject(NgtsPointsInput);
197
+ this.positionPoints = signal([]);
198
+ this.parentMatrix = new THREE.Matrix4();
199
+ this.position = new THREE.Vector3();
200
+ this.points = this.positionPoints.asReadonly();
201
+ this.positions = computed(() => new Float32Array(this.pointsInput.limit() * 3));
202
+ this.colors = computed(() => Float32Array.from({ length: this.pointsInput.limit() * 3 }, () => 1));
203
+ this.sizes = computed(() => Float32Array.from({ length: this.pointsInput.limit() }, () => 1));
204
+ this.injector = inject(Injector);
205
+ this.api = computed(() => ({
206
+ getParent: () => this.pointsInput.pointsRef,
207
+ subscribe: (pointRef) => {
208
+ untracked(() => {
209
+ this.positionPoints.update((s) => [...s, pointRef]);
210
+ });
211
+ return () => {
212
+ untracked(() => {
213
+ this.positionPoints.update((s) => s.filter((positionPoint) => positionPoint !== pointRef));
214
+ });
215
+ };
216
+ },
217
+ }));
218
+ this.checkUpdatePositionAttribute();
219
+ this.beforeRender();
220
+ }
221
+ checkUpdatePositionAttribute() {
222
+ effect(() => {
223
+ const points = this.pointsInput.pointsRef.nativeElement;
224
+ if (!points)
225
+ return;
226
+ checkUpdate(points.geometry.attributes['position']);
227
+ });
228
+ }
229
+ beforeRender() {
230
+ injectBeforeRender(() => {
231
+ const points = this.pointsInput.pointsRef.nativeElement;
232
+ if (!points)
233
+ return;
234
+ const [limit, range, positionPoints, positions, colors, sizes] = [
235
+ this.pointsInput.limit(),
236
+ this.pointsInput.range(),
237
+ this.positionPoints(),
238
+ this.positions(),
239
+ this.colors(),
240
+ this.sizes(),
241
+ ];
242
+ points.updateMatrix();
243
+ points.updateMatrixWorld();
244
+ this.parentMatrix.copy(points.matrixWorld).invert();
245
+ points.geometry.drawRange.count = Math.min(limit, range !== undefined ? range : limit, positionPoints.length);
246
+ for (let i = 0; i < positionPoints.length; i++) {
247
+ const positionPointRef = positionPoints[i];
248
+ const positionPoint = is.ref(positionPointRef) ? positionPointRef.nativeElement : positionPointRef;
249
+ if (!positionPoint)
250
+ continue;
251
+ positionPoint.getWorldPosition(this.position).applyMatrix4(this.parentMatrix);
252
+ this.position.toArray(positions, i * 3);
253
+ checkUpdate(points.geometry.attributes['position']);
254
+ positionPoint.matrixWorldNeedsUpdate = true;
255
+ positionPoint.color.toArray(colors, i * 3);
256
+ checkUpdate(points.geometry.attributes['color']);
257
+ sizes.set([positionPoint.size], i);
258
+ checkUpdate(points.geometry.attributes['size']);
259
+ }
260
+ });
261
+ }
262
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPointsInstances, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
263
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsPointsInstances, isStandalone: true, selector: "ngts-points-instances", providers: [provideNgtsPointsInstancesApi()], ngImport: i0, template: `
264
+ <ngt-points
265
+ [ref]="pointsInput.pointsRef"
266
+ [userData]="{ instances: points() }"
267
+ [matrixAutoUpdate]="false"
268
+ [raycast]="nullRaycast"
269
+ ngtCompound
270
+ >
271
+ <ngt-buffer-geometry>
272
+ <ngt-buffer-attribute
273
+ attach="attributes.position"
274
+ [count]="positions().length / 3"
275
+ [array]="positions()"
276
+ [itemSize]="3"
277
+ [usage]="DynamicDrawUsage"
278
+ />
279
+ <ngt-buffer-attribute
280
+ attach="attributes.color"
281
+ [count]="colors().length / 3"
282
+ [array]="colors()"
283
+ [itemSize]="3"
284
+ [usage]="DynamicDrawUsage"
285
+ />
286
+ <ngt-buffer-attribute
287
+ attach="attributes.size"
288
+ [count]="sizes().length"
289
+ [array]="sizes()"
290
+ [itemSize]="1"
291
+ [usage]="DynamicDrawUsage"
292
+ />
293
+ </ngt-buffer-geometry>
294
+ <ng-content />
295
+ </ngt-points>
296
+ `, isInline: true }); }
297
+ }
298
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPointsInstances, decorators: [{
299
+ type: Component,
300
+ args: [{
301
+ selector: 'ngts-points-instances',
302
+ standalone: true,
303
+ template: `
304
+ <ngt-points
305
+ [ref]="pointsInput.pointsRef"
306
+ [userData]="{ instances: points() }"
307
+ [matrixAutoUpdate]="false"
308
+ [raycast]="nullRaycast"
309
+ ngtCompound
310
+ >
311
+ <ngt-buffer-geometry>
312
+ <ngt-buffer-attribute
313
+ attach="attributes.position"
314
+ [count]="positions().length / 3"
315
+ [array]="positions()"
316
+ [itemSize]="3"
317
+ [usage]="DynamicDrawUsage"
318
+ />
319
+ <ngt-buffer-attribute
320
+ attach="attributes.color"
321
+ [count]="colors().length / 3"
322
+ [array]="colors()"
323
+ [itemSize]="3"
324
+ [usage]="DynamicDrawUsage"
325
+ />
326
+ <ngt-buffer-attribute
327
+ attach="attributes.size"
328
+ [count]="sizes().length"
329
+ [array]="sizes()"
330
+ [itemSize]="1"
331
+ [usage]="DynamicDrawUsage"
332
+ />
333
+ </ngt-buffer-geometry>
334
+ <ng-content />
335
+ </ngt-points>
336
+ `,
337
+ providers: [provideNgtsPointsInstancesApi()],
338
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
339
+ }]
340
+ }], ctorParameters: function () { return []; } });
341
+ class NgtsPoint {
342
+ constructor() {
343
+ this.pointRef = injectNgtRef();
344
+ this.zone = inject(NgZone);
345
+ this.injector = inject(Injector);
346
+ this.pointsInstancesApi = injectNgtsPointsInstanceApi();
347
+ }
348
+ ngOnInit() {
349
+ effect((onCleanup) => {
350
+ const cleanup = this.zone.runOutsideAngular(() => {
351
+ const api = this.pointsInstancesApi();
352
+ return api.subscribe(this.pointRef);
353
+ });
354
+ onCleanup(cleanup);
355
+ }, { injector: this.injector });
356
+ }
357
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPoint, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
358
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsPoint, isStandalone: true, selector: "ngts-point", inputs: { pointRef: "pointRef" }, ngImport: i0, template: `
359
+ <ngt-position-point
360
+ [instance]="pointsInstancesApi().getParent()"
361
+ [ref]="pointRef"
362
+ [instanceKey]="pointRef"
363
+ ngtCompound
364
+ >
365
+ <ng-content />
366
+ </ngt-position-point>
367
+ `, isInline: true }); }
368
+ }
369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPoint, decorators: [{
370
+ type: Component,
371
+ args: [{
372
+ selector: 'ngts-point',
373
+ standalone: true,
374
+ template: `
375
+ <ngt-position-point
376
+ [instance]="pointsInstancesApi().getParent()"
377
+ [ref]="pointRef"
378
+ [instanceKey]="pointRef"
379
+ ngtCompound
380
+ >
381
+ <ng-content />
382
+ </ngt-position-point>
383
+ `,
384
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
385
+ }]
386
+ }], propDecorators: { pointRef: [{
387
+ type: Input
388
+ }] } });
389
+ class NgtsPointsBuffers {
390
+ constructor() {
391
+ this.DynamicDrawUsage = THREE.DynamicDrawUsage;
392
+ this.pointsInput = inject(NgtsPointsInput);
393
+ this.store = injectNgtStore();
394
+ injectBeforeRender(() => {
395
+ const points = this.pointsInput.pointsRef.nativeElement;
396
+ if (!points)
397
+ return;
398
+ const [sizes, colors] = [this.pointsInput.sizes(), this.pointsInput.colors()];
399
+ const attr = points.geometry.attributes;
400
+ checkUpdate(attr['position']);
401
+ if (colors)
402
+ checkUpdate(attr['color']);
403
+ if (sizes)
404
+ checkUpdate(attr['size']);
405
+ });
406
+ }
407
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPointsBuffers, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
408
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsPointsBuffers, isStandalone: true, selector: "ngts-points-buffers", ngImport: i0, template: `
409
+ <ngt-points [ref]="pointsInput.pointsRef" ngtCompound>
410
+ <ngt-buffer-geometry>
411
+ <ngt-buffer-attribute
412
+ attach="attributes.position"
413
+ [count]="pointsInput.positions().length / pointsInput.stride()"
414
+ [array]="pointsInput.positions()"
415
+ [itemSize]="pointsInput.stride()"
416
+ [usage]="DynamicDrawUsage"
417
+ />
418
+ <ngt-buffer-attribute
419
+ attach="attributes.color"
420
+ [count]="pointsInput.colorsLength() / pointsInput.stride()"
421
+ [array]="pointsInput.colors()"
422
+ [itemSize]="pointsInput.stride()"
423
+ [usage]="DynamicDrawUsage"
424
+ />
425
+ <ngt-buffer-attribute
426
+ attach="attributes.size"
427
+ [count]="pointsInput.sizesLength() / pointsInput.stride()"
428
+ [array]="pointsInput.sizes()"
429
+ [itemSize]="1"
430
+ [usage]="DynamicDrawUsage"
431
+ />
432
+ </ngt-buffer-geometry>
433
+ <ng-content />
434
+ </ngt-points>
435
+ `, isInline: true }); }
436
+ }
437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPointsBuffers, decorators: [{
438
+ type: Component,
439
+ args: [{
440
+ selector: 'ngts-points-buffers',
441
+ standalone: true,
442
+ template: `
443
+ <ngt-points [ref]="pointsInput.pointsRef" ngtCompound>
444
+ <ngt-buffer-geometry>
445
+ <ngt-buffer-attribute
446
+ attach="attributes.position"
447
+ [count]="pointsInput.positions().length / pointsInput.stride()"
448
+ [array]="pointsInput.positions()"
449
+ [itemSize]="pointsInput.stride()"
450
+ [usage]="DynamicDrawUsage"
451
+ />
452
+ <ngt-buffer-attribute
453
+ attach="attributes.color"
454
+ [count]="pointsInput.colorsLength() / pointsInput.stride()"
455
+ [array]="pointsInput.colors()"
456
+ [itemSize]="pointsInput.stride()"
457
+ [usage]="DynamicDrawUsage"
458
+ />
459
+ <ngt-buffer-attribute
460
+ attach="attributes.size"
461
+ [count]="pointsInput.sizesLength() / pointsInput.stride()"
462
+ [array]="pointsInput.sizes()"
463
+ [itemSize]="1"
464
+ [usage]="DynamicDrawUsage"
465
+ />
466
+ </ngt-buffer-geometry>
467
+ <ng-content />
468
+ </ngt-points>
469
+ `,
470
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
471
+ }]
472
+ }], ctorParameters: function () { return []; } });
473
+ class NgtsPoints extends NgtsPointsInput {
474
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPoints, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
475
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsPoints, isStandalone: true, selector: "ngts-points", providers: [{ provide: NgtsPointsInput, useExisting: NgtsPoints }], queries: [{ propertyName: "content", first: true, predicate: NgtsSobaContent, descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: `
476
+ <ngts-points-buffers *ngIf="positions()">
477
+ <ng-container *ngTemplateOutlet="content" />
478
+ </ngts-points-buffers>
479
+ <ngts-points-instances *ngIf="!positions()" #pointsInstances>
480
+ <!-- NOTE: passing in the injector to templateOutlet allow the consumers to abstract ngts-point -->
481
+ <ng-container *ngTemplateOutlet="content; injector: pointsInstances.injector" />
482
+ </ngts-points-instances>
483
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: NgtsPointsBuffers, selector: "ngts-points-buffers" }, { kind: "component", type: NgtsPointsInstances, selector: "ngts-points-instances" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
484
+ }
485
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPoints, decorators: [{
486
+ type: Component,
487
+ args: [{
488
+ selector: 'ngts-points',
489
+ standalone: true,
490
+ template: `
491
+ <ngts-points-buffers *ngIf="positions()">
492
+ <ng-container *ngTemplateOutlet="content" />
493
+ </ngts-points-buffers>
494
+ <ngts-points-instances *ngIf="!positions()" #pointsInstances>
495
+ <!-- NOTE: passing in the injector to templateOutlet allow the consumers to abstract ngts-point -->
496
+ <ng-container *ngTemplateOutlet="content; injector: pointsInstances.injector" />
497
+ </ngts-points-instances>
498
+ `,
499
+ imports: [NgIf, NgtsPointsBuffers, NgtsPointsInstances, NgTemplateOutlet],
500
+ providers: [{ provide: NgtsPointsInput, useExisting: NgtsPoints }],
501
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
502
+ }]
503
+ }], propDecorators: { content: [{
504
+ type: ContentChild,
505
+ args: [NgtsSobaContent, { static: true, read: TemplateRef }]
506
+ }] } });
507
+
508
+ class SegmentObject {
509
+ constructor() {
510
+ this.color = new THREE.Color('white');
511
+ this.start = new THREE.Vector3(0, 0, 0);
512
+ this.end = new THREE.Vector3(0, 0, 0);
513
+ }
514
+ }
515
+
516
+ const normPos = (pos) => pos instanceof THREE.Vector3
517
+ ? pos
518
+ : new THREE.Vector3(...(typeof pos === 'number' ? [pos, pos, pos] : pos));
519
+ extend({ SegmentObject });
520
+ const [injectNgtsSegmentsApi, provideNgtsSegmentsApi] = createInjectionToken((segments) => segments.api, { isRoot: false, deps: [forwardRef(() => NgtsSegments)] });
521
+ class NgtsSegment {
522
+ constructor() {
523
+ this.inputs = signalStore({});
524
+ this.segmentRef = injectNgtRef();
525
+ this.segmentsApi = injectNgtsSegmentsApi();
526
+ this.injector = inject(Injector);
527
+ this.zone = inject(NgZone);
528
+ this.start = this.inputs.select('start');
529
+ this.end = this.inputs.select('end');
530
+ this.normalizedStart = computed(() => normPos(this.start()));
531
+ this.normalizedEnd = computed(() => normPos(this.end()));
532
+ this.color = this.inputs.select('color');
533
+ }
534
+ set _start(start) {
535
+ this.inputs.set({ start });
536
+ }
537
+ set _end(end) {
538
+ this.inputs.set({ end });
539
+ }
540
+ set _color(color) {
541
+ this.inputs.set({ color });
542
+ }
543
+ ngOnInit() {
544
+ effect((onCleanup) => {
545
+ const cleanup = this.zone.runOutsideAngular(() => {
546
+ const api = this.segmentsApi();
547
+ return api.subscribe(this.segmentRef);
548
+ });
549
+ onCleanup(cleanup);
550
+ }, { injector: this.injector });
551
+ }
552
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsSegment, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
553
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsSegment, isStandalone: true, selector: "ngts-segment", inputs: { segmentRef: "segmentRef", _start: ["start", "_start"], _end: ["end", "_end"], _color: ["color", "_color"] }, ngImport: i0, template: `
554
+ <ngt-segment-object [ref]="segmentRef" [color]="color()" [start]="normalizedStart()" [end]="normalizedEnd()" />
555
+ `, isInline: true }); }
556
+ }
557
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsSegment, decorators: [{
558
+ type: Component,
559
+ args: [{
560
+ selector: 'ngts-segment',
561
+ standalone: true,
562
+ template: `
563
+ <ngt-segment-object [ref]="segmentRef" [color]="color()" [start]="normalizedStart()" [end]="normalizedEnd()" />
564
+ `,
565
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
566
+ }]
567
+ }], propDecorators: { segmentRef: [{
568
+ type: Input
569
+ }], _start: [{
570
+ type: Input,
571
+ args: [{ alias: 'start' }]
572
+ }], _end: [{
573
+ type: Input,
574
+ args: [{ alias: 'end' }]
575
+ }], _color: [{
576
+ type: Input,
577
+ args: [{ alias: 'color' }]
578
+ }] } });
579
+ class NgtsSegments {
580
+ set _limit(limit) {
581
+ this.inputs.set({ limit });
582
+ }
583
+ set _lineWidth(lineWidth) {
584
+ this.inputs.set({ lineWidth });
585
+ }
586
+ constructor() {
587
+ this.inputs = signalStore({ limit: 1000, lineWidth: 1 });
588
+ this.segmentsRef = injectNgtRef();
589
+ this.segments = signal([]);
590
+ this.limit = this.inputs.select('limit');
591
+ this.positions = computed(() => Array(this.limit() * 6).fill(0));
592
+ this.colors = computed(() => Array(this.limit() * 6).fill(0));
593
+ this.resolution = new THREE.Vector2(512, 512);
594
+ this.lineWidth = this.inputs.select('lineWidth');
595
+ this.line = new Line2();
596
+ this.material = new LineMaterial();
597
+ this.geometry = new LineSegmentsGeometry();
598
+ this.api = computed(() => ({
599
+ subscribe: (segmentRef) => {
600
+ untracked(() => {
601
+ this.segments.update((s) => [...s, segmentRef]);
602
+ });
603
+ return () => {
604
+ untracked(() => {
605
+ this.segments.update((s) => s.filter((segment) => segment !== segmentRef));
606
+ });
607
+ };
608
+ },
609
+ }));
610
+ this.beforeRender();
611
+ }
612
+ beforeRender() {
613
+ injectBeforeRender(() => {
614
+ const [segments, limit, positions, colors] = [
615
+ this.segments(),
616
+ this.limit(),
617
+ this.positions(),
618
+ this.colors(),
619
+ ];
620
+ for (let i = 0; i < limit; i++) {
621
+ const segmentRef = segments[i];
622
+ const segment = is.ref(segmentRef) ? segmentRef.nativeElement : segmentRef;
623
+ if (segment) {
624
+ positions[i * 6 + 0] = segment.start.x;
625
+ positions[i * 6 + 1] = segment.start.y;
626
+ positions[i * 6 + 2] = segment.start.z;
627
+ positions[i * 6 + 3] = segment.end.x;
628
+ positions[i * 6 + 4] = segment.end.y;
629
+ positions[i * 6 + 5] = segment.end.z;
630
+ colors[i * 6 + 0] = segment.color.r;
631
+ colors[i * 6 + 1] = segment.color.g;
632
+ colors[i * 6 + 2] = segment.color.b;
633
+ colors[i * 6 + 3] = segment.color.r;
634
+ colors[i * 6 + 4] = segment.color.g;
635
+ colors[i * 6 + 5] = segment.color.b;
636
+ }
637
+ }
638
+ this.geometry.setColors(colors);
639
+ this.geometry.setPositions(positions);
640
+ this.line.computeLineDistances();
641
+ });
642
+ }
643
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsSegments, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
644
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsSegments, isStandalone: true, selector: "ngts-segments", inputs: { segmentsRef: "segmentsRef", _limit: ["limit", "_limit"], _lineWidth: ["lineWidth", "_lineWidth"] }, providers: [provideNgtsSegmentsApi()], ngImport: i0, template: `
645
+ <ngt-primitive *args="[line]" [ref]="segmentsRef">
646
+ <ngt-primitive *args="[geometry]" attach="geometry" />
647
+ <ngt-primitive
648
+ *args="[material]"
649
+ attach="material"
650
+ ngtCompound
651
+ [vertexColors]="true"
652
+ [resolution]="resolution"
653
+ [linewidth]="lineWidth()"
654
+ />
655
+ <ng-content />
656
+ </ngt-primitive>
657
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
658
+ }
659
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsSegments, decorators: [{
660
+ type: Component,
661
+ args: [{
662
+ selector: 'ngts-segments',
663
+ standalone: true,
664
+ template: `
665
+ <ngt-primitive *args="[line]" [ref]="segmentsRef">
666
+ <ngt-primitive *args="[geometry]" attach="geometry" />
667
+ <ngt-primitive
668
+ *args="[material]"
669
+ attach="material"
670
+ ngtCompound
671
+ [vertexColors]="true"
672
+ [resolution]="resolution"
673
+ [linewidth]="lineWidth()"
674
+ />
675
+ <ng-content />
676
+ </ngt-primitive>
677
+ `,
678
+ imports: [NgtArgs],
679
+ providers: [provideNgtsSegmentsApi()],
680
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
681
+ }]
682
+ }], ctorParameters: function () { return []; }, propDecorators: { segmentsRef: [{
683
+ type: Input
684
+ }], _limit: [{
685
+ type: Input,
686
+ args: [{ alias: 'limit' }]
687
+ }], _lineWidth: [{
688
+ type: Input,
689
+ args: [{ alias: 'lineWidth' }]
690
+ }] } });
691
+
692
+ /**
693
+ * Generated bundle index. Do not edit.
694
+ */
695
+
696
+ export { NgtsAdaptiveDpr, NgtsAdaptiveEvents, NgtsPoint, NgtsPoints, NgtsPointsBuffers, NgtsPointsInstances, NgtsSegment, NgtsSegments, SegmentObject, injectNgtsPointsInstanceApi, injectNgtsSegmentsApi, provideNgtsPointsInstancesApi, provideNgtsSegmentsApi };
697
+ //# sourceMappingURL=angular-three-soba-performances.mjs.map