angular-three-soba 1.13.0 → 1.14.1

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 (257) hide show
  1. package/abstractions/lib/billboard/billboard.d.ts +1 -1
  2. package/abstractions/lib/catmull-rom-line/catmull-rom-line.d.ts +1 -1
  3. package/abstractions/lib/cubic-bezier-line/cubic-bezier-line.d.ts +1 -1
  4. package/abstractions/lib/edges/edges.d.ts +2 -2
  5. package/abstractions/lib/gizmo-helper/gizmo-helper.d.ts +1 -1
  6. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +1 -1
  7. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +2 -2
  8. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +1 -1
  9. package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +1 -1
  10. package/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +2 -2
  11. package/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +1 -1
  12. package/abstractions/lib/line/line-input.d.ts +1 -1
  13. package/abstractions/lib/line/line.d.ts +1 -1
  14. package/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.d.ts +1 -1
  15. package/abstractions/lib/text/text.d.ts +1 -1
  16. package/abstractions/lib/text-3d/text-3d.d.ts +1 -1
  17. package/cameras/lib/camera/camera-content.d.ts +1 -1
  18. package/cameras/lib/camera/camera.d.ts +1 -1
  19. package/cameras/lib/cube-camera/cube-camera.d.ts +1 -1
  20. package/cameras/lib/orthographic-camera/orthographic-camera.d.ts +1 -1
  21. package/controls/lib/orbit-controls/orbit-controls.d.ts +1 -1
  22. package/esm2022/abstractions/lib/billboard/billboard.mjs +74 -0
  23. package/esm2022/abstractions/lib/catmull-rom-line/catmull-rom-line.mjs +120 -0
  24. package/esm2022/abstractions/lib/cubic-bezier-line/cubic-bezier-line.mjs +99 -0
  25. package/esm2022/abstractions/lib/edges/edges.mjs +96 -0
  26. package/esm2022/abstractions/lib/gizmo-helper/gizmo-helper.mjs +213 -0
  27. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +92 -0
  28. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +184 -0
  29. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +46 -0
  30. package/{esm2020 → esm2022}/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +8 -7
  31. package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +195 -0
  32. package/{esm2020 → esm2022}/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +8 -7
  33. package/esm2022/abstractions/lib/line/line-input.mjs +76 -0
  34. package/esm2022/abstractions/lib/line/line.mjs +133 -0
  35. package/esm2022/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.mjs +128 -0
  36. package/esm2022/abstractions/lib/text/text.mjs +115 -0
  37. package/esm2022/abstractions/lib/text-3d/text-3d.mjs +145 -0
  38. package/esm2022/cameras/lib/camera/camera-content.mjs +21 -0
  39. package/esm2022/cameras/lib/camera/camera.mjs +75 -0
  40. package/esm2022/cameras/lib/cube-camera/cube-camera.mjs +131 -0
  41. package/esm2022/cameras/lib/orthographic-camera/orthographic-camera.mjs +93 -0
  42. package/{esm2020 → esm2022}/cameras/lib/perspective-camera/perspective-camera.mjs +8 -7
  43. package/esm2022/controls/lib/orbit-controls/orbit-controls.mjs +147 -0
  44. package/{esm2020 → esm2022}/loaders/lib/cube-texture-loader/cube-texture-loader.mjs +3 -3
  45. package/esm2022/loaders/lib/loader/loader.mjs +134 -0
  46. package/esm2022/materials/lib/mesh-distort-material/mesh-distort-material.mjs +75 -0
  47. package/esm2022/materials/lib/mesh-reflector-material/mesh-reflector-material.mjs +328 -0
  48. package/esm2022/materials/lib/mesh-refraction-material/mesh-refraction-material.mjs +158 -0
  49. package/esm2022/materials/lib/mesh-transmission-material/mesh-transmission-material.mjs +238 -0
  50. package/esm2022/materials/lib/mesh-wobble-material/mesh-wobble-material.mjs +68 -0
  51. package/esm2022/misc/lib/bake-shadows/bake-shadows.mjs +26 -0
  52. package/esm2022/performance/lib/adaptive/adaptive-dpr.mjs +47 -0
  53. package/esm2022/performance/lib/adaptive/adaptive-events.mjs +37 -0
  54. package/esm2022/performance/lib/detailed/detailed.mjs +54 -0
  55. package/esm2022/performance/lib/stats/stats.mjs +80 -0
  56. package/esm2022/shaders/lib/blur-pass/blur-pass.mjs +61 -0
  57. package/esm2022/staging/lib/accumulative-shadows/accumulative-shadows.mjs +249 -0
  58. package/esm2022/staging/lib/accumulative-shadows/randomized-lights.mjs +201 -0
  59. package/{esm2020 → esm2022}/staging/lib/bounds/bounds.mjs +8 -7
  60. package/esm2022/staging/lib/camera-shake/camera-shake.mjs +122 -0
  61. package/esm2022/staging/lib/caustics/caustics.mjs +364 -0
  62. package/esm2022/staging/lib/center/center.mjs +143 -0
  63. package/esm2022/staging/lib/cloud/cloud.mjs +160 -0
  64. package/esm2022/staging/lib/contact-shadows/contact-shadows.mjs +228 -0
  65. package/esm2022/staging/lib/environment/environment-cube.mjs +41 -0
  66. package/esm2022/staging/lib/environment/environment-ground.mjs +67 -0
  67. package/esm2022/staging/lib/environment/environment-inputs.mjs +87 -0
  68. package/esm2022/staging/lib/environment/environment-map.mjs +39 -0
  69. package/esm2022/staging/lib/environment/environment-portal.mjs +111 -0
  70. package/{esm2020 → esm2022}/staging/lib/environment/environment.mjs +13 -11
  71. package/esm2022/staging/lib/float/float.mjs +77 -0
  72. package/esm2022/staging/lib/sky/sky.mjs +109 -0
  73. package/esm2022/staging/lib/sparkles/sparkles.mjs +210 -0
  74. package/esm2022/staging/lib/spot-light/shadow-mesh-input.mjs +51 -0
  75. package/esm2022/staging/lib/spot-light/spot-light-input.mjs +62 -0
  76. package/esm2022/staging/lib/spot-light/spot-light-shadow-no-shader.mjs +74 -0
  77. package/esm2022/staging/lib/spot-light/spot-light-shadow-shader.mjs +126 -0
  78. package/{esm2020 → esm2022}/staging/lib/spot-light/spot-light-shadow.mjs +8 -7
  79. package/esm2022/staging/lib/spot-light/spot-light.mjs +117 -0
  80. package/esm2022/staging/lib/spot-light/volumetric-mesh.mjs +86 -0
  81. package/{esm2020 → esm2022}/staging/lib/stage/stage.mjs +13 -11
  82. package/esm2022/staging/lib/stars/stars.mjs +140 -0
  83. package/{fesm2020 → fesm2022}/angular-three-soba-abstractions.mjs +89 -89
  84. package/{fesm2015 → fesm2022}/angular-three-soba-abstractions.mjs.map +1 -1
  85. package/{fesm2015 → fesm2022}/angular-three-soba-cameras.mjs +21 -21
  86. package/{fesm2015 → fesm2022}/angular-three-soba-cameras.mjs.map +1 -1
  87. package/{fesm2020 → fesm2022}/angular-three-soba-controls.mjs +5 -5
  88. package/fesm2022/angular-three-soba-controls.mjs.map +1 -0
  89. package/{fesm2020 → fesm2022}/angular-three-soba-loaders.mjs +7 -7
  90. package/{fesm2020 → fesm2022}/angular-three-soba-loaders.mjs.map +1 -1
  91. package/{fesm2020 → fesm2022}/angular-three-soba-materials.mjs +25 -25
  92. package/{fesm2020 → fesm2022}/angular-three-soba-materials.mjs.map +1 -1
  93. package/{fesm2020 → fesm2022}/angular-three-soba-misc.mjs +3 -3
  94. package/{fesm2020 → fesm2022}/angular-three-soba-misc.mjs.map +1 -1
  95. package/{fesm2020 → fesm2022}/angular-three-soba-performance.mjs +14 -14
  96. package/{fesm2020 → fesm2022}/angular-three-soba-performance.mjs.map +1 -1
  97. package/{fesm2020 → fesm2022}/angular-three-soba-shaders.mjs +2 -2
  98. package/fesm2022/angular-three-soba-shaders.mjs.map +1 -0
  99. package/{fesm2020 → fesm2022}/angular-three-soba-staging.mjs +139 -139
  100. package/{fesm2020 → fesm2022}/angular-three-soba-staging.mjs.map +1 -1
  101. package/loaders/lib/loader/loader.d.ts +1 -1
  102. package/materials/lib/mesh-distort-material/mesh-distort-material.d.ts +1 -1
  103. package/materials/lib/mesh-reflector-material/mesh-reflector-material.d.ts +1 -1
  104. package/materials/lib/mesh-refraction-material/mesh-refraction-material.d.ts +1 -1
  105. package/materials/lib/mesh-transmission-material/mesh-transmission-material.d.ts +1 -1
  106. package/materials/lib/mesh-wobble-material/mesh-wobble-material.d.ts +1 -1
  107. package/package.json +45 -70
  108. package/performance/lib/adaptive/adaptive-dpr.d.ts +1 -1
  109. package/performance/lib/detailed/detailed.d.ts +1 -1
  110. package/performance/lib/stats/stats.d.ts +1 -1
  111. package/plugin/package.json +1 -1
  112. package/plugin/src/generators/init/compat.js +1 -1
  113. package/plugin/src/generators/init/compat.js.map +1 -1
  114. package/plugin/src/generators/init/init.d.ts +1 -1
  115. package/plugin/src/generators/init/init.js +1 -1
  116. package/plugin/src/generators/init/init.js.map +1 -1
  117. package/staging/lib/accumulative-shadows/accumulative-shadows.d.ts +2 -2
  118. package/staging/lib/accumulative-shadows/randomized-lights.d.ts +1 -1
  119. package/staging/lib/bounds/bounds.d.ts +1 -1
  120. package/staging/lib/camera-shake/camera-shake.d.ts +1 -1
  121. package/staging/lib/caustics/caustics.d.ts +2 -2
  122. package/staging/lib/center/center.d.ts +1 -1
  123. package/staging/lib/cloud/cloud.d.ts +1 -1
  124. package/staging/lib/contact-shadows/contact-shadows.d.ts +1 -1
  125. package/staging/lib/environment/environment-inputs.d.ts +1 -1
  126. package/staging/lib/float/float.d.ts +1 -1
  127. package/staging/lib/sky/sky.d.ts +1 -1
  128. package/staging/lib/sparkles/sparkles.d.ts +2 -2
  129. package/staging/lib/spot-light/shadow-mesh-input.d.ts +1 -1
  130. package/staging/lib/spot-light/spot-light-input.d.ts +1 -1
  131. package/staging/lib/spot-light/spot-light-shadow-no-shader.d.ts +1 -1
  132. package/staging/lib/spot-light/spot-light-shadow-shader.d.ts +1 -1
  133. package/staging/lib/spot-light/spot-light.d.ts +1 -1
  134. package/staging/lib/spot-light/volumetric-mesh.d.ts +1 -1
  135. package/staging/lib/stage/stage.d.ts +2 -2
  136. package/staging/lib/stars/stars.d.ts +2 -2
  137. package/esm2020/abstractions/lib/billboard/billboard.mjs +0 -73
  138. package/esm2020/abstractions/lib/catmull-rom-line/catmull-rom-line.mjs +0 -119
  139. package/esm2020/abstractions/lib/cubic-bezier-line/cubic-bezier-line.mjs +0 -98
  140. package/esm2020/abstractions/lib/edges/edges.mjs +0 -95
  141. package/esm2020/abstractions/lib/gizmo-helper/gizmo-helper.mjs +0 -211
  142. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +0 -91
  143. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +0 -182
  144. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +0 -45
  145. package/esm2020/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +0 -193
  146. package/esm2020/abstractions/lib/line/line-input.mjs +0 -75
  147. package/esm2020/abstractions/lib/line/line.mjs +0 -132
  148. package/esm2020/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.mjs +0 -127
  149. package/esm2020/abstractions/lib/text/text.mjs +0 -114
  150. package/esm2020/abstractions/lib/text-3d/text-3d.mjs +0 -144
  151. package/esm2020/cameras/lib/camera/camera-content.mjs +0 -20
  152. package/esm2020/cameras/lib/camera/camera.mjs +0 -74
  153. package/esm2020/cameras/lib/cube-camera/cube-camera.mjs +0 -130
  154. package/esm2020/cameras/lib/orthographic-camera/orthographic-camera.mjs +0 -92
  155. package/esm2020/controls/lib/orbit-controls/orbit-controls.mjs +0 -146
  156. package/esm2020/loaders/lib/loader/loader.mjs +0 -133
  157. package/esm2020/materials/lib/mesh-distort-material/mesh-distort-material.mjs +0 -74
  158. package/esm2020/materials/lib/mesh-reflector-material/mesh-reflector-material.mjs +0 -327
  159. package/esm2020/materials/lib/mesh-refraction-material/mesh-refraction-material.mjs +0 -157
  160. package/esm2020/materials/lib/mesh-transmission-material/mesh-transmission-material.mjs +0 -237
  161. package/esm2020/materials/lib/mesh-wobble-material/mesh-wobble-material.mjs +0 -67
  162. package/esm2020/misc/lib/bake-shadows/bake-shadows.mjs +0 -25
  163. package/esm2020/performance/lib/adaptive/adaptive-dpr.mjs +0 -46
  164. package/esm2020/performance/lib/adaptive/adaptive-events.mjs +0 -36
  165. package/esm2020/performance/lib/detailed/detailed.mjs +0 -53
  166. package/esm2020/performance/lib/stats/stats.mjs +0 -79
  167. package/esm2020/shaders/lib/blur-pass/blur-pass.mjs +0 -61
  168. package/esm2020/staging/lib/accumulative-shadows/accumulative-shadows.mjs +0 -247
  169. package/esm2020/staging/lib/accumulative-shadows/randomized-lights.mjs +0 -199
  170. package/esm2020/staging/lib/camera-shake/camera-shake.mjs +0 -121
  171. package/esm2020/staging/lib/caustics/caustics.mjs +0 -363
  172. package/esm2020/staging/lib/center/center.mjs +0 -142
  173. package/esm2020/staging/lib/cloud/cloud.mjs +0 -159
  174. package/esm2020/staging/lib/contact-shadows/contact-shadows.mjs +0 -227
  175. package/esm2020/staging/lib/environment/environment-cube.mjs +0 -40
  176. package/esm2020/staging/lib/environment/environment-ground.mjs +0 -66
  177. package/esm2020/staging/lib/environment/environment-inputs.mjs +0 -86
  178. package/esm2020/staging/lib/environment/environment-map.mjs +0 -38
  179. package/esm2020/staging/lib/environment/environment-portal.mjs +0 -110
  180. package/esm2020/staging/lib/float/float.mjs +0 -76
  181. package/esm2020/staging/lib/sky/sky.mjs +0 -108
  182. package/esm2020/staging/lib/sparkles/sparkles.mjs +0 -209
  183. package/esm2020/staging/lib/spot-light/shadow-mesh-input.mjs +0 -50
  184. package/esm2020/staging/lib/spot-light/spot-light-input.mjs +0 -61
  185. package/esm2020/staging/lib/spot-light/spot-light-shadow-no-shader.mjs +0 -73
  186. package/esm2020/staging/lib/spot-light/spot-light-shadow-shader.mjs +0 -125
  187. package/esm2020/staging/lib/spot-light/spot-light.mjs +0 -116
  188. package/esm2020/staging/lib/spot-light/volumetric-mesh.mjs +0 -85
  189. package/esm2020/staging/lib/stars/stars.mjs +0 -139
  190. package/fesm2015/angular-three-soba-abstractions.mjs +0 -2048
  191. package/fesm2015/angular-three-soba-controls.mjs +0 -153
  192. package/fesm2015/angular-three-soba-controls.mjs.map +0 -1
  193. package/fesm2015/angular-three-soba-loaders.mjs +0 -229
  194. package/fesm2015/angular-three-soba-loaders.mjs.map +0 -1
  195. package/fesm2015/angular-three-soba-materials.mjs +0 -851
  196. package/fesm2015/angular-three-soba-materials.mjs.map +0 -1
  197. package/fesm2015/angular-three-soba-misc.mjs +0 -148
  198. package/fesm2015/angular-three-soba-misc.mjs.map +0 -1
  199. package/fesm2015/angular-three-soba-performance.mjs +0 -210
  200. package/fesm2015/angular-three-soba-performance.mjs.map +0 -1
  201. package/fesm2015/angular-three-soba-shaders.mjs +0 -1239
  202. package/fesm2015/angular-three-soba-shaders.mjs.map +0 -1
  203. package/fesm2015/angular-three-soba-staging.mjs +0 -3772
  204. package/fesm2015/angular-three-soba-staging.mjs.map +0 -1
  205. package/fesm2020/angular-three-soba-abstractions.mjs.map +0 -1
  206. package/fesm2020/angular-three-soba-cameras.mjs +0 -347
  207. package/fesm2020/angular-three-soba-cameras.mjs.map +0 -1
  208. package/fesm2020/angular-three-soba-controls.mjs.map +0 -1
  209. package/fesm2020/angular-three-soba-shaders.mjs.map +0 -1
  210. package/fesm2020/angular-three-soba.mjs +0 -6
  211. package/fesm2020/angular-three-soba.mjs.map +0 -1
  212. /package/{esm2020 → esm2022}/abstractions/angular-three-soba-abstractions.mjs +0 -0
  213. /package/{esm2020 → esm2022}/abstractions/index.mjs +0 -0
  214. /package/{esm2020 → esm2022}/abstractions/lib/gizmo-helper/gizmo-viewcube/constants.mjs +0 -0
  215. /package/{esm2020 → esm2022}/angular-three-soba.mjs +0 -0
  216. /package/{esm2020 → esm2022}/cameras/angular-three-soba-cameras.mjs +0 -0
  217. /package/{esm2020 → esm2022}/cameras/index.mjs +0 -0
  218. /package/{esm2020 → esm2022}/controls/angular-three-soba-controls.mjs +0 -0
  219. /package/{esm2020 → esm2022}/controls/index.mjs +0 -0
  220. /package/{esm2020 → esm2022}/index.mjs +0 -0
  221. /package/{esm2020 → esm2022}/loaders/angular-three-soba-loaders.mjs +0 -0
  222. /package/{esm2020 → esm2022}/loaders/index.mjs +0 -0
  223. /package/{esm2020 → esm2022}/loaders/lib/gltf-loader/gltf-loader.mjs +0 -0
  224. /package/{esm2020 → esm2022}/loaders/lib/progress/progress.mjs +0 -0
  225. /package/{esm2020 → esm2022}/loaders/lib/texture-loader/texture-loader.mjs +0 -0
  226. /package/{esm2020 → esm2022}/materials/angular-three-soba-materials.mjs +0 -0
  227. /package/{esm2020 → esm2022}/materials/index.mjs +0 -0
  228. /package/{esm2020 → esm2022}/misc/angular-three-soba-misc.mjs +0 -0
  229. /package/{esm2020 → esm2022}/misc/index.mjs +0 -0
  230. /package/{esm2020 → esm2022}/misc/lib/animations/animations.mjs +0 -0
  231. /package/{esm2020 → esm2022}/misc/lib/depth-buffer/depth-buffer.mjs +0 -0
  232. /package/{esm2020 → esm2022}/misc/lib/fbo/fbo.mjs +0 -0
  233. /package/{esm2020 → esm2022}/performance/angular-three-soba-performance.mjs +0 -0
  234. /package/{esm2020 → esm2022}/performance/index.mjs +0 -0
  235. /package/{esm2020 → esm2022}/shaders/angular-three-soba-shaders.mjs +0 -0
  236. /package/{esm2020 → esm2022}/shaders/index.mjs +0 -0
  237. /package/{esm2020 → esm2022}/shaders/lib/caustics-material/caustics-material.mjs +0 -0
  238. /package/{esm2020 → esm2022}/shaders/lib/caustics-projection-material/caustics-projection-material.mjs +0 -0
  239. /package/{esm2020 → esm2022}/shaders/lib/convolution-material/convolution-material.mjs +0 -0
  240. /package/{esm2020 → esm2022}/shaders/lib/discard-material/discard-material.mjs +0 -0
  241. /package/{esm2020 → esm2022}/shaders/lib/mesh-distort-material/mesh-distort-material.mjs +0 -0
  242. /package/{esm2020 → esm2022}/shaders/lib/mesh-reflector-material/mesh-reflector-material.mjs +0 -0
  243. /package/{esm2020 → esm2022}/shaders/lib/mesh-refraction-material/mesh-refraction-material.mjs +0 -0
  244. /package/{esm2020 → esm2022}/shaders/lib/mesh-transmission-material/mesh-transmission-material.mjs +0 -0
  245. /package/{esm2020 → esm2022}/shaders/lib/mesh-wobble-material/mesh-wobble-material.mjs +0 -0
  246. /package/{esm2020 → esm2022}/shaders/lib/shader-material/shader-material.mjs +0 -0
  247. /package/{esm2020 → esm2022}/shaders/lib/soft-shadow-material/soft-shadow-material.mjs +0 -0
  248. /package/{esm2020 → esm2022}/shaders/lib/spot-light-material/spot-light-material.mjs +0 -0
  249. /package/{esm2020 → esm2022}/shaders/lib/star-field-material/star-field-material.mjs +0 -0
  250. /package/{esm2020 → esm2022}/staging/angular-three-soba-staging.mjs +0 -0
  251. /package/{esm2020 → esm2022}/staging/index.mjs +0 -0
  252. /package/{esm2020 → esm2022}/staging/lib/accumulative-shadows/progressive-light-map.mjs +0 -0
  253. /package/{esm2020 → esm2022}/staging/lib/environment/assets.mjs +0 -0
  254. /package/{esm2020 → esm2022}/staging/lib/environment/utils.mjs +0 -0
  255. /package/{esm2020 → esm2022}/staging/lib/spot-light/common.mjs +0 -0
  256. /package/{fesm2015 → fesm2022}/angular-three-soba.mjs +0 -0
  257. /package/{fesm2015 → fesm2022}/angular-three-soba.mjs.map +0 -0
@@ -1,851 +0,0 @@
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';
5
- import { NgIf } from '@angular/common';
6
- import { debounceTime, map, combineLatest } from 'rxjs';
7
- import * as THREE from 'three';
8
- import { MeshBVH, SAH } from 'three-mesh-bvh';
9
- import { injectNgtsFBO } from 'angular-three-soba/misc';
10
-
11
- class NgtsMeshDistortMaterial extends NgtRxStore {
12
- set time(time) {
13
- this.set({ time });
14
- }
15
- set distort(distort) {
16
- this.set({ distort });
17
- }
18
- set radius(radius) {
19
- this.set({ radius });
20
- }
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 });
27
- }
28
- constructor() {
29
- super();
30
- this.MeshDistortMaterial = inject(NGTS_DISTORT_MATERIAL_SHADER);
31
- this.material = new this.MeshDistortMaterial();
32
- this.materialRef = injectNgtRef();
33
- injectBeforeRender(({ clock }) => {
34
- this.material.time = clock.getElapsedTime() * this.get('speed');
35
- });
36
- }
37
- }
38
- NgtsMeshDistortMaterial.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsMeshDistortMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component });
39
- NgtsMeshDistortMaterial.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", 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: `
40
- <ngt-primitive
41
- *args="[material]"
42
- [ref]="materialRef"
43
- [time]="get('time')"
44
- [distort]="get('distort')"
45
- [radius]="get('radius')"
46
- ngtCompound
47
- attach="material"
48
- />
49
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
50
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsMeshDistortMaterial, decorators: [{
51
- type: Component,
52
- args: [{
53
- selector: 'ngts-mesh-distort-material',
54
- standalone: true,
55
- 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
- `,
66
- imports: [NgtArgs],
67
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
68
- }]
69
- }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
70
- type: Input
71
- }], time: [{
72
- type: Input
73
- }], distort: [{
74
- type: Input
75
- }], radius: [{
76
- type: Input
77
- }], speed: [{
78
- type: Input
79
- }] } });
80
-
81
- extend({ MeshReflectorMaterial });
82
- class NgtsMeshReflectorMaterial extends NgtRxStore {
83
- set resolution(resolution) {
84
- this.set({ resolution });
85
- }
86
- set mixBlur(mixBlur) {
87
- this.set({ mixBlur });
88
- }
89
- set mixStrength(mixStrength) {
90
- this.set({ mixStrength });
91
- }
92
- set blur(blur) {
93
- this.set({ blur });
94
- }
95
- set mirror(mirror) {
96
- this.set({ mirror });
97
- }
98
- set minDepthThreshold(minDepthThreshold) {
99
- this.set({ minDepthThreshold });
100
- }
101
- set maxDepthThreshold(maxDepthThreshold) {
102
- this.set({ maxDepthThreshold });
103
- }
104
- set depthScale(depthScale) {
105
- this.set({ depthScale });
106
- }
107
- set depthToBlurRatioBias(depthToBlurRatioBias) {
108
- this.set({ depthToBlurRatioBias });
109
- }
110
- set distortionMap(distortionMap) {
111
- this.set({ distortionMap });
112
- }
113
- set distortion(distortion) {
114
- this.set({ distortion });
115
- }
116
- set mixContrast(mixContrast) {
117
- this.set({ mixContrast });
118
- }
119
- set reflectorOffset(reflectorOffset) {
120
- this.set({ reflectorOffset });
121
- }
122
- get reflectorProps() {
123
- return this.get('reflectorEntities', 'reflectorProps');
124
- }
125
- initialize() {
126
- super.initialize();
127
- this.set({
128
- mixBlur: 0,
129
- mixStrength: 1,
130
- resolution: 256,
131
- blur: [0, 0],
132
- minDepthThreshold: 0.9,
133
- maxDepthThreshold: 1,
134
- depthScale: 0,
135
- depthToBlurRatioBias: 0.25,
136
- mirror: 0,
137
- distortion: 1,
138
- mixContrast: 1,
139
- reflectorOffset: 0,
140
- });
141
- }
142
- constructor() {
143
- super();
144
- this.materialRef = injectNgtRef();
145
- this.defines$ = this.select('reflectorEntities', 'reflectorProps', 'defines').pipe(debounceTime(0));
146
- this.store = inject(NgtStore);
147
- this.reflectorPlane = new THREE.Plane();
148
- this.normal = new THREE.Vector3();
149
- this.reflectorWorldPosition = new THREE.Vector3();
150
- this.cameraWorldPosition = new THREE.Vector3();
151
- this.rotationMatrix = new THREE.Matrix4();
152
- this.lookAtPosition = new THREE.Vector3(0, 0, -1);
153
- this.clipPlane = new THREE.Vector4();
154
- this.view = new THREE.Vector3();
155
- this.target = new THREE.Vector3();
156
- this.q = new THREE.Vector4();
157
- this.textureMatrix = new THREE.Matrix4();
158
- 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,]) => {
177
- const parameters = {
178
- minFilter: THREE.LinearFilter,
179
- magFilter: THREE.LinearFilter,
180
- encoding: gl.outputEncoding,
181
- type: THREE.HalfFloatType,
182
- };
183
- const fbo1 = new THREE.WebGLRenderTarget(resolution, resolution, parameters);
184
- fbo1.depthBuffer = true;
185
- fbo1.depthTexture = new THREE.DepthTexture(resolution, resolution);
186
- fbo1.depthTexture.format = THREE.DepthFormat;
187
- fbo1.depthTexture.type = THREE.UnsignedShortType;
188
- const fbo2 = new THREE.WebGLRenderTarget(resolution, resolution, parameters);
189
- const blurPass = new BlurPass({
190
- gl,
191
- resolution,
192
- width: blur[0],
193
- height: blur[1],
194
- minDepthThreshold,
195
- maxDepthThreshold,
196
- depthScale,
197
- depthToBlurRatioBias,
198
- });
199
- const reflectorProps = {
200
- mirror,
201
- textureMatrix: this.textureMatrix,
202
- mixBlur,
203
- tDiffuse: fbo1.texture,
204
- tDepth: fbo1.depthTexture,
205
- tDiffuseBlur: fbo2.texture,
206
- hasBlur,
207
- mixStrength,
208
- minDepthThreshold,
209
- maxDepthThreshold,
210
- depthScale,
211
- depthToBlurRatioBias,
212
- distortion,
213
- distortionMap,
214
- mixContrast,
215
- defines: {
216
- USE_BLUR: hasBlur ? '' : undefined,
217
- USE_DEPTH: depthScale > 0 ? '' : undefined,
218
- USE_DISTORTION: distortionMap ? '' : undefined,
219
- },
220
- };
221
- return { fbo1, fbo2, blurPass, reflectorProps };
222
- })));
223
- injectBeforeRender(this.onBeforeRender.bind(this));
224
- }
225
- beforeRender(state) {
226
- const parent = getLocalState(this.materialRef.nativeElement).parent;
227
- if (!parent)
228
- return;
229
- const { camera } = state;
230
- this.reflectorWorldPosition.setFromMatrixPosition(parent.matrixWorld);
231
- this.cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);
232
- this.rotationMatrix.extractRotation(parent.matrixWorld);
233
- this.normal.set(0, 0, 1);
234
- this.normal.applyMatrix4(this.rotationMatrix);
235
- this.reflectorWorldPosition.addScaledVector(this.normal, this.get('reflectorOffset'));
236
- this.view.subVectors(this.reflectorWorldPosition, this.cameraWorldPosition);
237
- // Avoid rendering when reflector is facing away
238
- if (this.view.dot(this.normal) > 0)
239
- return;
240
- this.view.reflect(this.normal).negate();
241
- this.view.add(this.reflectorWorldPosition);
242
- this.rotationMatrix.extractRotation(camera.matrixWorld);
243
- this.lookAtPosition.set(0, 0, -1);
244
- this.lookAtPosition.applyMatrix4(this.rotationMatrix);
245
- this.lookAtPosition.add(this.cameraWorldPosition);
246
- this.target.subVectors(this.reflectorWorldPosition, this.lookAtPosition);
247
- this.target.reflect(this.normal).negate();
248
- this.target.add(this.reflectorWorldPosition);
249
- this.virtualCamera.position.copy(this.view);
250
- this.virtualCamera.up.set(0, 1, 0);
251
- this.virtualCamera.up.applyMatrix4(this.rotationMatrix);
252
- this.virtualCamera.up.reflect(this.normal);
253
- this.virtualCamera.lookAt(this.target);
254
- this.virtualCamera.far = camera.far; // Used in WebGLBackground
255
- this.virtualCamera.updateMatrixWorld();
256
- this.virtualCamera.projectionMatrix.copy(camera.projectionMatrix);
257
- // 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);
262
- // Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html
263
- // Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
264
- this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal, this.reflectorWorldPosition);
265
- this.reflectorPlane.applyMatrix4(this.virtualCamera.matrixWorldInverse);
266
- this.clipPlane.set(this.reflectorPlane.normal.x, this.reflectorPlane.normal.y, this.reflectorPlane.normal.z, this.reflectorPlane.constant);
267
- const projectionMatrix = this.virtualCamera.projectionMatrix;
268
- this.q.x = (Math.sign(this.clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];
269
- this.q.y = (Math.sign(this.clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];
270
- this.q.z = -1.0;
271
- this.q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];
272
- // Calculate the scaled plane vector
273
- this.clipPlane.multiplyScalar(2.0 / this.clipPlane.dot(this.q));
274
- // Replacing the third row of the projection matrix
275
- projectionMatrix.elements[2] = this.clipPlane.x;
276
- projectionMatrix.elements[6] = this.clipPlane.y;
277
- projectionMatrix.elements[10] = this.clipPlane.z + 1.0;
278
- projectionMatrix.elements[14] = this.clipPlane.w;
279
- }
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
- }
310
- NgtsMeshReflectorMaterial.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsMeshReflectorMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component });
311
- NgtsMeshReflectorMaterial.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", 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: `
312
- <ngt-mesh-reflector-material
313
- ngtCompound
314
- attach="material"
315
- *ngIf="defines$ | ngtPush as defines"
316
- [ref]="materialRef"
317
- [defines]="defines"
318
- [mirror]="reflectorProps.mirror"
319
- [textureMatrix]="reflectorProps.textureMatrix"
320
- [mixBlur]="reflectorProps.mixBlur"
321
- [tDiffuse]="reflectorProps.tDiffuse"
322
- [tDepth]="reflectorProps.tDepth"
323
- [tDiffuseBlur]="reflectorProps.tDiffuseBlur"
324
- [hasBlur]="reflectorProps.hasBlur"
325
- [mixStrength]="reflectorProps.mixStrength"
326
- [minDepthThreshold]="reflectorProps.minDepthThreshold"
327
- [maxDepthThreshold]="reflectorProps.maxDepthThreshold"
328
- [depthScale]="reflectorProps.depthScale"
329
- [depthToBlurRatioBias]="reflectorProps.depthToBlurRatioBias"
330
- [distortion]="reflectorProps.distortion"
331
- [distortionMap]="reflectorProps.distortionMap"
332
- [mixContrast]="reflectorProps.mixContrast"
333
- >
334
- <ng-content />
335
- </ngt-mesh-reflector-material>
336
- `, isInline: true, dependencies: [{ kind: "pipe", type: NgtPush, name: "ngtPush" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
337
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsMeshReflectorMaterial, decorators: [{
338
- type: Component,
339
- args: [{
340
- selector: 'ngts-mesh-reflector-material',
341
- standalone: true,
342
- 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],
369
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
370
- }]
371
- }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
372
- 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
399
- }] } });
400
-
401
- extend({ MeshRefractionMaterial });
402
- const isCubeTexture = (def) => def && def.isCubeTexture;
403
- class NgtsMeshRefractionMaterial extends NgtRxStore {
404
- /** Environment map */
405
- set envMap(envMap) {
406
- this.set({ envMap });
407
- }
408
- /** Number of ray-cast bounces, it can be expensive to have too many, 2 */
409
- set bounces(bounces) {
410
- this.set({ bounces });
411
- }
412
- /** Refraction index, 2.4 */
413
- set ior(ior) {
414
- this.set({ ior });
415
- }
416
- /** Fresnel (strip light), 0 */
417
- set fresnel(fresnel) {
418
- this.set({ fresnel });
419
- }
420
- /** RGB shift intensity, can be expensive, 0 */
421
- set aberrationStrength(aberrationStrength) {
422
- this.set({ aberrationStrength });
423
- }
424
- /** Color, white */
425
- set color(color) {
426
- this.set({ color });
427
- }
428
- /** 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
- });
438
- }
439
- constructor() {
440
- super();
441
- 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]) => {
445
- var _a, _b;
446
- const temp = {};
447
- // Sampler2D and SamplerCube need different defines
448
- const isCubeMap = isCubeTexture(envMap);
449
- const w = (_b = (isCubeMap ? (_a = envMap.image[0]) === null || _a === void 0 ? void 0 : _a.width : envMap.image.width)) !== null && _b !== void 0 ? _b : 1024;
450
- const cubeSize = w / 4;
451
- const _lodMax = Math.floor(Math.log2(cubeSize));
452
- const _cubeSize = Math.pow(2, _lodMax);
453
- const width = 3 * Math.max(_cubeSize, 16 * 7);
454
- const height = 4 * _cubeSize;
455
- if (isCubeMap)
456
- temp['ENVMAP_TYPE_CUBEM'] = '';
457
- temp['CUBEUV_TEXEL_WIDTH'] = `${1.0 / width}`;
458
- temp['CUBEUV_TEXEL_HEIGHT'] = `${1.0 / height}`;
459
- temp['CUBEUV_MAX_MIP'] = `${_lodMax}.0`;
460
- // Add defines from chromatic aberration
461
- if (aberrationStrength > 0)
462
- temp['CHROMATIC_ABERRATIONS'] = '';
463
- if (fastChroma)
464
- temp['FAST_CHROMA'] = '';
465
- return temp;
466
- })));
467
- this.connect('resolution', this.store.select('size').pipe(map((size) => [size.width, size.height])));
468
- injectBeforeRender(({ camera }) => {
469
- if (this.materialRef.nativeElement) {
470
- this.materialRef.nativeElement.viewMatrixInverse = camera.matrixWorld;
471
- this.materialRef.nativeElement.projectionMatrixInverse = camera.projectionMatrixInverse;
472
- }
473
- });
474
- }
475
- ngOnInit() {
476
- this.setupGeometry();
477
- }
478
- setupGeometry() {
479
- this.hold(this.materialRef.$, (material) => {
480
- var _a;
481
- const geometry = (_a = getLocalState(material).parent) === null || _a === void 0 ? void 0 : _a.geometry;
482
- if (geometry) {
483
- material.bvh.updateFrom(new MeshBVH(geometry.toNonIndexed(), { lazyGeneration: false, strategy: SAH }));
484
- }
485
- });
486
- }
487
- }
488
- NgtsMeshRefractionMaterial.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsMeshRefractionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component });
489
- NgtsMeshRefractionMaterial.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", 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: `
490
- <ngt-mesh-refraction-material
491
- *ngIf="defines$ | ngtPush as defines"
492
- [ref]="materialRef"
493
- [defines]="defines"
494
- [resolution]="get('resolution')"
495
- [aberrationStrength]="get('aberrationStrength')"
496
- [envMap]="get('envMap')"
497
- [bounces]="get('bounces')"
498
- [ior]="get('ior')"
499
- [fresnel]="get('fresnel')"
500
- [color]="get('color')"
501
- [fastChroma]="get('fastChroma')"
502
- ngtCompound
503
- attach="material"
504
- >
505
- <ng-content />
506
- </ngt-mesh-refraction-material>
507
- `, isInline: true, dependencies: [{ kind: "pipe", type: NgtPush, name: "ngtPush" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
508
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsMeshRefractionMaterial, decorators: [{
509
- type: Component,
510
- args: [{
511
- selector: 'ngts-mesh-refraction-material',
512
- standalone: true,
513
- template: `
514
- <ngt-mesh-refraction-material
515
- *ngIf="defines$ | ngtPush as defines"
516
- [ref]="materialRef"
517
- [defines]="defines"
518
- [resolution]="get('resolution')"
519
- [aberrationStrength]="get('aberrationStrength')"
520
- [envMap]="get('envMap')"
521
- [bounces]="get('bounces')"
522
- [ior]="get('ior')"
523
- [fresnel]="get('fresnel')"
524
- [color]="get('color')"
525
- [fastChroma]="get('fastChroma')"
526
- ngtCompound
527
- attach="material"
528
- >
529
- <ng-content />
530
- </ngt-mesh-refraction-material>
531
- `,
532
- imports: [NgtPush, NgIf],
533
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
534
- }]
535
- }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
536
- type: Input
537
- }], envMap: [{
538
- type: Input
539
- }], bounces: [{
540
- type: Input
541
- }], ior: [{
542
- type: Input
543
- }], fresnel: [{
544
- type: Input
545
- }], aberrationStrength: [{
546
- type: Input
547
- }], color: [{
548
- type: Input
549
- }], fastChroma: [{
550
- type: Input
551
- }] } });
552
-
553
- extend({ MeshTransmissionMaterial });
554
- class NgtsMeshTranmissionMaterial extends NgtRxStore {
555
- /** transmissionSampler, you can use the threejs transmission sampler texture that is
556
- * generated once for all transmissive materials. The upside is that it can be faster if you
557
- * use multiple MeshPhysical and Transmission materials, the downside is that transmissive materials
558
- * using this can't see other transparent or transmissive objects, default: false */
559
- set transmissionSampler(transmissionSampler) {
560
- this.set({ transmissionSampler });
561
- }
562
- /** Render the backside of the material (more cost, better results), default: false */
563
- set backside(backside) {
564
- this.set({ backside });
565
- }
566
- /** Backside thickness (when backside is true), default: 0 */
567
- set backsideThickness(backsideThickness) {
568
- this.set({ backsideThickness });
569
- }
570
- /** Resolution of the local buffer, default: undefined (fullscreen) */
571
- set resolution(resolution) {
572
- this.set({ resolution });
573
- }
574
- /** Resolution of the local buffer for backfaces, default: undefined (fullscreen) */
575
- set backsideResolution(backsideResolution) {
576
- this.set({ backsideResolution });
577
- }
578
- /** Refraction samples, default: 10 */
579
- set samples(samples) {
580
- this.set({ samples });
581
- }
582
- /** Buffer scene background (can be a texture, a cubetexture or a color), default: null */
583
- set background(background) {
584
- this.set({ background });
585
- }
586
- /* Transmission, default: 1 */
587
- set transmission(transmission) {
588
- this.set({ transmission });
589
- }
590
- /* Thickness (refraction), default: 0 */
591
- set thickness(thickness) {
592
- this.set({ thickness });
593
- }
594
- /* Roughness (blur), default: 0 */
595
- set roughness(roughness) {
596
- this.set({ roughness });
597
- }
598
- /* Chromatic aberration, default: 0.03 */
599
- set chromaticAberration(chromaticAberration) {
600
- this.set({ chromaticAberration });
601
- }
602
- /* Anisotropy, default: 0.1 */
603
- set anisotropy(anisotropy) {
604
- this.set({ anisotropy });
605
- }
606
- /* Distortion, default: 0 */
607
- set distortion(distortion) {
608
- this.set({ distortion });
609
- }
610
- /* Distortion scale, default: 0.5 */
611
- set distortionScale(distortionScale) {
612
- this.set({ distortionScale });
613
- }
614
- /* Temporal distortion (speed of movement), default: 0.0 */
615
- set temporalDistortion(temporalDistortion) {
616
- this.set({ temporalDistortion });
617
- }
618
- /** The scene rendered into a texture (use it to share a texture between materials), default: null */
619
- set buffer(buffer) {
620
- this.set({ buffer });
621
- }
622
- /** Internals */
623
- set time(time) {
624
- this.set({ time });
625
- }
626
- initialize() {
627
- super.initialize();
628
- this.set({
629
- transmissionSampler: false,
630
- backside: false,
631
- side: THREE.FrontSide,
632
- transmission: 1,
633
- thickness: 0,
634
- backsideThickness: 0,
635
- samples: 10,
636
- roughness: 0,
637
- anisotropy: 0.1,
638
- chromaticAberration: 0.03,
639
- distortion: 0,
640
- distortionScale: 0.5,
641
- temporalDistortion: 0.0,
642
- buffer: null,
643
- });
644
- }
645
- constructor() {
646
- super();
647
- this.materialRef = injectNgtRef();
648
- this.discardMaterial = new DiscardMaterial();
649
- this.fboBackRef = injectNgtsFBO(() => combineLatest([this.select('backsideResolution'), this.select('resolution')]).pipe(map(([backsideResolution, resolution]) => backsideResolution || resolution)));
650
- this.fboMainRef = injectNgtsFBO(() => this.select('resolution'));
651
- let oldBg;
652
- let oldTone;
653
- let parent;
654
- injectBeforeRender((state) => {
655
- const { transmissionSampler, background, backside, backsideThickness, thickness, side } = this.get();
656
- this.materialRef.nativeElement.time = state.clock.getElapsedTime();
657
- // Render only if the buffer matches the built-in and no transmission sampler is set
658
- if (this.materialRef.nativeElement.buffer === this.fboMainRef.nativeElement.texture &&
659
- !transmissionSampler) {
660
- parent = getLocalState(this.materialRef.nativeElement).parent;
661
- if (parent) {
662
- // Save defaults
663
- oldTone = state.gl.toneMapping;
664
- oldBg = state.scene.background;
665
- // Switch off tonemapping lest it double tone maps
666
- // Save the current background and set the HDR as the new BG
667
- // Use discardmaterial, the parent will be invisible, but it's shadows will still be cast
668
- state.gl.toneMapping = THREE.NoToneMapping;
669
- if (background)
670
- state.scene.background = background;
671
- parent['material'] = this.discardMaterial;
672
- if (backside) {
673
- // Render into the backside buffer
674
- state.gl.setRenderTarget(this.fboBackRef.nativeElement);
675
- state.gl.render(state.scene, state.camera);
676
- // And now prepare the material for the main render using the backside buffer
677
- parent['material'] = this.materialRef.nativeElement;
678
- parent['material'].buffer = this.fboBackRef.nativeElement.texture;
679
- parent['material'].thickness = backsideThickness;
680
- parent['material'].side = THREE.BackSide;
681
- }
682
- // Render into the main buffer
683
- state.gl.setRenderTarget(this.fboMainRef.nativeElement);
684
- state.gl.render(state.scene, state.camera);
685
- parent['material'].thickness = thickness;
686
- parent['material'].side = side;
687
- parent['material'].buffer = this.fboMainRef.nativeElement.texture;
688
- // Set old state back
689
- state.scene.background = oldBg;
690
- state.gl.setRenderTarget(null);
691
- parent['material'] = this.materialRef.nativeElement;
692
- state.gl.toneMapping = oldTone;
693
- }
694
- }
695
- });
696
- }
697
- }
698
- NgtsMeshTranmissionMaterial.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsMeshTranmissionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component });
699
- NgtsMeshTranmissionMaterial.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", 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: `
700
- <ngt-mesh-transmission-material
701
- *args="[get('samples'), get('transmissionSampler')]"
702
- ngtCompound
703
- [ref]="materialRef"
704
- [buffer]="get('buffer') || fboMainRef.nativeElement?.texture"
705
- [_transmission]="get('transmission')"
706
- [transmission]="get('transmissionSampler') ? get('transmission') : 0"
707
- [thickness]="get('thickness')"
708
- [side]="get('side')"
709
- [anisotropy]="get('anisotropy')"
710
- [roughness]="get('roughness')"
711
- [chromaticAberration]="get('chromaticAberration')"
712
- [distortion]="get('distortion')"
713
- [distortionScale]="get('distortionScale')"
714
- [temporalDistortion]="get('temporalDistortion')"
715
- [time]="get('time')"
716
- />
717
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
718
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsMeshTranmissionMaterial, decorators: [{
719
- type: Component,
720
- args: [{
721
- selector: 'ngts-mesh-transmission-material',
722
- standalone: true,
723
- template: `
724
- <ngt-mesh-transmission-material
725
- *args="[get('samples'), get('transmissionSampler')]"
726
- ngtCompound
727
- [ref]="materialRef"
728
- [buffer]="get('buffer') || fboMainRef.nativeElement?.texture"
729
- [_transmission]="get('transmission')"
730
- [transmission]="get('transmissionSampler') ? get('transmission') : 0"
731
- [thickness]="get('thickness')"
732
- [side]="get('side')"
733
- [anisotropy]="get('anisotropy')"
734
- [roughness]="get('roughness')"
735
- [chromaticAberration]="get('chromaticAberration')"
736
- [distortion]="get('distortion')"
737
- [distortionScale]="get('distortionScale')"
738
- [temporalDistortion]="get('temporalDistortion')"
739
- [time]="get('time')"
740
- />
741
- `,
742
- imports: [NgtArgs],
743
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
744
- }]
745
- }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
746
- type: Input
747
- }], transmissionSampler: [{
748
- type: Input
749
- }], backside: [{
750
- type: Input
751
- }], backsideThickness: [{
752
- type: Input
753
- }], resolution: [{
754
- type: Input
755
- }], backsideResolution: [{
756
- type: Input
757
- }], samples: [{
758
- type: Input
759
- }], background: [{
760
- type: Input
761
- }], transmission: [{
762
- type: Input
763
- }], thickness: [{
764
- type: Input
765
- }], roughness: [{
766
- type: Input
767
- }], chromaticAberration: [{
768
- type: Input
769
- }], anisotropy: [{
770
- type: Input
771
- }], distortion: [{
772
- type: Input
773
- }], distortionScale: [{
774
- type: Input
775
- }], temporalDistortion: [{
776
- type: Input
777
- }], buffer: [{
778
- type: Input
779
- }], time: [{
780
- type: Input
781
- }] } });
782
-
783
- extend({ MeshWobbleMaterial });
784
- class NgtsMeshWobbleMaterial extends NgtRxStore {
785
- set time(time) {
786
- this.set({ time });
787
- }
788
- set factor(factor) {
789
- this.set({ factor });
790
- }
791
- set speed(speed) {
792
- this.set({ speed });
793
- }
794
- initialize() {
795
- super.initialize();
796
- this.set({ speed: 1, time: 0, factor: 1 });
797
- }
798
- constructor() {
799
- super();
800
- this.material = new MeshWobbleMaterial();
801
- this.materialRef = injectNgtRef();
802
- injectBeforeRender(({ clock }) => {
803
- this.material.time = clock.getElapsedTime() * this.get('speed');
804
- });
805
- }
806
- }
807
- NgtsMeshWobbleMaterial.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsMeshWobbleMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component });
808
- NgtsMeshWobbleMaterial.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: NgtsMeshWobbleMaterial, isStandalone: true, selector: "ngts-mesh-wobble-material", inputs: { materialRef: "materialRef", time: "time", factor: "factor", speed: "speed" }, usesInheritance: true, ngImport: i0, template: `
809
- <ngt-primitive
810
- *args="[material]"
811
- [ref]="materialRef"
812
- [time]="get('time')"
813
- [factor]="get('factor')"
814
- attach="material"
815
- ngtCompound
816
- />
817
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
818
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgtsMeshWobbleMaterial, decorators: [{
819
- type: Component,
820
- args: [{
821
- selector: 'ngts-mesh-wobble-material',
822
- standalone: true,
823
- template: `
824
- <ngt-primitive
825
- *args="[material]"
826
- [ref]="materialRef"
827
- [time]="get('time')"
828
- [factor]="get('factor')"
829
- attach="material"
830
- ngtCompound
831
- />
832
- `,
833
- imports: [NgtArgs],
834
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
835
- }]
836
- }], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
837
- type: Input
838
- }], time: [{
839
- type: Input
840
- }], factor: [{
841
- type: Input
842
- }], speed: [{
843
- type: Input
844
- }] } });
845
-
846
- /**
847
- * Generated bundle index. Do not edit.
848
- */
849
-
850
- export { NgtsMeshDistortMaterial, NgtsMeshReflectorMaterial, NgtsMeshRefractionMaterial, NgtsMeshTranmissionMaterial, NgtsMeshWobbleMaterial };
851
- //# sourceMappingURL=angular-three-soba-materials.mjs.map