angular-three-soba 2.0.0-beta.2 → 2.0.0-beta.21

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