angular-three-soba 2.0.0-beta.4 → 2.0.0-beta.41

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 (323) hide show
  1. package/abstractions/billboard/billboard.d.ts +12 -8
  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 +42 -51
  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 +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 +49 -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 +34 -15
  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 +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 +120 -100
  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 +109 -85
  29. package/esm2022/gizmos/angular-three-soba-gizmos.mjs +5 -0
  30. package/esm2022/gizmos/gizmo-helper/gizmo-helper.mjs +198 -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 +151 -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 +14 -9
  40. package/esm2022/loaders/loader/loader.mjs +92 -87
  41. package/esm2022/loaders/progress/progress.mjs +31 -30
  42. package/esm2022/loaders/texture-loader/texture-loader.mjs +20 -15
  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 +99 -97
  47. package/esm2022/materials/mesh-transmission-material/mesh-transmission-material.mjs +164 -144
  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 +28 -23
  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 +41 -37
  55. package/esm2022/misc/example/example.mjs +161 -0
  56. package/esm2022/misc/fbo/fbo.mjs +42 -36
  57. package/esm2022/misc/html/html-wrapper.mjs +478 -0
  58. package/esm2022/misc/html/html.mjs +305 -0
  59. package/esm2022/misc/index.mjs +10 -1
  60. package/esm2022/misc/sampler/sampler.mjs +132 -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 +204 -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 +221 -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 +327 -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 +183 -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 +32 -0
  83. package/esm2022/shaders/convolution-material/convolution-material.mjs +3 -2
  84. package/esm2022/shaders/discard-material/discard-material.mjs +1 -1
  85. package/esm2022/shaders/grid-material/grid-material.mjs +30 -14
  86. package/esm2022/shaders/index.mjs +5 -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 +3 -2
  90. package/esm2022/shaders/mesh-transmission-material/mesh-transmission-material.mjs +7 -4
  91. package/esm2022/shaders/mesh-wobble-material/mesh-wobble-material.mjs +1 -1
  92. package/esm2022/shaders/shader-material/shader-material.mjs +3 -5
  93. package/esm2022/shaders/soft-shadow-material/soft-shadow-material.mjs +18 -25
  94. package/esm2022/shaders/sparkles-material/sparkles-material.mjs +32 -46
  95. package/esm2022/shaders/spot-light-material/spot-light-material.mjs +8 -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 +161 -176
  99. package/esm2022/staging/accumulative-shadows/progressive-light-map.mjs +8 -8
  100. package/esm2022/staging/accumulative-shadows/randomized-lights.mjs +129 -129
  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 +145 -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 -136
  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 +40 -17
  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 +267 -0
  124. package/esm2022/staging/spot-light/spot-light-input.mjs +67 -58
  125. package/esm2022/staging/spot-light/spot-light.mjs +51 -63
  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/constants.mjs +3 -0
  133. package/esm2022/utils/content/content.mjs +15 -0
  134. package/esm2022/utils/index.mjs +3 -0
  135. package/fesm2022/angular-three-soba-abstractions.mjs +504 -2079
  136. package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
  137. package/fesm2022/angular-three-soba-cameras.mjs +293 -260
  138. package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
  139. package/fesm2022/angular-three-soba-controls.mjs +108 -83
  140. package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
  141. package/fesm2022/angular-three-soba-gizmos.mjs +1045 -0
  142. package/fesm2022/angular-three-soba-gizmos.mjs.map +1 -0
  143. package/fesm2022/angular-three-soba-loaders.mjs +148 -132
  144. package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
  145. package/fesm2022/angular-three-soba-materials.mjs +656 -588
  146. package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
  147. package/fesm2022/angular-three-soba-misc.mjs +2202 -99
  148. package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
  149. package/fesm2022/angular-three-soba-modifiers.mjs +71 -0
  150. package/fesm2022/angular-three-soba-modifiers.mjs.map +1 -0
  151. package/fesm2022/angular-three-soba-performances.mjs +957 -0
  152. package/fesm2022/angular-three-soba-performances.mjs.map +1 -0
  153. package/fesm2022/angular-three-soba-shaders.mjs +508 -269
  154. package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
  155. package/fesm2022/angular-three-soba-staging.mjs +2910 -2573
  156. package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
  157. package/fesm2022/angular-three-soba-utils.mjs +25 -0
  158. package/fesm2022/angular-three-soba-utils.mjs.map +1 -0
  159. package/gizmos/README.md +3 -0
  160. package/gizmos/gizmo-helper/gizmo-helper.d.ts +73 -0
  161. package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +22 -0
  162. package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +29 -0
  163. package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-input.d.ts +33 -0
  164. package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +10 -0
  165. package/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +40 -0
  166. package/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +30 -0
  167. package/gizmos/index.d.ts +3 -0
  168. package/loaders/gltf-loader/gltf-loader.d.ts +15 -4
  169. package/loaders/loader/loader.d.ts +19 -17
  170. package/loaders/progress/progress.d.ts +1 -1
  171. package/loaders/texture-loader/texture-loader.d.ts +8 -3
  172. package/materials/index.d.ts +1 -0
  173. package/materials/mesh-distort-material/mesh-distort-material.d.ts +25 -15
  174. package/materials/mesh-reflector-material/mesh-reflector-material.d.ts +74 -56
  175. package/materials/mesh-refraction-material/mesh-refraction-material.d.ts +33 -21
  176. package/materials/mesh-transmission-material/mesh-transmission-material.d.ts +55 -39
  177. package/materials/mesh-wobble-material/mesh-wobble-material.d.ts +19 -10
  178. package/materials/point-material/point-material.d.ts +24 -0
  179. package/metadata.json +1 -0
  180. package/misc/animations/animations.d.ts +6 -4
  181. package/misc/caustics/caustics.d.ts +87 -0
  182. package/misc/decal/decal.d.ts +49 -0
  183. package/misc/depth-buffer/depth-buffer.d.ts +2 -2
  184. package/misc/example/example.d.ts +85 -0
  185. package/misc/fbo/fbo.d.ts +2 -2
  186. package/misc/html/html-wrapper.d.ts +559 -0
  187. package/misc/html/html.d.ts +218 -0
  188. package/misc/index.d.ts +9 -0
  189. package/misc/sampler/sampler.d.ts +67 -0
  190. package/misc/shadow/shadow.d.ts +37 -0
  191. package/misc/stats-gl/stats-gl.d.ts +24 -0
  192. package/misc/trail/trail.d.ts +57 -0
  193. package/misc/trail-texture/inject-trail-texture.d.ts +9 -0
  194. package/misc/trail-texture/trail-texture.d.ts +50 -0
  195. package/modifiers/README.md +3 -0
  196. package/modifiers/curve-modifier/curve-modifier.d.ts +23 -0
  197. package/modifiers/index.d.ts +1 -0
  198. package/package.json +42 -24
  199. package/performances/README.md +3 -0
  200. package/performances/adaptive-dpr/adaptive-dpr.d.ts +14 -0
  201. package/{performance/adaptive → performances/adaptive-events}/adaptive-events.d.ts +3 -0
  202. package/performances/index.d.ts +7 -0
  203. package/performances/instances/instances.d.ts +83 -0
  204. package/{performance → performances}/instances/position-mesh.d.ts +1 -1
  205. package/performances/points/points-input.d.ts +32 -0
  206. package/performances/points/points.d.ts +96 -0
  207. package/performances/points/position-point.d.ts +11 -0
  208. package/performances/segments/segment-object.d.ts +7 -0
  209. package/performances/segments/segments.d.ts +128 -0
  210. package/shaders/grid-material/grid-material.d.ts +33 -0
  211. package/shaders/index.d.ts +4 -2
  212. package/shaders/mesh-distort-material/mesh-distort-material.d.ts +173 -6
  213. package/shaders/mesh-transmission-material/mesh-transmission-material.d.ts +1 -1
  214. package/shaders/shader-material/shader-material.d.ts +2 -2
  215. package/shaders/soft-shadow-material/soft-shadow-material.d.ts +10 -1
  216. package/shaders/sparkles-material/sparkles-material.d.ts +13 -0
  217. package/shaders/spot-light-material/spot-light-material.d.ts +11 -2
  218. package/shaders/star-field-material/star-field-material.d.ts +9 -0
  219. package/shaders/wireframe-material/wireframe-material.d.ts +58 -0
  220. package/staging/accumulative-shadows/accumulative-shadows.d.ts +93 -39
  221. package/staging/accumulative-shadows/randomized-lights.d.ts +41 -28
  222. package/staging/backdrop/backdrop.d.ts +30 -0
  223. package/staging/bb-anchor/bb-anchor.d.ts +27 -0
  224. package/staging/bounds/bounds.d.ts +105 -25
  225. package/staging/camera-shake/camera-shake.d.ts +30 -19
  226. package/staging/center/center.d.ts +43 -35
  227. package/staging/cloud/cloud.d.ts +27 -24
  228. package/staging/contact-shadows/contact-shadows.d.ts +43 -30
  229. package/staging/environment/assets.d.ts +9 -9
  230. package/staging/environment/environment-cube.d.ts +9 -5
  231. package/staging/environment/environment-ground.d.ts +7 -7
  232. package/staging/environment/environment-input.d.ts +38 -38
  233. package/staging/environment/environment-map.d.ts +10 -5
  234. package/staging/environment/environment-portal.d.ts +10 -5
  235. package/staging/environment/environment.d.ts +0 -4
  236. package/staging/environment/utils.d.ts +2 -2
  237. package/staging/float/float.d.ts +15 -11
  238. package/staging/index.d.ts +6 -2
  239. package/staging/matcap-texture/matcap-texture.d.ts +13 -0
  240. package/staging/normal-texture/normal-texture.d.ts +16 -0
  241. package/staging/sky/sky.d.ts +28 -21
  242. package/staging/sparkles/sparkles.d.ts +36 -22
  243. package/staging/spot-light/shadow-mesh-input.d.ts +29 -0
  244. package/staging/spot-light/shadow-mesh.d.ts +37 -0
  245. package/staging/spot-light/spot-light-input.d.ts +25 -25
  246. package/staging/spot-light/spot-light.d.ts +35 -15
  247. package/staging/spot-light/volumetric-mesh.d.ts +15 -9
  248. package/staging/stage/stage.d.ts +89 -65
  249. package/staging/stars/stars.d.ts +28 -17
  250. package/staging/wireframe/wireframe-input.d.ts +65 -0
  251. package/staging/wireframe/wireframe.d.ts +28 -0
  252. package/utils/README.md +3 -0
  253. package/utils/constants.d.ts +1 -0
  254. package/utils/content/content.d.ts +8 -0
  255. package/utils/index.d.ts +2 -0
  256. package/web-types.json +1 -0
  257. package/abstractions/catmull-rom-line/catmull-rom-line.d.ts +0 -25
  258. package/abstractions/cubic-bezier-line/cubic-bezier-line.d.ts +0 -25
  259. package/abstractions/gizmo-helper/gizmo-helper.d.ts +0 -34
  260. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +0 -22
  261. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +0 -30
  262. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +0 -32
  263. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +0 -14
  264. package/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +0 -47
  265. package/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +0 -40
  266. package/abstractions/line/line-input.d.ts +0 -42
  267. package/abstractions/line/line.d.ts +0 -35
  268. package/abstractions/quadratic-bezier-line/quadratic-bezier-line.d.ts +0 -23
  269. package/esm2022/abstractions/catmull-rom-line/catmull-rom-line.mjs +0 -131
  270. package/esm2022/abstractions/cubic-bezier-line/cubic-bezier-line.mjs +0 -113
  271. package/esm2022/abstractions/gizmo-helper/gizmo-helper.mjs +0 -210
  272. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/constants.mjs +0 -31
  273. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +0 -95
  274. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +0 -155
  275. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +0 -62
  276. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +0 -80
  277. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +0 -206
  278. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +0 -273
  279. package/esm2022/abstractions/line/line-input.mjs +0 -113
  280. package/esm2022/abstractions/line/line.mjs +0 -165
  281. package/esm2022/abstractions/quadratic-bezier-line/quadratic-bezier-line.mjs +0 -128
  282. package/esm2022/performance/adaptive/adaptive-dpr.mjs +0 -46
  283. package/esm2022/performance/adaptive/adaptive-events.mjs +0 -31
  284. package/esm2022/performance/angular-three-soba-performance.mjs +0 -5
  285. package/esm2022/performance/detailed/detailed.mjs +0 -61
  286. package/esm2022/performance/index.mjs +0 -7
  287. package/esm2022/performance/instances/instance.mjs +0 -48
  288. package/esm2022/performance/instances/instances.mjs +0 -189
  289. package/esm2022/performance/instances/position-mesh.mjs +0 -52
  290. package/esm2022/performance/stats/stats.mjs +0 -79
  291. package/esm2022/shaders/caustics-material/caustics-material.mjs +0 -128
  292. package/esm2022/shaders/caustics-material/caustics-projection-material.mjs +0 -33
  293. package/esm2022/staging/caustics/caustisc.mjs +0 -384
  294. package/esm2022/staging/spot-light/spot-light-shadow-mesh-input.mjs +0 -57
  295. package/esm2022/staging/spot-light/spot-light-shadow-mesh.mjs +0 -256
  296. package/fesm2022/angular-three-soba-performance.mjs +0 -487
  297. package/fesm2022/angular-three-soba-performance.mjs.map +0 -1
  298. package/performance/README.md +0 -3
  299. package/performance/adaptive/adaptive-dpr.d.ts +0 -8
  300. package/performance/detailed/detailed.d.ts +0 -20
  301. package/performance/index.d.ts +0 -6
  302. package/performance/instances/instance.d.ts +0 -9
  303. package/performance/instances/instances.d.ts +0 -35
  304. package/performance/stats/stats.d.ts +0 -18
  305. package/plugin/generators.json +0 -19
  306. package/plugin/libs/plugin/README.md +0 -11
  307. package/plugin/package.json +0 -9
  308. package/plugin/src/generators/init/compat.d.ts +0 -2
  309. package/plugin/src/generators/init/compat.js +0 -6
  310. package/plugin/src/generators/init/compat.js.map +0 -1
  311. package/plugin/src/generators/init/init.d.ts +0 -7
  312. package/plugin/src/generators/init/init.js +0 -28
  313. package/plugin/src/generators/init/init.js.map +0 -1
  314. package/plugin/src/generators/init/schema.json +0 -6
  315. package/plugin/src/index.d.ts +0 -1
  316. package/plugin/src/index.js +0 -6
  317. package/plugin/src/index.js.map +0 -1
  318. package/staging/caustics/caustisc.d.ts +0 -70
  319. package/staging/spot-light/spot-light-shadow-mesh-input.d.ts +0 -29
  320. package/staging/spot-light/spot-light-shadow-mesh.d.ts +0 -38
  321. /package/{abstractions → gizmos}/gizmo-helper/gizmo-viewcube/constants.d.ts +0 -0
  322. /package/shaders/{caustics-material → caustics}/caustics-material.d.ts +0 -0
  323. /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.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.3", ngImport: i0, type: NgtsMeshDistortMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
41
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", 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.3", 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.3", ngImport: i0, type: NgtsMeshReflectorMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
343
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", 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.3", 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()?.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.0", ngImport: i0, type: NgtsMeshRefractionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
550
- 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: `
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.2.3", ngImport: i0, type: NgtsMeshRefractionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
540
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", 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.0", ngImport: i0, type: NgtsMeshRefractionMaterial, decorators: [{
561
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", 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,11 @@ 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();
741
+ if (this.materialRef.nativeElement.buffer === this.fboMainRef()?.texture && !transmissionSampler) {
742
+ parent = getLocalState(this.materialRef.nativeElement).parent?.();
744
743
  if (parent) {
745
744
  // Save defaults
746
745
  oldTone = state.gl.toneMapping;
@@ -751,14 +750,14 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
751
750
  state.gl.toneMapping = THREE.NoToneMapping;
752
751
  if (background)
753
752
  state.scene.background = background;
754
- parent['material'] = this.#discardMaterial;
753
+ parent['material'] = this.discardMaterial;
755
754
  if (backside) {
756
755
  // Render into the backside buffer
757
756
  state.gl.setRenderTarget(this.fboBackRef());
758
757
  state.gl.render(state.scene, state.camera);
759
758
  // And now prepare the material for the main render using the backside buffer
760
759
  parent['material'] = this.materialRef.nativeElement;
761
- parent['material'].buffer = this.fboBackRef().texture;
760
+ parent['material'].buffer = this.fboBackRef()?.texture;
762
761
  parent['material'].thickness = backsideThickness;
763
762
  parent['material'].side = THREE.BackSide;
764
763
  }
@@ -767,7 +766,7 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
767
766
  state.gl.render(state.scene, state.camera);
768
767
  parent['material'].thickness = thickness;
769
768
  parent['material'].side = this.side;
770
- parent['material'].buffer = this.fboMainRef().texture;
769
+ parent['material'].buffer = this.fboMainRef()?.texture;
771
770
  // Set old state back
772
771
  state.scene.background = oldBg;
773
772
  state.gl.setRenderTarget(null);
@@ -777,150 +776,219 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
777
776
  }
778
777
  });
779
778
  }
780
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsMeshTranmissionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
781
- 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: `
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"] }] }); }
779
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshTranmissionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
780
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", 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: `
781
+ <ngt-mesh-transmission-material
782
+ ngtCompound
783
+ *args="[samples(), transmissionSampler()]"
784
+ [ref]="materialRef"
785
+ [buffer]="buffer() || fboMainRef()?.texture"
786
+ [_transmission]="transmission()"
787
+ [transmission]="transmissionSampler() ? transmission() : 0"
788
+ [thickness]="thickness()"
789
+ [side]="side"
790
+ [anisotropicBlur]="anisotropicBlur() ?? anisotropy()"
791
+ [roughness]="roughness()"
792
+ [chromaticAberration]="chromaticAberration()"
793
+ [distortion]="distortion()"
794
+ [distortionScale]="distortionScale()"
795
+ [temporalDistortion]="temporalDistortion()"
796
+ [time]="time()"
797
+ />
798
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
800
799
  }
801
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsMeshTranmissionMaterial, decorators: [{
800
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshTranmissionMaterial, decorators: [{
802
801
  type: Component,
803
802
  args: [{
804
803
  selector: 'ngts-mesh-transmission-material',
805
804
  standalone: true,
806
805
  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
- `,
806
+ <ngt-mesh-transmission-material
807
+ ngtCompound
808
+ *args="[samples(), transmissionSampler()]"
809
+ [ref]="materialRef"
810
+ [buffer]="buffer() || fboMainRef()?.texture"
811
+ [_transmission]="transmission()"
812
+ [transmission]="transmissionSampler() ? transmission() : 0"
813
+ [thickness]="thickness()"
814
+ [side]="side"
815
+ [anisotropicBlur]="anisotropicBlur() ?? anisotropy()"
816
+ [roughness]="roughness()"
817
+ [chromaticAberration]="chromaticAberration()"
818
+ [distortion]="distortion()"
819
+ [distortionScale]="distortionScale()"
820
+ [temporalDistortion]="temporalDistortion()"
821
+ [time]="time()"
822
+ />
823
+ `,
825
824
  imports: [NgtArgs],
826
825
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
827
826
  }]
828
827
  }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
829
828
  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
829
+ }], _transmissionSampler: [{
830
+ type: Input,
831
+ args: [{ alias: 'transmissionSampler' }]
832
+ }], _backside: [{
833
+ type: Input,
834
+ args: [{ alias: 'backside' }]
835
+ }], _backsideThickness: [{
836
+ type: Input,
837
+ args: [{ alias: 'backsideThickness' }]
838
+ }], _resolution: [{
839
+ type: Input,
840
+ args: [{ alias: 'resolution' }]
841
+ }], _backsideResolution: [{
842
+ type: Input,
843
+ args: [{ alias: 'backsideResolution' }]
844
+ }], _samples: [{
845
+ type: Input,
846
+ args: [{ alias: 'samples' }]
847
+ }], _background: [{
848
+ type: Input,
849
+ args: [{ alias: 'background' }]
850
+ }], _transmission: [{
851
+ type: Input,
852
+ args: [{ alias: 'transmission' }]
853
+ }], _thickness: [{
854
+ type: Input,
855
+ args: [{ alias: 'thickness' }]
856
+ }], _roughness: [{
857
+ type: Input,
858
+ args: [{ alias: 'roughness' }]
859
+ }], _chromaticAberration: [{
860
+ type: Input,
861
+ args: [{ alias: 'chromaticAberration' }]
862
+ }], _anisotropy: [{
863
+ type: Input,
864
+ args: [{ alias: 'anisotropy' }]
865
+ }], _anisotropicBlur: [{
866
+ type: Input,
867
+ args: [{ alias: 'anisotropicBlur' }]
868
+ }], _distortion: [{
869
+ type: Input,
870
+ args: [{ alias: 'distortion' }]
871
+ }], _distortionScale: [{
872
+ type: Input,
873
+ args: [{ alias: 'distortionScale' }]
874
+ }], _temporalDistortion: [{
875
+ type: Input,
876
+ args: [{ alias: 'temporalDistortion' }]
877
+ }], _buffer: [{
878
+ type: Input,
879
+ args: [{ alias: 'buffer' }]
880
+ }], _time: [{
881
+ type: Input,
882
+ args: [{ alias: 'time' }]
864
883
  }] } });
865
884
 
866
885
  extend({ MeshWobbleMaterial });
867
- class NgtsMeshWobbleMaterial extends NgtSignalStore {
868
- set time(time) {
869
- this.set({ time });
886
+ class NgtsMeshWobbleMaterial {
887
+ set _time(time) {
888
+ this.inputs.set({ time });
870
889
  }
871
- set factor(factor) {
872
- this.set({ factor });
890
+ set _factor(factor) {
891
+ this.inputs.set({ factor });
873
892
  }
874
- set speed(speed) {
875
- this.set({ speed });
893
+ set _speed(speed) {
894
+ this.inputs.set({ speed });
876
895
  }
877
896
  constructor() {
878
- super({ speed: 1, time: 0, factor: 1 });
879
- this.material = new MeshWobbleMaterial();
897
+ this.inputs = signalStore({ speed: 1, time: 0, factor: 1 });
880
898
  this.materialRef = injectNgtRef();
881
- this.wobbleTime = this.select('time');
882
- this.wobbleFactor = this.select('factor');
899
+ this.material = new MeshWobbleMaterial();
900
+ this.time = this.inputs.select('time');
901
+ this.factor = this.inputs.select('factor');
883
902
  injectBeforeRender(({ clock }) => {
884
- this.material.time = clock.getElapsedTime() * this.get('speed');
903
+ this.material.time = clock.getElapsedTime() * this.inputs.get('speed');
885
904
  });
886
905
  }
887
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsMeshWobbleMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
888
- 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: `
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"] }] }); }
906
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshWobbleMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
907
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtsMeshWobbleMaterial, isStandalone: true, selector: "ngts-mesh-wobble-material", inputs: { materialRef: "materialRef", _time: ["time", "_time"], _factor: ["factor", "_factor"], _speed: ["speed", "_speed"] }, ngImport: i0, template: `
908
+ <ngt-primitive
909
+ *args="[material]"
910
+ [ref]="materialRef"
911
+ [time]="time()"
912
+ [factor]="factor()"
913
+ attach="material"
914
+ ngtCompound
915
+ />
916
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
898
917
  }
899
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsMeshWobbleMaterial, decorators: [{
918
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshWobbleMaterial, decorators: [{
900
919
  type: Component,
901
920
  args: [{
902
921
  selector: 'ngts-mesh-wobble-material',
903
922
  standalone: true,
904
923
  template: `
905
- <ngt-primitive
906
- *args="[material]"
907
- [ref]="materialRef"
908
- [time]="wobbleTime()"
909
- [factor]="wobbleFactor()"
910
- attach="material"
911
- ngtCompound
912
- />
913
- `,
924
+ <ngt-primitive
925
+ *args="[material]"
926
+ [ref]="materialRef"
927
+ [time]="time()"
928
+ [factor]="factor()"
929
+ attach="material"
930
+ ngtCompound
931
+ />
932
+ `,
914
933
  imports: [NgtArgs],
915
934
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
916
935
  }]
917
936
  }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
918
937
  type: Input
919
- }], time: [{
920
- type: Input
921
- }], factor: [{
922
- type: Input
923
- }], speed: [{
938
+ }], _time: [{
939
+ type: Input,
940
+ args: [{ alias: 'time' }]
941
+ }], _factor: [{
942
+ type: Input,
943
+ args: [{ alias: 'factor' }]
944
+ }], _speed: [{
945
+ type: Input,
946
+ args: [{ alias: 'speed' }]
947
+ }] } });
948
+
949
+ const opaque_fragment = parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'opaque_fragment' : 'output_fragment';
950
+ class PointMaterial extends THREE.PointsMaterial {
951
+ constructor(parameters) {
952
+ super(parameters);
953
+ this.onBeforeCompile = (shader, renderer) => {
954
+ const { isWebGL2 } = renderer.capabilities;
955
+ shader.fragmentShader = shader.fragmentShader.replace(`#include <${opaque_fragment}>`, `
956
+ ${!isWebGL2
957
+ ? `#extension GL_OES_standard_derivatives : enable\n#include <${opaque_fragment}>`
958
+ : `#include <${opaque_fragment}>`}
959
+ vec2 cxy = 2.0 * gl_PointCoord - 1.0;
960
+ float r = dot(cxy, cxy);
961
+ float delta = fwidth(r);
962
+ float mask = 1.0 - smoothstep(1.0 - delta, 1.0 + delta, r);
963
+ gl_FragColor = vec4(gl_FragColor.rgb, mask * gl_FragColor.a );
964
+ #include <tonemapping_fragment>
965
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
966
+ `);
967
+ };
968
+ }
969
+ }
970
+ class NgtsPointMaterial {
971
+ constructor() {
972
+ this.pointMaterialRef = injectNgtRef();
973
+ this.material = new PointMaterial({});
974
+ }
975
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsPointMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
976
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtsPointMaterial, isStandalone: true, selector: "ngts-point-material", inputs: { pointMaterialRef: "pointMaterialRef" }, ngImport: i0, template: `
977
+ <ngt-primitive ngtCompound [ref]="pointMaterialRef" *args="[material]" attach="material" />
978
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
979
+ }
980
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsPointMaterial, decorators: [{
981
+ type: Component,
982
+ args: [{
983
+ selector: 'ngts-point-material',
984
+ standalone: true,
985
+ template: `
986
+ <ngt-primitive ngtCompound [ref]="pointMaterialRef" *args="[material]" attach="material" />
987
+ `,
988
+ imports: [NgtArgs],
989
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
990
+ }]
991
+ }], propDecorators: { pointMaterialRef: [{
924
992
  type: Input
925
993
  }] } });
926
994
 
@@ -928,5 +996,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
928
996
  * Generated bundle index. Do not edit.
929
997
  */
930
998
 
931
- export { NgtsMeshDistortMaterial, NgtsMeshReflectorMaterial, NgtsMeshRefractionMaterial, NgtsMeshTranmissionMaterial, NgtsMeshWobbleMaterial };
999
+ export { NgtsMeshDistortMaterial, NgtsMeshReflectorMaterial, NgtsMeshRefractionMaterial, NgtsMeshTranmissionMaterial, NgtsMeshWobbleMaterial, NgtsPointMaterial, PointMaterial };
932
1000
  //# sourceMappingURL=angular-three-soba-materials.mjs.map