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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/abstractions/billboard/billboard.d.ts +11 -7
  2. package/abstractions/detailed/detailed.d.ts +26 -0
  3. package/abstractions/edges/edges.d.ts +23 -11
  4. package/abstractions/grid/grid.d.ts +41 -50
  5. package/abstractions/index.d.ts +1 -7
  6. package/abstractions/text/text.d.ts +10 -4
  7. package/abstractions/text-3d/text-3d.d.ts +47 -40
  8. package/cameras/camera/camera-content.d.ts +1 -1
  9. package/cameras/camera/camera.d.ts +16 -13
  10. package/cameras/cube-camera/cube-camera.d.ts +50 -23
  11. package/cameras/index.d.ts +0 -1
  12. package/cameras/orthographic-camera/orthographic-camera.d.ts +29 -18
  13. package/cameras/perspective-camera/perspective-camera.d.ts +10 -1
  14. package/controls/orbit-controls/orbit-controls.d.ts +30 -13
  15. package/esm2022/abstractions/billboard/billboard.mjs +36 -33
  16. package/esm2022/abstractions/detailed/detailed.mjs +64 -0
  17. package/esm2022/abstractions/edges/edges.mjs +58 -63
  18. package/esm2022/abstractions/grid/grid.mjs +140 -110
  19. package/esm2022/abstractions/index.mjs +2 -8
  20. package/esm2022/abstractions/text/text.mjs +123 -122
  21. package/esm2022/abstractions/text-3d/text-3d.mjs +119 -121
  22. package/esm2022/cameras/camera/camera-content.mjs +5 -6
  23. package/esm2022/cameras/camera/camera.mjs +48 -42
  24. package/esm2022/cameras/cube-camera/cube-camera.mjs +129 -99
  25. package/esm2022/cameras/index.mjs +1 -2
  26. package/esm2022/cameras/orthographic-camera/orthographic-camera.mjs +78 -75
  27. package/esm2022/cameras/perspective-camera/perspective-camera.mjs +25 -26
  28. package/esm2022/controls/orbit-controls/orbit-controls.mjs +94 -90
  29. package/esm2022/loaders/gltf-loader/gltf-loader.mjs +3 -6
  30. package/esm2022/loaders/loader/loader.mjs +92 -87
  31. package/esm2022/loaders/progress/progress.mjs +1 -1
  32. package/esm2022/loaders/texture-loader/texture-loader.mjs +4 -4
  33. package/esm2022/materials/index.mjs +2 -1
  34. package/esm2022/materials/mesh-distort-material/mesh-distort-material.mjs +60 -51
  35. package/esm2022/materials/mesh-reflector-material/mesh-reflector-material.mjs +239 -255
  36. package/esm2022/materials/mesh-refraction-material/mesh-refraction-material.mjs +99 -97
  37. package/esm2022/materials/mesh-transmission-material/mesh-transmission-material.mjs +167 -146
  38. package/esm2022/materials/mesh-wobble-material/mesh-wobble-material.mjs +44 -42
  39. package/esm2022/materials/point-material/point-material.mjs +46 -0
  40. package/esm2022/misc/animations/animations.mjs +20 -16
  41. package/esm2022/misc/bake-shadows/bake-shadows.mjs +13 -13
  42. package/esm2022/misc/caustics/caustics.mjs +387 -0
  43. package/esm2022/misc/decal/decal.mjs +187 -0
  44. package/esm2022/misc/depth-buffer/depth-buffer.mjs +33 -35
  45. package/esm2022/misc/example/example.mjs +160 -0
  46. package/esm2022/misc/fbo/fbo.mjs +35 -35
  47. package/esm2022/misc/html/html-wrapper.mjs +478 -0
  48. package/esm2022/misc/html/html.mjs +304 -0
  49. package/esm2022/misc/index.mjs +10 -1
  50. package/esm2022/misc/sampler/sampler.mjs +142 -0
  51. package/esm2022/misc/shadow/shadow.mjs +111 -0
  52. package/esm2022/misc/stats-gl/stats-gl.mjs +61 -0
  53. package/esm2022/misc/trail/trail.mjs +209 -0
  54. package/esm2022/misc/trail-texture/inject-trail-texture.mjs +17 -0
  55. package/esm2022/misc/trail-texture/trail-texture.mjs +106 -0
  56. package/esm2022/modifiers/angular-three-soba-modifiers.mjs +5 -0
  57. package/esm2022/modifiers/curve-modifier/curve-modifier.mjs +64 -0
  58. package/esm2022/modifiers/index.mjs +2 -0
  59. package/esm2022/performances/adaptive-dpr/adaptive-dpr.mjs +44 -0
  60. package/esm2022/performances/adaptive-events/adaptive-events.mjs +27 -0
  61. package/esm2022/performances/angular-three-soba-performances.mjs +5 -0
  62. package/esm2022/performances/index.mjs +6 -0
  63. package/esm2022/performances/points/points-input.mjs +64 -0
  64. package/esm2022/performances/points/points.mjs +329 -0
  65. package/esm2022/performances/points/position-point.mjs +54 -0
  66. package/esm2022/performances/segments/segment-object.mjs +9 -0
  67. package/esm2022/performances/segments/segments.mjs +182 -0
  68. package/esm2022/shaders/blur-pass/blur-pass.mjs +1 -1
  69. package/esm2022/shaders/caustics/caustics-material.mjs +130 -0
  70. package/esm2022/shaders/caustics/caustics-projection-material.mjs +31 -0
  71. package/esm2022/shaders/convolution-material/convolution-material.mjs +1 -1
  72. package/esm2022/shaders/discard-material/discard-material.mjs +1 -1
  73. package/esm2022/shaders/grid-material/grid-material.mjs +29 -14
  74. package/esm2022/shaders/index.mjs +5 -3
  75. package/esm2022/shaders/mesh-distort-material/mesh-distort-material.mjs +42 -41
  76. package/esm2022/shaders/mesh-reflector-material/mesh-reflector-material.mjs +1 -1
  77. package/esm2022/shaders/mesh-refraction-material/mesh-refraction-material.mjs +2 -2
  78. package/esm2022/shaders/mesh-transmission-material/mesh-transmission-material.mjs +4 -4
  79. package/esm2022/shaders/mesh-wobble-material/mesh-wobble-material.mjs +1 -1
  80. package/esm2022/shaders/shader-material/shader-material.mjs +1 -1
  81. package/esm2022/shaders/soft-shadow-material/soft-shadow-material.mjs +17 -25
  82. package/esm2022/shaders/sparkles-material/sparkles-material.mjs +32 -46
  83. package/esm2022/shaders/spot-light-material/spot-light-material.mjs +7 -7
  84. package/esm2022/shaders/star-field-material/star-field-material.mjs +3 -2
  85. package/esm2022/shaders/wireframe-material/wireframe-material.mjs +247 -0
  86. package/esm2022/staging/accumulative-shadows/accumulative-shadows.mjs +160 -176
  87. package/esm2022/staging/accumulative-shadows/progressive-light-map.mjs +1 -1
  88. package/esm2022/staging/accumulative-shadows/randomized-lights.mjs +126 -128
  89. package/esm2022/staging/backdrop/backdrop.mjs +77 -0
  90. package/esm2022/staging/bb-anchor/bb-anchor.mjs +70 -0
  91. package/esm2022/staging/bounds/bounds.mjs +144 -143
  92. package/esm2022/staging/camera-shake/camera-shake.mjs +86 -80
  93. package/esm2022/staging/center/center.mjs +106 -91
  94. package/esm2022/staging/cloud/cloud.mjs +118 -124
  95. package/esm2022/staging/contact-shadows/contact-shadows.mjs +131 -134
  96. package/esm2022/staging/environment/assets.mjs +12 -12
  97. package/esm2022/staging/environment/environment-cube.mjs +28 -30
  98. package/esm2022/staging/environment/environment-ground.mjs +18 -20
  99. package/esm2022/staging/environment/environment-input.mjs +97 -84
  100. package/esm2022/staging/environment/environment-map.mjs +33 -33
  101. package/esm2022/staging/environment/environment-portal.mjs +75 -97
  102. package/esm2022/staging/environment/environment.mjs +34 -51
  103. package/esm2022/staging/environment/utils.mjs +35 -14
  104. package/esm2022/staging/float/float.mjs +70 -58
  105. package/esm2022/staging/index.mjs +7 -3
  106. package/esm2022/staging/matcap-texture/matcap-texture.mjs +64 -0
  107. package/esm2022/staging/normal-texture/normal-texture.mjs +53 -0
  108. package/esm2022/staging/sky/sky.mjs +85 -80
  109. package/esm2022/staging/sparkles/sparkles.mjs +108 -105
  110. package/esm2022/staging/spot-light/shadow-mesh-input.mjs +63 -0
  111. package/esm2022/staging/spot-light/shadow-mesh.mjs +266 -0
  112. package/esm2022/staging/spot-light/spot-light-input.mjs +67 -58
  113. package/esm2022/staging/spot-light/spot-light.mjs +51 -64
  114. package/esm2022/staging/spot-light/volumetric-mesh.mjs +61 -78
  115. package/esm2022/staging/stage/stage.mjs +304 -290
  116. package/esm2022/staging/stars/stars.mjs +101 -102
  117. package/esm2022/staging/wireframe/wireframe-input.mjs +191 -0
  118. package/esm2022/staging/wireframe/wireframe.mjs +224 -0
  119. package/esm2022/utils/angular-three-soba-utils.mjs +5 -0
  120. package/esm2022/utils/content/content.mjs +15 -0
  121. package/esm2022/utils/index.mjs +2 -0
  122. package/fesm2022/angular-three-soba-abstractions.mjs +505 -2087
  123. package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
  124. package/fesm2022/angular-three-soba-cameras.mjs +302 -259
  125. package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
  126. package/fesm2022/angular-three-soba-controls.mjs +93 -88
  127. package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
  128. package/fesm2022/angular-three-soba-loaders.mjs +94 -90
  129. package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
  130. package/fesm2022/angular-three-soba-materials.mjs +655 -590
  131. package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
  132. package/fesm2022/angular-three-soba-misc.mjs +2198 -89
  133. package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
  134. package/fesm2022/angular-three-soba-modifiers.mjs +71 -0
  135. package/fesm2022/angular-three-soba-modifiers.mjs.map +1 -0
  136. package/fesm2022/angular-three-soba-performances.mjs +697 -0
  137. package/fesm2022/angular-three-soba-performances.mjs.map +1 -0
  138. package/fesm2022/angular-three-soba-shaders.mjs +501 -264
  139. package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
  140. package/fesm2022/angular-three-soba-staging.mjs +2870 -2555
  141. package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
  142. package/fesm2022/angular-three-soba-utils.mjs +22 -0
  143. package/fesm2022/angular-three-soba-utils.mjs.map +1 -0
  144. package/loaders/gltf-loader/gltf-loader.d.ts +4 -3
  145. package/loaders/loader/loader.d.ts +19 -17
  146. package/loaders/progress/progress.d.ts +1 -1
  147. package/loaders/texture-loader/texture-loader.d.ts +2 -2
  148. package/materials/index.d.ts +1 -0
  149. package/materials/mesh-distort-material/mesh-distort-material.d.ts +25 -15
  150. package/materials/mesh-reflector-material/mesh-reflector-material.d.ts +74 -56
  151. package/materials/mesh-refraction-material/mesh-refraction-material.d.ts +33 -21
  152. package/materials/mesh-transmission-material/mesh-transmission-material.d.ts +55 -39
  153. package/materials/mesh-wobble-material/mesh-wobble-material.d.ts +19 -10
  154. package/materials/point-material/point-material.d.ts +24 -0
  155. package/metadata.json +1 -0
  156. package/misc/animations/animations.d.ts +6 -4
  157. package/misc/caustics/caustics.d.ts +87 -0
  158. package/misc/decal/decal.d.ts +49 -0
  159. package/misc/depth-buffer/depth-buffer.d.ts +2 -2
  160. package/misc/example/example.d.ts +81 -0
  161. package/misc/fbo/fbo.d.ts +2 -2
  162. package/misc/html/html-wrapper.d.ts +559 -0
  163. package/misc/html/html.d.ts +214 -0
  164. package/misc/index.d.ts +9 -0
  165. package/misc/sampler/sampler.d.ts +67 -0
  166. package/misc/shadow/shadow.d.ts +37 -0
  167. package/misc/stats-gl/stats-gl.d.ts +24 -0
  168. package/misc/trail/trail.d.ts +57 -0
  169. package/misc/trail-texture/inject-trail-texture.d.ts +9 -0
  170. package/misc/trail-texture/trail-texture.d.ts +50 -0
  171. package/modifiers/README.md +3 -0
  172. package/modifiers/curve-modifier/curve-modifier.d.ts +23 -0
  173. package/modifiers/index.d.ts +1 -0
  174. package/package.json +30 -22
  175. package/performances/README.md +3 -0
  176. package/performances/adaptive-dpr/adaptive-dpr.d.ts +14 -0
  177. package/{performance/adaptive → performances/adaptive-events}/adaptive-events.d.ts +3 -0
  178. package/performances/index.d.ts +5 -0
  179. package/performances/points/points-input.d.ts +32 -0
  180. package/performances/points/points.d.ts +92 -0
  181. package/{performance/instances/position-mesh.d.ts → performances/points/position-point.d.ts} +4 -3
  182. package/performances/segments/segment-object.d.ts +7 -0
  183. package/performances/segments/segments.d.ts +124 -0
  184. package/shaders/grid-material/grid-material.d.ts +33 -0
  185. package/shaders/index.d.ts +4 -2
  186. package/shaders/mesh-distort-material/mesh-distort-material.d.ts +146 -1
  187. package/shaders/mesh-transmission-material/mesh-transmission-material.d.ts +1 -1
  188. package/shaders/shader-material/shader-material.d.ts +2 -2
  189. package/shaders/soft-shadow-material/soft-shadow-material.d.ts +10 -1
  190. package/shaders/sparkles-material/sparkles-material.d.ts +15 -1
  191. package/shaders/spot-light-material/spot-light-material.d.ts +11 -2
  192. package/shaders/star-field-material/star-field-material.d.ts +11 -1
  193. package/shaders/wireframe-material/wireframe-material.d.ts +58 -0
  194. package/staging/accumulative-shadows/accumulative-shadows.d.ts +89 -39
  195. package/staging/accumulative-shadows/randomized-lights.d.ts +40 -27
  196. package/staging/backdrop/backdrop.d.ts +30 -0
  197. package/staging/bb-anchor/bb-anchor.d.ts +27 -0
  198. package/staging/bounds/bounds.d.ts +100 -24
  199. package/staging/camera-shake/camera-shake.d.ts +30 -19
  200. package/staging/center/center.d.ts +43 -35
  201. package/staging/cloud/cloud.d.ts +26 -23
  202. package/staging/contact-shadows/contact-shadows.d.ts +41 -28
  203. package/staging/environment/assets.d.ts +9 -9
  204. package/staging/environment/environment-cube.d.ts +9 -5
  205. package/staging/environment/environment-ground.d.ts +7 -7
  206. package/staging/environment/environment-input.d.ts +36 -36
  207. package/staging/environment/environment-map.d.ts +10 -5
  208. package/staging/environment/environment-portal.d.ts +10 -5
  209. package/staging/environment/environment.d.ts +0 -4
  210. package/staging/environment/utils.d.ts +2 -2
  211. package/staging/float/float.d.ts +14 -10
  212. package/staging/index.d.ts +6 -2
  213. package/staging/matcap-texture/matcap-texture.d.ts +13 -0
  214. package/staging/normal-texture/normal-texture.d.ts +16 -0
  215. package/staging/sky/sky.d.ts +28 -21
  216. package/staging/sparkles/sparkles.d.ts +35 -21
  217. package/staging/spot-light/shadow-mesh-input.d.ts +29 -0
  218. package/staging/spot-light/shadow-mesh.d.ts +37 -0
  219. package/staging/spot-light/spot-light-input.d.ts +25 -25
  220. package/staging/spot-light/spot-light.d.ts +31 -15
  221. package/staging/spot-light/volumetric-mesh.d.ts +15 -9
  222. package/staging/stage/stage.d.ts +88 -63
  223. package/staging/stars/stars.d.ts +27 -16
  224. package/staging/wireframe/wireframe-input.d.ts +65 -0
  225. package/staging/wireframe/wireframe.d.ts +28 -0
  226. package/utils/README.md +3 -0
  227. package/utils/content/content.d.ts +8 -0
  228. package/utils/index.d.ts +1 -0
  229. package/web-types.json +1 -0
  230. package/abstractions/catmull-rom-line/catmull-rom-line.d.ts +0 -25
  231. package/abstractions/cubic-bezier-line/cubic-bezier-line.d.ts +0 -25
  232. package/abstractions/gizmo-helper/gizmo-helper.d.ts +0 -34
  233. package/abstractions/gizmo-helper/gizmo-viewcube/constants.d.ts +0 -12
  234. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +0 -22
  235. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +0 -30
  236. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +0 -32
  237. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +0 -14
  238. package/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +0 -47
  239. package/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +0 -40
  240. package/abstractions/line/line-input.d.ts +0 -42
  241. package/abstractions/line/line.d.ts +0 -35
  242. package/abstractions/quadratic-bezier-line/quadratic-bezier-line.d.ts +0 -23
  243. package/esm2022/abstractions/catmull-rom-line/catmull-rom-line.mjs +0 -131
  244. package/esm2022/abstractions/cubic-bezier-line/cubic-bezier-line.mjs +0 -113
  245. package/esm2022/abstractions/gizmo-helper/gizmo-helper.mjs +0 -210
  246. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/constants.mjs +0 -31
  247. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +0 -95
  248. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +0 -155
  249. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +0 -62
  250. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +0 -80
  251. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +0 -206
  252. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +0 -273
  253. package/esm2022/abstractions/line/line-input.mjs +0 -113
  254. package/esm2022/abstractions/line/line.mjs +0 -165
  255. package/esm2022/abstractions/quadratic-bezier-line/quadratic-bezier-line.mjs +0 -128
  256. package/esm2022/performance/adaptive/adaptive-dpr.mjs +0 -46
  257. package/esm2022/performance/adaptive/adaptive-events.mjs +0 -31
  258. package/esm2022/performance/angular-three-soba-performance.mjs +0 -5
  259. package/esm2022/performance/detailed/detailed.mjs +0 -61
  260. package/esm2022/performance/index.mjs +0 -7
  261. package/esm2022/performance/instances/instance.mjs +0 -48
  262. package/esm2022/performance/instances/instances.mjs +0 -189
  263. package/esm2022/performance/instances/position-mesh.mjs +0 -52
  264. package/esm2022/performance/stats/stats.mjs +0 -79
  265. package/esm2022/shaders/caustics-material/caustics-material.mjs +0 -128
  266. package/esm2022/shaders/caustics-material/caustics-projection-material.mjs +0 -33
  267. package/esm2022/staging/caustics/caustisc.mjs +0 -384
  268. package/esm2022/staging/spot-light/spot-light-shadow-mesh-input.mjs +0 -57
  269. package/esm2022/staging/spot-light/spot-light-shadow-mesh.mjs +0 -258
  270. package/fesm2022/angular-three-soba-performance.mjs +0 -487
  271. package/fesm2022/angular-three-soba-performance.mjs.map +0 -1
  272. package/performance/README.md +0 -3
  273. package/performance/adaptive/adaptive-dpr.d.ts +0 -8
  274. package/performance/detailed/detailed.d.ts +0 -20
  275. package/performance/index.d.ts +0 -6
  276. package/performance/instances/instance.d.ts +0 -9
  277. package/performance/instances/instances.d.ts +0 -35
  278. package/performance/stats/stats.d.ts +0 -18
  279. package/plugin/generators.json +0 -19
  280. package/plugin/libs/plugin/README.md +0 -11
  281. package/plugin/package.json +0 -9
  282. package/plugin/src/generators/init/compat.d.ts +0 -2
  283. package/plugin/src/generators/init/compat.js +0 -6
  284. package/plugin/src/generators/init/compat.js.map +0 -1
  285. package/plugin/src/generators/init/init.d.ts +0 -7
  286. package/plugin/src/generators/init/init.js +0 -28
  287. package/plugin/src/generators/init/init.js.map +0 -1
  288. package/plugin/src/generators/init/schema.json +0 -6
  289. package/plugin/src/index.d.ts +0 -1
  290. package/plugin/src/index.js +0 -6
  291. package/plugin/src/index.js.map +0 -1
  292. package/staging/caustics/caustisc.d.ts +0 -70
  293. package/staging/spot-light/spot-light-shadow-mesh-input.d.ts +0 -29
  294. package/staging/spot-light/spot-light-shadow-mesh.d.ts +0 -38
  295. /package/shaders/{caustics-material → caustics}/caustics-material.d.ts +0 -0
  296. /package/shaders/{caustics-material → caustics}/caustics-projection-material.d.ts +0 -0
@@ -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
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.3", ngImport: i0, type: NgtsMeshDistortMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
35
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.3", 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.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"] }] }); }
46
52
  }
47
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.3", ngImport: i0, type: NgtsMeshDistortMaterial, decorators: [{
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", 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?.value;
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?.value;
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.3", ngImport: i0, type: NgtsMeshReflectorMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
363
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.3", 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.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
+ >
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.3", ngImport: i0, type: NgtsMeshReflectorMaterial, decorators: [{
371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", 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,174 +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?.value?.geometry;
532
+ const geometry = getLocalState(material).parent?.()?.geometry;
543
533
  if (geometry) {
544
534
  material.bvh = new MeshBVHUniformStruct();
545
535
  material.bvh.updateFrom(new MeshBVH(geometry.clone().toNonIndexed(), { lazyGeneration: false, strategy: SAH }));
546
536
  }
547
537
  });
548
538
  }
549
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.3", ngImport: i0, type: NgtsMeshRefractionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
550
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.3", 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: `
551
- <ngt-mesh-refraction-material
552
- *ngIf="defines() as defines"
553
- [ref]="materialRef"
554
- [defines]="defines"
555
- [resolution]="resolution()"
556
- [aberrationStrength]="refractionAberrationStrength()"
557
- [envMap]="refractionEnvMap()"
558
- [bounces]="refractionBounces()"
559
- [ior]="refractionIor()"
560
- [fresnel]="refractionFresnel()"
561
- [color]="refractionColor()"
562
- [fastChroma]="refractionFastChroma()"
563
- ngtCompound
564
- attach="material"
565
- >
566
- <ng-content />
567
- </ngt-mesh-refraction-material>
568
- `, 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.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()"
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"] }] }); }
569
560
  }
570
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.3", ngImport: i0, type: NgtsMeshRefractionMaterial, decorators: [{
561
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshRefractionMaterial, decorators: [{
571
562
  type: Component,
572
563
  args: [{
573
564
  selector: 'ngts-mesh-refraction-material',
574
565
  standalone: true,
575
566
  template: `
576
- <ngt-mesh-refraction-material
577
- *ngIf="defines() as defines"
578
- [ref]="materialRef"
579
- [defines]="defines"
580
- [resolution]="resolution()"
581
- [aberrationStrength]="refractionAberrationStrength()"
582
- [envMap]="refractionEnvMap()"
583
- [bounces]="refractionBounces()"
584
- [ior]="refractionIor()"
585
- [fresnel]="refractionFresnel()"
586
- [color]="refractionColor()"
587
- [fastChroma]="refractionFastChroma()"
588
- ngtCompound
589
- attach="material"
590
- >
591
- <ng-content />
592
- </ngt-mesh-refraction-material>
593
- `,
594
- 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],
595
587
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
596
588
  }]
597
589
  }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
598
590
  type: Input
599
- }], envMap: [{
591
+ }], _envMap: [{
600
592
  type: Input,
601
- args: [{ required: true }]
602
- }], bounces: [{
603
- type: Input
604
- }], ior: [{
605
- type: Input
606
- }], fresnel: [{
607
- type: Input
608
- }], aberrationStrength: [{
609
- type: Input
610
- }], color: [{
611
- type: Input
612
- }], fastChroma: [{
613
- 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' }]
614
612
  }] } });
615
613
 
616
614
  extend({ MeshTransmissionMaterial });
617
- class NgtsMeshTranmissionMaterial extends NgtSignalStore {
615
+ class NgtsMeshTranmissionMaterial {
618
616
  /** transmissionSampler, you can use the threejs transmission sampler texture that is
619
617
  * generated once for all transmissive materials. The upside is that it can be faster if you
620
618
  * use multiple MeshPhysical and Transmission materials, the downside is that transmissive materials
621
619
  * using this can't see other transparent or transmissive objects, default: false */
622
- set transmissionSampler(transmissionSampler) {
623
- this.set({ transmissionSampler });
620
+ set _transmissionSampler(transmissionSampler) {
621
+ this.inputs.set({ transmissionSampler });
624
622
  }
625
623
  /** Render the backside of the material (more cost, better results), default: false */
626
- set backside(backside) {
627
- this.set({ backside });
624
+ set _backside(backside) {
625
+ this.inputs.set({ backside });
628
626
  }
629
627
  /** Backside thickness (when backside is true), default: 0 */
630
- set backsideThickness(backsideThickness) {
631
- this.set({ backsideThickness });
628
+ set _backsideThickness(backsideThickness) {
629
+ this.inputs.set({ backsideThickness });
632
630
  }
633
631
  /** Resolution of the local buffer, default: undefined (fullscreen) */
634
- set resolution(resolution) {
635
- this.set({ resolution });
632
+ set _resolution(resolution) {
633
+ this.inputs.set({ resolution });
636
634
  }
637
635
  /** Resolution of the local buffer for backfaces, default: undefined (fullscreen) */
638
- set backsideResolution(backsideResolution) {
639
- this.set({ backsideResolution });
636
+ set _backsideResolution(backsideResolution) {
637
+ this.inputs.set({ backsideResolution });
640
638
  }
641
639
  /** Refraction samples, default: 10 */
642
- set samples(samples) {
643
- this.set({ samples });
640
+ set _samples(samples) {
641
+ this.inputs.set({ samples });
644
642
  }
645
643
  /** Buffer scene background (can be a texture, a cubetexture or a color), default: null */
646
- set background(background) {
647
- this.set({ background });
644
+ set _background(background) {
645
+ this.inputs.set({ background });
648
646
  }
649
647
  /* Transmission, default: 1 */
650
- set transmission(transmission) {
651
- this.set({ transmission });
648
+ set _transmission(transmission) {
649
+ this.inputs.set({ transmission });
652
650
  }
653
651
  /* Thickness (refraction), default: 0 */
654
- set thickness(thickness) {
655
- this.set({ thickness });
652
+ set _thickness(thickness) {
653
+ this.inputs.set({ thickness });
656
654
  }
657
655
  /* Roughness (blur), default: 0 */
658
- set roughness(roughness) {
659
- this.set({ roughness });
656
+ set _roughness(roughness) {
657
+ this.inputs.set({ roughness });
660
658
  }
661
659
  /* Chromatic aberration, default: 0.03 */
662
- set chromaticAberration(chromaticAberration) {
663
- this.set({ chromaticAberration });
660
+ set _chromaticAberration(chromaticAberration) {
661
+ this.inputs.set({ chromaticAberration });
664
662
  }
665
663
  /* Anisotropy, default: 0.1 */
666
- set anisotropy(anisotropy) {
667
- 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 });
668
670
  }
669
671
  /* Distortion, default: 0 */
670
- set distortion(distortion) {
671
- this.set({ distortion });
672
+ set _distortion(distortion) {
673
+ this.inputs.set({ distortion });
672
674
  }
673
675
  /* Distortion scale, default: 0.5 */
674
- set distortionScale(distortionScale) {
675
- this.set({ distortionScale });
676
+ set _distortionScale(distortionScale) {
677
+ this.inputs.set({ distortionScale });
676
678
  }
677
679
  /* Temporal distortion (speed of movement), default: 0.0 */
678
- set temporalDistortion(temporalDistortion) {
679
- this.set({ temporalDistortion });
680
+ set _temporalDistortion(temporalDistortion) {
681
+ this.inputs.set({ temporalDistortion });
680
682
  }
681
683
  /** The scene rendered into a texture (use it to share a texture between materials), default: null */
682
- set buffer(buffer) {
683
- this.set({ buffer });
684
+ set _buffer(buffer) {
685
+ this.inputs.set({ buffer });
684
686
  }
685
687
  /** Internals */
686
- set time(time) {
687
- this.set({ time });
688
- }
689
- #discardMaterial;
690
- #backsideResolution;
691
- #resolution;
692
- #fboBackSettings;
693
- #fboMainSettings;
688
+ set _time(time) {
689
+ this.inputs.set({ time });
690
+ }
694
691
  constructor() {
695
- super({
692
+ this.inputs = signalStore({
696
693
  transmissionSampler: false,
697
694
  backside: false,
698
695
  transmission: 1,
@@ -701,6 +698,7 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
701
698
  samples: 10,
702
699
  roughness: 0,
703
700
  anisotropy: 0.1,
701
+ anisotropicBlur: 0.1,
704
702
  chromaticAberration: 0.03,
705
703
  distortion: 0,
706
704
  distortionScale: 0.5,
@@ -708,27 +706,28 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
708
706
  buffer: null,
709
707
  });
710
708
  this.materialRef = injectNgtRef();
711
- this.transmissionTransmissionSampler = this.select('transmissionSampler');
712
- this.transmissionBackside = this.select('backside');
713
- this.transmissionTransmission = this.select('transmission');
714
- this.transmissionThickness = this.select('thickness');
715
- this.transmissionBacksideThickness = this.select('backsideThickness');
716
- this.transmissionSamples = this.select('samples');
717
- this.transmissionRoughness = this.select('roughness');
718
- this.transmissionAnisotropy = this.select('anisotropy');
719
- this.transmissionChromaticAberration = this.select('chromaticAberration');
720
- this.transmissionDistortion = this.select('distortion');
721
- this.transmissionDistortionScale = this.select('distortionScale');
722
- this.transmissionTemporalDistortion = this.select('temporalDistortion');
723
- this.transmissionBuffer = this.select('buffer');
724
- this.transmissionTime = this.select('time');
725
- this.#discardMaterial = new DiscardMaterial();
726
- this.#backsideResolution = this.select('backsideResolution');
727
- this.#resolution = this.select('resolution');
728
- this.#fboBackSettings = computed(() => ({ width: this.#backsideResolution() || this.#resolution() }));
729
- this.#fboMainSettings = computed(() => ({ width: this.#resolution() }));
730
- this.fboBackRef = injectNgtsFBO(this.#fboBackSettings);
731
- 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);
732
731
  this.side = THREE.FrontSide;
733
732
  let oldBg;
734
733
  let oldTone;
@@ -736,11 +735,12 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
736
735
  injectBeforeRender((state) => {
737
736
  if (!this.materialRef.nativeElement)
738
737
  return;
739
- const { transmissionSampler, background, backside, backsideThickness, thickness } = this.get();
738
+ const { transmissionSampler, background, backside, backsideThickness, thickness } = this.inputs.get();
740
739
  this.materialRef.nativeElement.time = state.clock.getElapsedTime();
741
740
  // Render only if the buffer matches the built-in and no transmission sampler is set
742
- if (this.materialRef.nativeElement.buffer === this.fboMainRef().texture && !transmissionSampler) {
743
- parent = getLocalState(this.materialRef.nativeElement).parent?.value;
741
+ if (this.materialRef.nativeElement.buffer === this.fboMainRef.nativeElement?.texture &&
742
+ !transmissionSampler) {
743
+ parent = getLocalState(this.materialRef.nativeElement).parent?.();
744
744
  if (parent) {
745
745
  // Save defaults
746
746
  oldTone = state.gl.toneMapping;
@@ -751,23 +751,23 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
751
751
  state.gl.toneMapping = THREE.NoToneMapping;
752
752
  if (background)
753
753
  state.scene.background = background;
754
- parent['material'] = this.#discardMaterial;
754
+ parent['material'] = this.discardMaterial;
755
755
  if (backside) {
756
756
  // Render into the backside buffer
757
- state.gl.setRenderTarget(this.fboBackRef());
757
+ state.gl.setRenderTarget(this.fboBackRef.nativeElement);
758
758
  state.gl.render(state.scene, state.camera);
759
759
  // And now prepare the material for the main render using the backside buffer
760
760
  parent['material'] = this.materialRef.nativeElement;
761
- parent['material'].buffer = this.fboBackRef().texture;
761
+ parent['material'].buffer = this.fboBackRef.nativeElement?.texture;
762
762
  parent['material'].thickness = backsideThickness;
763
763
  parent['material'].side = THREE.BackSide;
764
764
  }
765
765
  // Render into the main buffer
766
- state.gl.setRenderTarget(this.fboMainRef());
766
+ state.gl.setRenderTarget(this.fboMainRef.nativeElement);
767
767
  state.gl.render(state.scene, state.camera);
768
768
  parent['material'].thickness = thickness;
769
769
  parent['material'].side = this.side;
770
- parent['material'].buffer = this.fboMainRef().texture;
770
+ parent['material'].buffer = this.fboMainRef.nativeElement?.texture;
771
771
  // Set old state back
772
772
  state.scene.background = oldBg;
773
773
  state.gl.setRenderTarget(null);
@@ -777,150 +777,215 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
777
777
  }
778
778
  });
779
779
  }
780
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.3", ngImport: i0, type: NgtsMeshTranmissionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
781
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.3", 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: `
782
- <ngt-mesh-transmission-material
783
- ngtCompound
784
- *args="[transmissionSamples(), transmissionTransmissionSampler()]"
785
- [ref]="materialRef"
786
- [buffer]="transmissionBuffer() || fboMainRef()?.texture"
787
- [_transmission]="transmissionTransmission()"
788
- [transmission]="transmissionTransmissionSampler() ? transmissionTransmission() : 0"
789
- [thickness]="transmissionThickness()"
790
- [side]="side"
791
- [anisotropy]="transmissionAnisotropy()"
792
- [roughness]="transmissionRoughness()"
793
- [chromaticAberration]="transmissionChromaticAberration()"
794
- [distortion]="transmissionDistortion()"
795
- [distortionScale]="transmissionDistortionScale()"
796
- [temporalDistortion]="transmissionTemporalDistortion()"
797
- [time]="transmissionTime()"
798
- />
799
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] }); }
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"
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"] }] }); }
800
800
  }
801
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.3", ngImport: i0, type: NgtsMeshTranmissionMaterial, decorators: [{
801
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshTranmissionMaterial, decorators: [{
802
802
  type: Component,
803
803
  args: [{
804
804
  selector: 'ngts-mesh-transmission-material',
805
805
  standalone: true,
806
806
  template: `
807
- <ngt-mesh-transmission-material
808
- ngtCompound
809
- *args="[transmissionSamples(), transmissionTransmissionSampler()]"
810
- [ref]="materialRef"
811
- [buffer]="transmissionBuffer() || fboMainRef()?.texture"
812
- [_transmission]="transmissionTransmission()"
813
- [transmission]="transmissionTransmissionSampler() ? transmissionTransmission() : 0"
814
- [thickness]="transmissionThickness()"
815
- [side]="side"
816
- [anisotropy]="transmissionAnisotropy()"
817
- [roughness]="transmissionRoughness()"
818
- [chromaticAberration]="transmissionChromaticAberration()"
819
- [distortion]="transmissionDistortion()"
820
- [distortionScale]="transmissionDistortionScale()"
821
- [temporalDistortion]="transmissionTemporalDistortion()"
822
- [time]="transmissionTime()"
823
- />
824
- `,
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
+ `,
825
825
  imports: [NgtArgs],
826
826
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
827
827
  }]
828
828
  }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
829
829
  type: Input
830
- }], transmissionSampler: [{
831
- type: Input
832
- }], backside: [{
833
- type: Input
834
- }], backsideThickness: [{
835
- type: Input
836
- }], resolution: [{
837
- type: Input
838
- }], backsideResolution: [{
839
- type: Input
840
- }], samples: [{
841
- type: Input
842
- }], background: [{
843
- type: Input
844
- }], transmission: [{
845
- type: Input
846
- }], thickness: [{
847
- type: Input
848
- }], roughness: [{
849
- type: Input
850
- }], chromaticAberration: [{
851
- type: Input
852
- }], anisotropy: [{
853
- type: Input
854
- }], distortion: [{
855
- type: Input
856
- }], distortionScale: [{
857
- type: Input
858
- }], temporalDistortion: [{
859
- type: Input
860
- }], buffer: [{
861
- type: Input
862
- }], time: [{
863
- 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' }]
864
884
  }] } });
865
885
 
866
886
  extend({ MeshWobbleMaterial });
867
- class NgtsMeshWobbleMaterial extends NgtSignalStore {
868
- set time(time) {
869
- this.set({ time });
887
+ class NgtsMeshWobbleMaterial {
888
+ set _time(time) {
889
+ this.inputs.set({ time });
870
890
  }
871
- set factor(factor) {
872
- this.set({ factor });
891
+ set _factor(factor) {
892
+ this.inputs.set({ factor });
873
893
  }
874
- set speed(speed) {
875
- this.set({ speed });
894
+ set _speed(speed) {
895
+ this.inputs.set({ speed });
876
896
  }
877
897
  constructor() {
878
- super({ speed: 1, time: 0, factor: 1 });
879
- this.material = new MeshWobbleMaterial();
898
+ this.inputs = signalStore({ speed: 1, time: 0, factor: 1 });
880
899
  this.materialRef = injectNgtRef();
881
- this.wobbleTime = this.select('time');
882
- this.wobbleFactor = this.select('factor');
900
+ this.material = new MeshWobbleMaterial();
901
+ this.time = this.inputs.select('time');
902
+ this.factor = this.inputs.select('factor');
883
903
  injectBeforeRender(({ clock }) => {
884
- this.material.time = clock.getElapsedTime() * this.get('speed');
904
+ this.material.time = clock.getElapsedTime() * this.inputs.get('speed');
885
905
  });
886
906
  }
887
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.3", ngImport: i0, type: NgtsMeshWobbleMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
888
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.3", type: NgtsMeshWobbleMaterial, isStandalone: true, selector: "ngts-mesh-wobble-material", inputs: { materialRef: "materialRef", time: "time", factor: "factor", speed: "speed" }, usesInheritance: true, ngImport: i0, template: `
889
- <ngt-primitive
890
- *args="[material]"
891
- [ref]="materialRef"
892
- [time]="wobbleTime()"
893
- [factor]="wobbleFactor()"
894
- attach="material"
895
- ngtCompound
896
- />
897
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] }); }
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"] }] }); }
898
918
  }
899
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.3", ngImport: i0, type: NgtsMeshWobbleMaterial, decorators: [{
919
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsMeshWobbleMaterial, decorators: [{
900
920
  type: Component,
901
921
  args: [{
902
922
  selector: 'ngts-mesh-wobble-material',
903
923
  standalone: true,
904
924
  template: `
905
- <ngt-primitive
906
- *args="[material]"
907
- [ref]="materialRef"
908
- [time]="wobbleTime()"
909
- [factor]="wobbleFactor()"
910
- attach="material"
911
- ngtCompound
912
- />
913
- `,
925
+ <ngt-primitive
926
+ *args="[material]"
927
+ [ref]="materialRef"
928
+ [time]="time()"
929
+ [factor]="factor()"
930
+ attach="material"
931
+ ngtCompound
932
+ />
933
+ `,
914
934
  imports: [NgtArgs],
915
935
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
916
936
  }]
917
937
  }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
918
938
  type: Input
919
- }], time: [{
920
- type: Input
921
- }], factor: [{
922
- type: Input
923
- }], 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.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"] }] }); }
978
+ }
979
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: NgtsPointMaterial, decorators: [{
980
+ type: Component,
981
+ args: [{
982
+ selector: 'ngts-point-material',
983
+ standalone: true,
984
+ template: `<ngt-primitive ngtCompound [ref]="pointMaterialRef" *args="[material]" attach="material" />`,
985
+ imports: [NgtArgs],
986
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
987
+ }]
988
+ }], propDecorators: { pointMaterialRef: [{
924
989
  type: Input
925
990
  }] } });
926
991
 
@@ -928,5 +993,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.3", ngImpor
928
993
  * Generated bundle index. Do not edit.
929
994
  */
930
995
 
931
- export { NgtsMeshDistortMaterial, NgtsMeshReflectorMaterial, NgtsMeshRefractionMaterial, NgtsMeshTranmissionMaterial, NgtsMeshWobbleMaterial };
996
+ export { NgtsMeshDistortMaterial, NgtsMeshReflectorMaterial, NgtsMeshRefractionMaterial, NgtsMeshTranmissionMaterial, NgtsMeshWobbleMaterial, NgtsPointMaterial, PointMaterial };
932
997
  //# sourceMappingURL=angular-three-soba-materials.mjs.map