angular-three-soba 2.0.0-beta.3 → 2.0.0-beta.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/abstractions/billboard/billboard.d.ts +12 -8
  2. package/abstractions/detailed/detailed.d.ts +26 -0
  3. package/abstractions/edges/edges.d.ts +24 -12
  4. package/abstractions/grid/grid.d.ts +50 -0
  5. package/abstractions/index.d.ts +2 -7
  6. package/abstractions/text/text.d.ts +10 -5
  7. package/abstractions/text-3d/text-3d.d.ts +51 -41
  8. package/cameras/camera/camera-content.d.ts +1 -1
  9. package/cameras/camera/camera.d.ts +16 -13
  10. package/cameras/cube-camera/cube-camera.d.ts +50 -23
  11. package/cameras/index.d.ts +0 -1
  12. package/cameras/orthographic-camera/orthographic-camera.d.ts +29 -18
  13. package/cameras/perspective-camera/perspective-camera.d.ts +10 -1
  14. package/controls/orbit-controls/orbit-controls.d.ts +34 -15
  15. package/esm2022/abstractions/billboard/billboard.mjs +36 -33
  16. package/esm2022/abstractions/detailed/detailed.mjs +64 -0
  17. package/esm2022/abstractions/edges/edges.mjs +58 -63
  18. package/esm2022/abstractions/grid/grid.mjs +180 -0
  19. package/esm2022/abstractions/index.mjs +3 -8
  20. package/esm2022/abstractions/text/text.mjs +123 -124
  21. package/esm2022/abstractions/text-3d/text-3d.mjs +120 -115
  22. package/esm2022/cameras/camera/camera-content.mjs +6 -6
  23. package/esm2022/cameras/camera/camera.mjs +48 -42
  24. package/esm2022/cameras/cube-camera/cube-camera.mjs +130 -99
  25. package/esm2022/cameras/index.mjs +1 -2
  26. package/esm2022/cameras/orthographic-camera/orthographic-camera.mjs +78 -75
  27. package/esm2022/cameras/perspective-camera/perspective-camera.mjs +25 -26
  28. package/esm2022/controls/orbit-controls/orbit-controls.mjs +109 -85
  29. package/esm2022/gizmos/angular-three-soba-gizmos.mjs +5 -0
  30. package/esm2022/gizmos/gizmo-helper/gizmo-helper.mjs +198 -0
  31. package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/constants.mjs +31 -0
  32. package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +93 -0
  33. package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +151 -0
  34. package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-input.mjs +66 -0
  35. package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +71 -0
  36. package/esm2022/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +195 -0
  37. package/esm2022/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +272 -0
  38. package/esm2022/gizmos/index.mjs +4 -0
  39. package/esm2022/loaders/gltf-loader/gltf-loader.mjs +8 -6
  40. package/esm2022/loaders/loader/loader.mjs +92 -87
  41. package/esm2022/loaders/progress/progress.mjs +31 -30
  42. package/esm2022/loaders/texture-loader/texture-loader.mjs +6 -5
  43. package/esm2022/materials/index.mjs +2 -1
  44. package/esm2022/materials/mesh-distort-material/mesh-distort-material.mjs +60 -51
  45. package/esm2022/materials/mesh-reflector-material/mesh-reflector-material.mjs +239 -255
  46. package/esm2022/materials/mesh-refraction-material/mesh-refraction-material.mjs +102 -99
  47. package/esm2022/materials/mesh-transmission-material/mesh-transmission-material.mjs +167 -146
  48. package/esm2022/materials/mesh-wobble-material/mesh-wobble-material.mjs +44 -42
  49. package/esm2022/materials/point-material/point-material.mjs +50 -0
  50. package/esm2022/misc/animations/animations.mjs +39 -34
  51. package/esm2022/misc/bake-shadows/bake-shadows.mjs +13 -13
  52. package/esm2022/misc/caustics/caustics.mjs +387 -0
  53. package/esm2022/misc/decal/decal.mjs +187 -0
  54. package/esm2022/misc/depth-buffer/depth-buffer.mjs +35 -36
  55. package/esm2022/misc/example/example.mjs +161 -0
  56. package/esm2022/misc/fbo/fbo.mjs +37 -36
  57. package/esm2022/misc/html/html-wrapper.mjs +478 -0
  58. package/esm2022/misc/html/html.mjs +305 -0
  59. package/esm2022/misc/index.mjs +10 -1
  60. package/esm2022/misc/sampler/sampler.mjs +143 -0
  61. package/esm2022/misc/shadow/shadow.mjs +111 -0
  62. package/esm2022/misc/stats-gl/stats-gl.mjs +61 -0
  63. package/esm2022/misc/trail/trail.mjs +210 -0
  64. package/esm2022/misc/trail-texture/inject-trail-texture.mjs +18 -0
  65. package/esm2022/misc/trail-texture/trail-texture.mjs +106 -0
  66. package/esm2022/modifiers/angular-three-soba-modifiers.mjs +5 -0
  67. package/esm2022/modifiers/curve-modifier/curve-modifier.mjs +64 -0
  68. package/esm2022/modifiers/index.mjs +2 -0
  69. package/esm2022/performances/adaptive-dpr/adaptive-dpr.mjs +44 -0
  70. package/esm2022/performances/adaptive-events/adaptive-events.mjs +27 -0
  71. package/esm2022/performances/angular-three-soba-performances.mjs +5 -0
  72. package/esm2022/performances/index.mjs +8 -0
  73. package/esm2022/performances/instances/instances.mjs +221 -0
  74. package/esm2022/performances/instances/position-mesh.mjs +52 -0
  75. package/esm2022/performances/points/points-input.mjs +64 -0
  76. package/esm2022/performances/points/points.mjs +327 -0
  77. package/esm2022/performances/points/position-point.mjs +54 -0
  78. package/esm2022/performances/segments/segment-object.mjs +9 -0
  79. package/esm2022/performances/segments/segments.mjs +183 -0
  80. package/esm2022/shaders/blur-pass/blur-pass.mjs +2 -2
  81. package/esm2022/shaders/caustics/caustics-material.mjs +130 -0
  82. package/esm2022/shaders/caustics/caustics-projection-material.mjs +31 -0
  83. package/esm2022/shaders/convolution-material/convolution-material.mjs +1 -1
  84. package/esm2022/shaders/discard-material/discard-material.mjs +1 -1
  85. package/esm2022/shaders/grid-material/grid-material.mjs +77 -0
  86. package/esm2022/shaders/index.mjs +6 -3
  87. package/esm2022/shaders/mesh-distort-material/mesh-distort-material.mjs +42 -41
  88. package/esm2022/shaders/mesh-reflector-material/mesh-reflector-material.mjs +2 -2
  89. package/esm2022/shaders/mesh-refraction-material/mesh-refraction-material.mjs +2 -2
  90. package/esm2022/shaders/mesh-transmission-material/mesh-transmission-material.mjs +4 -4
  91. package/esm2022/shaders/mesh-wobble-material/mesh-wobble-material.mjs +1 -1
  92. package/esm2022/shaders/shader-material/shader-material.mjs +3 -5
  93. package/esm2022/shaders/soft-shadow-material/soft-shadow-material.mjs +17 -25
  94. package/esm2022/shaders/sparkles-material/sparkles-material.mjs +32 -46
  95. package/esm2022/shaders/spot-light-material/spot-light-material.mjs +7 -7
  96. package/esm2022/shaders/star-field-material/star-field-material.mjs +3 -2
  97. package/esm2022/shaders/wireframe-material/wireframe-material.mjs +247 -0
  98. package/esm2022/staging/accumulative-shadows/accumulative-shadows.mjs +161 -176
  99. package/esm2022/staging/accumulative-shadows/progressive-light-map.mjs +8 -8
  100. package/esm2022/staging/accumulative-shadows/randomized-lights.mjs +128 -129
  101. package/esm2022/staging/backdrop/backdrop.mjs +77 -0
  102. package/esm2022/staging/bb-anchor/bb-anchor.mjs +69 -0
  103. package/esm2022/staging/bounds/bounds.mjs +145 -143
  104. package/esm2022/staging/camera-shake/camera-shake.mjs +86 -80
  105. package/esm2022/staging/center/center.mjs +129 -112
  106. package/esm2022/staging/cloud/cloud.mjs +118 -124
  107. package/esm2022/staging/contact-shadows/contact-shadows.mjs +131 -136
  108. package/esm2022/staging/environment/assets.mjs +12 -12
  109. package/esm2022/staging/environment/environment-cube.mjs +28 -30
  110. package/esm2022/staging/environment/environment-ground.mjs +17 -19
  111. package/esm2022/staging/environment/environment-input.mjs +98 -85
  112. package/esm2022/staging/environment/environment-map.mjs +33 -33
  113. package/esm2022/staging/environment/environment-portal.mjs +75 -97
  114. package/esm2022/staging/environment/environment.mjs +34 -51
  115. package/esm2022/staging/environment/utils.mjs +40 -17
  116. package/esm2022/staging/float/float.mjs +70 -58
  117. package/esm2022/staging/index.mjs +7 -3
  118. package/esm2022/staging/matcap-texture/matcap-texture.mjs +64 -0
  119. package/esm2022/staging/normal-texture/normal-texture.mjs +53 -0
  120. package/esm2022/staging/sky/sky.mjs +85 -80
  121. package/esm2022/staging/sparkles/sparkles.mjs +108 -105
  122. package/esm2022/staging/spot-light/shadow-mesh-input.mjs +63 -0
  123. package/esm2022/staging/spot-light/shadow-mesh.mjs +267 -0
  124. package/esm2022/staging/spot-light/spot-light-input.mjs +67 -58
  125. package/esm2022/staging/spot-light/spot-light.mjs +51 -63
  126. package/esm2022/staging/spot-light/volumetric-mesh.mjs +67 -70
  127. package/esm2022/staging/stage/stage.mjs +305 -290
  128. package/esm2022/staging/stars/stars.mjs +101 -102
  129. package/esm2022/staging/wireframe/wireframe-input.mjs +191 -0
  130. package/esm2022/staging/wireframe/wireframe.mjs +228 -0
  131. package/esm2022/utils/angular-three-soba-utils.mjs +5 -0
  132. package/esm2022/utils/content/content.mjs +15 -0
  133. package/esm2022/utils/index.mjs +2 -0
  134. package/fesm2022/angular-three-soba-abstractions.mjs +514 -1947
  135. package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
  136. package/fesm2022/angular-three-soba-cameras.mjs +303 -259
  137. package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
  138. package/fesm2022/angular-three-soba-controls.mjs +108 -83
  139. package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
  140. package/fesm2022/angular-three-soba-gizmos.mjs +1045 -0
  141. package/fesm2022/angular-three-soba-gizmos.mjs.map +1 -0
  142. package/fesm2022/angular-three-soba-loaders.mjs +129 -119
  143. package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
  144. package/fesm2022/angular-three-soba-materials.mjs +662 -592
  145. package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
  146. package/fesm2022/angular-three-soba-misc.mjs +2219 -108
  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 +957 -0
  151. package/fesm2022/angular-three-soba-performances.mjs.map +1 -0
  152. package/fesm2022/angular-three-soba-shaders.mjs +551 -256
  153. package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
  154. package/fesm2022/angular-three-soba-staging.mjs +2910 -2573
  155. package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
  156. package/fesm2022/angular-three-soba-utils.mjs +22 -0
  157. package/fesm2022/angular-three-soba-utils.mjs.map +1 -0
  158. package/gizmos/README.md +3 -0
  159. package/gizmos/gizmo-helper/gizmo-helper.d.ts +69 -0
  160. package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +22 -0
  161. package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +29 -0
  162. package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-input.d.ts +33 -0
  163. package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +10 -0
  164. package/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +40 -0
  165. package/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +30 -0
  166. package/gizmos/index.d.ts +3 -0
  167. package/loaders/gltf-loader/gltf-loader.d.ts +4 -3
  168. package/loaders/loader/loader.d.ts +19 -17
  169. package/loaders/progress/progress.d.ts +1 -1
  170. package/loaders/texture-loader/texture-loader.d.ts +2 -2
  171. package/materials/index.d.ts +1 -0
  172. package/materials/mesh-distort-material/mesh-distort-material.d.ts +25 -15
  173. package/materials/mesh-reflector-material/mesh-reflector-material.d.ts +74 -56
  174. package/materials/mesh-refraction-material/mesh-refraction-material.d.ts +33 -21
  175. package/materials/mesh-transmission-material/mesh-transmission-material.d.ts +55 -39
  176. package/materials/mesh-wobble-material/mesh-wobble-material.d.ts +19 -10
  177. package/materials/point-material/point-material.d.ts +24 -0
  178. package/metadata.json +1 -0
  179. package/misc/animations/animations.d.ts +6 -4
  180. package/misc/caustics/caustics.d.ts +87 -0
  181. package/misc/decal/decal.d.ts +49 -0
  182. package/misc/depth-buffer/depth-buffer.d.ts +2 -2
  183. package/misc/example/example.d.ts +81 -0
  184. package/misc/fbo/fbo.d.ts +2 -2
  185. package/misc/html/html-wrapper.d.ts +559 -0
  186. package/misc/html/html.d.ts +214 -0
  187. package/misc/index.d.ts +9 -0
  188. package/misc/sampler/sampler.d.ts +67 -0
  189. package/misc/shadow/shadow.d.ts +37 -0
  190. package/misc/stats-gl/stats-gl.d.ts +24 -0
  191. package/misc/trail/trail.d.ts +57 -0
  192. package/misc/trail-texture/inject-trail-texture.d.ts +9 -0
  193. package/misc/trail-texture/trail-texture.d.ts +50 -0
  194. package/modifiers/README.md +3 -0
  195. package/modifiers/curve-modifier/curve-modifier.d.ts +23 -0
  196. package/modifiers/index.d.ts +1 -0
  197. package/package.json +42 -26
  198. package/performances/README.md +3 -0
  199. package/performances/adaptive-dpr/adaptive-dpr.d.ts +14 -0
  200. package/{performance/adaptive → performances/adaptive-events}/adaptive-events.d.ts +3 -0
  201. package/performances/index.d.ts +7 -0
  202. package/performances/instances/instances.d.ts +79 -0
  203. package/{performance → performances}/instances/position-mesh.d.ts +1 -1
  204. package/performances/points/points-input.d.ts +32 -0
  205. package/performances/points/points.d.ts +92 -0
  206. package/performances/points/position-point.d.ts +11 -0
  207. package/performances/segments/segment-object.d.ts +7 -0
  208. package/performances/segments/segments.d.ts +124 -0
  209. package/shaders/grid-material/grid-material.d.ts +37 -0
  210. package/shaders/index.d.ts +5 -2
  211. package/shaders/mesh-distort-material/mesh-distort-material.d.ts +173 -6
  212. package/shaders/mesh-transmission-material/mesh-transmission-material.d.ts +1 -1
  213. package/shaders/shader-material/shader-material.d.ts +2 -2
  214. package/shaders/soft-shadow-material/soft-shadow-material.d.ts +10 -1
  215. package/shaders/sparkles-material/sparkles-material.d.ts +15 -1
  216. package/shaders/spot-light-material/spot-light-material.d.ts +11 -2
  217. package/shaders/star-field-material/star-field-material.d.ts +11 -1
  218. package/shaders/wireframe-material/wireframe-material.d.ts +58 -0
  219. package/staging/accumulative-shadows/accumulative-shadows.d.ts +89 -39
  220. package/staging/accumulative-shadows/randomized-lights.d.ts +41 -28
  221. package/staging/backdrop/backdrop.d.ts +30 -0
  222. package/staging/bb-anchor/bb-anchor.d.ts +27 -0
  223. package/staging/bounds/bounds.d.ts +101 -25
  224. package/staging/camera-shake/camera-shake.d.ts +30 -19
  225. package/staging/center/center.d.ts +43 -35
  226. package/staging/cloud/cloud.d.ts +27 -24
  227. package/staging/contact-shadows/contact-shadows.d.ts +43 -30
  228. package/staging/environment/assets.d.ts +9 -9
  229. package/staging/environment/environment-cube.d.ts +9 -5
  230. package/staging/environment/environment-ground.d.ts +7 -7
  231. package/staging/environment/environment-input.d.ts +38 -38
  232. package/staging/environment/environment-map.d.ts +10 -5
  233. package/staging/environment/environment-portal.d.ts +10 -5
  234. package/staging/environment/environment.d.ts +0 -4
  235. package/staging/environment/utils.d.ts +2 -2
  236. package/staging/float/float.d.ts +15 -11
  237. package/staging/index.d.ts +6 -2
  238. package/staging/matcap-texture/matcap-texture.d.ts +13 -0
  239. package/staging/normal-texture/normal-texture.d.ts +16 -0
  240. package/staging/sky/sky.d.ts +28 -21
  241. package/staging/sparkles/sparkles.d.ts +36 -22
  242. package/staging/spot-light/shadow-mesh-input.d.ts +29 -0
  243. package/staging/spot-light/shadow-mesh.d.ts +37 -0
  244. package/staging/spot-light/spot-light-input.d.ts +25 -25
  245. package/staging/spot-light/spot-light.d.ts +31 -15
  246. package/staging/spot-light/volumetric-mesh.d.ts +15 -9
  247. package/staging/stage/stage.d.ts +89 -65
  248. package/staging/stars/stars.d.ts +28 -17
  249. package/staging/wireframe/wireframe-input.d.ts +65 -0
  250. package/staging/wireframe/wireframe.d.ts +28 -0
  251. package/utils/README.md +3 -0
  252. package/utils/content/content.d.ts +8 -0
  253. package/utils/index.d.ts +1 -0
  254. package/web-types.json +1 -0
  255. package/abstractions/catmull-rom-line/catmull-rom-line.d.ts +0 -25
  256. package/abstractions/cubic-bezier-line/cubic-bezier-line.d.ts +0 -25
  257. package/abstractions/gizmo-helper/gizmo-helper.d.ts +0 -34
  258. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +0 -22
  259. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +0 -30
  260. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +0 -32
  261. package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +0 -14
  262. package/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +0 -47
  263. package/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +0 -40
  264. package/abstractions/line/line-input.d.ts +0 -42
  265. package/abstractions/line/line.d.ts +0 -35
  266. package/abstractions/quadratic-bezier-line/quadratic-bezier-line.d.ts +0 -23
  267. package/esm2022/abstractions/catmull-rom-line/catmull-rom-line.mjs +0 -131
  268. package/esm2022/abstractions/cubic-bezier-line/cubic-bezier-line.mjs +0 -113
  269. package/esm2022/abstractions/gizmo-helper/gizmo-helper.mjs +0 -210
  270. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/constants.mjs +0 -31
  271. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +0 -95
  272. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +0 -155
  273. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +0 -62
  274. package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +0 -80
  275. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +0 -206
  276. package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +0 -273
  277. package/esm2022/abstractions/line/line-input.mjs +0 -113
  278. package/esm2022/abstractions/line/line.mjs +0 -165
  279. package/esm2022/abstractions/quadratic-bezier-line/quadratic-bezier-line.mjs +0 -128
  280. package/esm2022/performance/adaptive/adaptive-dpr.mjs +0 -46
  281. package/esm2022/performance/adaptive/adaptive-events.mjs +0 -31
  282. package/esm2022/performance/angular-three-soba-performance.mjs +0 -5
  283. package/esm2022/performance/detailed/detailed.mjs +0 -61
  284. package/esm2022/performance/index.mjs +0 -7
  285. package/esm2022/performance/instances/instance.mjs +0 -48
  286. package/esm2022/performance/instances/instances.mjs +0 -189
  287. package/esm2022/performance/instances/position-mesh.mjs +0 -52
  288. package/esm2022/performance/stats/stats.mjs +0 -79
  289. package/esm2022/shaders/caustics-material/caustics-material.mjs +0 -128
  290. package/esm2022/shaders/caustics-material/caustics-projection-material.mjs +0 -33
  291. package/esm2022/staging/caustics/caustisc.mjs +0 -384
  292. package/esm2022/staging/spot-light/spot-light-shadow-mesh-input.mjs +0 -57
  293. package/esm2022/staging/spot-light/spot-light-shadow-mesh.mjs +0 -256
  294. package/fesm2022/angular-three-soba-performance.mjs +0 -487
  295. package/fesm2022/angular-three-soba-performance.mjs.map +0 -1
  296. package/performance/README.md +0 -3
  297. package/performance/adaptive/adaptive-dpr.d.ts +0 -8
  298. package/performance/detailed/detailed.d.ts +0 -20
  299. package/performance/index.d.ts +0 -6
  300. package/performance/instances/instance.d.ts +0 -9
  301. package/performance/instances/instances.d.ts +0 -35
  302. package/performance/stats/stats.d.ts +0 -18
  303. package/plugin/generators.json +0 -19
  304. package/plugin/libs/plugin/README.md +0 -11
  305. package/plugin/package.json +0 -9
  306. package/plugin/src/generators/init/compat.d.ts +0 -2
  307. package/plugin/src/generators/init/compat.js +0 -6
  308. package/plugin/src/generators/init/compat.js.map +0 -1
  309. package/plugin/src/generators/init/init.d.ts +0 -4
  310. package/plugin/src/generators/init/init.js +0 -22
  311. package/plugin/src/generators/init/init.js.map +0 -1
  312. package/plugin/src/generators/init/schema.json +0 -6
  313. package/plugin/src/index.d.ts +0 -1
  314. package/plugin/src/index.js +0 -6
  315. package/plugin/src/index.js.map +0 -1
  316. package/staging/caustics/caustisc.d.ts +0 -70
  317. package/staging/spot-light/spot-light-shadow-mesh-input.d.ts +0 -29
  318. package/staging/spot-light/spot-light-shadow-mesh.d.ts +0 -38
  319. /package/{abstractions → gizmos}/gizmo-helper/gizmo-viewcube/constants.d.ts +0 -0
  320. /package/shaders/{caustics-material → caustics}/caustics-material.d.ts +0 -0
  321. /package/shaders/{caustics-material → caustics}/caustics-projection-material.d.ts +0 -0
@@ -1,7 +1,8 @@
1
1
  import * as THREE from 'three';
2
- import { ShaderMaterial, Uniform, Vector2, NoBlending, WebGLRenderTarget, LinearFilter, HalfFloatType, Scene, PerspectiveCamera, BufferGeometry, BufferAttribute, Mesh, MeshStandardMaterial, Vector3, Color } from 'three';
3
- import { InjectionToken } from '@angular/core';
2
+ import { ShaderMaterial, Uniform, Vector2, NoBlending, WebGLRenderTarget, LinearFilter, HalfFloatType, Scene, PerspectiveCamera, BufferGeometry, BufferAttribute, Mesh, MeshStandardMaterial } from 'three';
3
+ import { InjectionToken, inject, runInInjectionContext, computed, effect } from '@angular/core';
4
4
  import { MeshBVHUniformStruct, shaderStructs, shaderIntersectFunction } from 'three-mesh-bvh';
5
+ import { assertInjector } from 'ngxtension/assert-injector';
5
6
 
6
7
  class ConvolutionMaterial extends ShaderMaterial {
7
8
  constructor(texelSize = new Vector2()) {
@@ -163,10 +164,8 @@ function shaderMaterial(uniforms, vertexShader, fragmentShader, onInit) {
163
164
  super({
164
165
  uniforms: entries.reduce((acc, [name, value]) => {
165
166
  const uniform = THREE.UniformsUtils.clone({ [name]: { value } });
166
- return {
167
- ...acc,
168
- ...uniform,
169
- };
167
+ Object.assign(acc, uniform);
168
+ return acc;
170
169
  }, {}),
171
170
  vertexShader,
172
171
  fragmentShader,
@@ -206,113 +205,115 @@ const CausticsMaterial = shaderMaterial({
206
205
  size: 10,
207
206
  intensity: 0.5,
208
207
  },
209
- /* glsl */ `varying vec2 vUv;
210
- void main() {
211
- vUv = uv;
212
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
213
- }`,
214
- /* glsl */ `uniform mat4 cameraMatrixWorld;
215
- uniform mat4 cameraProjectionMatrixInv;
216
- uniform vec3 lightDir;
217
- uniform vec3 lightPlaneNormal;
218
- uniform float lightPlaneConstant;
219
- uniform float near;
220
- uniform float far;
221
- uniform float time;
222
- uniform float worldRadius;
223
- uniform float resolution;
224
- uniform float size;
225
- uniform float intensity;
226
- uniform float ior;
227
- precision highp isampler2D;
228
- precision highp usampler2D;
229
- uniform sampler2D normalTexture;
230
- uniform sampler2D depthTexture;
231
- uniform float bounces;
232
- varying vec2 vUv;
233
- vec3 WorldPosFromDepth(float depth, vec2 coord) {
234
- float z = depth * 2.0 - 1.0;
235
- vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
236
- vec4 viewSpacePosition = cameraProjectionMatrixInv * clipSpacePosition;
237
- // Perspective division
238
- viewSpacePosition /= viewSpacePosition.w;
239
- vec4 worldSpacePosition = cameraMatrixWorld * viewSpacePosition;
240
- return worldSpacePosition.xyz;
241
- }
242
- float sdPlane( vec3 p, vec3 n, float h ) {
243
- // n must be normalized
244
- return dot(p,n) + h;
245
- }
246
- float planeIntersect( vec3 ro, vec3 rd, vec4 p ) {
247
- return -(dot(ro,p.xyz)+p.w)/dot(rd,p.xyz);
248
- }
249
- vec3 totalInternalReflection(vec3 ro, vec3 rd, vec3 pos, vec3 normal, float ior, out vec3 rayOrigin, out vec3 rayDirection) {
250
- rayOrigin = ro;
251
- rayDirection = rd;
252
- rayDirection = refract(rayDirection, normal, 1.0 / ior);
253
- rayOrigin = pos + rayDirection * 0.1;
254
- return rayDirection;
255
- }
256
- void main() {
257
- // Each sample consists of random offset in the x and y direction
258
- float caustic = 0.0;
259
- float causticTexelSize = (1.0 / resolution) * size * 2.0;
260
- float texelsNeeded = worldRadius / causticTexelSize;
261
- float sampleRadius = texelsNeeded / resolution;
262
- float sum = 0.0;
263
- if (texture2D(depthTexture, vUv).x == 1.0) {
264
- gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
265
- return;
208
+ /* glsl */ `
209
+ varying vec2 vUv;
210
+ void main() {
211
+ vUv = uv;
212
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
213
+ }`,
214
+ /* glsl */ `
215
+ uniform mat4 cameraMatrixWorld;
216
+ uniform mat4 cameraProjectionMatrixInv;
217
+ uniform vec3 lightDir;
218
+ uniform vec3 lightPlaneNormal;
219
+ uniform float lightPlaneConstant;
220
+ uniform float near;
221
+ uniform float far;
222
+ uniform float time;
223
+ uniform float worldRadius;
224
+ uniform float resolution;
225
+ uniform float size;
226
+ uniform float intensity;
227
+ uniform float ior;
228
+ precision highp isampler2D;
229
+ precision highp usampler2D;
230
+ uniform sampler2D normalTexture;
231
+ uniform sampler2D depthTexture;
232
+ uniform float bounces;
233
+ varying vec2 vUv;
234
+ vec3 WorldPosFromDepth(float depth, vec2 coord) {
235
+ float z = depth * 2.0 - 1.0;
236
+ vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
237
+ vec4 viewSpacePosition = cameraProjectionMatrixInv * clipSpacePosition;
238
+ // Perspective division
239
+ viewSpacePosition /= viewSpacePosition.w;
240
+ vec4 worldSpacePosition = cameraMatrixWorld * viewSpacePosition;
241
+ return worldSpacePosition.xyz;
242
+ }
243
+ float sdPlane( vec3 p, vec3 n, float h ) {
244
+ // n must be normalized
245
+ return dot(p,n) + h;
266
246
  }
267
- vec2 offset1 = vec2(-0.5, -0.5);//vec2(rand() - 0.5, rand() - 0.5);
268
- vec2 offset2 = vec2(-0.5, 0.5);//vec2(rand() - 0.5, rand() - 0.5);
269
- vec2 offset3 = vec2(0.5, 0.5);//vec2(rand() - 0.5, rand() - 0.5);
270
- vec2 offset4 = vec2(0.5, -0.5);//vec2(rand() - 0.5, rand() - 0.5);
271
- vec2 uv1 = vUv + offset1 * sampleRadius;
272
- vec2 uv2 = vUv + offset2 * sampleRadius;
273
- vec2 uv3 = vUv + offset3 * sampleRadius;
274
- vec2 uv4 = vUv + offset4 * sampleRadius;
275
- vec3 normal1 = texture2D(normalTexture, uv1, -10.0).rgb * 2.0 - 1.0;
276
- vec3 normal2 = texture2D(normalTexture, uv2, -10.0).rgb * 2.0 - 1.0;
277
- vec3 normal3 = texture2D(normalTexture, uv3, -10.0).rgb * 2.0 - 1.0;
278
- vec3 normal4 = texture2D(normalTexture, uv4, -10.0).rgb * 2.0 - 1.0;
279
- float depth1 = texture2D(depthTexture, uv1, -10.0).x;
280
- float depth2 = texture2D(depthTexture, uv2, -10.0).x;
281
- float depth3 = texture2D(depthTexture, uv3, -10.0).x;
282
- float depth4 = texture2D(depthTexture, uv4, -10.0).x;
283
- // Sanity check the depths
284
- if (depth1 == 1.0 || depth2 == 1.0 || depth3 == 1.0 || depth4 == 1.0) {
285
- gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
286
- return;
247
+ float planeIntersect( vec3 ro, vec3 rd, vec4 p ) {
248
+ return -(dot(ro,p.xyz)+p.w)/dot(rd,p.xyz);
287
249
  }
288
- vec3 pos1 = WorldPosFromDepth(depth1, uv1);
289
- vec3 pos2 = WorldPosFromDepth(depth2, uv2);
290
- vec3 pos3 = WorldPosFromDepth(depth3, uv3);
291
- vec3 pos4 = WorldPosFromDepth(depth4, uv4);
292
- vec3 originPos1 = WorldPosFromDepth(0.0, uv1);
293
- vec3 originPos2 = WorldPosFromDepth(0.0, uv2);
294
- vec3 originPos3 = WorldPosFromDepth(0.0, uv3);
295
- vec3 originPos4 = WorldPosFromDepth(0.0, uv4);
296
- vec3 endPos1, endPos2, endPos3, endPos4;
297
- vec3 endDir1, endDir2, endDir3, endDir4;
298
- totalInternalReflection(originPos1, lightDir, pos1, normal1, ior, endPos1, endDir1);
299
- totalInternalReflection(originPos2, lightDir, pos2, normal2, ior, endPos2, endDir2);
300
- totalInternalReflection(originPos3, lightDir, pos3, normal3, ior, endPos3, endDir3);
301
- totalInternalReflection(originPos4, lightDir, pos4, normal4, ior, endPos4, endDir4);
302
- float lightPosArea = length(cross(originPos2 - originPos1, originPos3 - originPos1)) + length(cross(originPos3 - originPos1, originPos4 - originPos1));
303
- float t1 = planeIntersect(endPos1, endDir1, vec4(lightPlaneNormal, lightPlaneConstant));
304
- float t2 = planeIntersect(endPos2, endDir2, vec4(lightPlaneNormal, lightPlaneConstant));
305
- float t3 = planeIntersect(endPos3, endDir3, vec4(lightPlaneNormal, lightPlaneConstant));
306
- float t4 = planeIntersect(endPos4, endDir4, vec4(lightPlaneNormal, lightPlaneConstant));
307
- vec3 finalPos1 = endPos1 + endDir1 * t1;
308
- vec3 finalPos2 = endPos2 + endDir2 * t2;
309
- vec3 finalPos3 = endPos3 + endDir3 * t3;
310
- vec3 finalPos4 = endPos4 + endDir4 * t4;
311
- float finalArea = length(cross(finalPos2 - finalPos1, finalPos3 - finalPos1)) + length(cross(finalPos3 - finalPos1, finalPos4 - finalPos1));
312
- caustic += intensity * (lightPosArea / finalArea);
313
- // Calculate the area of the triangle in light spaces
314
- gl_FragColor = vec4(vec3(max(caustic, 0.0)), 1.0);
315
- }`);
250
+ vec3 totalInternalReflection(vec3 ro, vec3 rd, vec3 pos, vec3 normal, float ior, out vec3 rayOrigin, out vec3 rayDirection) {
251
+ rayOrigin = ro;
252
+ rayDirection = rd;
253
+ rayDirection = refract(rayDirection, normal, 1.0 / ior);
254
+ rayOrigin = pos + rayDirection * 0.1;
255
+ return rayDirection;
256
+ }
257
+ void main() {
258
+ // Each sample consists of random offset in the x and y direction
259
+ float caustic = 0.0;
260
+ float causticTexelSize = (1.0 / resolution) * size * 2.0;
261
+ float texelsNeeded = worldRadius / causticTexelSize;
262
+ float sampleRadius = texelsNeeded / resolution;
263
+ float sum = 0.0;
264
+ if (texture2D(depthTexture, vUv).x == 1.0) {
265
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
266
+ return;
267
+ }
268
+ vec2 offset1 = vec2(-0.5, -0.5);//vec2(rand() - 0.5, rand() - 0.5);
269
+ vec2 offset2 = vec2(-0.5, 0.5);//vec2(rand() - 0.5, rand() - 0.5);
270
+ vec2 offset3 = vec2(0.5, 0.5);//vec2(rand() - 0.5, rand() - 0.5);
271
+ vec2 offset4 = vec2(0.5, -0.5);//vec2(rand() - 0.5, rand() - 0.5);
272
+ vec2 uv1 = vUv + offset1 * sampleRadius;
273
+ vec2 uv2 = vUv + offset2 * sampleRadius;
274
+ vec2 uv3 = vUv + offset3 * sampleRadius;
275
+ vec2 uv4 = vUv + offset4 * sampleRadius;
276
+ vec3 normal1 = texture2D(normalTexture, uv1, -10.0).rgb * 2.0 - 1.0;
277
+ vec3 normal2 = texture2D(normalTexture, uv2, -10.0).rgb * 2.0 - 1.0;
278
+ vec3 normal3 = texture2D(normalTexture, uv3, -10.0).rgb * 2.0 - 1.0;
279
+ vec3 normal4 = texture2D(normalTexture, uv4, -10.0).rgb * 2.0 - 1.0;
280
+ float depth1 = texture2D(depthTexture, uv1, -10.0).x;
281
+ float depth2 = texture2D(depthTexture, uv2, -10.0).x;
282
+ float depth3 = texture2D(depthTexture, uv3, -10.0).x;
283
+ float depth4 = texture2D(depthTexture, uv4, -10.0).x;
284
+ // Sanity check the depths
285
+ if (depth1 == 1.0 || depth2 == 1.0 || depth3 == 1.0 || depth4 == 1.0) {
286
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
287
+ return;
288
+ }
289
+ vec3 pos1 = WorldPosFromDepth(depth1, uv1);
290
+ vec3 pos2 = WorldPosFromDepth(depth2, uv2);
291
+ vec3 pos3 = WorldPosFromDepth(depth3, uv3);
292
+ vec3 pos4 = WorldPosFromDepth(depth4, uv4);
293
+ vec3 originPos1 = WorldPosFromDepth(0.0, uv1);
294
+ vec3 originPos2 = WorldPosFromDepth(0.0, uv2);
295
+ vec3 originPos3 = WorldPosFromDepth(0.0, uv3);
296
+ vec3 originPos4 = WorldPosFromDepth(0.0, uv4);
297
+ vec3 endPos1, endPos2, endPos3, endPos4;
298
+ vec3 endDir1, endDir2, endDir3, endDir4;
299
+ totalInternalReflection(originPos1, lightDir, pos1, normal1, ior, endPos1, endDir1);
300
+ totalInternalReflection(originPos2, lightDir, pos2, normal2, ior, endPos2, endDir2);
301
+ totalInternalReflection(originPos3, lightDir, pos3, normal3, ior, endPos3, endDir3);
302
+ totalInternalReflection(originPos4, lightDir, pos4, normal4, ior, endPos4, endDir4);
303
+ float lightPosArea = length(cross(originPos2 - originPos1, originPos3 - originPos1)) + length(cross(originPos3 - originPos1, originPos4 - originPos1));
304
+ float t1 = planeIntersect(endPos1, endDir1, vec4(lightPlaneNormal, lightPlaneConstant));
305
+ float t2 = planeIntersect(endPos2, endDir2, vec4(lightPlaneNormal, lightPlaneConstant));
306
+ float t3 = planeIntersect(endPos3, endDir3, vec4(lightPlaneNormal, lightPlaneConstant));
307
+ float t4 = planeIntersect(endPos4, endDir4, vec4(lightPlaneNormal, lightPlaneConstant));
308
+ vec3 finalPos1 = endPos1 + endDir1 * t1;
309
+ vec3 finalPos2 = endPos2 + endDir2 * t2;
310
+ vec3 finalPos3 = endPos3 + endDir3 * t3;
311
+ vec3 finalPos4 = endPos4 + endDir4 * t4;
312
+ float finalArea = length(cross(finalPos2 - finalPos1, finalPos3 - finalPos1)) + length(cross(finalPos3 - finalPos1, finalPos4 - finalPos1));
313
+ caustic += intensity * (lightPosArea / finalArea);
314
+ // Calculate the area of the triangle in light spaces
315
+ gl_FragColor = vec4(vec3(max(caustic, 0.0)), 1.0);
316
+ }`);
316
317
 
317
318
  const CausticsProjectionMaterial = shaderMaterial({
318
319
  causticsTexture: null,
@@ -320,85 +321,159 @@ const CausticsProjectionMaterial = shaderMaterial({
320
321
  color: new THREE.Color(),
321
322
  lightProjMatrix: new THREE.Matrix4(),
322
323
  lightViewMatrix: new THREE.Matrix4(),
323
- },
324
- /* glsl */ `varying vec3 vWorldPosition;
325
- void main() {
326
- gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
327
- vec4 worldPosition = modelMatrix * vec4(position, 1.);
328
- vWorldPosition = worldPosition.xyz;
329
- }`,
330
- /* glsl */ `varying vec3 vWorldPosition;
331
- uniform vec3 color;
332
- uniform sampler2D causticsTexture;
333
- uniform sampler2D causticsTextureB;
334
- uniform mat4 lightProjMatrix;
335
- uniform mat4 lightViewMatrix;
336
- void main() {
337
- // Apply caustics
338
- vec4 lightSpacePos = lightProjMatrix * lightViewMatrix * vec4(vWorldPosition, 1.0);
339
- lightSpacePos.xyz /= lightSpacePos.w;
340
- lightSpacePos.xyz = lightSpacePos.xyz * 0.5 + 0.5;
341
- vec3 front = texture2D(causticsTexture, lightSpacePos.xy).rgb;
342
- vec3 back = texture2D(causticsTextureB, lightSpacePos.xy).rgb;
343
- gl_FragColor = vec4((front + back) * color, 1.0);
344
- #include <tonemapping_fragment>
345
- #include <encodings_fragment>
346
- }`);
324
+ }, `varying vec3 vWorldPosition;
325
+ void main() {
326
+ gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
327
+ vec4 worldPosition = modelMatrix * vec4(position, 1.);
328
+ vWorldPosition = worldPosition.xyz;
329
+ }`, `varying vec3 vWorldPosition;
330
+ uniform vec3 color;
331
+ uniform sampler2D causticsTexture;
332
+ uniform sampler2D causticsTextureB;
333
+ uniform mat4 lightProjMatrix;
334
+ uniform mat4 lightViewMatrix;
335
+ void main() {
336
+ // Apply caustics
337
+ vec4 lightSpacePos = lightProjMatrix * lightViewMatrix * vec4(vWorldPosition, 1.0);
338
+ lightSpacePos.xyz /= lightSpacePos.w;
339
+ lightSpacePos.xyz = lightSpacePos.xyz * 0.5 + 0.5;
340
+ vec3 front = texture2D(causticsTexture, lightSpacePos.xy).rgb;
341
+ vec3 back = texture2D(causticsTextureB, lightSpacePos.xy).rgb;
342
+ gl_FragColor = vec4((front + back) * color, 1.0);
343
+ #include <tonemapping_fragment>
344
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
345
+ }`);
347
346
 
348
347
  const DiscardMaterial = shaderMaterial({}, 'void main() { }', 'void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }');
349
348
 
349
+ const GridMaterial = shaderMaterial({
350
+ cellSize: 0.5,
351
+ sectionSize: 1,
352
+ fadeDistance: 100,
353
+ fadeStrength: 1,
354
+ cellThickness: 0.5,
355
+ sectionThickness: 1,
356
+ cellColor: new THREE.Color(),
357
+ sectionColor: new THREE.Color(),
358
+ infiniteGrid: false,
359
+ followCamera: false,
360
+ worldCamProjPosition: new THREE.Vector3(),
361
+ worldPlanePosition: new THREE.Vector3(),
362
+ },
363
+ /* glsl */ `
364
+ varying vec3 localPosition;
365
+ varying vec4 worldPosition;
366
+
367
+ uniform vec3 worldCamProjPosition;
368
+ uniform vec3 worldPlanePosition;
369
+ uniform float fadeDistance;
370
+ uniform bool infiniteGrid;
371
+ uniform bool followCamera;
372
+
373
+ void main() {
374
+ localPosition = position.xzy;
375
+ if (infiniteGrid) localPosition *= 1.0 + fadeDistance;
376
+
377
+ worldPosition = modelMatrix * vec4(localPosition, 1.0);
378
+ if (followCamera) {
379
+ worldPosition.xyz += (worldCamProjPosition - worldPlanePosition);
380
+ localPosition = (inverse(modelMatrix) * worldPosition).xyz;
381
+ }
382
+
383
+ gl_Position = projectionMatrix * viewMatrix * worldPosition;
384
+ }
385
+ `,
386
+ /* glsl */ `
387
+ varying vec3 localPosition;
388
+ varying vec4 worldPosition;
389
+
390
+ uniform vec3 worldCamProjPosition;
391
+ uniform float cellSize;
392
+ uniform float sectionSize;
393
+ uniform vec3 cellColor;
394
+ uniform vec3 sectionColor;
395
+ uniform float fadeDistance;
396
+ uniform float fadeStrength;
397
+ uniform float cellThickness;
398
+ uniform float sectionThickness;
399
+
400
+ float getGrid(float size, float thickness) {
401
+ vec2 r = localPosition.xz / size;
402
+ vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);
403
+ float line = min(grid.x, grid.y) + 1.0 - thickness;
404
+ return 1.0 - min(line, 1.0);
405
+ }
406
+
407
+ void main() {
408
+ float g1 = getGrid(cellSize, cellThickness);
409
+ float g2 = getGrid(sectionSize, sectionThickness);
410
+
411
+ float dist = distance(worldCamProjPosition, worldPosition.xyz);
412
+ float d = 1.0 - min(dist / fadeDistance, 1.0);
413
+ vec3 color = mix(cellColor, sectionColor, min(1.0, sectionThickness * g2));
414
+
415
+ gl_FragColor = vec4(color, (g1 + g2) * pow(d, fadeStrength));
416
+ gl_FragColor.a = mix(0.75 * gl_FragColor.a, gl_FragColor.a, g2);
417
+ if (gl_FragColor.a <= 0.0) discard;
418
+
419
+ #include <tonemapping_fragment>
420
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
421
+ }
422
+ `);
423
+
350
424
  const NGTS_DISTORT_MATERIAL_SHADER = new InjectionToken('DistortMaterialShader');
351
- function provideNgtsMeshDistortMaterialShader(distortShader) {
352
- return {
353
- provide: NGTS_DISTORT_MATERIAL_SHADER,
354
- useFactory: () => {
355
- return class extends THREE.MeshPhysicalMaterial {
356
- constructor(parameters = {}) {
357
- super(parameters);
358
- this.setValues(parameters);
359
- this._time = { value: 0 };
360
- this._distort = { value: 0.4 };
361
- this._radius = { value: 1 };
362
- }
363
- onBeforeCompile(shader) {
364
- shader.uniforms['time'] = this._time;
365
- shader.uniforms['radius'] = this._radius;
366
- shader.uniforms['distort'] = this._distort;
367
- shader.vertexShader = `
425
+ function injectNgtsMeshDistortMaterial() {
426
+ return inject(NGTS_DISTORT_MATERIAL_SHADER);
427
+ }
428
+ function createMeshDistortMaterial(distortShader) {
429
+ return class extends THREE.MeshPhysicalMaterial {
430
+ constructor(parameters = {}) {
431
+ super(parameters);
432
+ this.setValues(parameters);
433
+ this._time = { value: 0 };
434
+ this._distort = { value: 0.4 };
435
+ this._radius = { value: 1 };
436
+ }
437
+ onBeforeCompile(shader) {
438
+ shader.uniforms['time'] = this._time;
439
+ shader.uniforms['radius'] = this._radius;
440
+ shader.uniforms['distort'] = this._distort;
441
+ shader.vertexShader = `
368
442
  uniform float time;
369
443
  uniform float radius;
370
444
  uniform float distort;
371
445
  ${distortShader}
372
446
  ${shader.vertexShader}
373
447
  `;
374
- shader.vertexShader = shader.vertexShader.replace('#include <begin_vertex>', `
448
+ shader.vertexShader = shader.vertexShader.replace('#include <begin_vertex>', `
375
449
  float updateTime = time / 50.0;
376
450
  float noise = snoise(vec3(position / 2.0 + updateTime * 5.0));
377
451
  vec3 transformed = vec3(position * (noise * pow(distort, 2.0) + radius));
378
452
  `);
379
- }
380
- get time() {
381
- return this._time.value;
382
- }
383
- set time(v) {
384
- this._time.value = v;
385
- }
386
- get distort() {
387
- return this._distort.value;
388
- }
389
- set distort(v) {
390
- this._distort.value = v;
391
- }
392
- get radius() {
393
- return this._radius.value;
394
- }
395
- set radius(v) {
396
- this._radius.value = v;
397
- }
398
- };
399
- },
453
+ }
454
+ get time() {
455
+ return this._time.value;
456
+ }
457
+ set time(v) {
458
+ this._time.value = v;
459
+ }
460
+ get distort() {
461
+ return this._distort.value;
462
+ }
463
+ set distort(v) {
464
+ this._distort.value = v;
465
+ }
466
+ get radius() {
467
+ return this._radius.value;
468
+ }
469
+ set radius(v) {
470
+ this._radius.value = v;
471
+ }
400
472
  };
401
473
  }
474
+ function provideNgtsMeshDistortMaterialShader(distortShader) {
475
+ return { provide: NGTS_DISTORT_MATERIAL_SHADER, useFactory: () => createMeshDistortMaterial(distortShader) };
476
+ }
402
477
 
403
478
  class MeshReflectorMaterial extends MeshStandardMaterial {
404
479
  constructor(parameters = {}) {
@@ -785,7 +860,7 @@ const MeshRefractionMaterial = shaderMaterial({
785
860
  float nFresnel = fresnelFunc(viewDirection, normal) * fresnel;
786
861
  gl_FragColor = vec4(mix(finalColor, vec3(1.0), nFresnel), 1.0);
787
862
  #include <tonemapping_fragment>
788
- #include <encodings_fragment>
863
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
789
864
  }`);
790
865
 
791
866
  class MeshTransmissionMaterial extends THREE.MeshPhysicalMaterial {
@@ -804,7 +879,7 @@ class MeshTransmissionMaterial extends THREE.MeshPhysicalMaterial {
804
879
  thicknessMap: { value: null },
805
880
  attenuationDistance: { value: Infinity },
806
881
  attenuationColor: { value: new THREE.Color('white') },
807
- anisotropy: { value: 0.1 },
882
+ anisotropicBlur: { value: 0.1 },
808
883
  time: { value: 0 },
809
884
  distortion: { value: 0.0 },
810
885
  distortionScale: { value: 0.5 },
@@ -827,7 +902,7 @@ class MeshTransmissionMaterial extends THREE.MeshPhysicalMaterial {
827
902
  shader.fragmentShader =
828
903
  /*glsl*/ `
829
904
  uniform float chromaticAberration;
830
- uniform float anisotropy;
905
+ uniform float anisotropicBlur;
831
906
  uniform float time;
832
907
  uniform float distortion;
833
908
  uniform float distortionScale;
@@ -1018,7 +1093,7 @@ class MeshTransmissionMaterial extends THREE.MeshPhysicalMaterial {
1018
1093
  vec3 transmission = vec3(0.0);
1019
1094
  float transmissionR, transmissionB, transmissionG;
1020
1095
  float randomCoords = rand();
1021
- float thickness_smear = thickness * max(pow(roughnessFactor, 0.33), anisotropy);
1096
+ float thickness_smear = thickness * max(pow(roughnessFactor, 0.33), anisotropicBlur);
1022
1097
  vec3 distortionNormal = vec3(0.0);
1023
1098
  vec3 temporalOffset = vec3(time, -time, -time) * temporalDistortion;
1024
1099
  if (distortion > 0.0) {
@@ -1097,78 +1172,55 @@ const SoftShadowMaterial = shaderMaterial({
1097
1172
  alphaTest: 0.75,
1098
1173
  opacity: 0,
1099
1174
  map: null,
1100
- },
1101
- // language=glsl
1102
- `
1103
- varying vec2 vUv;
1104
- void main() {
1105
- gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
1106
- vUv = uv;
1107
- }
1108
- `,
1109
- // language=glsl
1110
- `
1111
- varying vec2 vUv;
1112
- uniform sampler2D map;
1113
- uniform vec3 color;
1114
- uniform float opacity;
1115
- uniform float alphaTest;
1116
- uniform float blend;
1117
- void main() {
1118
- vec4 sampledDiffuseColor = texture2D(map, vUv);
1119
- gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity);
1120
- #include <tonemapping_fragment>
1121
- #include <encodings_fragment>
1122
- }
1123
- `);
1124
-
1125
- const SparklesMaterial = shaderMaterial({ time: 0, pixelRatio: 1 },
1126
- // language=GLSL
1127
- `
1128
- uniform float pixelRatio;
1129
- uniform float time;
1130
-
1131
- attribute float size;
1132
- attribute float speed;
1133
- attribute float opacity;
1134
- attribute vec3 noise;
1135
- attribute vec3 color;
1136
-
1137
- varying vec3 vColor;
1138
- varying float vOpacity;
1139
-
1140
- void main() {
1141
- vec4 modelPosition = modelMatrix * vec4(position, 1.0);
1142
-
1143
- modelPosition.y += sin(time * speed + modelPosition.x * noise.x * 100.0) * 0.2;
1144
- modelPosition.z += cos(time * speed + modelPosition.x * noise.y * 100.0) * 0.2;
1145
- modelPosition.x += cos(time * speed + modelPosition.x * noise.z * 100.0) * 0.2;
1146
-
1147
- vec4 viewPosition = viewMatrix * modelPosition;
1148
- vec4 projectionPostion = projectionMatrix * viewPosition;
1149
-
1150
- gl_Position = projectionPostion;
1151
- gl_PointSize = size * 25. * pixelRatio;
1152
- gl_PointSize *= (1.0 / - viewPosition.z);
1153
-
1154
- vColor = color;
1155
- vOpacity = opacity;
1156
- }
1157
- `,
1158
- // language=GLSL
1159
- `
1160
- varying vec3 vColor;
1161
- varying float vOpacity;
1162
-
1163
- void main() {
1164
- float distanceToCenter = distance(gl_PointCoord, vec2(0.5));
1165
- float strength = 0.05 / distanceToCenter - 0.1;
1166
-
1167
- gl_FragColor = vec4(vColor, strength * vOpacity);
1168
- }
1169
- `);
1170
-
1171
- class SpotLightMaterial extends ShaderMaterial {
1175
+ }, `varying vec2 vUv;
1176
+ void main() {
1177
+ gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
1178
+ vUv = uv;
1179
+ }`, `varying vec2 vUv;
1180
+ uniform sampler2D map;
1181
+ uniform vec3 color;
1182
+ uniform float opacity;
1183
+ uniform float alphaTest;
1184
+ uniform float blend;
1185
+ void main() {
1186
+ vec4 sampledDiffuseColor = texture2D(map, vUv);
1187
+ gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity);
1188
+ #include <tonemapping_fragment>
1189
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
1190
+ }`);
1191
+
1192
+ const SparklesMaterial = shaderMaterial({ time: 0, pixelRatio: 1 }, ` uniform float pixelRatio;
1193
+ uniform float time;
1194
+ attribute float size;
1195
+ attribute float speed;
1196
+ attribute float opacity;
1197
+ attribute vec3 noise;
1198
+ attribute vec3 color;
1199
+ varying vec3 vColor;
1200
+ varying float vOpacity;
1201
+ void main() {
1202
+ vec4 modelPosition = modelMatrix * vec4(position, 1.0);
1203
+ modelPosition.y += sin(time * speed + modelPosition.x * noise.x * 100.0) * 0.2;
1204
+ modelPosition.z += cos(time * speed + modelPosition.x * noise.y * 100.0) * 0.2;
1205
+ modelPosition.x += cos(time * speed + modelPosition.x * noise.z * 100.0) * 0.2;
1206
+ vec4 viewPosition = viewMatrix * modelPosition;
1207
+ vec4 projectionPostion = projectionMatrix * viewPosition;
1208
+ gl_Position = projectionPostion;
1209
+ gl_PointSize = size * 25. * pixelRatio;
1210
+ gl_PointSize *= (1.0 / - viewPosition.z);
1211
+ vColor = color;
1212
+ vOpacity = opacity;
1213
+ }`, ` varying vec3 vColor;
1214
+ varying float vOpacity;
1215
+ void main() {
1216
+ float distanceToCenter = distance(gl_PointCoord, vec2(0.5));
1217
+ float strength = 0.05 / distanceToCenter - 0.1;
1218
+ gl_FragColor = vec4(vColor, strength * vOpacity);
1219
+ #include <tonemapping_fragment>
1220
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
1221
+ }`);
1222
+
1223
+ class SpotLightMaterial extends THREE.ShaderMaterial {
1172
1224
  constructor() {
1173
1225
  super({
1174
1226
  uniforms: {
@@ -1176,11 +1228,11 @@ class SpotLightMaterial extends ShaderMaterial {
1176
1228
  opacity: { value: 1 },
1177
1229
  attenuation: { value: 2.5 },
1178
1230
  anglePower: { value: 12 },
1179
- spotPosition: { value: new Vector3(0, 0, 0) },
1180
- lightColor: { value: new Color('white') },
1231
+ spotPosition: { value: new THREE.Vector3(0, 0, 0) },
1232
+ lightColor: { value: new THREE.Color('white') },
1181
1233
  cameraNear: { value: 0 },
1182
1234
  cameraFar: { value: 1 },
1183
- resolution: { value: new Vector2(0, 0) },
1235
+ resolution: { value: new THREE.Vector2(0, 0) },
1184
1236
  },
1185
1237
  transparent: true,
1186
1238
  depthWrite: false,
@@ -1247,7 +1299,7 @@ class SpotLightMaterial extends ShaderMaterial {
1247
1299
  gl_FragColor = vec4(lightColor, intensity * opacity);
1248
1300
 
1249
1301
  #include <tonemapping_fragment>
1250
- #include <encodings_fragment>
1302
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
1251
1303
  }`,
1252
1304
  });
1253
1305
  }
@@ -1280,13 +1332,256 @@ void main() {
1280
1332
  gl_FragColor = vec4(vColor, opacity);
1281
1333
 
1282
1334
  #include <tonemapping_fragment>
1283
- #include <encodings_fragment>
1335
+ #include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
1284
1336
  }
1285
1337
  `);
1286
1338
 
1339
+ const WireframeMaterialShaders = {
1340
+ uniforms: {
1341
+ strokeOpacity: 1,
1342
+ fillOpacity: 0.25,
1343
+ fillMix: 0,
1344
+ thickness: 0.05,
1345
+ colorBackfaces: false,
1346
+ dashInvert: true,
1347
+ dash: false,
1348
+ dashRepeats: 4,
1349
+ dashLength: 0.5,
1350
+ squeeze: false,
1351
+ squeezeMin: 0.2,
1352
+ squeezeMax: 1,
1353
+ stroke: new THREE.Color('#ff0000'),
1354
+ backfaceStroke: new THREE.Color('#0000ff'),
1355
+ fill: new THREE.Color('#00ff00'),
1356
+ },
1357
+ vertex: /* glsl */ `
1358
+ attribute vec3 barycentric;
1359
+
1360
+ varying vec3 v_edges_Barycentric;
1361
+ varying vec3 v_edges_Position;
1362
+
1363
+ void initWireframe() {
1364
+ v_edges_Barycentric = barycentric;
1365
+ v_edges_Position = position.xyz;
1366
+ }
1367
+ `,
1368
+ fragment: /* glsl */ `
1369
+ #ifndef PI
1370
+ #define PI 3.1415926535897932384626433832795
1371
+ #endif
1372
+
1373
+ varying vec3 v_edges_Barycentric;
1374
+ varying vec3 v_edges_Position;
1375
+
1376
+ uniform float strokeOpacity;
1377
+ uniform float fillOpacity;
1378
+ uniform float fillMix;
1379
+ uniform float thickness;
1380
+ uniform bool colorBackfaces;
1381
+
1382
+ // Dash
1383
+ uniform bool dashInvert;
1384
+ uniform bool dash;
1385
+ uniform bool dashOnly;
1386
+ uniform float dashRepeats;
1387
+ uniform float dashLength;
1388
+
1389
+ // Squeeze
1390
+ uniform bool squeeze;
1391
+ uniform float squeezeMin;
1392
+ uniform float squeezeMax;
1393
+
1394
+ // Colors
1395
+ uniform vec3 stroke;
1396
+ uniform vec3 backfaceStroke;
1397
+ uniform vec3 fill;
1398
+
1399
+ // This is like
1400
+ float wireframe_aastep(float threshold, float dist) {
1401
+ float afwidth = fwidth(dist) * 0.5;
1402
+ return smoothstep(threshold - afwidth, threshold + afwidth, dist);
1403
+ }
1404
+
1405
+ float wireframe_map(float value, float min1, float max1, float min2, float max2) {
1406
+ return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
1407
+ }
1408
+
1409
+ float getWireframe() {
1410
+ vec3 barycentric = v_edges_Barycentric;
1411
+
1412
+ // Distance from center of each triangle to its edges.
1413
+ float d = min(min(barycentric.x, barycentric.y), barycentric.z);
1414
+
1415
+ // for dashed rendering, we can use this to get the 0 .. 1 value of the line length
1416
+ float positionAlong = max(barycentric.x, barycentric.y);
1417
+ if (barycentric.y < barycentric.x && barycentric.y < barycentric.z) {
1418
+ positionAlong = 1.0 - positionAlong;
1419
+ }
1420
+
1421
+ // the thickness of the stroke
1422
+ float computedThickness = wireframe_map(thickness, 0.0, 1.0, 0.0, 0.34);
1423
+
1424
+ // if we want to shrink the thickness toward the center of the line segment
1425
+ if (squeeze) {
1426
+ computedThickness *= mix(squeezeMin, squeezeMax, (1.0 - sin(positionAlong * PI)));
1427
+ }
1428
+
1429
+ // Create dash pattern
1430
+ if (dash) {
1431
+ // here we offset the stroke position depending on whether it
1432
+ // should overlap or not
1433
+ float offset = 1.0 / dashRepeats * dashLength / 2.0;
1434
+ if (!dashInvert) {
1435
+ offset += 1.0 / dashRepeats / 2.0;
1436
+ }
1437
+
1438
+ // if we should animate the dash or not
1439
+ // if (dashAnimate) {
1440
+ // offset += time * 0.22;
1441
+ // }
1442
+
1443
+ // create the repeating dash pattern
1444
+ float pattern = fract((positionAlong + offset) * dashRepeats);
1445
+ computedThickness *= 1.0 - wireframe_aastep(dashLength, pattern);
1446
+ }
1447
+
1448
+ // compute the anti-aliased stroke edge
1449
+ float edge = 1.0 - wireframe_aastep(computedThickness, d);
1450
+
1451
+ return edge;
1452
+ }
1453
+ `,
1454
+ };
1455
+ const WireframeMaterial = shaderMaterial(WireframeMaterialShaders.uniforms, WireframeMaterialShaders.vertex +
1456
+ /* glsl */ `
1457
+ void main() {
1458
+ initWireframe();
1459
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
1460
+ }
1461
+ `, WireframeMaterialShaders.fragment +
1462
+ /* glsl */ `
1463
+ void main () {
1464
+ // Compute color
1465
+
1466
+ float edge = getWireframe();
1467
+ vec4 colorStroke = vec4(stroke, edge);
1468
+
1469
+ #ifdef FLIP_SIDED
1470
+ colorStroke.rgb = backfaceStroke;
1471
+ #endif
1472
+
1473
+ vec4 colorFill = vec4(fill, fillOpacity);
1474
+ vec4 outColor = mix(colorFill, colorStroke, edge * strokeOpacity);
1475
+
1476
+ gl_FragColor = outColor;
1477
+ }
1478
+ `);
1479
+ function setWireframeOverride(material, uniforms) {
1480
+ material.onBeforeCompile = (shader) => {
1481
+ shader.uniforms = {
1482
+ ...shader.uniforms,
1483
+ ...uniforms,
1484
+ };
1485
+ shader.vertexShader = shader.vertexShader.replace('void main() {', `
1486
+ ${WireframeMaterialShaders.vertex}
1487
+ void main() {
1488
+ initWireframe();
1489
+ `);
1490
+ shader.fragmentShader = shader.fragmentShader.replace('void main() {', `
1491
+ ${WireframeMaterialShaders.fragment}
1492
+ void main() {
1493
+ `);
1494
+ shader.fragmentShader = shader.fragmentShader.replace('#include <color_fragment>',
1495
+ /* glsl */ `
1496
+ #include <color_fragment>
1497
+ float edge = getWireframe();
1498
+ vec4 colorStroke = vec4(stroke, edge);
1499
+ #ifdef FLIP_SIDED
1500
+ colorStroke.rgb = backfaceStroke;
1501
+ #endif
1502
+ vec4 colorFill = vec4(mix(diffuseColor.rgb, fill, fillMix), mix(diffuseColor.a, fillOpacity, fillMix));
1503
+ vec4 outColor = mix(colorFill, colorStroke, edge * strokeOpacity);
1504
+
1505
+ diffuseColor.rgb = outColor.rgb;
1506
+ diffuseColor.a *= outColor.a;
1507
+ `);
1508
+ };
1509
+ material.side = THREE.DoubleSide;
1510
+ material.transparent = true;
1511
+ }
1512
+ function injectNgtsWireframeUniforms(uniformsFactory, stateFactory, { injector } = {}) {
1513
+ injector = assertInjector(injectNgtsWireframeUniforms, injector);
1514
+ return runInInjectionContext(injector, () => {
1515
+ const uniforms = uniformsFactory();
1516
+ const state = computed(() => stateFactory());
1517
+ const fillOpacity = computed(() => state().fillOpacity);
1518
+ const fillMix = computed(() => state().fillMix);
1519
+ const strokeOpacity = computed(() => state().strokeOpacity);
1520
+ const thickness = computed(() => state().thickness);
1521
+ const colorBackfaces = computed(() => state().colorBackfaces);
1522
+ const dash = computed(() => state().dash);
1523
+ const dashInvert = computed(() => state().dashInvert);
1524
+ const dashRepeats = computed(() => state().dashRepeats);
1525
+ const dashLength = computed(() => state().dashLength);
1526
+ const squeeze = computed(() => state().squeeze);
1527
+ const squeezeMin = computed(() => state().squeezeMin);
1528
+ const squeezeMax = computed(() => state().squeezeMax);
1529
+ const stroke = computed(() => state().stroke);
1530
+ const fill = computed(() => state().fill);
1531
+ const backfaceStroke = computed(() => state().backfaceStroke);
1532
+ effect(() => {
1533
+ uniforms['fillOpacity'].value = fillOpacity() ?? uniforms['fillOpacity'].value;
1534
+ });
1535
+ effect(() => {
1536
+ uniforms['fillMix'].value = fillMix() ?? uniforms['fillMix'].value;
1537
+ });
1538
+ effect(() => {
1539
+ uniforms['strokeOpacity'].value = strokeOpacity() ?? uniforms['strokeOpacity'].value;
1540
+ });
1541
+ effect(() => {
1542
+ uniforms['thickness'].value = thickness() ?? uniforms['thickness'].value;
1543
+ });
1544
+ effect(() => {
1545
+ uniforms['colorBackfaces'].value = colorBackfaces() ?? uniforms['colorBackfaces'].value;
1546
+ });
1547
+ effect(() => {
1548
+ uniforms['dash'].value = dash() ?? uniforms['dash'].value;
1549
+ });
1550
+ effect(() => {
1551
+ uniforms['dashInvert'].value = dashInvert() ?? uniforms['dashInvert'].value;
1552
+ });
1553
+ effect(() => {
1554
+ uniforms['dashRepeats'].value = dashRepeats() ?? uniforms['dashRepeats'].value;
1555
+ });
1556
+ effect(() => {
1557
+ uniforms['dashLength'].value = dashLength() ?? uniforms['dashLength'].value;
1558
+ });
1559
+ effect(() => {
1560
+ uniforms['squeeze'].value = squeeze() ?? uniforms['squeeze'].value;
1561
+ });
1562
+ effect(() => {
1563
+ uniforms['squeezeMin'].value = squeezeMin() ?? uniforms['squeezeMin'].value;
1564
+ });
1565
+ effect(() => {
1566
+ uniforms['squeezeMax'].value = squeezeMax() ?? uniforms['squeezeMax'].value;
1567
+ });
1568
+ effect(() => {
1569
+ uniforms['stroke'].value = stroke() ? new THREE.Color(stroke()) : uniforms['stroke'].value;
1570
+ });
1571
+ effect(() => {
1572
+ uniforms['fill'].value = fill() ? new THREE.Color(fill()) : uniforms['fill'].value;
1573
+ });
1574
+ effect(() => {
1575
+ uniforms['backfaceStroke'].value = backfaceStroke()
1576
+ ? new THREE.Color(backfaceStroke())
1577
+ : uniforms['backfaceStroke'].value;
1578
+ });
1579
+ });
1580
+ }
1581
+
1287
1582
  /**
1288
1583
  * Generated bundle index. Do not edit.
1289
1584
  */
1290
1585
 
1291
- export { BlurPass, CausticsMaterial, CausticsProjectionMaterial, ConvolutionMaterial, DiscardMaterial, MeshReflectorMaterial, MeshRefractionMaterial, MeshTransmissionMaterial, MeshWobbleMaterial, NGTS_DISTORT_MATERIAL_SHADER, SoftShadowMaterial, SparklesMaterial, SpotLightMaterial, StarFieldMaterial, provideNgtsMeshDistortMaterialShader };
1586
+ export { BlurPass, CausticsMaterial, CausticsProjectionMaterial, ConvolutionMaterial, DiscardMaterial, GridMaterial, MeshReflectorMaterial, MeshRefractionMaterial, MeshTransmissionMaterial, MeshWobbleMaterial, NGTS_DISTORT_MATERIAL_SHADER, SoftShadowMaterial, SparklesMaterial, SpotLightMaterial, StarFieldMaterial, WireframeMaterial, WireframeMaterialShaders, createMeshDistortMaterial, injectNgtsMeshDistortMaterial, injectNgtsWireframeUniforms, provideNgtsMeshDistortMaterialShader, setWireframeOverride, shaderMaterial };
1292
1587
  //# sourceMappingURL=angular-three-soba-shaders.mjs.map