angular-three-soba 1.14.0 → 2.0.0-beta.3

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 (343) hide show
  1. package/README.md +2 -2
  2. package/abstractions/{lib/billboard → billboard}/billboard.d.ts +14 -4
  3. package/abstractions/catmull-rom-line/catmull-rom-line.d.ts +25 -0
  4. package/abstractions/cubic-bezier-line/cubic-bezier-line.d.ts +25 -0
  5. package/abstractions/{lib/edges → edges}/edges.d.ts +11 -7
  6. package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-helper.d.ts +16 -23
  7. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +22 -0
  8. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +30 -0
  9. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +32 -0
  10. package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewcube/gizmo-viewcube.d.ts +2 -3
  11. package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewport/gizmo-viewport-axis.d.ts +28 -9
  12. package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewport/gizmo-viewport.d.ts +23 -4
  13. package/abstractions/index.d.ts +11 -11
  14. package/abstractions/line/line-input.d.ts +42 -0
  15. package/abstractions/line/line.d.ts +35 -0
  16. package/abstractions/{lib/quadratic-bezier-line → quadratic-bezier-line}/quadratic-bezier-line.d.ts +12 -8
  17. package/abstractions/text/text.d.ts +77 -0
  18. package/abstractions/text-3d/text-3d.d.ts +74 -0
  19. package/cameras/{lib/camera → camera}/camera-content.d.ts +1 -1
  20. package/cameras/{lib/camera → camera}/camera.d.ts +12 -8
  21. package/cameras/cube-camera/cube-camera.d.ts +42 -0
  22. package/cameras/index.d.ts +5 -4
  23. package/cameras/{lib/orthographic-camera → orthographic-camera}/orthographic-camera.d.ts +14 -5
  24. package/controls/index.d.ts +1 -1
  25. package/controls/{lib/orbit-controls → orbit-controls}/orbit-controls.d.ts +19 -11
  26. package/esm2022/abstractions/angular-three-soba-abstractions.mjs +1 -1
  27. package/esm2022/abstractions/billboard/billboard.mjs +71 -0
  28. package/esm2022/abstractions/catmull-rom-line/catmull-rom-line.mjs +131 -0
  29. package/esm2022/abstractions/cubic-bezier-line/cubic-bezier-line.mjs +113 -0
  30. package/esm2022/abstractions/edges/edges.mjs +93 -0
  31. package/esm2022/abstractions/gizmo-helper/gizmo-helper.mjs +210 -0
  32. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/constants.mjs +31 -0
  33. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +95 -0
  34. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +155 -0
  35. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +62 -0
  36. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +80 -0
  37. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +206 -0
  38. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +273 -0
  39. package/esm2022/abstractions/index.mjs +12 -12
  40. package/esm2022/abstractions/line/line-input.mjs +113 -0
  41. package/esm2022/abstractions/line/line.mjs +165 -0
  42. package/esm2022/abstractions/quadratic-bezier-line/quadratic-bezier-line.mjs +128 -0
  43. package/esm2022/abstractions/text/text.mjs +275 -0
  44. package/esm2022/abstractions/text-3d/text-3d.mjs +167 -0
  45. package/esm2022/angular-three-soba.mjs +1 -1
  46. package/esm2022/cameras/angular-three-soba-cameras.mjs +1 -1
  47. package/esm2022/cameras/camera/camera-content.mjs +21 -0
  48. package/esm2022/cameras/camera/camera.mjs +71 -0
  49. package/esm2022/cameras/cube-camera/cube-camera.mjs +131 -0
  50. package/esm2022/cameras/index.mjs +6 -5
  51. package/esm2022/cameras/orthographic-camera/orthographic-camera.mjs +99 -0
  52. package/esm2022/cameras/perspective-camera/perspective-camera.mjs +47 -0
  53. package/esm2022/controls/angular-three-soba-controls.mjs +1 -1
  54. package/esm2022/controls/index.mjs +2 -2
  55. package/esm2022/controls/orbit-controls/orbit-controls.mjs +165 -0
  56. package/esm2022/index.mjs +1 -1
  57. package/esm2022/loaders/angular-three-soba-loaders.mjs +1 -1
  58. package/esm2022/loaders/gltf-loader/gltf-loader.mjs +33 -0
  59. package/esm2022/loaders/index.mjs +5 -6
  60. package/esm2022/loaders/loader/loader.mjs +133 -0
  61. package/esm2022/loaders/progress/progress.mjs +52 -0
  62. package/esm2022/loaders/texture-loader/texture-loader.mjs +28 -0
  63. package/esm2022/materials/angular-three-soba-materials.mjs +1 -1
  64. package/esm2022/materials/index.mjs +6 -6
  65. package/esm2022/materials/mesh-distort-material/mesh-distort-material.mjs +73 -0
  66. package/esm2022/materials/mesh-reflector-material/mesh-reflector-material.mjs +383 -0
  67. package/esm2022/materials/mesh-refraction-material/mesh-refraction-material.mjs +168 -0
  68. package/esm2022/materials/mesh-transmission-material/mesh-transmission-material.mjs +257 -0
  69. package/esm2022/materials/mesh-wobble-material/mesh-wobble-material.mjs +66 -0
  70. package/esm2022/misc/angular-three-soba-misc.mjs +1 -1
  71. package/esm2022/misc/animations/animations.mjs +55 -0
  72. package/esm2022/misc/bake-shadows/bake-shadows.mjs +24 -0
  73. package/esm2022/misc/depth-buffer/depth-buffer.mjs +46 -0
  74. package/esm2022/misc/fbo/fbo.mjs +47 -0
  75. package/esm2022/misc/index.mjs +5 -5
  76. package/esm2022/performance/adaptive/adaptive-dpr.mjs +46 -0
  77. package/esm2022/performance/adaptive/adaptive-events.mjs +31 -0
  78. package/esm2022/performance/angular-three-soba-performance.mjs +1 -1
  79. package/esm2022/performance/detailed/detailed.mjs +61 -0
  80. package/esm2022/performance/index.mjs +7 -5
  81. package/esm2022/performance/instances/instance.mjs +48 -0
  82. package/esm2022/performance/instances/instances.mjs +189 -0
  83. package/esm2022/performance/instances/position-mesh.mjs +52 -0
  84. package/esm2022/performance/stats/stats.mjs +79 -0
  85. package/esm2022/shaders/angular-three-soba-shaders.mjs +1 -1
  86. package/esm2022/shaders/blur-pass/blur-pass.mjs +61 -0
  87. package/esm2022/shaders/caustics-material/caustics-material.mjs +128 -0
  88. package/esm2022/shaders/caustics-material/caustics-projection-material.mjs +33 -0
  89. package/esm2022/shaders/convolution-material/convolution-material.mjs +94 -0
  90. package/esm2022/shaders/discard-material/discard-material.mjs +3 -0
  91. package/esm2022/shaders/index.mjs +15 -15
  92. package/esm2022/shaders/mesh-distort-material/mesh-distort-material.mjs +55 -0
  93. package/esm2022/shaders/mesh-reflector-material/mesh-reflector-material.mjs +223 -0
  94. package/esm2022/shaders/mesh-refraction-material/mesh-refraction-material.mjs +170 -0
  95. package/esm2022/shaders/mesh-transmission-material/mesh-transmission-material.mjs +268 -0
  96. package/esm2022/shaders/mesh-wobble-material/mesh-wobble-material.mjs +37 -0
  97. package/esm2022/shaders/shader-material/shader-material.mjs +34 -0
  98. package/esm2022/shaders/soft-shadow-material/soft-shadow-material.mjs +33 -0
  99. package/esm2022/shaders/sparkles-material/sparkles-material.mjs +47 -0
  100. package/esm2022/shaders/spot-light-material/spot-light-material.mjs +86 -0
  101. package/esm2022/shaders/star-field-material/star-field-material.mjs +32 -0
  102. package/esm2022/staging/accumulative-shadows/accumulative-shadows.mjs +283 -0
  103. package/esm2022/staging/accumulative-shadows/progressive-light-map.mjs +108 -0
  104. package/esm2022/staging/accumulative-shadows/randomized-lights.mjs +208 -0
  105. package/esm2022/staging/angular-three-soba-staging.mjs +1 -1
  106. package/esm2022/staging/bounds/bounds.mjs +307 -0
  107. package/esm2022/staging/camera-shake/camera-shake.mjs +117 -0
  108. package/esm2022/staging/caustics/caustisc.mjs +384 -0
  109. package/esm2022/staging/center/center.mjs +148 -0
  110. package/esm2022/staging/cloud/cloud.mjs +164 -0
  111. package/esm2022/staging/contact-shadows/contact-shadows.mjs +249 -0
  112. package/esm2022/staging/environment/assets.mjs +13 -0
  113. package/esm2022/staging/environment/environment-cube.mjs +49 -0
  114. package/esm2022/staging/environment/environment-ground.mjs +43 -0
  115. package/esm2022/staging/environment/environment-input.mjs +106 -0
  116. package/esm2022/staging/environment/environment-map.mjs +53 -0
  117. package/esm2022/staging/environment/environment-portal.mjs +135 -0
  118. package/esm2022/staging/environment/environment.mjs +78 -0
  119. package/esm2022/staging/environment/utils.mjs +84 -0
  120. package/esm2022/staging/float/float.mjs +82 -0
  121. package/esm2022/staging/index.mjs +18 -18
  122. package/esm2022/staging/sky/sky.mjs +114 -0
  123. package/esm2022/staging/sparkles/sparkles.mjs +161 -0
  124. package/esm2022/staging/spot-light/spot-light-input.mjs +75 -0
  125. package/esm2022/staging/spot-light/spot-light-shadow-mesh-input.mjs +57 -0
  126. package/esm2022/staging/spot-light/spot-light-shadow-mesh.mjs +256 -0
  127. package/esm2022/staging/spot-light/spot-light.mjs +94 -0
  128. package/esm2022/staging/spot-light/volumetric-mesh.mjs +101 -0
  129. package/esm2022/staging/stage/stage.mjs +374 -0
  130. package/esm2022/staging/stars/stars.mjs +148 -0
  131. package/fesm2022/angular-three-soba-abstractions.mjs +1116 -890
  132. package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
  133. package/fesm2022/angular-three-soba-cameras.mjs +126 -122
  134. package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
  135. package/fesm2022/angular-three-soba-controls.mjs +72 -54
  136. package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
  137. package/fesm2022/angular-three-soba-loaders.mjs +147 -131
  138. package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
  139. package/fesm2022/angular-three-soba-materials.mjs +340 -258
  140. package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
  141. package/fesm2022/angular-three-soba-misc.mjs +140 -123
  142. package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
  143. package/fesm2022/angular-three-soba-performance.mjs +383 -106
  144. package/fesm2022/angular-three-soba-performance.mjs.map +1 -1
  145. package/fesm2022/angular-three-soba-shaders.mjs +57 -9
  146. package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
  147. package/fesm2022/angular-three-soba-staging.mjs +1609 -1561
  148. package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
  149. package/fesm2022/angular-three-soba.mjs.map +1 -1
  150. package/loaders/gltf-loader/gltf-loader.d.ts +9 -0
  151. package/loaders/index.d.ts +4 -5
  152. package/loaders/{lib/loader → loader}/loader.d.ts +20 -15
  153. package/loaders/progress/progress.d.ts +9 -0
  154. package/loaders/texture-loader/texture-loader.d.ts +7 -0
  155. package/materials/index.d.ts +5 -5
  156. package/materials/{lib/mesh-distort-material → mesh-distort-material}/mesh-distort-material.d.ts +11 -5
  157. package/materials/mesh-reflector-material/mesh-reflector-material.d.ts +81 -0
  158. package/materials/mesh-refraction-material/mesh-refraction-material.d.ts +50 -0
  159. package/materials/{lib/mesh-transmission-material → mesh-transmission-material}/mesh-transmission-material.d.ts +51 -6
  160. package/materials/{lib/mesh-wobble-material → mesh-wobble-material}/mesh-wobble-material.d.ts +9 -3
  161. package/misc/animations/animations.d.ts +13 -0
  162. package/misc/{lib/bake-shadows → bake-shadows}/bake-shadows.d.ts +2 -5
  163. package/misc/depth-buffer/depth-buffer.d.ts +9 -0
  164. package/misc/{lib/fbo → fbo}/fbo.d.ts +4 -2
  165. package/misc/index.d.ts +4 -4
  166. package/package.json +25 -23
  167. package/performance/{lib/adaptive → adaptive}/adaptive-dpr.d.ts +4 -7
  168. package/performance/{lib/adaptive → adaptive}/adaptive-events.d.ts +2 -6
  169. package/performance/detailed/detailed.d.ts +20 -0
  170. package/performance/index.d.ts +6 -4
  171. package/performance/instances/instance.d.ts +9 -0
  172. package/performance/instances/instances.d.ts +35 -0
  173. package/performance/instances/position-mesh.d.ts +10 -0
  174. package/performance/{lib/stats → stats}/stats.d.ts +10 -7
  175. package/plugin/package.json +1 -1
  176. package/plugin/src/generators/init/compat.js.map +1 -1
  177. package/plugin/src/generators/init/init.d.ts +1 -1
  178. package/plugin/src/generators/init/init.js +1 -1
  179. package/plugin/src/generators/init/init.js.map +1 -1
  180. package/plugin/src/index.js.map +1 -1
  181. package/shaders/{lib/blur-pass → blur-pass}/blur-pass.d.ts +2 -2
  182. package/shaders/index.d.ts +14 -14
  183. package/shaders/{lib/mesh-distort-material → mesh-distort-material}/mesh-distort-material.d.ts +1 -1
  184. package/shaders/{lib/mesh-wobble-material → mesh-wobble-material}/mesh-wobble-material.d.ts +1 -0
  185. package/shaders/{lib/soft-shadow-material → soft-shadow-material}/soft-shadow-material.d.ts +2 -2
  186. package/shaders/sparkles-material/sparkles-material.d.ts +3 -0
  187. package/staging/{lib/accumulative-shadows → accumulative-shadows}/accumulative-shadows.d.ts +55 -17
  188. package/staging/{lib/accumulative-shadows → accumulative-shadows}/progressive-light-map.d.ts +2 -2
  189. package/staging/{lib/accumulative-shadows → accumulative-shadows}/randomized-lights.d.ts +45 -10
  190. package/staging/{lib/bounds → bounds}/bounds.d.ts +32 -22
  191. package/staging/{lib/camera-shake → camera-shake}/camera-shake.d.ts +15 -11
  192. package/staging/{lib/caustics/caustics.d.ts → caustics/caustisc.d.ts} +36 -13
  193. package/staging/{lib/center → center}/center.d.ts +30 -8
  194. package/staging/cloud/cloud.d.ts +48 -0
  195. package/staging/{lib/contact-shadows → contact-shadows}/contact-shadows.d.ts +38 -10
  196. package/staging/environment/environment-cube.d.ts +11 -0
  197. package/staging/environment/environment-ground.d.ts +13 -0
  198. package/staging/environment/environment-input.d.ts +68 -0
  199. package/staging/environment/environment-map.d.ts +11 -0
  200. package/staging/{lib/environment → environment}/environment-portal.d.ts +5 -7
  201. package/staging/{lib/environment → environment}/environment.d.ts +2 -2
  202. package/staging/environment/utils.d.ts +7 -0
  203. package/staging/float/float.d.ts +27 -0
  204. package/staging/index.d.ts +17 -17
  205. package/staging/{lib/sky → sky}/sky.d.ts +26 -5
  206. package/staging/{lib/sparkles → sparkles}/sparkles.d.ts +30 -10
  207. package/staging/{lib/spot-light → spot-light}/spot-light-input.d.ts +24 -2
  208. package/staging/{lib/spot-light/shadow-mesh-input.d.ts → spot-light/spot-light-shadow-mesh-input.d.ts} +18 -3
  209. package/staging/spot-light/spot-light-shadow-mesh.d.ts +38 -0
  210. package/staging/{lib/spot-light → spot-light}/spot-light.d.ts +11 -5
  211. package/staging/{lib/spot-light → spot-light}/volumetric-mesh.d.ts +8 -5
  212. package/staging/{lib/stage → stage}/stage.d.ts +33 -14
  213. package/staging/{lib/stars → stars}/stars.d.ts +21 -7
  214. package/abstractions/lib/catmull-rom-line/catmull-rom-line.d.ts +0 -15
  215. package/abstractions/lib/cubic-bezier-line/cubic-bezier-line.d.ts +0 -15
  216. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +0 -16
  217. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +0 -24
  218. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +0 -14
  219. package/abstractions/lib/line/line-input.d.ts +0 -19
  220. package/abstractions/lib/line/line.d.ts +0 -21
  221. package/abstractions/lib/text/text.d.ts +0 -21
  222. package/abstractions/lib/text-3d/text-3d.d.ts +0 -39
  223. package/assets/default-spot-light-shadow.glsl +0 -10
  224. package/cameras/lib/cube-camera/cube-camera.d.ts +0 -27
  225. package/esm2022/abstractions/lib/billboard/billboard.mjs +0 -74
  226. package/esm2022/abstractions/lib/catmull-rom-line/catmull-rom-line.mjs +0 -120
  227. package/esm2022/abstractions/lib/cubic-bezier-line/cubic-bezier-line.mjs +0 -99
  228. package/esm2022/abstractions/lib/edges/edges.mjs +0 -96
  229. package/esm2022/abstractions/lib/gizmo-helper/gizmo-helper.mjs +0 -213
  230. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/constants.mjs +0 -31
  231. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +0 -92
  232. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +0 -184
  233. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +0 -46
  234. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +0 -134
  235. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +0 -195
  236. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +0 -267
  237. package/esm2022/abstractions/lib/line/line-input.mjs +0 -76
  238. package/esm2022/abstractions/lib/line/line.mjs +0 -133
  239. package/esm2022/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.mjs +0 -128
  240. package/esm2022/abstractions/lib/text/text.mjs +0 -115
  241. package/esm2022/abstractions/lib/text-3d/text-3d.mjs +0 -145
  242. package/esm2022/cameras/lib/camera/camera-content.mjs +0 -21
  243. package/esm2022/cameras/lib/camera/camera.mjs +0 -75
  244. package/esm2022/cameras/lib/cube-camera/cube-camera.mjs +0 -131
  245. package/esm2022/cameras/lib/orthographic-camera/orthographic-camera.mjs +0 -93
  246. package/esm2022/cameras/lib/perspective-camera/perspective-camera.mjs +0 -47
  247. package/esm2022/controls/lib/orbit-controls/orbit-controls.mjs +0 -147
  248. package/esm2022/loaders/lib/cube-texture-loader/cube-texture-loader.mjs +0 -10
  249. package/esm2022/loaders/lib/gltf-loader/gltf-loader.mjs +0 -32
  250. package/esm2022/loaders/lib/loader/loader.mjs +0 -134
  251. package/esm2022/loaders/lib/progress/progress.mjs +0 -39
  252. package/esm2022/loaders/lib/texture-loader/texture-loader.mjs +0 -19
  253. package/esm2022/materials/lib/mesh-distort-material/mesh-distort-material.mjs +0 -75
  254. package/esm2022/materials/lib/mesh-reflector-material/mesh-reflector-material.mjs +0 -328
  255. package/esm2022/materials/lib/mesh-refraction-material/mesh-refraction-material.mjs +0 -158
  256. package/esm2022/materials/lib/mesh-transmission-material/mesh-transmission-material.mjs +0 -238
  257. package/esm2022/materials/lib/mesh-wobble-material/mesh-wobble-material.mjs +0 -68
  258. package/esm2022/misc/lib/animations/animations.mjs +0 -52
  259. package/esm2022/misc/lib/bake-shadows/bake-shadows.mjs +0 -26
  260. package/esm2022/misc/lib/depth-buffer/depth-buffer.mjs +0 -39
  261. package/esm2022/misc/lib/fbo/fbo.mjs +0 -39
  262. package/esm2022/performance/lib/adaptive/adaptive-dpr.mjs +0 -47
  263. package/esm2022/performance/lib/adaptive/adaptive-events.mjs +0 -37
  264. package/esm2022/performance/lib/detailed/detailed.mjs +0 -54
  265. package/esm2022/performance/lib/stats/stats.mjs +0 -80
  266. package/esm2022/shaders/lib/blur-pass/blur-pass.mjs +0 -61
  267. package/esm2022/shaders/lib/caustics-material/caustics-material.mjs +0 -128
  268. package/esm2022/shaders/lib/caustics-projection-material/caustics-projection-material.mjs +0 -33
  269. package/esm2022/shaders/lib/convolution-material/convolution-material.mjs +0 -94
  270. package/esm2022/shaders/lib/discard-material/discard-material.mjs +0 -3
  271. package/esm2022/shaders/lib/mesh-distort-material/mesh-distort-material.mjs +0 -55
  272. package/esm2022/shaders/lib/mesh-reflector-material/mesh-reflector-material.mjs +0 -223
  273. package/esm2022/shaders/lib/mesh-refraction-material/mesh-refraction-material.mjs +0 -169
  274. package/esm2022/shaders/lib/mesh-transmission-material/mesh-transmission-material.mjs +0 -268
  275. package/esm2022/shaders/lib/mesh-wobble-material/mesh-wobble-material.mjs +0 -37
  276. package/esm2022/shaders/lib/shader-material/shader-material.mjs +0 -34
  277. package/esm2022/shaders/lib/soft-shadow-material/soft-shadow-material.mjs +0 -33
  278. package/esm2022/shaders/lib/spot-light-material/spot-light-material.mjs +0 -86
  279. package/esm2022/shaders/lib/star-field-material/star-field-material.mjs +0 -32
  280. package/esm2022/staging/lib/accumulative-shadows/accumulative-shadows.mjs +0 -249
  281. package/esm2022/staging/lib/accumulative-shadows/progressive-light-map.mjs +0 -108
  282. package/esm2022/staging/lib/accumulative-shadows/randomized-lights.mjs +0 -201
  283. package/esm2022/staging/lib/bounds/bounds.mjs +0 -284
  284. package/esm2022/staging/lib/camera-shake/camera-shake.mjs +0 -122
  285. package/esm2022/staging/lib/caustics/caustics.mjs +0 -364
  286. package/esm2022/staging/lib/center/center.mjs +0 -143
  287. package/esm2022/staging/lib/cloud/cloud.mjs +0 -160
  288. package/esm2022/staging/lib/contact-shadows/contact-shadows.mjs +0 -228
  289. package/esm2022/staging/lib/environment/assets.mjs +0 -13
  290. package/esm2022/staging/lib/environment/environment-cube.mjs +0 -41
  291. package/esm2022/staging/lib/environment/environment-ground.mjs +0 -67
  292. package/esm2022/staging/lib/environment/environment-inputs.mjs +0 -87
  293. package/esm2022/staging/lib/environment/environment-map.mjs +0 -39
  294. package/esm2022/staging/lib/environment/environment-portal.mjs +0 -111
  295. package/esm2022/staging/lib/environment/environment.mjs +0 -165
  296. package/esm2022/staging/lib/environment/utils.mjs +0 -70
  297. package/esm2022/staging/lib/float/float.mjs +0 -77
  298. package/esm2022/staging/lib/sky/sky.mjs +0 -109
  299. package/esm2022/staging/lib/sparkles/sparkles.mjs +0 -210
  300. package/esm2022/staging/lib/spot-light/common.mjs +0 -42
  301. package/esm2022/staging/lib/spot-light/shadow-mesh-input.mjs +0 -51
  302. package/esm2022/staging/lib/spot-light/spot-light-input.mjs +0 -62
  303. package/esm2022/staging/lib/spot-light/spot-light-shadow-no-shader.mjs +0 -74
  304. package/esm2022/staging/lib/spot-light/spot-light-shadow-shader.mjs +0 -126
  305. package/esm2022/staging/lib/spot-light/spot-light-shadow.mjs +0 -63
  306. package/esm2022/staging/lib/spot-light/spot-light.mjs +0 -117
  307. package/esm2022/staging/lib/spot-light/volumetric-mesh.mjs +0 -86
  308. package/esm2022/staging/lib/stage/stage.mjs +0 -368
  309. package/esm2022/staging/lib/stars/stars.mjs +0 -140
  310. package/loaders/lib/cube-texture-loader/cube-texture-loader.d.ts +0 -3
  311. package/loaders/lib/gltf-loader/gltf-loader.d.ts +0 -8
  312. package/loaders/lib/progress/progress.d.ts +0 -16
  313. package/loaders/lib/texture-loader/texture-loader.d.ts +0 -5
  314. package/materials/lib/mesh-reflector-material/mesh-reflector-material.d.ts +0 -41
  315. package/materials/lib/mesh-refraction-material/mesh-refraction-material.d.ts +0 -28
  316. package/misc/lib/animations/animations.d.ts +0 -13
  317. package/misc/lib/depth-buffer/depth-buffer.d.ts +0 -7
  318. package/performance/lib/detailed/detailed.d.ts +0 -13
  319. package/staging/lib/cloud/cloud.d.ts +0 -23
  320. package/staging/lib/environment/environment-cube.d.ts +0 -11
  321. package/staging/lib/environment/environment-ground.d.ts +0 -9
  322. package/staging/lib/environment/environment-inputs.d.ts +0 -28
  323. package/staging/lib/environment/environment-map.d.ts +0 -10
  324. package/staging/lib/environment/utils.d.ts +0 -8
  325. package/staging/lib/float/float.d.ts +0 -16
  326. package/staging/lib/spot-light/common.d.ts +0 -3
  327. package/staging/lib/spot-light/spot-light-shadow-no-shader.d.ts +0 -14
  328. package/staging/lib/spot-light/spot-light-shadow-shader.d.ts +0 -25
  329. package/staging/lib/spot-light/spot-light-shadow.d.ts +0 -6
  330. /package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewcube/constants.d.ts +0 -0
  331. /package/cameras/{lib/perspective-camera → perspective-camera}/perspective-camera.d.ts +0 -0
  332. /package/plugin/{README.md → libs/plugin/README.md} +0 -0
  333. /package/shaders/{lib/caustics-material → caustics-material}/caustics-material.d.ts +0 -0
  334. /package/shaders/{lib/caustics-projection-material → caustics-material}/caustics-projection-material.d.ts +0 -0
  335. /package/shaders/{lib/convolution-material → convolution-material}/convolution-material.d.ts +0 -0
  336. /package/shaders/{lib/discard-material → discard-material}/discard-material.d.ts +0 -0
  337. /package/shaders/{lib/mesh-reflector-material → mesh-reflector-material}/mesh-reflector-material.d.ts +0 -0
  338. /package/shaders/{lib/mesh-refraction-material → mesh-refraction-material}/mesh-refraction-material.d.ts +0 -0
  339. /package/shaders/{lib/mesh-transmission-material → mesh-transmission-material}/mesh-transmission-material.d.ts +0 -0
  340. /package/shaders/{lib/shader-material → shader-material}/shader-material.d.ts +0 -0
  341. /package/shaders/{lib/spot-light-material → spot-light-material}/spot-light-material.d.ts +0 -0
  342. /package/shaders/{lib/star-field-material → star-field-material}/star-field-material.d.ts +0 -0
  343. /package/staging/{lib/environment → environment}/assets.d.ts +0 -0
@@ -1,112 +1,113 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Directive, Input, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
- import { RxActionFactory } from '@rx-angular/state/actions';
4
- import { NgtRxStore, NgtStore, extend, injectNgtRef, is, startWithUndefined, addEffect, addAfterEffect } from 'angular-three';
5
- import { combineLatest } from 'rxjs';
6
- import { LOD } from 'three';
2
+ import { signal, inject, effect, untracked, Directive, Input, computed, Component, CUSTOM_ELEMENTS_SCHEMA, InjectionToken, ElementRef } from '@angular/core';
3
+ import { NgtStore, extend, NgtSignalStore, injectNgtRef, requestAnimationInInjectionContext, checkUpdate, injectBeforeRender, NgtArgs, is, addEffect, addAfterEffect } from 'angular-three';
4
+ import * as THREE from 'three';
5
+ import { LOD, InstancedMesh, InstancedBufferAttribute } from 'three';
7
6
  import { DOCUMENT } from '@angular/common';
8
7
  import * as Stats from 'stats.js';
9
8
 
10
- class NgtsAdaptiveDpr extends NgtRxStore {
9
+ class NgtsAdaptiveDpr {
10
+ #pixelated = signal(false);
11
+ set pixelated(pixelated) {
12
+ this.#pixelated.set(pixelated);
13
+ }
11
14
  constructor() {
12
- super(...arguments);
13
- this.store = inject(NgtStore);
14
- this.actions = inject((RxActionFactory)).create();
15
- this.pixelated = false;
16
- }
17
- ngOnInit() {
18
- this.effect(this.actions.restorePixel$, () => {
19
- const domElement = this.store.get('gl', 'domElement');
20
- return () => {
21
- const active = this.store.get('internal', 'active');
22
- const setDpr = this.store.get('setDpr');
23
- const initialDpr = this.store.get('viewport', 'initialDpr');
15
+ const store = inject(NgtStore);
16
+ effect((onCleanup) => {
17
+ const domElement = store.get('gl', 'domElement');
18
+ onCleanup(() => {
19
+ const active = store.get('internal', 'active');
20
+ const setDpr = store.get('setDpr');
21
+ const initialDpr = store.get('viewport', 'initialDpr');
24
22
  if (active)
25
23
  setDpr(initialDpr);
26
- if (this.pixelated && domElement)
24
+ if (untracked(this.#pixelated) && domElement)
27
25
  domElement.style.imageRendering = 'auto';
28
- };
29
- });
30
- this.actions.restorePixel();
31
- this.hold(this.store.select('performance', 'current'), (performanceCurrent) => {
32
- const { gl, viewport, setDpr } = this.store.get();
33
- setDpr(performanceCurrent * viewport.initialDpr);
34
- if (this.pixelated && gl.domElement)
35
- gl.domElement.style.imageRendering = performanceCurrent === 1 ? 'auto' : 'pixelated';
36
- });
26
+ });
27
+ }, { allowSignalWrites: true });
28
+ const performanceCurrent = store.select('performance', 'current');
29
+ // TODO: mousemove event doesn't seem to trigger change detection. investigate later
30
+ effect(() => {
31
+ const current = performanceCurrent();
32
+ const { gl, viewport, setDpr } = store.get();
33
+ setDpr(current * viewport.initialDpr);
34
+ if (untracked(this.#pixelated) && gl.domElement)
35
+ gl.domElement.style.imageRendering = current === 1 ? 'auto' : 'pixelated';
36
+ }, { allowSignalWrites: true });
37
37
  }
38
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsAdaptiveDpr, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
39
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: NgtsAdaptiveDpr, isStandalone: true, selector: "ngts-adaptive-dpr", inputs: { pixelated: "pixelated" }, providers: [RxActionFactory], usesInheritance: true, ngImport: i0 }); }
38
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsAdaptiveDpr, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
39
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: NgtsAdaptiveDpr, isStandalone: true, selector: "ngts-adaptive-dpr", inputs: { pixelated: "pixelated" }, ngImport: i0 }); }
40
40
  }
41
41
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsAdaptiveDpr, decorators: [{
42
42
  type: Directive,
43
43
  args: [{
44
44
  selector: 'ngts-adaptive-dpr',
45
45
  standalone: true,
46
- providers: [RxActionFactory],
47
46
  }]
48
- }], propDecorators: { pixelated: [{
47
+ }], ctorParameters: function () { return []; }, propDecorators: { pixelated: [{
49
48
  type: Input
50
49
  }] } });
51
50
 
52
- class NgtsAdaptiveEvents extends NgtRxStore {
51
+ class NgtsAdaptiveEvents {
53
52
  constructor() {
54
- super(...arguments);
55
- this.store = inject(NgtStore);
56
- this.actions = inject((RxActionFactory)).create();
57
- }
58
- ngOnInit() {
59
- this.effect(this.actions.setEvents$, () => {
60
- const enabled = this.store.get('events', 'enabled');
61
- return () => {
62
- const setEvents = this.store.get('setEvents');
53
+ const store = inject(NgtStore);
54
+ effect((onCleanup) => {
55
+ const enabled = store.get('events', 'enabled');
56
+ onCleanup(() => {
57
+ const setEvents = store.get('setEvents');
63
58
  setEvents({ enabled });
64
- };
65
- });
66
- this.actions.setEvents();
67
- this.hold(this.store.select('performance', 'current'), (current) => {
68
- const setEvents = this.store.get('setEvents');
69
- setEvents({ enabled: current === 1 });
70
- });
59
+ });
60
+ }, { allowSignalWrites: true });
61
+ const performanceCurrent = store.select('performance', 'current');
62
+ effect(() => {
63
+ const setEvents = store.get('setEvents');
64
+ setEvents({ enabled: performanceCurrent() === 1 });
65
+ }, { allowSignalWrites: true });
71
66
  }
72
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsAdaptiveEvents, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
73
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: NgtsAdaptiveEvents, isStandalone: true, selector: "ngts-adaptive-events", providers: [RxActionFactory], usesInheritance: true, ngImport: i0 }); }
67
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsAdaptiveEvents, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
68
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: NgtsAdaptiveEvents, isStandalone: true, selector: "ngts-adaptive-events", ngImport: i0 }); }
74
69
  }
75
70
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsAdaptiveEvents, decorators: [{
76
71
  type: Directive,
77
72
  args: [{
78
73
  selector: 'ngts-adaptive-events',
79
74
  standalone: true,
80
- providers: [RxActionFactory],
81
75
  }]
82
- }] });
76
+ }], ctorParameters: function () { return []; } });
83
77
 
84
78
  extend({ LOD });
85
- class NgtsDetailed extends NgtRxStore {
86
- constructor() {
87
- super(...arguments);
88
- this.lodRef = injectNgtRef();
89
- }
79
+ class NgtsDetailed extends NgtSignalStore {
90
80
  set distances(distances) {
91
81
  this.set({ distances });
92
82
  }
93
- ngOnInit() {
94
- this.updateLodChildren();
83
+ constructor() {
84
+ super();
85
+ this.lodRef = injectNgtRef();
86
+ this.#updateChildren();
95
87
  }
96
88
  onLODBeforeRender({ object, state }) {
97
89
  object.update(state.camera);
98
90
  }
99
- updateLodChildren() {
100
- this.hold(combineLatest([this.lodRef.children$(), this.select('distances')]), ([children, distances]) => {
101
- this.lodRef.nativeElement.levels.length = 0;
102
- children.forEach((child, index) => {
103
- this.lodRef.nativeElement.addLevel(child, distances[index]);
104
- });
91
+ #updateChildren() {
92
+ const distances = this.select('distances');
93
+ const trigger = computed(() => {
94
+ const children = this.lodRef.children();
95
+ return { children: children(), distances: distances() };
96
+ });
97
+ effect(() => {
98
+ const { children, distances } = trigger();
99
+ const lod = this.lodRef.untracked;
100
+ if (lod) {
101
+ lod.levels.length = 0;
102
+ children.forEach((child, index) => {
103
+ lod.addLevel(child, distances[index]);
104
+ });
105
+ }
105
106
  });
106
107
  }
107
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsDetailed, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
108
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsDetailed, isStandalone: true, selector: "ngts-detailed[distances]", inputs: { lodRef: "lodRef", distances: "distances" }, usesInheritance: true, ngImport: i0, template: `
109
- <ngt-lOD [ref]="lodRef" ngtCompound (beforeRender)="onLODBeforeRender($any($event))">
108
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsDetailed, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
109
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsDetailed, isStandalone: true, selector: "ngts-detailed", inputs: { lodRef: "lodRef", distances: "distances" }, usesInheritance: true, ngImport: i0, template: `
110
+ <ngt-lOD ngtCompound [ref]="lodRef" (beforeRender)="onLODBeforeRender($event)">
110
111
  <ng-content />
111
112
  </ngt-lOD>
112
113
  `, isInline: true }); }
@@ -114,31 +115,300 @@ class NgtsDetailed extends NgtRxStore {
114
115
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsDetailed, decorators: [{
115
116
  type: Component,
116
117
  args: [{
117
- selector: 'ngts-detailed[distances]',
118
+ selector: 'ngts-detailed',
118
119
  standalone: true,
119
120
  template: `
120
- <ngt-lOD [ref]="lodRef" ngtCompound (beforeRender)="onLODBeforeRender($any($event))">
121
+ <ngt-lOD ngtCompound [ref]="lodRef" (beforeRender)="onLODBeforeRender($event)">
121
122
  <ng-content />
122
123
  </ngt-lOD>
123
124
  `,
124
125
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
125
126
  }]
126
- }], propDecorators: { lodRef: [{
127
+ }], ctorParameters: function () { return []; }, propDecorators: { lodRef: [{
127
128
  type: Input
128
129
  }], distances: [{
130
+ type: Input,
131
+ args: [{ required: true }]
132
+ }] } });
133
+
134
+ extend({ InstancedMesh, InstancedBufferAttribute });
135
+ const NGTS_INSTANCES_API = new InjectionToken('NgtsInstances API');
136
+ class NgtsInstances extends NgtSignalStore {
137
+ set range(range) {
138
+ this.set({ range });
139
+ }
140
+ set limit(limit) {
141
+ this.set({ limit });
142
+ }
143
+ set frames(frames) {
144
+ this.set({ frames });
145
+ }
146
+ #parentMatrix;
147
+ #instanceMatrix;
148
+ #tempMatrix;
149
+ #translation;
150
+ #rotation;
151
+ #scale;
152
+ #limit;
153
+ constructor() {
154
+ super({ limit: 1000, frames: Infinity });
155
+ this.nullRaycast = () => null;
156
+ this.DynamicDrawUsage = THREE.DynamicDrawUsage;
157
+ this.instancesRef = injectNgtRef();
158
+ this.#parentMatrix = new THREE.Matrix4();
159
+ this.#instanceMatrix = new THREE.Matrix4();
160
+ this.#tempMatrix = new THREE.Matrix4();
161
+ this.#translation = new THREE.Vector3();
162
+ this.#rotation = new THREE.Quaternion();
163
+ this.#scale = new THREE.Vector3();
164
+ this.#limit = this.select('limit');
165
+ this.matrices = computed(() => {
166
+ const limit = this.#limit();
167
+ const mArray = new Float32Array(limit * 16);
168
+ for (let i = 0; i < limit; i++)
169
+ this.#tempMatrix.identity().toArray(mArray, i * 16);
170
+ return mArray;
171
+ });
172
+ this.colors = computed(() => {
173
+ const limit = this.#limit();
174
+ return new Float32Array([...new Array(limit * 3)].map(() => 1));
175
+ });
176
+ this.instances = signal([]);
177
+ this.api = computed(() => ({
178
+ getParent: () => this.instancesRef,
179
+ subscribe: (ref) => {
180
+ this.instances.update((prev) => [...prev, ref]);
181
+ return () => this.instances.update((prev) => prev.filter((instance) => instance.nativeElement !== ref.nativeElement));
182
+ },
183
+ }));
184
+ requestAnimationInInjectionContext(() => {
185
+ this.#checkUpdate();
186
+ this.#setBeforeRender();
187
+ });
188
+ }
189
+ #checkUpdate() {
190
+ effect(() => {
191
+ const instances = this.instancesRef.nativeElement;
192
+ if (!instances)
193
+ return;
194
+ checkUpdate(instances.instanceMatrix);
195
+ });
196
+ }
197
+ #setBeforeRender() {
198
+ let count = 0;
199
+ let updateRange = 0;
200
+ injectBeforeRender(() => {
201
+ const instances = this.instancesRef.nativeElement;
202
+ if (!instances)
203
+ return;
204
+ const { frames, range, limit } = this.get();
205
+ const meshes = this.instances();
206
+ const colors = this.colors();
207
+ const matrices = this.matrices();
208
+ if (frames === Infinity || count < frames) {
209
+ instances.updateMatrix();
210
+ instances.updateMatrixWorld();
211
+ this.#parentMatrix.copy(instances.matrixWorld).invert();
212
+ updateRange = Math.min(limit, range !== undefined ? range : limit, meshes.length);
213
+ instances.count = updateRange;
214
+ instances.instanceMatrix.updateRange.count = updateRange * 16;
215
+ if (instances.instanceColor) {
216
+ instances.instanceColor.updateRange.count = updateRange * 3;
217
+ }
218
+ for (let i = 0; i < meshes.length; i++) {
219
+ const instance = meshes[i].nativeElement;
220
+ // Multiply the inverse of the InstancedMesh world matrix or else
221
+ // Instances will be double-transformed if <Instances> isn't at identity
222
+ instance.matrixWorld.decompose(this.#translation, this.#rotation, this.#scale);
223
+ this.#instanceMatrix
224
+ .compose(this.#translation, this.#rotation, this.#scale)
225
+ .premultiply(this.#parentMatrix);
226
+ this.#instanceMatrix.toArray(matrices, i * 16);
227
+ instances.instanceMatrix.needsUpdate = true;
228
+ instance.color.toArray(colors, i * 3);
229
+ if (instances.instanceColor) {
230
+ checkUpdate(instances.instanceColor);
231
+ }
232
+ }
233
+ count++;
234
+ }
235
+ });
236
+ }
237
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsInstances, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
238
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsInstances, isStandalone: true, selector: "ngts-instances", inputs: { instancesRef: "instancesRef", range: "range", limit: "limit", frames: "frames" }, providers: [
239
+ { provide: NGTS_INSTANCES_API, useFactory: (instances) => instances.api, deps: [NgtsInstances] },
240
+ ], usesInheritance: true, ngImport: i0, template: `
241
+ <ngt-instanced-mesh
242
+ *args="[undefined, undefined, 0]"
243
+ ngtCompound
244
+ [ref]="instancesRef"
245
+ [matrixAutoUpdate]="false"
246
+ [raycast]="nullRaycast"
247
+ [userData]="{ instances }"
248
+ >
249
+ <ngt-instanced-buffer-attribute
250
+ attach="instanceMatrix"
251
+ [count]="matrices().length / 16"
252
+ [array]="matrices()"
253
+ [itemSize]="16"
254
+ [usage]="DynamicDrawUsage"
255
+ />
256
+ <ngt-instanced-buffer-attribute
257
+ attach="instanceColor"
258
+ [count]="colors().length / 3"
259
+ [array]="colors()"
260
+ [itemSize]="3"
261
+ [usage]="DynamicDrawUsage"
262
+ />
263
+
264
+ <ng-content />
265
+ </ngt-instanced-mesh>
266
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] }); }
267
+ }
268
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsInstances, decorators: [{
269
+ type: Component,
270
+ args: [{
271
+ selector: 'ngts-instances',
272
+ standalone: true,
273
+ template: `
274
+ <ngt-instanced-mesh
275
+ *args="[undefined, undefined, 0]"
276
+ ngtCompound
277
+ [ref]="instancesRef"
278
+ [matrixAutoUpdate]="false"
279
+ [raycast]="nullRaycast"
280
+ [userData]="{ instances }"
281
+ >
282
+ <ngt-instanced-buffer-attribute
283
+ attach="instanceMatrix"
284
+ [count]="matrices().length / 16"
285
+ [array]="matrices()"
286
+ [itemSize]="16"
287
+ [usage]="DynamicDrawUsage"
288
+ />
289
+ <ngt-instanced-buffer-attribute
290
+ attach="instanceColor"
291
+ [count]="colors().length / 3"
292
+ [array]="colors()"
293
+ [itemSize]="3"
294
+ [usage]="DynamicDrawUsage"
295
+ />
296
+
297
+ <ng-content />
298
+ </ngt-instanced-mesh>
299
+ `,
300
+ imports: [NgtArgs],
301
+ providers: [
302
+ { provide: NGTS_INSTANCES_API, useFactory: (instances) => instances.api, deps: [NgtsInstances] },
303
+ ],
304
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
305
+ }]
306
+ }], ctorParameters: function () { return []; }, propDecorators: { instancesRef: [{
307
+ type: Input
308
+ }], range: [{
309
+ type: Input,
310
+ args: [{ required: true }]
311
+ }], limit: [{
312
+ type: Input
313
+ }], frames: [{
129
314
  type: Input
130
315
  }] } });
131
316
 
132
- class NgtsStats extends NgtRxStore {
317
+ const _instanceLocalMatrix = /*@__PURE__*/ new THREE.Matrix4();
318
+ const _instanceWorldMatrix = /*@__PURE__*/ new THREE.Matrix4();
319
+ const _instanceIntersects = [];
320
+ const _mesh = /*@__PURE__*/ new THREE.Mesh();
321
+ class PositionMesh extends THREE.Group {
133
322
  constructor() {
134
- super(...arguments);
135
- this.document = inject(DOCUMENT);
136
- this.stats = Stats['default']
137
- ? new Stats['default']()
138
- : new Stats();
323
+ super();
324
+ this.color = new THREE.Color('white');
325
+ this.instance = new ElementRef(undefined);
326
+ this.instanceKey = new ElementRef(undefined);
327
+ }
328
+ // This will allow the virtual instance have bounds
329
+ get geometry() {
330
+ return this.instance.nativeElement?.geometry;
139
331
  }
332
+ // And this will allow the virtual instance to receive events
333
+ raycast(raycaster, intersects) {
334
+ const parent = this.instance.nativeElement;
335
+ if (!parent)
336
+ return;
337
+ if (!parent.geometry || !parent.material)
338
+ return;
339
+ _mesh.geometry = parent.geometry;
340
+ const matrixWorld = parent.matrixWorld;
341
+ const instanceId = parent.userData['instances']().indexOf(this.instanceKey);
342
+ // If the instance wasn't found or exceeds the parents draw range, bail out
343
+ if (instanceId === -1 || instanceId > parent.count)
344
+ return;
345
+ // calculate the world matrix for each instance
346
+ parent.getMatrixAt(instanceId, _instanceLocalMatrix);
347
+ _instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix);
348
+ // the mesh represents this single instance
349
+ _mesh.matrixWorld = _instanceWorldMatrix;
350
+ // raycast side according to instance material
351
+ if (parent.material instanceof THREE.Material)
352
+ _mesh.material.side = parent.material.side;
353
+ else
354
+ _mesh.material.side = parent.material[0].side;
355
+ _mesh.raycast(raycaster, _instanceIntersects);
356
+ // process the result of raycast
357
+ for (let i = 0, l = _instanceIntersects.length; i < l; i++) {
358
+ const intersect = _instanceIntersects[i];
359
+ intersect.instanceId = instanceId;
360
+ intersect.object = this;
361
+ intersects.push(intersect);
362
+ }
363
+ _instanceIntersects.length = 0;
364
+ }
365
+ }
366
+
367
+ extend({ PositionMesh });
368
+ class NgtsInstance {
369
+ constructor() {
370
+ this.positionMeshRef = injectNgtRef();
371
+ this.instancesApi = inject(NGTS_INSTANCES_API);
372
+ requestAnimationInInjectionContext(() => {
373
+ effect((onCleanup) => {
374
+ onCleanup(this.instancesApi().subscribe(this.positionMeshRef));
375
+ });
376
+ });
377
+ }
378
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsInstance, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
379
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsInstance, isStandalone: true, selector: "ngts-instance", ngImport: i0, template: `
380
+ <ngt-position-mesh
381
+ ngtCompound
382
+ [ref]="positionMeshRef"
383
+ [instanceKey]="positionMeshRef"
384
+ [instance]="instancesApi().getParent()"
385
+ >
386
+ <ng-content />
387
+ </ngt-position-mesh>
388
+ `, isInline: true }); }
389
+ }
390
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsInstance, decorators: [{
391
+ type: Component,
392
+ args: [{
393
+ selector: 'ngts-instance',
394
+ standalone: true,
395
+ template: `
396
+ <ngt-position-mesh
397
+ ngtCompound
398
+ [ref]="positionMeshRef"
399
+ [instanceKey]="positionMeshRef"
400
+ [instance]="instancesApi().getParent()"
401
+ >
402
+ <ng-content />
403
+ </ngt-position-mesh>
404
+ `,
405
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
406
+ }]
407
+ }], ctorParameters: function () { return []; } });
408
+
409
+ class NgtsStats extends NgtSignalStore {
140
410
  set showPanel(showPanel) {
141
- this.set({ showPanel: showPanel === undefined ? this.get('showPanel') : showPanel });
411
+ this.set({ showPanel });
142
412
  }
143
413
  set parent(parent) {
144
414
  this.set({ parent: is.ref(parent) ? parent.nativeElement : parent });
@@ -149,41 +419,48 @@ class NgtsStats extends NgtRxStore {
149
419
  set right(right) {
150
420
  this.set({ right });
151
421
  }
152
- initialize() {
153
- super.initialize();
154
- this.set({ showPanel: 0, right: false });
155
- }
156
- ngOnInit() {
157
- this.effect(combineLatest([
158
- this.select('showPanel'),
159
- this.select('right'),
160
- this.select('parent').pipe(startWithUndefined()),
161
- this.select('classes').pipe(startWithUndefined()),
162
- ]), ([showPanel, right, parent, classes]) => {
163
- const node = parent ?? this.document.body;
164
- this.stats.showPanel(showPanel);
165
- node.appendChild(this.stats.dom);
422
+ constructor() {
423
+ super({ showPanel: 0, right: false });
424
+ const document = inject(DOCUMENT);
425
+ const stats = Stats['default']
426
+ ? new Stats['default']()
427
+ : new Stats();
428
+ const showPanel = this.select('showPanel');
429
+ const right = this.select('right');
430
+ const parent = this.select('parent');
431
+ const classes = this.select('classes');
432
+ const trigger = computed(() => ({
433
+ showPanel: showPanel(),
434
+ right: right(),
435
+ parent: parent(),
436
+ classes: classes(),
437
+ }));
438
+ effect((onCleanup) => {
439
+ const { showPanel, right, parent, classes } = trigger();
440
+ const node = parent ?? document.body;
441
+ stats.showPanel(showPanel);
442
+ node.appendChild(stats.dom);
166
443
  if (classes) {
167
- this.stats.dom.classList.add(...classes.split(' ').filter((cls) => cls));
444
+ stats.dom.classList.add(...classes.split(' ').filter((cls) => cls));
168
445
  }
169
446
  if (right) {
170
- this.stats.dom.style.right = '0px';
171
- this.stats.dom.style.left = 'inherit';
447
+ stats.dom.style.right = '0px';
448
+ stats.dom.style.left = 'inherit';
172
449
  }
173
450
  else {
174
- this.stats.dom.style.left = '0px';
175
- this.stats.dom.style.right = 'inherit';
451
+ stats.dom.style.left = '0px';
452
+ stats.dom.style.right = 'inherit';
176
453
  }
177
- const begin = addEffect(() => this.stats.begin());
178
- const end = addAfterEffect(() => this.stats.end());
179
- return () => {
180
- node.removeChild(this.stats.dom);
454
+ const begin = addEffect(() => stats.begin());
455
+ const end = addAfterEffect(() => stats.end());
456
+ onCleanup(() => {
457
+ node.removeChild(stats.dom);
181
458
  begin();
182
459
  end();
183
- };
460
+ });
184
461
  });
185
462
  }
186
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsStats, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
463
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsStats, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
187
464
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: NgtsStats, isStandalone: true, selector: "ngts-stats", inputs: { showPanel: "showPanel", parent: "parent", classes: "classes", right: "right" }, usesInheritance: true, ngImport: i0 }); }
188
465
  }
189
466
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsStats, decorators: [{
@@ -192,7 +469,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
192
469
  selector: 'ngts-stats',
193
470
  standalone: true,
194
471
  }]
195
- }], propDecorators: { showPanel: [{
472
+ }], ctorParameters: function () { return []; }, propDecorators: { showPanel: [{
196
473
  type: Input
197
474
  }], parent: [{
198
475
  type: Input
@@ -206,5 +483,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
206
483
  * Generated bundle index. Do not edit.
207
484
  */
208
485
 
209
- export { NgtsAdaptiveDpr, NgtsAdaptiveEvents, NgtsDetailed, NgtsStats };
486
+ export { NGTS_INSTANCES_API, NgtsAdaptiveDpr, NgtsAdaptiveEvents, NgtsDetailed, NgtsInstance, NgtsInstances, NgtsStats };
210
487
  //# sourceMappingURL=angular-three-soba-performance.mjs.map