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

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