angular-three-soba 1.14.1 → 2.0.0-beta.11

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