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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/README.md +62 -4
  2. package/abstractions/README.md +279 -2
  3. package/abstractions/index.d.ts +13 -6
  4. package/abstractions/lib/billboard.d.ts +19 -0
  5. package/abstractions/lib/catmull-rom-line.d.ts +617 -0
  6. package/abstractions/lib/cubic-bezier-line.d.ts +19 -0
  7. package/abstractions/lib/edges.d.ts +800 -0
  8. package/abstractions/lib/gradient-texture.d.ts +24 -0
  9. package/abstractions/lib/grid.d.ts +315 -0
  10. package/abstractions/lib/helper.d.ts +25 -0
  11. package/abstractions/lib/line.d.ts +41 -0
  12. package/abstractions/lib/prism-geometry.d.ts +32 -0
  13. package/abstractions/lib/quadratic-bezier-line.d.ts +21 -0
  14. package/abstractions/lib/rounded-box.d.ts +41 -0
  15. package/abstractions/lib/text-3d.d.ts +314 -0
  16. package/abstractions/lib/text.d.ts +54 -0
  17. package/cameras/README.md +91 -2
  18. package/cameras/index.d.ts +4 -4
  19. package/cameras/lib/camera-content.d.ts +10 -0
  20. package/cameras/lib/cube-camera.d.ts +38 -0
  21. package/cameras/lib/orthographic-camera.d.ts +40 -0
  22. package/cameras/lib/perspective-camera.d.ts +36 -0
  23. package/controls/README.md +96 -2
  24. package/controls/index.d.ts +4 -1
  25. package/controls/lib/camera-controls.d.ts +31 -0
  26. package/controls/lib/orbit-controls.d.ts +38 -0
  27. package/controls/lib/pivot-controls/axis-arrow.d.ts +31 -0
  28. package/controls/lib/pivot-controls/axis-rotator.d.ts +30 -0
  29. package/controls/lib/pivot-controls/pivot-controls.d.ts +110 -0
  30. package/controls/lib/pivot-controls/plane-slider.d.ts +32 -0
  31. package/controls/lib/pivot-controls/scaling-sphere.d.ts +32 -0
  32. package/controls/lib/scroll-controls.d.ts +78 -0
  33. package/esm2022/abstractions/index.mjs +14 -7
  34. package/esm2022/abstractions/lib/billboard.mjs +69 -0
  35. package/esm2022/abstractions/lib/catmull-rom-line.mjs +76 -0
  36. package/esm2022/abstractions/lib/cubic-bezier-line.mjs +51 -0
  37. package/esm2022/abstractions/lib/edges.mjs +70 -0
  38. package/esm2022/abstractions/lib/gradient-texture.mjs +91 -0
  39. package/esm2022/abstractions/lib/grid.mjs +103 -0
  40. package/esm2022/abstractions/lib/helper.mjs +76 -0
  41. package/esm2022/abstractions/lib/line.mjs +126 -0
  42. package/esm2022/abstractions/lib/prism-geometry.mjs +46 -0
  43. package/esm2022/abstractions/lib/quadratic-bezier-line.mjs +73 -0
  44. package/esm2022/abstractions/lib/rounded-box.mjs +111 -0
  45. package/esm2022/abstractions/lib/text-3d.mjs +98 -0
  46. package/esm2022/abstractions/lib/text.mjs +91 -0
  47. package/esm2022/cameras/index.mjs +5 -5
  48. package/esm2022/cameras/lib/camera-content.mjs +14 -0
  49. package/esm2022/cameras/lib/cube-camera.mjs +111 -0
  50. package/esm2022/cameras/lib/orthographic-camera.mjs +131 -0
  51. package/esm2022/cameras/lib/perspective-camera.mjs +104 -0
  52. package/esm2022/controls/index.mjs +5 -2
  53. package/esm2022/controls/lib/camera-controls.mjs +127 -0
  54. package/esm2022/controls/lib/orbit-controls.mjs +132 -0
  55. package/esm2022/controls/lib/pivot-controls/axis-arrow.mjs +263 -0
  56. package/esm2022/controls/lib/pivot-controls/axis-rotator.mjs +264 -0
  57. package/esm2022/controls/lib/pivot-controls/pivot-controls.mjs +340 -0
  58. package/esm2022/controls/lib/pivot-controls/plane-slider.mjs +266 -0
  59. package/esm2022/controls/lib/pivot-controls/scaling-sphere.mjs +232 -0
  60. package/esm2022/controls/lib/scroll-controls.mjs +268 -0
  61. package/esm2022/loaders/index.mjs +6 -5
  62. package/esm2022/loaders/lib/font-loader.mjs +49 -0
  63. package/esm2022/loaders/lib/gltf-loader.mjs +51 -0
  64. package/esm2022/loaders/lib/loader.mjs +109 -0
  65. package/esm2022/loaders/lib/progress.mjs +51 -0
  66. package/esm2022/loaders/lib/texture-loader.mjs +32 -0
  67. package/esm2022/materials/index.mjs +8 -7
  68. package/esm2022/materials/lib/custom-shader-material.mjs +71 -0
  69. package/esm2022/materials/lib/mesh-distort-material.mjs +42 -0
  70. package/esm2022/materials/lib/mesh-reflector-material.mjs +278 -0
  71. package/esm2022/materials/lib/mesh-refraction-material.mjs +144 -0
  72. package/esm2022/materials/lib/mesh-transmission-material.mjs +188 -0
  73. package/esm2022/materials/lib/mesh-wobble-material.mjs +42 -0
  74. package/esm2022/materials/lib/point-material.mjs +33 -0
  75. package/esm2022/misc/index.mjs +14 -14
  76. package/esm2022/misc/lib/animations.mjs +71 -0
  77. package/esm2022/misc/lib/bake-shadows.mjs +26 -0
  78. package/esm2022/misc/lib/computed-attribute.mjs +55 -0
  79. package/esm2022/misc/lib/constants.mjs +5 -0
  80. package/esm2022/misc/lib/decal.mjs +139 -0
  81. package/esm2022/misc/lib/deprecated.mjs +15 -0
  82. package/esm2022/misc/lib/depth-buffer.mjs +39 -0
  83. package/esm2022/misc/lib/fbo.mjs +86 -0
  84. package/esm2022/misc/lib/html/html-content.mjs +327 -0
  85. package/esm2022/misc/lib/html/html.mjs +129 -0
  86. package/esm2022/misc/lib/html/utils.mjs +74 -0
  87. package/esm2022/misc/lib/intersect.mjs +52 -0
  88. package/esm2022/misc/lib/sampler.mjs +122 -0
  89. package/esm2022/misc/lib/scale-factor.mjs +29 -0
  90. package/esm2022/performances/index.mjs +7 -6
  91. package/esm2022/performances/lib/adaptive-dpr.mjs +52 -0
  92. package/esm2022/performances/lib/adaptive-events.mjs +28 -0
  93. package/esm2022/performances/lib/detailed.mjs +57 -0
  94. package/esm2022/performances/lib/instances/instances.mjs +183 -0
  95. package/esm2022/performances/lib/instances/position-mesh.mjs +51 -0
  96. package/esm2022/performances/lib/points/points.mjs +278 -0
  97. package/esm2022/performances/lib/points/position-point.mjs +53 -0
  98. package/esm2022/performances/lib/segments/segment-object.mjs +9 -0
  99. package/esm2022/performances/lib/segments/segments.mjs +129 -0
  100. package/esm2022/shaders/index.mjs +4 -18
  101. package/esm2022/shaders/lib/grid-material.mjs +81 -0
  102. package/esm2022/shaders/lib/mesh-refraction-material.mjs +163 -0
  103. package/esm2022/shaders/lib/point-material.mjs +24 -0
  104. package/esm2022/staging/index.mjs +19 -22
  105. package/esm2022/staging/lib/accumulative-shadows.mjs +182 -0
  106. package/esm2022/staging/lib/backdrop.mjs +73 -0
  107. package/esm2022/staging/lib/bb-anchor.mjs +58 -0
  108. package/esm2022/staging/lib/bounds.mjs +286 -0
  109. package/esm2022/staging/lib/camera-shake.mjs +69 -0
  110. package/esm2022/staging/lib/caustics.mjs +188 -0
  111. package/esm2022/staging/lib/center.mjs +118 -0
  112. package/esm2022/staging/lib/contact-shadows.mjs +214 -0
  113. package/esm2022/staging/lib/environment.mjs +481 -0
  114. package/esm2022/staging/lib/float.mjs +70 -0
  115. package/esm2022/staging/lib/lightformer.mjs +107 -0
  116. package/esm2022/staging/lib/matcap-texture.mjs +81 -0
  117. package/esm2022/staging/lib/normal-texture.mjs +81 -0
  118. package/esm2022/staging/lib/randomized-lights.mjs +104 -0
  119. package/esm2022/staging/lib/render-texture.mjs +203 -0
  120. package/esm2022/staging/lib/sky.mjs +86 -0
  121. package/esm2022/staging/lib/spot-light.mjs +453 -0
  122. package/esm2022/staging/lib/stage.mjs +236 -0
  123. package/esm2022/{utils/angular-three-soba-utils.mjs → stats/angular-three-soba-stats.mjs} +1 -1
  124. package/esm2022/stats/index.mjs +2 -0
  125. package/esm2022/stats/lib/stats.mjs +63 -0
  126. package/esm2022/vanilla-exports/angular-three-soba-vanilla-exports.mjs +5 -0
  127. package/esm2022/vanilla-exports/index.mjs +3 -0
  128. package/fesm2022/angular-three-soba-abstractions.mjs +884 -697
  129. package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
  130. package/fesm2022/angular-three-soba-cameras.mjs +261 -308
  131. package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
  132. package/fesm2022/angular-three-soba-controls.mjs +1776 -109
  133. package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
  134. package/fesm2022/angular-three-soba-loaders.mjs +191 -145
  135. package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
  136. package/fesm2022/angular-three-soba-materials.mjs +527 -748
  137. package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
  138. package/fesm2022/angular-three-soba-misc.mjs +783 -1935
  139. package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
  140. package/fesm2022/angular-three-soba-performances.mjs +591 -475
  141. package/fesm2022/angular-three-soba-performances.mjs.map +1 -1
  142. package/fesm2022/angular-three-soba-shaders.mjs +51 -1369
  143. package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
  144. package/fesm2022/angular-three-soba-staging.mjs +2350 -3521
  145. package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
  146. package/fesm2022/angular-three-soba-stats.mjs +70 -0
  147. package/fesm2022/angular-three-soba-stats.mjs.map +1 -0
  148. package/fesm2022/angular-three-soba-vanilla-exports.mjs +6 -0
  149. package/fesm2022/angular-three-soba-vanilla-exports.mjs.map +1 -0
  150. package/loaders/README.md +130 -2
  151. package/loaders/index.d.ts +5 -4
  152. package/loaders/lib/font-loader.d.ts +27 -0
  153. package/loaders/lib/gltf-loader.d.ts +24 -0
  154. package/loaders/lib/loader.d.ts +29 -0
  155. package/loaders/lib/progress.d.ts +9 -0
  156. package/loaders/lib/texture-loader.d.ts +13 -0
  157. package/materials/README.md +160 -2
  158. package/materials/index.d.ts +7 -6
  159. package/materials/lib/custom-shader-material.d.ts +20 -0
  160. package/materials/lib/mesh-distort-material.d.ts +17 -0
  161. package/materials/lib/mesh-reflector-material.d.ts +51 -0
  162. package/materials/lib/mesh-refraction-material.d.ts +42 -0
  163. package/materials/lib/mesh-transmission-material.d.ts +77 -0
  164. package/materials/lib/mesh-wobble-material.d.ts +15 -0
  165. package/materials/lib/point-material.d.ts +11 -0
  166. package/metadata.json +1 -1
  167. package/misc/README.md +217 -2
  168. package/misc/index.d.ts +13 -13
  169. package/misc/lib/animations.d.ts +17 -0
  170. package/misc/lib/computed-attribute.d.ts +64 -0
  171. package/misc/lib/constants.d.ts +1 -0
  172. package/misc/lib/decal.d.ts +27 -0
  173. package/misc/lib/deprecated.d.ts +14 -0
  174. package/misc/lib/depth-buffer.d.ts +8 -0
  175. package/misc/lib/fbo.d.ts +46 -0
  176. package/misc/lib/html/html-content.d.ts +47 -0
  177. package/misc/lib/html/html.d.ts +30 -0
  178. package/misc/lib/html/utils.d.ts +14 -0
  179. package/misc/lib/intersect.d.ts +13 -0
  180. package/misc/lib/sampler.d.ts +73 -0
  181. package/misc/lib/scale-factor.d.ts +3 -0
  182. package/package.json +89 -48
  183. package/performances/index.d.ts +6 -5
  184. package/performances/lib/adaptive-dpr.d.ts +7 -0
  185. package/performances/{adaptive-events → lib}/adaptive-events.d.ts +0 -3
  186. package/performances/lib/detailed.d.ts +17 -0
  187. package/performances/lib/instances/instances.d.ts +122 -0
  188. package/performances/lib/instances/position-mesh.d.ts +20 -0
  189. package/performances/lib/points/points.d.ts +224 -0
  190. package/performances/lib/points/position-point.d.ts +21 -0
  191. package/performances/lib/segments/segment-object.d.ts +17 -0
  192. package/performances/lib/segments/segments.d.ts +97 -0
  193. package/shaders/index.d.ts +3 -17
  194. package/shaders/lib/grid-material.d.ts +69 -0
  195. package/shaders/lib/mesh-refraction-material.d.ts +11 -0
  196. package/shaders/lib/point-material.d.ts +14 -0
  197. package/staging/README.md +473 -2
  198. package/staging/index.d.ts +18 -21
  199. package/staging/lib/accumulative-shadows.d.ts +75 -0
  200. package/staging/lib/backdrop.d.ts +22 -0
  201. package/staging/lib/bb-anchor.d.ts +17 -0
  202. package/staging/lib/bounds.d.ts +47 -0
  203. package/staging/lib/camera-shake.d.ts +29 -0
  204. package/staging/lib/caustics.d.ts +53 -0
  205. package/staging/lib/center.d.ts +390 -0
  206. package/staging/lib/contact-shadows.d.ts +55 -0
  207. package/staging/lib/environment.d.ts +132 -0
  208. package/staging/lib/float.d.ts +20 -0
  209. package/staging/lib/lightformer.d.ts +310 -0
  210. package/staging/lib/matcap-texture.d.ts +32 -0
  211. package/staging/lib/normal-texture.d.ts +37 -0
  212. package/staging/lib/randomized-lights.d.ts +54 -0
  213. package/staging/lib/render-texture.d.ts +64 -0
  214. package/staging/lib/sky.d.ts +32 -0
  215. package/staging/lib/spot-light.d.ts +119 -0
  216. package/staging/lib/stage.d.ts +352 -0
  217. package/stats/README.md +3 -0
  218. package/stats/index.d.ts +1 -0
  219. package/stats/lib/stats.d.ts +14 -0
  220. package/vanilla-exports/README.md +3 -0
  221. package/vanilla-exports/index.d.ts +27 -0
  222. package/web-types.json +1 -1
  223. package/abstractions/billboard/billboard.d.ts +0 -28
  224. package/abstractions/detailed/detailed.d.ts +0 -26
  225. package/abstractions/edges/edges.d.ts +0 -34
  226. package/abstractions/grid/grid.d.ts +0 -50
  227. package/abstractions/text/text.d.ts +0 -82
  228. package/abstractions/text-3d/text-3d.d.ts +0 -81
  229. package/assets/distort.vert.glsl +0 -1
  230. package/cameras/camera/camera-content.d.ts +0 -13
  231. package/cameras/camera/camera.d.ts +0 -26
  232. package/cameras/cube-camera/cube-camera.d.ts +0 -69
  233. package/cameras/orthographic-camera/orthographic-camera.d.ts +0 -37
  234. package/cameras/perspective-camera/perspective-camera.d.ts +0 -18
  235. package/controls/orbit-controls/orbit-controls.d.ts +0 -54
  236. package/esm2022/abstractions/billboard/billboard.mjs +0 -74
  237. package/esm2022/abstractions/detailed/detailed.mjs +0 -64
  238. package/esm2022/abstractions/edges/edges.mjs +0 -88
  239. package/esm2022/abstractions/grid/grid.mjs +0 -180
  240. package/esm2022/abstractions/text/text.mjs +0 -274
  241. package/esm2022/abstractions/text-3d/text-3d.mjs +0 -165
  242. package/esm2022/cameras/camera/camera-content.mjs +0 -20
  243. package/esm2022/cameras/camera/camera.mjs +0 -77
  244. package/esm2022/cameras/cube-camera/cube-camera.mjs +0 -161
  245. package/esm2022/cameras/orthographic-camera/orthographic-camera.mjs +0 -102
  246. package/esm2022/cameras/perspective-camera/perspective-camera.mjs +0 -46
  247. package/esm2022/controls/orbit-controls/orbit-controls.mjs +0 -181
  248. package/esm2022/loaders/gltf-loader/gltf-loader.mjs +0 -30
  249. package/esm2022/loaders/loader/loader.mjs +0 -138
  250. package/esm2022/loaders/progress/progress.mjs +0 -45
  251. package/esm2022/loaders/texture-loader/texture-loader.mjs +0 -28
  252. package/esm2022/materials/mesh-distort-material/mesh-distort-material.mjs +0 -82
  253. package/esm2022/materials/mesh-reflector-material/mesh-reflector-material.mjs +0 -367
  254. package/esm2022/materials/mesh-refraction-material/mesh-refraction-material.mjs +0 -171
  255. package/esm2022/materials/mesh-transmission-material/mesh-transmission-material.mjs +0 -278
  256. package/esm2022/materials/mesh-wobble-material/mesh-wobble-material.mjs +0 -68
  257. package/esm2022/materials/point-material/point-material.mjs +0 -46
  258. package/esm2022/misc/animations/animations.mjs +0 -59
  259. package/esm2022/misc/bake-shadows/bake-shadows.mjs +0 -24
  260. package/esm2022/misc/caustics/caustics.mjs +0 -387
  261. package/esm2022/misc/decal/decal.mjs +0 -187
  262. package/esm2022/misc/depth-buffer/depth-buffer.mjs +0 -44
  263. package/esm2022/misc/example/example.mjs +0 -160
  264. package/esm2022/misc/fbo/fbo.mjs +0 -47
  265. package/esm2022/misc/html/html-wrapper.mjs +0 -478
  266. package/esm2022/misc/html/html.mjs +0 -304
  267. package/esm2022/misc/sampler/sampler.mjs +0 -142
  268. package/esm2022/misc/shadow/shadow.mjs +0 -111
  269. package/esm2022/misc/stats-gl/stats-gl.mjs +0 -61
  270. package/esm2022/misc/trail/trail.mjs +0 -209
  271. package/esm2022/misc/trail-texture/inject-trail-texture.mjs +0 -17
  272. package/esm2022/misc/trail-texture/trail-texture.mjs +0 -106
  273. package/esm2022/modifiers/angular-three-soba-modifiers.mjs +0 -5
  274. package/esm2022/modifiers/curve-modifier/curve-modifier.mjs +0 -64
  275. package/esm2022/modifiers/index.mjs +0 -2
  276. package/esm2022/performances/adaptive-dpr/adaptive-dpr.mjs +0 -44
  277. package/esm2022/performances/adaptive-events/adaptive-events.mjs +0 -27
  278. package/esm2022/performances/points/points-input.mjs +0 -64
  279. package/esm2022/performances/points/points.mjs +0 -329
  280. package/esm2022/performances/points/position-point.mjs +0 -54
  281. package/esm2022/performances/segments/segment-object.mjs +0 -9
  282. package/esm2022/performances/segments/segments.mjs +0 -182
  283. package/esm2022/shaders/blur-pass/blur-pass.mjs +0 -61
  284. package/esm2022/shaders/caustics/caustics-material.mjs +0 -130
  285. package/esm2022/shaders/caustics/caustics-projection-material.mjs +0 -31
  286. package/esm2022/shaders/convolution-material/convolution-material.mjs +0 -94
  287. package/esm2022/shaders/discard-material/discard-material.mjs +0 -3
  288. package/esm2022/shaders/grid-material/grid-material.mjs +0 -77
  289. package/esm2022/shaders/mesh-distort-material/mesh-distort-material.mjs +0 -56
  290. package/esm2022/shaders/mesh-reflector-material/mesh-reflector-material.mjs +0 -223
  291. package/esm2022/shaders/mesh-refraction-material/mesh-refraction-material.mjs +0 -170
  292. package/esm2022/shaders/mesh-transmission-material/mesh-transmission-material.mjs +0 -268
  293. package/esm2022/shaders/mesh-wobble-material/mesh-wobble-material.mjs +0 -37
  294. package/esm2022/shaders/shader-material/shader-material.mjs +0 -34
  295. package/esm2022/shaders/soft-shadow-material/soft-shadow-material.mjs +0 -25
  296. package/esm2022/shaders/sparkles-material/sparkles-material.mjs +0 -33
  297. package/esm2022/shaders/spot-light-material/spot-light-material.mjs +0 -86
  298. package/esm2022/shaders/star-field-material/star-field-material.mjs +0 -33
  299. package/esm2022/shaders/wireframe-material/wireframe-material.mjs +0 -247
  300. package/esm2022/staging/accumulative-shadows/accumulative-shadows.mjs +0 -267
  301. package/esm2022/staging/accumulative-shadows/progressive-light-map.mjs +0 -108
  302. package/esm2022/staging/accumulative-shadows/randomized-lights.mjs +0 -206
  303. package/esm2022/staging/backdrop/backdrop.mjs +0 -77
  304. package/esm2022/staging/bb-anchor/bb-anchor.mjs +0 -70
  305. package/esm2022/staging/bounds/bounds.mjs +0 -308
  306. package/esm2022/staging/camera-shake/camera-shake.mjs +0 -123
  307. package/esm2022/staging/center/center.mjs +0 -163
  308. package/esm2022/staging/cloud/cloud.mjs +0 -158
  309. package/esm2022/staging/contact-shadows/contact-shadows.mjs +0 -246
  310. package/esm2022/staging/environment/assets.mjs +0 -13
  311. package/esm2022/staging/environment/environment-cube.mjs +0 -47
  312. package/esm2022/staging/environment/environment-ground.mjs +0 -41
  313. package/esm2022/staging/environment/environment-input.mjs +0 -119
  314. package/esm2022/staging/environment/environment-map.mjs +0 -53
  315. package/esm2022/staging/environment/environment-portal.mjs +0 -113
  316. package/esm2022/staging/environment/environment.mjs +0 -61
  317. package/esm2022/staging/environment/utils.mjs +0 -105
  318. package/esm2022/staging/float/float.mjs +0 -94
  319. package/esm2022/staging/matcap-texture/matcap-texture.mjs +0 -64
  320. package/esm2022/staging/normal-texture/normal-texture.mjs +0 -53
  321. package/esm2022/staging/sky/sky.mjs +0 -119
  322. package/esm2022/staging/sparkles/sparkles.mjs +0 -164
  323. package/esm2022/staging/spot-light/shadow-mesh-input.mjs +0 -63
  324. package/esm2022/staging/spot-light/shadow-mesh.mjs +0 -266
  325. package/esm2022/staging/spot-light/spot-light-input.mjs +0 -84
  326. package/esm2022/staging/spot-light/spot-light.mjs +0 -81
  327. package/esm2022/staging/spot-light/volumetric-mesh.mjs +0 -98
  328. package/esm2022/staging/stage/stage.mjs +0 -388
  329. package/esm2022/staging/stars/stars.mjs +0 -147
  330. package/esm2022/staging/wireframe/wireframe-input.mjs +0 -191
  331. package/esm2022/staging/wireframe/wireframe.mjs +0 -224
  332. package/esm2022/utils/content/content.mjs +0 -15
  333. package/esm2022/utils/index.mjs +0 -2
  334. package/fesm2022/angular-three-soba-modifiers.mjs +0 -71
  335. package/fesm2022/angular-three-soba-modifiers.mjs.map +0 -1
  336. package/fesm2022/angular-three-soba-utils.mjs +0 -22
  337. package/fesm2022/angular-three-soba-utils.mjs.map +0 -1
  338. package/loaders/gltf-loader/gltf-loader.d.ts +0 -10
  339. package/loaders/loader/loader.d.ts +0 -33
  340. package/loaders/progress/progress.d.ts +0 -9
  341. package/loaders/texture-loader/texture-loader.d.ts +0 -7
  342. package/materials/mesh-distort-material/mesh-distort-material.d.ts +0 -40
  343. package/materials/mesh-reflector-material/mesh-reflector-material.d.ts +0 -99
  344. package/materials/mesh-refraction-material/mesh-refraction-material.d.ts +0 -62
  345. package/materials/mesh-transmission-material/mesh-transmission-material.d.ts +0 -107
  346. package/materials/mesh-wobble-material/mesh-wobble-material.d.ts +0 -29
  347. package/materials/point-material/point-material.d.ts +0 -24
  348. package/misc/animations/animations.d.ts +0 -15
  349. package/misc/caustics/caustics.d.ts +0 -87
  350. package/misc/decal/decal.d.ts +0 -49
  351. package/misc/depth-buffer/depth-buffer.d.ts +0 -9
  352. package/misc/example/example.d.ts +0 -81
  353. package/misc/fbo/fbo.d.ts +0 -17
  354. package/misc/html/html-wrapper.d.ts +0 -559
  355. package/misc/html/html.d.ts +0 -214
  356. package/misc/sampler/sampler.d.ts +0 -67
  357. package/misc/shadow/shadow.d.ts +0 -37
  358. package/misc/stats-gl/stats-gl.d.ts +0 -24
  359. package/misc/trail/trail.d.ts +0 -57
  360. package/misc/trail-texture/inject-trail-texture.d.ts +0 -9
  361. package/misc/trail-texture/trail-texture.d.ts +0 -50
  362. package/modifiers/README.md +0 -3
  363. package/modifiers/curve-modifier/curve-modifier.d.ts +0 -23
  364. package/modifiers/index.d.ts +0 -1
  365. package/performances/adaptive-dpr/adaptive-dpr.d.ts +0 -14
  366. package/performances/points/points-input.d.ts +0 -32
  367. package/performances/points/points.d.ts +0 -92
  368. package/performances/points/position-point.d.ts +0 -11
  369. package/performances/segments/segment-object.d.ts +0 -7
  370. package/performances/segments/segments.d.ts +0 -124
  371. package/shaders/blur-pass/blur-pass.d.ts +0 -23
  372. package/shaders/caustics/caustics-material.d.ts +0 -4
  373. package/shaders/caustics/caustics-projection-material.d.ts +0 -4
  374. package/shaders/convolution-material/convolution-material.d.ts +0 -7
  375. package/shaders/discard-material/discard-material.d.ts +0 -3
  376. package/shaders/grid-material/grid-material.d.ts +0 -37
  377. package/shaders/mesh-distort-material/mesh-distort-material.d.ts +0 -295
  378. package/shaders/mesh-reflector-material/mesh-reflector-material.d.ts +0 -50
  379. package/shaders/mesh-refraction-material/mesh-refraction-material.d.ts +0 -4
  380. package/shaders/mesh-transmission-material/mesh-transmission-material.d.ts +0 -25
  381. package/shaders/mesh-wobble-material/mesh-wobble-material.d.ts +0 -16
  382. package/shaders/shader-material/shader-material.d.ts +0 -6
  383. package/shaders/soft-shadow-material/soft-shadow-material.d.ts +0 -19
  384. package/shaders/sparkles-material/sparkles-material.d.ts +0 -17
  385. package/shaders/spot-light-material/spot-light-material.d.ts +0 -13
  386. package/shaders/star-field-material/star-field-material.d.ts +0 -13
  387. package/shaders/wireframe-material/wireframe-material.d.ts +0 -58
  388. package/staging/accumulative-shadows/accumulative-shadows.d.ts +0 -146
  389. package/staging/accumulative-shadows/progressive-light-map.d.ts +0 -34
  390. package/staging/accumulative-shadows/randomized-lights.d.ts +0 -90
  391. package/staging/backdrop/backdrop.d.ts +0 -30
  392. package/staging/bb-anchor/bb-anchor.d.ts +0 -27
  393. package/staging/bounds/bounds.d.ts +0 -134
  394. package/staging/camera-shake/camera-shake.d.ts +0 -43
  395. package/staging/center/center.d.ts +0 -70
  396. package/staging/cloud/cloud.d.ts +0 -51
  397. package/staging/contact-shadows/contact-shadows.d.ts +0 -70
  398. package/staging/environment/assets.d.ts +0 -13
  399. package/staging/environment/environment-cube.d.ts +0 -15
  400. package/staging/environment/environment-ground.d.ts +0 -13
  401. package/staging/environment/environment-input.d.ts +0 -68
  402. package/staging/environment/environment-map.d.ts +0 -16
  403. package/staging/environment/environment-portal.d.ts +0 -18
  404. package/staging/environment/environment.d.ts +0 -8
  405. package/staging/environment/utils.d.ts +0 -7
  406. package/staging/float/float.d.ts +0 -31
  407. package/staging/matcap-texture/matcap-texture.d.ts +0 -13
  408. package/staging/normal-texture/normal-texture.d.ts +0 -16
  409. package/staging/sky/sky.d.ts +0 -48
  410. package/staging/sparkles/sparkles.d.ts +0 -63
  411. package/staging/spot-light/shadow-mesh-input.d.ts +0 -29
  412. package/staging/spot-light/shadow-mesh.d.ts +0 -37
  413. package/staging/spot-light/spot-light-input.d.ts +0 -38
  414. package/staging/spot-light/spot-light.d.ts +0 -39
  415. package/staging/spot-light/volumetric-mesh.d.ts +0 -24
  416. package/staging/stage/stage.d.ts +0 -130
  417. package/staging/stars/stars.d.ts +0 -45
  418. package/staging/wireframe/wireframe-input.d.ts +0 -65
  419. package/staging/wireframe/wireframe.d.ts +0 -28
  420. package/utils/README.md +0 -3
  421. package/utils/content/content.d.ts +0 -8
  422. package/utils/index.d.ts +0 -1
  423. /package/misc/{bake-shadows → lib}/bake-shadows.d.ts +0 -0
@@ -1,224 +1,200 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, CUSTOM_ELEMENTS_SCHEMA, Input, computed, effect } from '@angular/core';
3
- import { signalStore, injectNgtRef, injectBeforeRender, NgtArgs, extend, injectNgtStore, getLocalState, NgtKey } from 'angular-three';
4
- import { injectNgtsMeshDistortMaterial, MeshReflectorMaterial, BlurPass, MeshRefractionMaterial, MeshTransmissionMaterial, DiscardMaterial, MeshWobbleMaterial } from 'angular-three-soba/shaders';
5
- import { NgIf } from '@angular/common';
6
- import * as THREE from 'three';
2
+ import { input, computed, afterNextRender, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, viewChild, untracked, inject, DestroyRef } from '@angular/core';
3
+ import { omit, is, pick, NgtArgs, injectBeforeRender, injectStore, applyProps, getLocalState } from 'angular-three';
4
+ import { injectAutoEffect } from 'ngxtension/auto-effect';
5
+ import CustomShaderMaterial from 'three-custom-shader-material/vanilla';
6
+ import { MeshDistortMaterial, BlurPass, MeshReflectorMaterial, MeshDiscardMaterial, MeshTransmissionMaterial, MeshWobbleMaterial } from 'angular-three-soba/vanilla-exports';
7
+ import { mergeInputs } from 'ngxtension/inject-inputs';
8
+ import { Plane, Vector3, Matrix4, Vector4, PerspectiveCamera, LinearFilter, HalfFloatType, WebGLRenderTarget, DepthTexture, DepthFormat, UnsignedShortType, FrontSide, NoToneMapping, BackSide } from 'three';
9
+ import { MeshRefractionMaterial, PointMaterial } from 'angular-three-soba/shaders';
7
10
  import { MeshBVHUniformStruct, MeshBVH, SAH } from 'three-mesh-bvh';
8
- import { injectNgtsFBO } from 'angular-three-soba/misc';
11
+ import { injectFBO } from 'angular-three-soba/misc';
9
12
 
10
- class NgtsMeshDistortMaterial {
11
- set _time(time) {
12
- this.inputs.set({ time });
13
- }
14
- set _distort(distort) {
15
- this.inputs.set({ distort });
16
- }
17
- set _radius(radius) {
18
- this.inputs.set({ radius });
19
- }
20
- set _speed(speed) {
21
- this.inputs.set({ speed });
22
- }
13
+ class NgtsCustomShaderMaterial {
23
14
  constructor() {
24
- this.inputs = signalStore({
25
- speed: 1,
26
- time: 0,
27
- distort: 0.4,
28
- radius: 1,
15
+ this.baseMaterial = input.required();
16
+ this.attach = input('material');
17
+ this.options = input({});
18
+ this.parameters = omit(this.options, ['fragmentShader', 'vertexShader', 'uniforms', 'cacheKey']);
19
+ this.base = computed(() => {
20
+ const baseMaterial = this.baseMaterial();
21
+ return is.ref(baseMaterial) ? baseMaterial.nativeElement : baseMaterial;
22
+ });
23
+ this.fragmentShader = pick(this.options, 'fragmentShader');
24
+ this.vertexShader = pick(this.options, 'vertexShader');
25
+ this.uniforms = pick(this.options, 'uniforms');
26
+ this.cacheKey = pick(this.options, 'cacheKey');
27
+ this.material = computed(() => {
28
+ const [base, fragmentShader, vertexShader, uniforms, cacheKey] = [
29
+ this.base(),
30
+ this.fragmentShader(),
31
+ this.vertexShader(),
32
+ this.uniforms(),
33
+ this.cacheKey(),
34
+ ];
35
+ // NOTE: this is specific to angular-three
36
+ if (is.instance(base)) {
37
+ delete base['__ngt__'];
38
+ delete base['__ngt_renderer__'];
39
+ }
40
+ return new CustomShaderMaterial({
41
+ baseMaterial: base,
42
+ fragmentShader,
43
+ vertexShader,
44
+ uniforms,
45
+ cacheKey,
46
+ });
47
+ });
48
+ const autoEffect = injectAutoEffect();
49
+ afterNextRender(() => {
50
+ autoEffect(() => {
51
+ const material = this.material();
52
+ return () => material.dispose();
53
+ });
29
54
  });
30
- this.materialRef = injectNgtRef();
31
- this.MeshDistortMaterial = injectNgtsMeshDistortMaterial();
32
- this.material = new this.MeshDistortMaterial();
33
- this.time = this.inputs.select('time');
34
- this.distort = this.inputs.select('distort');
35
- this.radius = this.inputs.select('radius');
55
+ }
56
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCustomShaderMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
57
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsCustomShaderMaterial, isStandalone: true, selector: "ngts-custom-shader-material", inputs: { baseMaterial: { classPropertyName: "baseMaterial", publicName: "baseMaterial", isSignal: true, isRequired: true, transformFunction: null }, attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
58
+ <ngt-primitive *args="[material()]" [attach]="attach()" [parameters]="parameters()">
59
+ <ng-content />
60
+ </ngt-primitive>
61
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
62
+ }
63
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCustomShaderMaterial, decorators: [{
64
+ type: Component,
65
+ args: [{
66
+ selector: 'ngts-custom-shader-material',
67
+ standalone: true,
68
+ template: `
69
+ <ngt-primitive *args="[material()]" [attach]="attach()" [parameters]="parameters()">
70
+ <ng-content />
71
+ </ngt-primitive>
72
+ `,
73
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
74
+ changeDetection: ChangeDetectionStrategy.OnPush,
75
+ imports: [NgtArgs],
76
+ }]
77
+ }], ctorParameters: () => [] });
78
+
79
+ const defaultOptions$4 = {
80
+ speed: 1,
81
+ };
82
+ class NgtsMeshDistortMaterial {
83
+ constructor() {
84
+ this.attach = input('material');
85
+ this.options = input(defaultOptions$4, { transform: mergeInputs(defaultOptions$4) });
86
+ this.parameters = omit(this.options, ['speed']);
87
+ this.material = new MeshDistortMaterial();
88
+ this.speed = pick(this.options, 'speed');
36
89
  injectBeforeRender(({ clock }) => {
37
- this.material.time = clock.getElapsedTime() * this.inputs.get('speed');
90
+ this.material.time = clock.getElapsedTime() * this.speed();
38
91
  });
39
92
  }
40
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshDistortMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
41
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsMeshDistortMaterial, isStandalone: true, selector: "ngts-mesh-distort-material", inputs: { materialRef: "materialRef", _time: ["time", "_time"], _distort: ["distort", "_distort"], _radius: ["radius", "_radius"], _speed: ["speed", "_speed"] }, ngImport: i0, template: `
42
- <ngt-primitive
43
- *args="[material]"
44
- [ref]="materialRef"
45
- [time]="time()"
46
- [distort]="distort()"
47
- [radius]="radius()"
48
- ngtCompound
49
- attach="material"
50
- />
51
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
93
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshDistortMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
94
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsMeshDistortMaterial, isStandalone: true, selector: "ngts-mesh-distort-material", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
95
+ <ngt-primitive *args="[material]" [attach]="attach()" [parameters]="parameters()">
96
+ <ng-content />
97
+ </ngt-primitive>
98
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
52
99
  }
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshDistortMaterial, decorators: [{
100
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshDistortMaterial, decorators: [{
54
101
  type: Component,
55
102
  args: [{
56
103
  selector: 'ngts-mesh-distort-material',
57
104
  standalone: true,
58
105
  template: `
59
- <ngt-primitive
60
- *args="[material]"
61
- [ref]="materialRef"
62
- [time]="time()"
63
- [distort]="distort()"
64
- [radius]="radius()"
65
- ngtCompound
66
- attach="material"
67
- />
106
+ <ngt-primitive *args="[material]" [attach]="attach()" [parameters]="parameters()">
107
+ <ng-content />
108
+ </ngt-primitive>
68
109
  `,
69
- imports: [NgtArgs],
70
110
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
111
+ changeDetection: ChangeDetectionStrategy.OnPush,
112
+ imports: [NgtArgs],
71
113
  }]
72
- }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
73
- type: Input
74
- }], _time: [{
75
- type: Input,
76
- args: [{ alias: 'time' }]
77
- }], _distort: [{
78
- type: Input,
79
- args: [{ alias: 'distort' }]
80
- }], _radius: [{
81
- type: Input,
82
- args: [{ alias: 'radius' }]
83
- }], _speed: [{
84
- type: Input,
85
- args: [{ alias: 'speed' }]
86
- }] } });
114
+ }], ctorParameters: () => [] });
87
115
 
88
- extend({ MeshReflectorMaterial });
116
+ const defaultOptions$3 = {
117
+ mixBlur: 0,
118
+ mixStrength: 1,
119
+ resolution: 256,
120
+ blur: [0, 0],
121
+ minDepthThreshold: 0.9,
122
+ maxDepthThreshold: 1,
123
+ depthScale: 0,
124
+ depthToBlurRatioBias: 0.25,
125
+ mirror: 0,
126
+ distortion: 1,
127
+ mixContrast: 1,
128
+ reflectorOffset: 0,
129
+ };
89
130
  class NgtsMeshReflectorMaterial {
90
- set _resolution(resolution) {
91
- this.inputs.set({ resolution });
92
- }
93
- set _mixBlur(mixBlur) {
94
- this.inputs.set({ mixBlur });
95
- }
96
- set _mixStrength(mixStrength) {
97
- this.inputs.set({ mixStrength });
98
- }
99
- set _blur(blur) {
100
- this.inputs.set({ blur });
101
- }
102
- set _mirror(mirror) {
103
- this.inputs.set({ mirror });
104
- }
105
- set _minDepthThreshold(minDepthThreshold) {
106
- this.inputs.set({ minDepthThreshold });
107
- }
108
- set _maxDepthThreshold(maxDepthThreshold) {
109
- this.inputs.set({ maxDepthThreshold });
110
- }
111
- set _depthScale(depthScale) {
112
- this.inputs.set({ depthScale });
113
- }
114
- set _depthToBlurRatioBias(depthToBlurRatioBias) {
115
- this.inputs.set({ depthToBlurRatioBias });
116
- }
117
- set _distortionMap(distortionMap) {
118
- this.inputs.set({ distortionMap });
119
- }
120
- set _distortion(distortion) {
121
- this.inputs.set({ distortion });
122
- }
123
- set _mixContrast(mixContrast) {
124
- this.inputs.set({ mixContrast });
125
- }
126
- set _reflectorOffset(reflectorOffset) {
127
- this.inputs.set({ reflectorOffset });
128
- }
129
131
  constructor() {
130
- this.inputs = signalStore({
131
- mixBlur: 0,
132
- mixStrength: 1,
133
- resolution: 256,
134
- blur: [0, 0],
135
- minDepthThreshold: 0.9,
136
- maxDepthThreshold: 1,
137
- depthScale: 0,
138
- depthToBlurRatioBias: 0.25,
139
- mirror: 0,
140
- distortion: 1,
141
- mixContrast: 1,
142
- reflectorOffset: 0,
143
- });
144
- this.materialRef = injectNgtRef();
145
- this.reflectorProps = computed(() => this.states().reflectorProps);
146
- this.defines = computed(() => this.reflectorProps().defines);
147
- this.mirror = computed(() => this.reflectorProps().mirror);
148
- this.textureMatrix = computed(() => this.reflectorProps().textureMatrix);
149
- this.mixBlur = computed(() => this.reflectorProps().mixBlur);
150
- this.tDiffuse = computed(() => this.reflectorProps().tDiffuse);
151
- this.tDepth = computed(() => this.reflectorProps().tDepth);
152
- this.tDiffuseBlur = computed(() => this.reflectorProps().tDiffuseBlur);
153
- this.hasBlur = computed(() => this.reflectorProps().hasBlur);
154
- this.mixStrength = computed(() => this.reflectorProps().mixStrength);
155
- this.minDepthThreshold = computed(() => this.reflectorProps().minDepthThreshold);
156
- this.maxDepthThreshold = computed(() => this.reflectorProps().maxDepthThreshold);
157
- this.depthScale = computed(() => this.reflectorProps().depthScale);
158
- this.depthToBlurRatioBias = computed(() => this.reflectorProps().depthToBlurRatioBias);
159
- this.distortion = computed(() => this.reflectorProps().distortion);
160
- this.distortionMap = computed(() => this.reflectorProps().distortionMap);
161
- this.mixContrast = computed(() => this.reflectorProps().mixContrast);
162
- this.store = injectNgtStore();
132
+ this.attach = input('material');
133
+ this.options = input(defaultOptions$3, { transform: mergeInputs(defaultOptions$3) });
134
+ this.parameters = omit(this.options, [
135
+ 'distortionMap',
136
+ 'resolution',
137
+ 'mixBlur',
138
+ 'mixStrength',
139
+ 'blur',
140
+ 'minDepthThreshold',
141
+ 'maxDepthThreshold',
142
+ 'depthScale',
143
+ 'depthToBlurRatioBias',
144
+ 'mirror',
145
+ 'distortion',
146
+ 'mixContrast',
147
+ 'reflectorOffset',
148
+ ]);
149
+ this.store = injectStore();
163
150
  this.gl = this.store.select('gl');
164
- this.reflectorPlane = new THREE.Plane();
165
- this.normal = new THREE.Vector3();
166
- this.reflectorWorldPosition = new THREE.Vector3();
167
- this.cameraWorldPosition = new THREE.Vector3();
168
- this.rotationMatrix = new THREE.Matrix4();
169
- this.lookAtPosition = new THREE.Vector3(0, 0, -1);
170
- this.clipPlane = new THREE.Vector4();
171
- this.view = new THREE.Vector3();
172
- this.target = new THREE.Vector3();
173
- this.q = new THREE.Vector4();
174
- this.virtualCamera = new THREE.PerspectiveCamera();
175
- this._textureMatrix = new THREE.Matrix4();
176
- this.__blur = this.inputs.select('blur');
177
- this.__resolution = this.inputs.select('resolution');
178
- this.__mirror = this.inputs.select('mirror');
179
- this.__mixBlur = this.inputs.select('mixBlur');
180
- this.__mixStrength = this.inputs.select('mixStrength');
181
- this.__minDepthThreshold = this.inputs.select('minDepthThreshold');
182
- this.__maxDepthThreshold = this.inputs.select('maxDepthThreshold');
183
- this.__depthScale = this.inputs.select('depthScale');
184
- this.__depthToBlurRatioBias = this.inputs.select('depthToBlurRatioBias');
185
- this.__distortion = this.inputs.select('distortion');
186
- this.__distortionMap = this.inputs.select('distortionMap');
187
- this.__mixContrast = this.inputs.select('mixContrast');
151
+ this.materialRef = viewChild('material');
152
+ this.reflectOptions = pick(this.options, [
153
+ 'distortionMap',
154
+ 'resolution',
155
+ 'mixBlur',
156
+ 'mixStrength',
157
+ 'blur',
158
+ 'minDepthThreshold',
159
+ 'maxDepthThreshold',
160
+ 'depthScale',
161
+ 'depthToBlurRatioBias',
162
+ 'mirror',
163
+ 'distortion',
164
+ 'mixContrast',
165
+ 'reflectorOffset',
166
+ ]);
167
+ this.blur = pick(this.reflectOptions, 'blur');
188
168
  this.normalizedBlur = computed(() => {
189
- const blur = this.__blur();
169
+ const blur = this.blur();
190
170
  return Array.isArray(blur) ? blur : [blur, blur];
191
171
  });
192
- this.__hasBlur = computed(() => {
193
- const [x, y] = this.normalizedBlur();
194
- return x + y > 0;
195
- });
196
- this.states = computed(() => {
197
- const gl = this.gl();
198
- const resolution = this.__resolution();
199
- const blur = this.normalizedBlur();
200
- const minDepthThreshold = this.__minDepthThreshold();
201
- const maxDepthThreshold = this.__maxDepthThreshold();
202
- const depthScale = this.__depthScale();
203
- const depthToBlurRatioBias = this.__depthToBlurRatioBias();
204
- const mirror = this.__mirror();
205
- const mixBlur = this.__mixBlur();
206
- const mixStrength = this.__mixStrength();
207
- const mixContrast = this.__mixContrast();
208
- const distortion = this.__distortion();
209
- const distortionMap = this.__distortionMap();
210
- const hasBlur = this.__hasBlur();
211
- const parameters = {
212
- minFilter: THREE.LinearFilter,
213
- magFilter: THREE.LinearFilter,
214
- type: THREE.HalfFloatType,
172
+ this.hasBlur = computed(() => this.normalizedBlur()[0] + this.normalizedBlur()[1] > 0);
173
+ this.reflectorPlane = new Plane();
174
+ this.normal = new Vector3();
175
+ this.reflectorWorldPosition = new Vector3();
176
+ this.cameraWorldPosition = new Vector3();
177
+ this.rotationMatrix = new Matrix4();
178
+ this.lookAtPosition = new Vector3(0, 0, -1);
179
+ this.clipPlane = new Vector4();
180
+ this.view = new Vector3();
181
+ this.target = new Vector3();
182
+ this.q = new Vector4();
183
+ this.textureMatrix = new Matrix4();
184
+ this.virtualCamera = new PerspectiveCamera();
185
+ this.reflectState = computed(() => {
186
+ const [gl, { resolution, minDepthThreshold, maxDepthThreshold, depthScale, depthToBlurRatioBias, mirror, mixBlur, mixStrength, distortion, distortionMap, mixContrast, }, blur, hasBlur,] = [this.gl(), this.reflectOptions(), this.normalizedBlur(), this.hasBlur()];
187
+ const renderTargetParameters = {
188
+ minFilter: LinearFilter,
189
+ magFilter: LinearFilter,
190
+ type: HalfFloatType,
215
191
  };
216
- const fbo1 = new THREE.WebGLRenderTarget(resolution, resolution, parameters);
192
+ const fbo1 = new WebGLRenderTarget(resolution, resolution, renderTargetParameters);
217
193
  fbo1.depthBuffer = true;
218
- fbo1.depthTexture = new THREE.DepthTexture(resolution, resolution);
219
- fbo1.depthTexture.format = THREE.DepthFormat;
220
- fbo1.depthTexture.type = THREE.UnsignedShortType;
221
- const fbo2 = new THREE.WebGLRenderTarget(resolution, resolution, parameters);
194
+ fbo1.depthTexture = new DepthTexture(resolution, resolution);
195
+ fbo1.depthTexture.format = DepthFormat;
196
+ fbo1.depthTexture.type = UnsignedShortType;
197
+ const fbo2 = new WebGLRenderTarget(resolution, resolution, renderTargetParameters);
222
198
  const blurPass = new BlurPass({
223
199
  gl,
224
200
  resolution,
@@ -229,9 +205,19 @@ class NgtsMeshReflectorMaterial {
229
205
  depthScale,
230
206
  depthToBlurRatioBias,
231
207
  });
232
- const reflectorProps = {
208
+ const defines = {};
209
+ if (hasBlur) {
210
+ defines['USE_BLUR'] = '';
211
+ }
212
+ if (depthScale > 0) {
213
+ defines['USE_DEPTH'] = '';
214
+ }
215
+ if (distortionMap) {
216
+ defines['USE_DISTORTION'] = '';
217
+ }
218
+ const reflectorParameters = {
233
219
  mirror,
234
- textureMatrix: this._textureMatrix,
220
+ textureMatrix: this.textureMatrix,
235
221
  mixBlur,
236
222
  tDiffuse: fbo1.texture,
237
223
  tDepth: fbo1.depthTexture,
@@ -245,30 +231,59 @@ class NgtsMeshReflectorMaterial {
245
231
  distortion,
246
232
  distortionMap,
247
233
  mixContrast,
248
- defines: {
249
- USE_BLUR: hasBlur ? '' : undefined,
250
- USE_DEPTH: depthScale > 0 ? '' : undefined,
251
- USE_DISTORTION: distortionMap ? '' : undefined,
252
- },
234
+ defines,
253
235
  };
254
- return { fbo1, fbo2, blurPass, reflectorProps };
236
+ return { fbo1, fbo2, blurPass, reflectorParameters };
255
237
  });
256
- injectBeforeRender(this.onBeforeRender.bind(this));
257
- }
258
- onBeforeRender(state) {
259
- if (!this.materialRef.nativeElement)
260
- return;
261
- const parent = getLocalState(this.materialRef.nativeElement).parent?.();
262
- if (!parent)
263
- return;
264
- const { gl, scene } = state;
265
- const hasBlur = this.__hasBlur();
266
- const { fbo1, fbo2, blurPass } = this.states();
267
- if (fbo1 && fbo2 && blurPass) {
238
+ this.definesKey = computed(() => {
239
+ const defines = this.reflectState().reflectorParameters.defines;
240
+ return Object.entries(defines).reduce((acc, [key, value]) => (value != null ? `${acc} ${key}` : acc), '');
241
+ });
242
+ this.material = computed(() => {
243
+ const prevMaterial = untracked(this.materialRef)?.nativeElement;
244
+ if (prevMaterial) {
245
+ prevMaterial.dispose();
246
+ delete prevMaterial['__ngt__'];
247
+ delete prevMaterial['__ngt_renderer__'];
248
+ }
249
+ // tracking defines key so that the material is recreated when the defines change
250
+ this.definesKey();
251
+ return new MeshReflectorMaterial();
252
+ });
253
+ const autoEffect = injectAutoEffect();
254
+ afterNextRender(() => {
255
+ autoEffect(() => {
256
+ const material = this.materialRef()?.nativeElement;
257
+ if (!material)
258
+ return;
259
+ const { reflectorParameters } = this.reflectState();
260
+ applyProps(material, { ...reflectorParameters, ...this.parameters() });
261
+ });
262
+ });
263
+ inject(DestroyRef).onDestroy(() => {
264
+ const material = this.materialRef()?.nativeElement;
265
+ if (material) {
266
+ material.dispose();
267
+ delete material['__ngt__'];
268
+ delete material['__ngt_renderer__'];
269
+ }
270
+ });
271
+ injectBeforeRender(({ gl, scene }) => {
272
+ const material = this.materialRef()?.nativeElement;
273
+ if (!material)
274
+ return;
275
+ const localState = getLocalState(material);
276
+ if (!localState)
277
+ return;
278
+ const parent = Reflect.get(material, 'parent') ?? untracked(localState.parent);
279
+ if (!parent)
280
+ return;
281
+ const { fbo1, fbo2, blurPass } = this.reflectState();
282
+ const hasBlur = this.hasBlur();
268
283
  parent.visible = false;
269
284
  const currentXrEnabled = gl.xr.enabled;
270
285
  const currentShadowAutoUpdate = gl.shadowMap.autoUpdate;
271
- this.beforeRender(state);
286
+ this.beforeRender();
272
287
  gl.xr.enabled = false;
273
288
  gl.shadowMap.autoUpdate = false;
274
289
  gl.setRenderTarget(fbo1);
@@ -282,19 +297,26 @@ class NgtsMeshReflectorMaterial {
282
297
  gl.shadowMap.autoUpdate = currentShadowAutoUpdate;
283
298
  parent.visible = true;
284
299
  gl.setRenderTarget(null);
285
- }
300
+ });
286
301
  }
287
- beforeRender(state) {
288
- const parent = getLocalState(this.materialRef.nativeElement).parent?.();
302
+ beforeRender() {
303
+ const material = this.materialRef()?.nativeElement;
304
+ if (!material)
305
+ return;
306
+ const localState = getLocalState(material);
307
+ if (!localState)
308
+ return;
309
+ const parent = Reflect.get(material, 'parent') ?? untracked(localState.parent);
289
310
  if (!parent)
290
311
  return;
291
- const { camera } = state;
312
+ const { camera } = this.store.snapshot;
313
+ const { reflectorOffset } = untracked(this.reflectOptions);
292
314
  this.reflectorWorldPosition.setFromMatrixPosition(parent.matrixWorld);
293
315
  this.cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);
294
316
  this.rotationMatrix.extractRotation(parent.matrixWorld);
295
317
  this.normal.set(0, 0, 1);
296
318
  this.normal.applyMatrix4(this.rotationMatrix);
297
- this.reflectorWorldPosition.addScaledVector(this.normal, this.inputs.get('reflectorOffset'));
319
+ this.reflectorWorldPosition.addScaledVector(this.normal, reflectorOffset);
298
320
  this.view.subVectors(this.reflectorWorldPosition, this.cameraWorldPosition);
299
321
  // Avoid rendering when reflector is facing away
300
322
  if (this.view.dot(this.normal) > 0)
@@ -317,10 +339,10 @@ class NgtsMeshReflectorMaterial {
317
339
  this.virtualCamera.updateMatrixWorld();
318
340
  this.virtualCamera.projectionMatrix.copy(camera.projectionMatrix);
319
341
  // Update the texture matrix
320
- this._textureMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);
321
- this._textureMatrix.multiply(this.virtualCamera.projectionMatrix);
322
- this._textureMatrix.multiply(this.virtualCamera.matrixWorldInverse);
323
- this._textureMatrix.multiply(parent.matrixWorld);
342
+ this.textureMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);
343
+ this.textureMatrix.multiply(this.virtualCamera.projectionMatrix);
344
+ this.textureMatrix.multiply(this.virtualCamera.matrixWorldInverse);
345
+ this.textureMatrix.multiply(parent.matrixWorld);
324
346
  // Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html
325
347
  // Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
326
348
  this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal, this.reflectorWorldPosition);
@@ -339,162 +361,59 @@ class NgtsMeshReflectorMaterial {
339
361
  projectionMatrix.elements[10] = this.clipPlane.z + 1.0;
340
362
  projectionMatrix.elements[14] = this.clipPlane.w;
341
363
  }
342
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshReflectorMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
343
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsMeshReflectorMaterial, isStandalone: true, selector: "ngts-mesh-reflector-material", inputs: { materialRef: "materialRef", _resolution: ["resolution", "_resolution"], _mixBlur: ["mixBlur", "_mixBlur"], _mixStrength: ["mixStrength", "_mixStrength"], _blur: ["blur", "_blur"], _mirror: ["mirror", "_mirror"], _minDepthThreshold: ["minDepthThreshold", "_minDepthThreshold"], _maxDepthThreshold: ["maxDepthThreshold", "_maxDepthThreshold"], _depthScale: ["depthScale", "_depthScale"], _depthToBlurRatioBias: ["depthToBlurRatioBias", "_depthToBlurRatioBias"], _distortionMap: ["distortionMap", "_distortionMap"], _distortion: ["distortion", "_distortion"], _mixContrast: ["mixContrast", "_mixContrast"], _reflectorOffset: ["reflectorOffset", "_reflectorOffset"] }, ngImport: i0, template: `
344
- <ngt-mesh-reflector-material
345
- *ngIf="defines() as defines"
346
- [key]="defines"
347
- ngtCompound
348
- attach="material"
349
- [ref]="materialRef"
350
- [defines]="defines"
351
- [mirror]="mirror()"
352
- [textureMatrix]="textureMatrix()"
353
- [mixBlur]="mixBlur()"
354
- [tDiffuse]="tDiffuse()"
355
- [tDepth]="tDepth()"
356
- [tDiffuseBlur]="tDiffuseBlur()"
357
- [hasBlur]="hasBlur()"
358
- [mixStrength]="mixStrength()"
359
- [minDepthThreshold]="minDepthThreshold()"
360
- [maxDepthThreshold]="maxDepthThreshold()"
361
- [depthScale]="depthScale()"
362
- [depthToBlurRatioBias]="depthToBlurRatioBias()"
363
- [distortion]="distortion()"
364
- [distortionMap]="distortionMap()"
365
- [mixContrast]="mixContrast()"
366
- >
364
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshReflectorMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
365
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsMeshReflectorMaterial, isStandalone: true, selector: "ngts-mesh-reflector-material", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "materialRef", first: true, predicate: ["material"], descendants: true, isSignal: true }], ngImport: i0, template: `
366
+ <ngt-primitive #material *args="[material()]" [attach]="attach()">
367
367
  <ng-content />
368
- </ngt-mesh-reflector-material>
369
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
368
+ </ngt-primitive>
369
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
370
370
  }
371
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshReflectorMaterial, decorators: [{
371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshReflectorMaterial, decorators: [{
372
372
  type: Component,
373
373
  args: [{
374
374
  selector: 'ngts-mesh-reflector-material',
375
375
  standalone: true,
376
376
  template: `
377
- <ngt-mesh-reflector-material
378
- *ngIf="defines() as defines"
379
- [key]="defines"
380
- ngtCompound
381
- attach="material"
382
- [ref]="materialRef"
383
- [defines]="defines"
384
- [mirror]="mirror()"
385
- [textureMatrix]="textureMatrix()"
386
- [mixBlur]="mixBlur()"
387
- [tDiffuse]="tDiffuse()"
388
- [tDepth]="tDepth()"
389
- [tDiffuseBlur]="tDiffuseBlur()"
390
- [hasBlur]="hasBlur()"
391
- [mixStrength]="mixStrength()"
392
- [minDepthThreshold]="minDepthThreshold()"
393
- [maxDepthThreshold]="maxDepthThreshold()"
394
- [depthScale]="depthScale()"
395
- [depthToBlurRatioBias]="depthToBlurRatioBias()"
396
- [distortion]="distortion()"
397
- [distortionMap]="distortionMap()"
398
- [mixContrast]="mixContrast()"
399
- >
377
+ <ngt-primitive #material *args="[material()]" [attach]="attach()">
400
378
  <ng-content />
401
- </ngt-mesh-reflector-material>
379
+ </ngt-primitive>
402
380
  `,
403
- imports: [NgIf, NgtKey],
404
381
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
382
+ changeDetection: ChangeDetectionStrategy.OnPush,
383
+ imports: [NgtArgs],
405
384
  }]
406
- }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
407
- type: Input
408
- }], _resolution: [{
409
- type: Input,
410
- args: [{ alias: 'resolution' }]
411
- }], _mixBlur: [{
412
- type: Input,
413
- args: [{ alias: 'mixBlur' }]
414
- }], _mixStrength: [{
415
- type: Input,
416
- args: [{ alias: 'mixStrength' }]
417
- }], _blur: [{
418
- type: Input,
419
- args: [{ alias: 'blur' }]
420
- }], _mirror: [{
421
- type: Input,
422
- args: [{ alias: 'mirror' }]
423
- }], _minDepthThreshold: [{
424
- type: Input,
425
- args: [{ alias: 'minDepthThreshold' }]
426
- }], _maxDepthThreshold: [{
427
- type: Input,
428
- args: [{ alias: 'maxDepthThreshold' }]
429
- }], _depthScale: [{
430
- type: Input,
431
- args: [{ alias: 'depthScale' }]
432
- }], _depthToBlurRatioBias: [{
433
- type: Input,
434
- args: [{ alias: 'depthToBlurRatioBias' }]
435
- }], _distortionMap: [{
436
- type: Input,
437
- args: [{ alias: 'distortionMap' }]
438
- }], _distortion: [{
439
- type: Input,
440
- args: [{ alias: 'distortion' }]
441
- }], _mixContrast: [{
442
- type: Input,
443
- args: [{ alias: 'mixContrast' }]
444
- }], _reflectorOffset: [{
445
- type: Input,
446
- args: [{ alias: 'reflectorOffset' }]
447
- }] } });
385
+ }], ctorParameters: () => [] });
448
386
 
449
- extend({ MeshRefractionMaterial });
450
- const isCubeTexture = (def) => def && def.isCubeTexture;
387
+ const defaultOptions$2 = {
388
+ bounces: 2,
389
+ ior: 2.4,
390
+ fresnel: 0,
391
+ aberrationStrength: 0,
392
+ color: 'white',
393
+ fastChroma: true,
394
+ };
395
+ function isCubeTexture(def) {
396
+ return def && def.isCubeTexture;
397
+ }
451
398
  class NgtsMeshRefractionMaterial {
452
- /** Environment map */
453
- set _envMap(envMap) {
454
- this.inputs.set({ envMap });
455
- }
456
- /** Number of ray-cast bounces, it can be expensive to have too many, 2 */
457
- set _bounces(bounces) {
458
- this.inputs.set({ bounces });
459
- }
460
- /** Refraction index, 2.4 */
461
- set _ior(ior) {
462
- this.inputs.set({ ior });
463
- }
464
- /** Fresnel (strip light), 0 */
465
- set _fresnel(fresnel) {
466
- this.inputs.set({ fresnel });
467
- }
468
- /** RGB shift intensity, can be expensive, 0 */
469
- set _aberrationStrength(aberrationStrength) {
470
- this.inputs.set({ aberrationStrength });
471
- }
472
- /** Color, white */
473
- set _color(color) {
474
- this.inputs.set({ color });
475
- }
476
- /** If this is on it uses fewer ray casts for the RGB shift sacrificing physical accuracy, true */
477
- set _fastChroma(fastChroma) {
478
- this.inputs.set({ fastChroma });
479
- }
480
399
  constructor() {
481
- this.inputs = signalStore({ aberrationStrength: 0, fastChroma: true });
482
- this.materialRef = injectNgtRef();
483
- this.envMap = this.inputs.select('envMap');
484
- this.bounces = this.inputs.select('bounces');
485
- this.ior = this.inputs.select('ior');
486
- this.fresnel = this.inputs.select('fresnel');
487
- this.aberrationStrength = this.inputs.select('aberrationStrength');
488
- this.color = this.inputs.select('color');
489
- this.fastChroma = this.inputs.select('fastChroma');
490
- this.store = injectNgtStore();
400
+ this.envMap = input.required();
401
+ this.attach = input('material');
402
+ this.options = input(defaultOptions$2, { transform: mergeInputs(defaultOptions$2) });
403
+ this.parameters = omit(this.options, ['fastChroma', 'aberrationStrength']);
404
+ this.fastChroma = pick(this.options, 'fastChroma');
405
+ this.aberrationStrength = pick(this.options, 'aberrationStrength');
406
+ this.materialRef = viewChild('material');
407
+ this.store = injectStore();
491
408
  this.size = this.store.select('size');
409
+ this.resolution = computed(() => [this.size().width, this.size().height]);
492
410
  this.defines = computed(() => {
493
- const [envMap, aberrationStrength, fastChroma] = [this.envMap(), this.aberrationStrength(), this.fastChroma()];
494
- if (!envMap)
495
- return null;
496
411
  const temp = {};
497
- // Sampler2D and SamplerCube need different defines
412
+ const [envMap, aberrationStrength, fastChroma] = [
413
+ untracked(this.envMap),
414
+ this.aberrationStrength(),
415
+ this.fastChroma(),
416
+ ];
498
417
  const isCubeMap = isCubeTexture(envMap);
499
418
  const w = (isCubeMap ? envMap.image[0]?.width : envMap.image.width) ?? 1024;
500
419
  const cubeSize = w / 4;
@@ -514,484 +433,344 @@ class NgtsMeshRefractionMaterial {
514
433
  temp['FAST_CHROMA'] = '';
515
434
  return temp;
516
435
  });
517
- this.resolution = computed(() => [this.size().width, this.size().height]);
436
+ this.defineKeys = computed(() => {
437
+ return Object.keys(this.defines()).join(' ');
438
+ });
439
+ this.material = computed(() => {
440
+ const prevMaterial = untracked(this.materialRef)?.nativeElement;
441
+ if (prevMaterial) {
442
+ prevMaterial.dispose();
443
+ delete prevMaterial['__ngt__'];
444
+ delete prevMaterial['__ngt_renderer__'];
445
+ }
446
+ // track by this.defineKeys
447
+ this.defineKeys();
448
+ return new MeshRefractionMaterial();
449
+ });
450
+ const autoEffect = injectAutoEffect();
451
+ afterNextRender(() => {
452
+ autoEffect(() => {
453
+ const material = this.materialRef()?.nativeElement;
454
+ if (!material)
455
+ return;
456
+ const localState = getLocalState(material);
457
+ if (!localState)
458
+ return;
459
+ const parent = untracked(localState.parent);
460
+ const geometry = parent.geometry;
461
+ if (geometry) {
462
+ material.bvh = new MeshBVHUniformStruct();
463
+ material.bvh.updateFrom(new MeshBVH(geometry.clone().toNonIndexed(), { strategy: SAH }));
464
+ }
465
+ });
466
+ });
518
467
  injectBeforeRender(({ camera }) => {
519
- const material = this.materialRef.nativeElement;
468
+ const material = this.materialRef()?.nativeElement;
520
469
  if (material) {
521
470
  material.viewMatrixInverse = camera.matrixWorld;
522
471
  material.projectionMatrixInverse = camera.projectionMatrixInverse;
523
472
  }
524
473
  });
525
- this.setupGeometry();
526
- }
527
- setupGeometry() {
528
- effect(() => {
529
- const material = this.materialRef.nativeElement;
530
- if (!material)
531
- return;
532
- const geometry = getLocalState(material).parent?.()?.geometry;
533
- if (geometry) {
534
- material.bvh = new MeshBVHUniformStruct();
535
- material.bvh.updateFrom(new MeshBVH(geometry.clone().toNonIndexed(), { lazyGeneration: false, strategy: SAH }));
474
+ inject(DestroyRef).onDestroy(() => {
475
+ const material = this.materialRef()?.nativeElement;
476
+ if (material) {
477
+ material.dispose();
478
+ delete material['__ngt__'];
479
+ delete material['__ngt_renderer__'];
536
480
  }
537
481
  });
538
482
  }
539
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshRefractionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
540
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsMeshRefractionMaterial, isStandalone: true, selector: "ngts-mesh-refraction-material", inputs: { materialRef: "materialRef", _envMap: ["envMap", "_envMap"], _bounces: ["bounces", "_bounces"], _ior: ["ior", "_ior"], _fresnel: ["fresnel", "_fresnel"], _aberrationStrength: ["aberrationStrength", "_aberrationStrength"], _color: ["color", "_color"], _fastChroma: ["fastChroma", "_fastChroma"] }, ngImport: i0, template: `
541
- <ngt-mesh-refraction-material
542
- *ngIf="defines() as defines"
543
- [key]="defines"
544
- [ref]="materialRef"
545
- [defines]="defines"
546
- [resolution]="resolution()"
547
- [aberrationStrength]="aberrationStrength()"
483
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshRefractionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
484
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsMeshRefractionMaterial, isStandalone: true, selector: "ngts-mesh-refraction-material", inputs: { envMap: { classPropertyName: "envMap", publicName: "envMap", isSignal: true, isRequired: true, transformFunction: null }, attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "materialRef", first: true, predicate: ["material"], descendants: true, isSignal: true }], ngImport: i0, template: `
485
+ <ngt-primitive
486
+ *args="[material()]"
487
+ #material
488
+ [attach]="attach()"
489
+ [parameters]="parameters()"
548
490
  [envMap]="envMap()"
549
- [bounces]="bounces()"
550
- [ior]="ior()"
551
- [fresnel]="fresnel()"
552
- [color]="color()"
553
- [fastChroma]="fastChroma()"
554
- ngtCompound
555
- attach="material"
491
+ [aberrationStrength]="aberrationStrength()"
492
+ [resolution]="resolution()"
493
+ [defines]="defines()"
556
494
  >
557
495
  <ng-content />
558
- </ngt-mesh-refraction-material>
559
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
496
+ </ngt-primitive>
497
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
560
498
  }
561
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshRefractionMaterial, decorators: [{
499
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshRefractionMaterial, decorators: [{
562
500
  type: Component,
563
501
  args: [{
564
502
  selector: 'ngts-mesh-refraction-material',
565
503
  standalone: true,
566
504
  template: `
567
- <ngt-mesh-refraction-material
568
- *ngIf="defines() as defines"
569
- [key]="defines"
570
- [ref]="materialRef"
571
- [defines]="defines"
572
- [resolution]="resolution()"
573
- [aberrationStrength]="aberrationStrength()"
505
+ <ngt-primitive
506
+ *args="[material()]"
507
+ #material
508
+ [attach]="attach()"
509
+ [parameters]="parameters()"
574
510
  [envMap]="envMap()"
575
- [bounces]="bounces()"
576
- [ior]="ior()"
577
- [fresnel]="fresnel()"
578
- [color]="color()"
579
- [fastChroma]="fastChroma()"
580
- ngtCompound
581
- attach="material"
511
+ [aberrationStrength]="aberrationStrength()"
512
+ [resolution]="resolution()"
513
+ [defines]="defines()"
582
514
  >
583
515
  <ng-content />
584
- </ngt-mesh-refraction-material>
516
+ </ngt-primitive>
585
517
  `,
586
- imports: [NgIf, NgtKey],
587
518
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
519
+ changeDetection: ChangeDetectionStrategy.OnPush,
520
+ imports: [NgtArgs],
588
521
  }]
589
- }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
590
- type: Input
591
- }], _envMap: [{
592
- type: Input,
593
- args: [{ required: true, alias: 'envMap' }]
594
- }], _bounces: [{
595
- type: Input,
596
- args: [{ alias: 'bounces' }]
597
- }], _ior: [{
598
- type: Input,
599
- args: [{ alias: 'ior' }]
600
- }], _fresnel: [{
601
- type: Input,
602
- args: [{ alias: 'fresnel' }]
603
- }], _aberrationStrength: [{
604
- type: Input,
605
- args: [{ alias: 'aberrationStrength' }]
606
- }], _color: [{
607
- type: Input,
608
- args: [{ alias: 'color' }]
609
- }], _fastChroma: [{
610
- type: Input,
611
- args: [{ alias: 'fastChroma' }]
612
- }] } });
522
+ }], ctorParameters: () => [] });
613
523
 
614
- extend({ MeshTransmissionMaterial });
615
- class NgtsMeshTranmissionMaterial {
616
- /** transmissionSampler, you can use the threejs transmission sampler texture that is
617
- * generated once for all transmissive materials. The upside is that it can be faster if you
618
- * use multiple MeshPhysical and Transmission materials, the downside is that transmissive materials
619
- * using this can't see other transparent or transmissive objects, default: false */
620
- set _transmissionSampler(transmissionSampler) {
621
- this.inputs.set({ transmissionSampler });
622
- }
623
- /** Render the backside of the material (more cost, better results), default: false */
624
- set _backside(backside) {
625
- this.inputs.set({ backside });
626
- }
627
- /** Backside thickness (when backside is true), default: 0 */
628
- set _backsideThickness(backsideThickness) {
629
- this.inputs.set({ backsideThickness });
630
- }
631
- /** Resolution of the local buffer, default: undefined (fullscreen) */
632
- set _resolution(resolution) {
633
- this.inputs.set({ resolution });
634
- }
635
- /** Resolution of the local buffer for backfaces, default: undefined (fullscreen) */
636
- set _backsideResolution(backsideResolution) {
637
- this.inputs.set({ backsideResolution });
638
- }
639
- /** Refraction samples, default: 10 */
640
- set _samples(samples) {
641
- this.inputs.set({ samples });
642
- }
643
- /** Buffer scene background (can be a texture, a cubetexture or a color), default: null */
644
- set _background(background) {
645
- this.inputs.set({ background });
646
- }
647
- /* Transmission, default: 1 */
648
- set _transmission(transmission) {
649
- this.inputs.set({ transmission });
650
- }
651
- /* Thickness (refraction), default: 0 */
652
- set _thickness(thickness) {
653
- this.inputs.set({ thickness });
654
- }
655
- /* Roughness (blur), default: 0 */
656
- set _roughness(roughness) {
657
- this.inputs.set({ roughness });
658
- }
659
- /* Chromatic aberration, default: 0.03 */
660
- set _chromaticAberration(chromaticAberration) {
661
- this.inputs.set({ chromaticAberration });
662
- }
663
- /* Anisotropy, default: 0.1 */
664
- set _anisotropy(anisotropy) {
665
- this.inputs.set({ anisotropy });
666
- }
667
- /* AnisotropicBlur, default: 0.1 */
668
- set _anisotropicBlur(anisotropicBlur) {
669
- this.inputs.set({ anisotropicBlur });
670
- }
671
- /* Distortion, default: 0 */
672
- set _distortion(distortion) {
673
- this.inputs.set({ distortion });
674
- }
675
- /* Distortion scale, default: 0.5 */
676
- set _distortionScale(distortionScale) {
677
- this.inputs.set({ distortionScale });
678
- }
679
- /* Temporal distortion (speed of movement), default: 0.0 */
680
- set _temporalDistortion(temporalDistortion) {
681
- this.inputs.set({ temporalDistortion });
682
- }
683
- /** The scene rendered into a texture (use it to share a texture between materials), default: null */
684
- set _buffer(buffer) {
685
- this.inputs.set({ buffer });
686
- }
687
- /** Internals */
688
- set _time(time) {
689
- this.inputs.set({ time });
690
- }
524
+ const defaultOptions$1 = {
525
+ transmissionSampler: false,
526
+ backside: false,
527
+ side: FrontSide,
528
+ transmission: 1,
529
+ thickness: 0,
530
+ backsideThickness: 0,
531
+ backsideEnvMapIntensity: 1,
532
+ samples: 10,
533
+ };
534
+ class NgtsMeshTransmissionMaterial {
691
535
  constructor() {
692
- this.inputs = signalStore({
693
- transmissionSampler: false,
694
- backside: false,
695
- transmission: 1,
696
- thickness: 0,
697
- backsideThickness: 0,
698
- samples: 10,
699
- roughness: 0,
700
- anisotropy: 0.1,
701
- anisotropicBlur: 0.1,
702
- chromaticAberration: 0.03,
703
- distortion: 0,
704
- distortionScale: 0.5,
705
- temporalDistortion: 0.0,
706
- buffer: null,
536
+ this.attach = input('material');
537
+ this.options = input(defaultOptions$1, { transform: mergeInputs(defaultOptions$1) });
538
+ this.parameters = omit(this.options, [
539
+ 'buffer',
540
+ 'transmissionSampler',
541
+ 'backside',
542
+ 'side',
543
+ 'transmission',
544
+ 'thickness',
545
+ 'backsideThickness',
546
+ 'backsideEnvMapIntensity',
547
+ 'samples',
548
+ 'resolution',
549
+ 'backsideResolution',
550
+ 'background',
551
+ 'anisotropy',
552
+ 'anisotropicBlur',
553
+ ]);
554
+ this.resolution = pick(this.options, 'resolution');
555
+ this.backsideResolution = pick(this.options, 'backsideResolution');
556
+ this.samples = pick(this.options, 'samples');
557
+ this.buffer = pick(this.options, 'buffer');
558
+ this.anisotropy = pick(this.options, 'anisotropy');
559
+ this.anisotropicBlur = pick(this.options, 'anisotropicBlur');
560
+ this.background = pick(this.options, 'background');
561
+ this.backside = pick(this.options, 'backside');
562
+ this.backsideThickness = pick(this.options, 'backsideThickness');
563
+ this.backsideEnvMapIntensity = pick(this.options, 'backsideEnvMapIntensity');
564
+ this.transmissionSampler = pick(this.options, 'transmissionSampler');
565
+ this.transmission = pick(this.options, 'transmission');
566
+ this.thickness = pick(this.options, 'thickness');
567
+ this.side = pick(this.options, 'side');
568
+ this.materialRef = viewChild('material');
569
+ this.backResolution = computed(() => this.backsideResolution() || this.resolution());
570
+ this.fboBack = injectFBO(() => ({ width: this.backResolution() }));
571
+ this.fboMain = injectFBO(() => ({ width: this.resolution() }));
572
+ this.bufferTexture = computed(() => this.buffer() || this.fboMain().texture);
573
+ this.anisotropicBlurOption = computed(() => this.anisotropicBlur() || this.anisotropy());
574
+ this.discardMaterial = new MeshDiscardMaterial();
575
+ this.material = computed(() => {
576
+ const previousMaterial = untracked(this.materialRef)?.nativeElement;
577
+ if (previousMaterial) {
578
+ previousMaterial.dispose();
579
+ delete previousMaterial['__ngt__'];
580
+ delete previousMaterial['__ngt_renderer__'];
581
+ }
582
+ const [samples, transmissionSampler] = [this.samples(), this.transmissionSampler()];
583
+ return new MeshTransmissionMaterial({ samples, transmissionSampler });
584
+ });
585
+ inject(DestroyRef).onDestroy(() => {
586
+ const material = this.materialRef()?.nativeElement;
587
+ if (material) {
588
+ material.dispose();
589
+ delete material['__ngt__'];
590
+ delete material['__ngt_renderer__'];
591
+ }
707
592
  });
708
- this.materialRef = injectNgtRef();
709
- this.transmissionSampler = this.inputs.select('transmissionSampler');
710
- this.backside = this.inputs.select('backside');
711
- this.transmission = this.inputs.select('transmission');
712
- this.thickness = this.inputs.select('thickness');
713
- this.backsideThickness = this.inputs.select('backsideThickness');
714
- this.samples = this.inputs.select('samples');
715
- this.roughness = this.inputs.select('roughness');
716
- this.anisotropy = this.inputs.select('anisotropy');
717
- this.anisotropicBlur = this.inputs.select('anisotropicBlur');
718
- this.chromaticAberration = this.inputs.select('chromaticAberration');
719
- this.distortion = this.inputs.select('distortion');
720
- this.distortionScale = this.inputs.select('distortionScale');
721
- this.temporalDistortion = this.inputs.select('temporalDistortion');
722
- this.buffer = this.inputs.select('buffer');
723
- this.time = this.inputs.select('time');
724
- this.discardMaterial = new DiscardMaterial();
725
- this.backsideResolution = this.inputs.select('backsideResolution');
726
- this.resolution = this.inputs.select('resolution');
727
- this.fboBackSettings = computed(() => ({ width: this.backsideResolution() || this.resolution() }));
728
- this.fboMainSettings = computed(() => ({ width: this.resolution() }));
729
- this.fboBackRef = injectNgtsFBO(this.fboBackSettings);
730
- this.fboMainRef = injectNgtsFBO(this.fboMainSettings);
731
- this.side = THREE.FrontSide;
732
593
  let oldBg;
594
+ let oldEnvMapIntensity;
733
595
  let oldTone;
734
596
  let parent;
735
- injectBeforeRender((state) => {
736
- if (!this.materialRef.nativeElement)
597
+ injectBeforeRender(({ clock, gl, scene, camera }) => {
598
+ const material = this.materialRef()?.nativeElement;
599
+ if (!material)
737
600
  return;
738
- const { transmissionSampler, background, backside, backsideThickness, thickness } = this.inputs.get();
739
- this.materialRef.nativeElement.time = state.clock.getElapsedTime();
601
+ const [fboMain, fboBack, transmissionSampler, background, backside, backsideThickness, backsideEnvMapIntensity, thickness, side,] = [
602
+ this.fboMain(),
603
+ this.fboBack(),
604
+ this.transmissionSampler(),
605
+ this.background(),
606
+ this.backside(),
607
+ this.backsideThickness(),
608
+ this.backsideEnvMapIntensity(),
609
+ this.thickness(),
610
+ this.side(),
611
+ ];
612
+ material.time = clock.getElapsedTime();
740
613
  // Render only if the buffer matches the built-in and no transmission sampler is set
741
- if (this.materialRef.nativeElement.buffer === this.fboMainRef.nativeElement?.texture &&
742
- !transmissionSampler) {
743
- parent = getLocalState(this.materialRef.nativeElement).parent?.();
614
+ // @ts-expect-error - we know material.buffer is not just undefined | null
615
+ if (material.buffer === fboMain.texture && !transmissionSampler) {
616
+ parent = getLocalState(material)?.parent();
744
617
  if (parent) {
745
618
  // Save defaults
746
- oldTone = state.gl.toneMapping;
747
- oldBg = state.scene.background;
619
+ oldTone = gl.toneMapping;
620
+ oldBg = scene.background;
621
+ oldEnvMapIntensity = material.envMapIntensity;
748
622
  // Switch off tonemapping lest it double tone maps
749
623
  // Save the current background and set the HDR as the new BG
750
624
  // Use discardmaterial, the parent will be invisible, but it's shadows will still be cast
751
- state.gl.toneMapping = THREE.NoToneMapping;
625
+ gl.toneMapping = NoToneMapping;
752
626
  if (background)
753
- state.scene.background = background;
754
- parent['material'] = this.discardMaterial;
627
+ scene.background = background;
628
+ parent.material = this.discardMaterial;
755
629
  if (backside) {
756
630
  // Render into the backside buffer
757
- state.gl.setRenderTarget(this.fboBackRef.nativeElement);
758
- state.gl.render(state.scene, state.camera);
631
+ gl.setRenderTarget(fboBack);
632
+ gl.render(scene, camera);
759
633
  // And now prepare the material for the main render using the backside buffer
760
- parent['material'] = this.materialRef.nativeElement;
761
- parent['material'].buffer = this.fboBackRef.nativeElement?.texture;
762
- parent['material'].thickness = backsideThickness;
763
- parent['material'].side = THREE.BackSide;
634
+ parent.material = material;
635
+ Object.assign(parent.material, {
636
+ buffer: fboBack.texture,
637
+ thickness: backsideThickness,
638
+ side: BackSide,
639
+ envMapIntensity: backsideEnvMapIntensity,
640
+ });
764
641
  }
765
642
  // Render into the main buffer
766
- state.gl.setRenderTarget(this.fboMainRef.nativeElement);
767
- state.gl.render(state.scene, state.camera);
768
- parent['material'].thickness = thickness;
769
- parent['material'].side = this.side;
770
- parent['material'].buffer = this.fboMainRef.nativeElement?.texture;
643
+ gl.setRenderTarget(fboMain);
644
+ gl.render(scene, camera);
645
+ parent.material = material;
646
+ Object.assign(parent.material, {
647
+ buffer: fboMain.texture,
648
+ thickness,
649
+ side,
650
+ envMapIntensity: oldEnvMapIntensity,
651
+ });
771
652
  // Set old state back
772
- state.scene.background = oldBg;
773
- state.gl.setRenderTarget(null);
774
- parent['material'] = this.materialRef.nativeElement;
775
- state.gl.toneMapping = oldTone;
653
+ scene.background = oldBg;
654
+ gl.setRenderTarget(null);
655
+ gl.toneMapping = oldTone;
776
656
  }
777
657
  }
778
658
  });
779
659
  }
780
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshTranmissionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
781
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsMeshTranmissionMaterial, isStandalone: true, selector: "ngts-mesh-transmission-material", inputs: { materialRef: "materialRef", _transmissionSampler: ["transmissionSampler", "_transmissionSampler"], _backside: ["backside", "_backside"], _backsideThickness: ["backsideThickness", "_backsideThickness"], _resolution: ["resolution", "_resolution"], _backsideResolution: ["backsideResolution", "_backsideResolution"], _samples: ["samples", "_samples"], _background: ["background", "_background"], _transmission: ["transmission", "_transmission"], _thickness: ["thickness", "_thickness"], _roughness: ["roughness", "_roughness"], _chromaticAberration: ["chromaticAberration", "_chromaticAberration"], _anisotropy: ["anisotropy", "_anisotropy"], _anisotropicBlur: ["anisotropicBlur", "_anisotropicBlur"], _distortion: ["distortion", "_distortion"], _distortionScale: ["distortionScale", "_distortionScale"], _temporalDistortion: ["temporalDistortion", "_temporalDistortion"], _buffer: ["buffer", "_buffer"], _time: ["time", "_time"] }, ngImport: i0, template: `
782
- <ngt-mesh-transmission-material
783
- ngtCompound
784
- *args="[samples(), transmissionSampler()]"
785
- [ref]="materialRef"
786
- [buffer]="buffer() || fboMainRef.nativeElement?.texture"
660
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshTransmissionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
661
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsMeshTransmissionMaterial, isStandalone: true, selector: "ngts-mesh-transmission-material", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "materialRef", first: true, predicate: ["material"], descendants: true, isSignal: true }], ngImport: i0, template: `
662
+ <ngt-primitive
663
+ *args="[material()]"
664
+ #material
665
+ [attach]="attach()"
666
+ [parameters]="parameters()"
787
667
  [_transmission]="transmission()"
788
668
  [transmission]="transmissionSampler() ? transmission() : 0"
669
+ [buffer]="bufferTexture()"
670
+ [anisotropicBlur]="anisotropicBlurOption()"
671
+ [side]="side()"
789
672
  [thickness]="thickness()"
790
- [side]="side"
791
- [anisotropicBlur]="anisotropicBlur() ?? anisotropy()"
792
- [roughness]="roughness()"
793
- [chromaticAberration]="chromaticAberration()"
794
- [distortion]="distortion()"
795
- [distortionScale]="distortionScale()"
796
- [temporalDistortion]="temporalDistortion()"
797
- [time]="time()"
798
- />
799
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
673
+ >
674
+ <ng-content />
675
+ </ngt-primitive>
676
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
800
677
  }
801
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshTranmissionMaterial, decorators: [{
678
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshTransmissionMaterial, decorators: [{
802
679
  type: Component,
803
680
  args: [{
804
681
  selector: 'ngts-mesh-transmission-material',
805
682
  standalone: true,
806
683
  template: `
807
- <ngt-mesh-transmission-material
808
- ngtCompound
809
- *args="[samples(), transmissionSampler()]"
810
- [ref]="materialRef"
811
- [buffer]="buffer() || fboMainRef.nativeElement?.texture"
684
+ <ngt-primitive
685
+ *args="[material()]"
686
+ #material
687
+ [attach]="attach()"
688
+ [parameters]="parameters()"
812
689
  [_transmission]="transmission()"
813
690
  [transmission]="transmissionSampler() ? transmission() : 0"
691
+ [buffer]="bufferTexture()"
692
+ [anisotropicBlur]="anisotropicBlurOption()"
693
+ [side]="side()"
814
694
  [thickness]="thickness()"
815
- [side]="side"
816
- [anisotropicBlur]="anisotropicBlur() ?? anisotropy()"
817
- [roughness]="roughness()"
818
- [chromaticAberration]="chromaticAberration()"
819
- [distortion]="distortion()"
820
- [distortionScale]="distortionScale()"
821
- [temporalDistortion]="temporalDistortion()"
822
- [time]="time()"
823
- />
695
+ >
696
+ <ng-content />
697
+ </ngt-primitive>
824
698
  `,
825
- imports: [NgtArgs],
826
699
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
700
+ changeDetection: ChangeDetectionStrategy.OnPush,
701
+ imports: [NgtArgs],
827
702
  }]
828
- }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
829
- type: Input
830
- }], _transmissionSampler: [{
831
- type: Input,
832
- args: [{ alias: 'transmissionSampler' }]
833
- }], _backside: [{
834
- type: Input,
835
- args: [{ alias: 'backside' }]
836
- }], _backsideThickness: [{
837
- type: Input,
838
- args: [{ alias: 'backsideThickness' }]
839
- }], _resolution: [{
840
- type: Input,
841
- args: [{ alias: 'resolution' }]
842
- }], _backsideResolution: [{
843
- type: Input,
844
- args: [{ alias: 'backsideResolution' }]
845
- }], _samples: [{
846
- type: Input,
847
- args: [{ alias: 'samples' }]
848
- }], _background: [{
849
- type: Input,
850
- args: [{ alias: 'background' }]
851
- }], _transmission: [{
852
- type: Input,
853
- args: [{ alias: 'transmission' }]
854
- }], _thickness: [{
855
- type: Input,
856
- args: [{ alias: 'thickness' }]
857
- }], _roughness: [{
858
- type: Input,
859
- args: [{ alias: 'roughness' }]
860
- }], _chromaticAberration: [{
861
- type: Input,
862
- args: [{ alias: 'chromaticAberration' }]
863
- }], _anisotropy: [{
864
- type: Input,
865
- args: [{ alias: 'anisotropy' }]
866
- }], _anisotropicBlur: [{
867
- type: Input,
868
- args: [{ alias: 'anisotropicBlur' }]
869
- }], _distortion: [{
870
- type: Input,
871
- args: [{ alias: 'distortion' }]
872
- }], _distortionScale: [{
873
- type: Input,
874
- args: [{ alias: 'distortionScale' }]
875
- }], _temporalDistortion: [{
876
- type: Input,
877
- args: [{ alias: 'temporalDistortion' }]
878
- }], _buffer: [{
879
- type: Input,
880
- args: [{ alias: 'buffer' }]
881
- }], _time: [{
882
- type: Input,
883
- args: [{ alias: 'time' }]
884
- }] } });
703
+ }], ctorParameters: () => [] });
885
704
 
886
- extend({ MeshWobbleMaterial });
705
+ const defaultOptions = {
706
+ speed: 1,
707
+ };
887
708
  class NgtsMeshWobbleMaterial {
888
- set _time(time) {
889
- this.inputs.set({ time });
890
- }
891
- set _factor(factor) {
892
- this.inputs.set({ factor });
893
- }
894
- set _speed(speed) {
895
- this.inputs.set({ speed });
896
- }
897
709
  constructor() {
898
- this.inputs = signalStore({ speed: 1, time: 0, factor: 1 });
899
- this.materialRef = injectNgtRef();
710
+ this.attach = input('material');
711
+ this.options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
712
+ this.parameters = omit(this.options, ['speed']);
900
713
  this.material = new MeshWobbleMaterial();
901
- this.time = this.inputs.select('time');
902
- this.factor = this.inputs.select('factor');
903
714
  injectBeforeRender(({ clock }) => {
904
- this.material.time = clock.getElapsedTime() * this.inputs.get('speed');
715
+ const material = this.material;
716
+ material.time = clock.elapsedTime * this.options().speed;
905
717
  });
906
718
  }
907
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshWobbleMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
908
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsMeshWobbleMaterial, isStandalone: true, selector: "ngts-mesh-wobble-material", inputs: { materialRef: "materialRef", _time: ["time", "_time"], _factor: ["factor", "_factor"], _speed: ["speed", "_speed"] }, ngImport: i0, template: `
909
- <ngt-primitive
910
- *args="[material]"
911
- [ref]="materialRef"
912
- [time]="time()"
913
- [factor]="factor()"
914
- attach="material"
915
- ngtCompound
916
- />
917
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
719
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshWobbleMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
720
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsMeshWobbleMaterial, isStandalone: true, selector: "ngts-mesh-wobble-material", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
721
+ <ngt-primitive *args="[material]" [parameters]="parameters()" [attach]="attach()">
722
+ <ng-content />
723
+ </ngt-primitive>
724
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
918
725
  }
919
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshWobbleMaterial, decorators: [{
726
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshWobbleMaterial, decorators: [{
920
727
  type: Component,
921
728
  args: [{
922
729
  selector: 'ngts-mesh-wobble-material',
923
730
  standalone: true,
924
731
  template: `
925
- <ngt-primitive
926
- *args="[material]"
927
- [ref]="materialRef"
928
- [time]="time()"
929
- [factor]="factor()"
930
- attach="material"
931
- ngtCompound
932
- />
732
+ <ngt-primitive *args="[material]" [parameters]="parameters()" [attach]="attach()">
733
+ <ng-content />
734
+ </ngt-primitive>
933
735
  `,
934
736
  imports: [NgtArgs],
935
737
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
738
+ changeDetection: ChangeDetectionStrategy.OnPush,
936
739
  }]
937
- }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
938
- type: Input
939
- }], _time: [{
940
- type: Input,
941
- args: [{ alias: 'time' }]
942
- }], _factor: [{
943
- type: Input,
944
- args: [{ alias: 'factor' }]
945
- }], _speed: [{
946
- type: Input,
947
- args: [{ alias: 'speed' }]
948
- }] } });
740
+ }], ctorParameters: () => [] });
949
741
 
950
- const opaque_fragment = parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'opaque_fragment' : 'output_fragment';
951
- class PointMaterial extends THREE.PointsMaterial {
952
- constructor(parameters) {
953
- super(parameters);
954
- this.onBeforeCompile = (shader, renderer) => {
955
- const { isWebGL2 } = renderer.capabilities;
956
- shader.fragmentShader = shader.fragmentShader.replace(`#include <${opaque_fragment}>`, `
957
- ${!isWebGL2
958
- ? `#extension GL_OES_standard_derivatives : enable\n#include <${opaque_fragment}>`
959
- : `#include <${opaque_fragment}>`}
960
- vec2 cxy = 2.0 * gl_PointCoord - 1.0;
961
- float r = dot(cxy, cxy);
962
- float delta = fwidth(r);
963
- float mask = 1.0 - smoothstep(1.0 - delta, 1.0 + delta, r);
964
- gl_FragColor = vec4(gl_FragColor.rgb, mask * gl_FragColor.a );
965
- #include <tonemapping_fragment>
966
- #include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
967
- `);
968
- };
969
- }
970
- }
971
742
  class NgtsPointMaterial {
972
743
  constructor() {
973
- this.pointMaterialRef = injectNgtRef();
974
- this.material = new PointMaterial({});
744
+ this.attach = input('material');
745
+ this.options = input({});
746
+ this.material = new PointMaterial(this.options());
975
747
  }
976
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPointMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
977
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: NgtsPointMaterial, isStandalone: true, selector: "ngts-point-material", inputs: { pointMaterialRef: "pointMaterialRef" }, ngImport: i0, template: `<ngt-primitive ngtCompound [ref]="pointMaterialRef" *args="[material]" attach="material" />`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
748
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsPointMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
749
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsPointMaterial, isStandalone: true, selector: "ngts-point-material", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
750
+ <ngt-primitive *args="[material]" [attach]="attach()" [parameters]="options()">
751
+ <ng-content />
752
+ </ngt-primitive>
753
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
978
754
  }
979
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPointMaterial, decorators: [{
755
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsPointMaterial, decorators: [{
980
756
  type: Component,
981
757
  args: [{
982
758
  selector: 'ngts-point-material',
983
759
  standalone: true,
984
- template: `<ngt-primitive ngtCompound [ref]="pointMaterialRef" *args="[material]" attach="material" />`,
985
- imports: [NgtArgs],
760
+ template: `
761
+ <ngt-primitive *args="[material]" [attach]="attach()" [parameters]="options()">
762
+ <ng-content />
763
+ </ngt-primitive>
764
+ `,
986
765
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
766
+ changeDetection: ChangeDetectionStrategy.OnPush,
767
+ imports: [NgtArgs],
987
768
  }]
988
- }], propDecorators: { pointMaterialRef: [{
989
- type: Input
990
- }] } });
769
+ }] });
991
770
 
992
771
  /**
993
772
  * Generated bundle index. Do not edit.
994
773
  */
995
774
 
996
- export { NgtsMeshDistortMaterial, NgtsMeshReflectorMaterial, NgtsMeshRefractionMaterial, NgtsMeshTranmissionMaterial, NgtsMeshWobbleMaterial, NgtsPointMaterial, PointMaterial };
775
+ export { NgtsCustomShaderMaterial, NgtsMeshDistortMaterial, NgtsMeshReflectorMaterial, NgtsMeshRefractionMaterial, NgtsMeshTransmissionMaterial, NgtsMeshWobbleMaterial, NgtsPointMaterial };
997
776
  //# sourceMappingURL=angular-three-soba-materials.mjs.map