@luma.gl/effects 7.4.0-alpha.2 → 9.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/LICENSE +10 -1
  2. package/README.md +2 -2
  3. package/dist/dist.dev.js +3458 -0
  4. package/dist/dist.min.js +18 -30
  5. package/dist/index.cjs +1724 -0
  6. package/dist/index.cjs.map +7 -0
  7. package/dist/index.d.ts +40 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +26 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/passes/postprocessing/fxaa/fxaa.d.ts +15 -0
  12. package/dist/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -0
  13. package/{src/shader-modules → dist/passes/postprocessing}/fxaa/fxaa.js +18 -14
  14. package/dist/passes/postprocessing/fxaa/fxaa.js.map +1 -0
  15. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +43 -0
  16. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -0
  17. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +68 -0
  18. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -0
  19. package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts +43 -0
  20. package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -0
  21. package/dist/passes/postprocessing/image-adjust-filters/denoise.js +74 -0
  22. package/dist/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -0
  23. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +46 -0
  24. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -0
  25. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js +101 -0
  26. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -0
  27. package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts +33 -0
  28. package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -0
  29. package/dist/passes/postprocessing/image-adjust-filters/noise.js +58 -0
  30. package/dist/passes/postprocessing/image-adjust-filters/noise.js.map +1 -0
  31. package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts +29 -0
  32. package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -0
  33. package/dist/passes/postprocessing/image-adjust-filters/sepia.js +44 -0
  34. package/dist/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -0
  35. package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts +29 -0
  36. package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -0
  37. package/dist/passes/postprocessing/image-adjust-filters/vibrance.js +35 -0
  38. package/dist/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -0
  39. package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts +44 -0
  40. package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -0
  41. package/dist/passes/postprocessing/image-adjust-filters/vignette.js +39 -0
  42. package/dist/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -0
  43. package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +79 -0
  44. package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -0
  45. package/dist/passes/postprocessing/image-blur-filters/tiltshift.js +111 -0
  46. package/dist/passes/postprocessing/image-blur-filters/tiltshift.js.map +1 -0
  47. package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts +56 -0
  48. package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -0
  49. package/dist/passes/postprocessing/image-blur-filters/triangleblur.js +65 -0
  50. package/dist/passes/postprocessing/image-blur-filters/triangleblur.js.map +1 -0
  51. package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +42 -0
  52. package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -0
  53. package/dist/passes/postprocessing/image-blur-filters/zoomblur.js +59 -0
  54. package/dist/passes/postprocessing/image-blur-filters/zoomblur.js.map +1 -0
  55. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +52 -0
  56. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -0
  57. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js +64 -0
  58. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js.map +1 -0
  59. package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts +50 -0
  60. package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -0
  61. package/dist/passes/postprocessing/image-fun-filters/dotscreen.js +50 -0
  62. package/dist/passes/postprocessing/image-fun-filters/dotscreen.js.map +1 -0
  63. package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts +54 -0
  64. package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -0
  65. package/dist/passes/postprocessing/image-fun-filters/edgework.js +101 -0
  66. package/dist/passes/postprocessing/image-fun-filters/edgework.js.map +1 -0
  67. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +43 -0
  68. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -0
  69. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js +68 -0
  70. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js.map +1 -0
  71. package/dist/passes/postprocessing/image-fun-filters/ink.d.ts +40 -0
  72. package/dist/passes/postprocessing/image-fun-filters/ink.d.ts.map +1 -0
  73. package/dist/passes/postprocessing/image-fun-filters/ink.js +52 -0
  74. package/dist/passes/postprocessing/image-fun-filters/ink.js.map +1 -0
  75. package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts +45 -0
  76. package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -0
  77. package/dist/passes/postprocessing/image-fun-filters/magnify.js +49 -0
  78. package/dist/passes/postprocessing/image-fun-filters/magnify.js.map +1 -0
  79. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +49 -0
  80. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -0
  81. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js +56 -0
  82. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js.map +1 -0
  83. package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts +50 -0
  84. package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts.map +1 -0
  85. package/dist/passes/postprocessing/image-warp-filters/swirl.js +57 -0
  86. package/dist/passes/postprocessing/image-warp-filters/swirl.js.map +1 -0
  87. package/dist/passes/postprocessing/image-warp-filters/warp.d.ts +8 -0
  88. package/dist/passes/postprocessing/image-warp-filters/warp.d.ts.map +1 -0
  89. package/dist/passes/postprocessing/image-warp-filters/warp.js +21 -0
  90. package/dist/passes/postprocessing/image-warp-filters/warp.js.map +1 -0
  91. package/package.json +37 -13
  92. package/src/index.ts +99 -0
  93. package/src/passes/postprocessing/fxaa/fxaa.ts +694 -0
  94. package/src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +81 -0
  95. package/src/passes/postprocessing/image-adjust-filters/denoise.ts +97 -0
  96. package/src/passes/postprocessing/image-adjust-filters/huesaturation.ts +120 -0
  97. package/src/passes/postprocessing/image-adjust-filters/noise.ts +73 -0
  98. package/src/passes/postprocessing/image-adjust-filters/sepia.ts +54 -0
  99. package/src/passes/postprocessing/image-adjust-filters/vibrance.ts +48 -0
  100. package/src/passes/postprocessing/image-adjust-filters/vignette.ts +58 -0
  101. package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +135 -0
  102. package/src/passes/postprocessing/image-blur-filters/triangleblur.ts +84 -0
  103. package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +75 -0
  104. package/src/passes/postprocessing/image-fun-filters/colorhalftone.ts +85 -0
  105. package/src/passes/postprocessing/image-fun-filters/dotscreen.ts +70 -0
  106. package/src/passes/postprocessing/image-fun-filters/edgework.ts +120 -0
  107. package/src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +86 -0
  108. package/src/passes/postprocessing/image-fun-filters/ink.ts +73 -0
  109. package/src/passes/postprocessing/image-fun-filters/magnify.ts +70 -0
  110. package/src/passes/postprocessing/image-warp-filters/bulgepinch.ts +72 -0
  111. package/src/passes/postprocessing/image-warp-filters/swirl.ts +77 -0
  112. package/src/passes/postprocessing/image-warp-filters/warp.ts +28 -0
  113. package/dist/dist.js +0 -3621
  114. package/dist/es5/experimental/passes/outline-pass.js +0 -125
  115. package/dist/es5/experimental/passes/outline-pass.js.map +0 -1
  116. package/dist/es5/experimental/passes/ssao-pass.js +0 -133
  117. package/dist/es5/experimental/passes/ssao-pass.js.map +0 -1
  118. package/dist/es5/experimental/shader-modules/convolution.js +0 -46
  119. package/dist/es5/experimental/shader-modules/convolution.js.map +0 -1
  120. package/dist/es5/experimental/shader-modules/depth.js +0 -27
  121. package/dist/es5/experimental/shader-modules/depth.js.map +0 -1
  122. package/dist/es5/experimental/shader-modules/pack.js +0 -19
  123. package/dist/es5/experimental/shader-modules/pack.js.map +0 -1
  124. package/dist/es5/experimental/shader-modules/ssao.js +0 -32
  125. package/dist/es5/experimental/shader-modules/ssao.js.map +0 -1
  126. package/dist/es5/index.js +0 -184
  127. package/dist/es5/index.js.map +0 -1
  128. package/dist/es5/shader-modules/adjust-filters/brightnesscontrast.js +0 -29
  129. package/dist/es5/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
  130. package/dist/es5/shader-modules/adjust-filters/denoise.js +0 -29
  131. package/dist/es5/shader-modules/adjust-filters/denoise.js.map +0 -1
  132. package/dist/es5/shader-modules/adjust-filters/huesaturation.js +0 -29
  133. package/dist/es5/shader-modules/adjust-filters/huesaturation.js.map +0 -1
  134. package/dist/es5/shader-modules/adjust-filters/noise.js +0 -24
  135. package/dist/es5/shader-modules/adjust-filters/noise.js.map +0 -1
  136. package/dist/es5/shader-modules/adjust-filters/sepia.js +0 -24
  137. package/dist/es5/shader-modules/adjust-filters/sepia.js.map +0 -1
  138. package/dist/es5/shader-modules/adjust-filters/vibrance.js +0 -24
  139. package/dist/es5/shader-modules/adjust-filters/vibrance.js.map +0 -1
  140. package/dist/es5/shader-modules/adjust-filters/vignette.js +0 -29
  141. package/dist/es5/shader-modules/adjust-filters/vignette.js.map +0 -1
  142. package/dist/es5/shader-modules/blur-filters/tiltshift.js +0 -49
  143. package/dist/es5/shader-modules/blur-filters/tiltshift.js.map +0 -1
  144. package/dist/es5/shader-modules/blur-filters/triangleblur.js +0 -42
  145. package/dist/es5/shader-modules/blur-filters/triangleblur.js.map +0 -1
  146. package/dist/es5/shader-modules/blur-filters/zoomblur.js +0 -31
  147. package/dist/es5/shader-modules/blur-filters/zoomblur.js.map +0 -1
  148. package/dist/es5/shader-modules/fun-filters/colorhalftone.js +0 -31
  149. package/dist/es5/shader-modules/fun-filters/colorhalftone.js.map +0 -1
  150. package/dist/es5/shader-modules/fun-filters/dotscreen.js +0 -31
  151. package/dist/es5/shader-modules/fun-filters/dotscreen.js.map +0 -1
  152. package/dist/es5/shader-modules/fun-filters/edgework.js +0 -42
  153. package/dist/es5/shader-modules/fun-filters/edgework.js.map +0 -1
  154. package/dist/es5/shader-modules/fun-filters/hexagonalpixelate.js +0 -29
  155. package/dist/es5/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
  156. package/dist/es5/shader-modules/fun-filters/ink.js +0 -24
  157. package/dist/es5/shader-modules/fun-filters/ink.js.map +0 -1
  158. package/dist/es5/shader-modules/fxaa/fxaa.js +0 -47
  159. package/dist/es5/shader-modules/fxaa/fxaa.js.map +0 -1
  160. package/dist/es5/shader-modules/utils/random.js +0 -13
  161. package/dist/es5/shader-modules/utils/random.js.map +0 -1
  162. package/dist/es5/shader-modules/warp-filters/bulgepinch.js +0 -36
  163. package/dist/es5/shader-modules/warp-filters/bulgepinch.js.map +0 -1
  164. package/dist/es5/shader-modules/warp-filters/swirl.js +0 -36
  165. package/dist/es5/shader-modules/warp-filters/swirl.js.map +0 -1
  166. package/dist/es5/shader-modules/warp-filters/warp.js +0 -13
  167. package/dist/es5/shader-modules/warp-filters/warp.js.map +0 -1
  168. package/dist/es6/experimental/passes/outline-pass.js +0 -48
  169. package/dist/es6/experimental/passes/outline-pass.js.map +0 -1
  170. package/dist/es6/experimental/passes/ssao-pass.js +0 -76
  171. package/dist/es6/experimental/passes/ssao-pass.js.map +0 -1
  172. package/dist/es6/experimental/shader-modules/convolution.js +0 -37
  173. package/dist/es6/experimental/shader-modules/convolution.js.map +0 -1
  174. package/dist/es6/experimental/shader-modules/depth.js +0 -13
  175. package/dist/es6/experimental/shader-modules/depth.js.map +0 -1
  176. package/dist/es6/experimental/shader-modules/pack.js +0 -10
  177. package/dist/es6/experimental/shader-modules/pack.js.map +0 -1
  178. package/dist/es6/experimental/shader-modules/ssao.js +0 -21
  179. package/dist/es6/experimental/shader-modules/ssao.js.map +0 -1
  180. package/dist/es6/index.js +0 -23
  181. package/dist/es6/index.js.map +0 -1
  182. package/dist/es6/shader-modules/adjust-filters/brightnesscontrast.js +0 -22
  183. package/dist/es6/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
  184. package/dist/es6/shader-modules/adjust-filters/denoise.js +0 -20
  185. package/dist/es6/shader-modules/adjust-filters/denoise.js.map +0 -1
  186. package/dist/es6/shader-modules/adjust-filters/huesaturation.js +0 -22
  187. package/dist/es6/shader-modules/adjust-filters/huesaturation.js.map +0 -1
  188. package/dist/es6/shader-modules/adjust-filters/noise.js +0 -17
  189. package/dist/es6/shader-modules/adjust-filters/noise.js.map +0 -1
  190. package/dist/es6/shader-modules/adjust-filters/sepia.js +0 -17
  191. package/dist/es6/shader-modules/adjust-filters/sepia.js.map +0 -1
  192. package/dist/es6/shader-modules/adjust-filters/vibrance.js +0 -17
  193. package/dist/es6/shader-modules/adjust-filters/vibrance.js.map +0 -1
  194. package/dist/es6/shader-modules/adjust-filters/vignette.js +0 -22
  195. package/dist/es6/shader-modules/adjust-filters/vignette.js.map +0 -1
  196. package/dist/es6/shader-modules/blur-filters/tiltshift.js +0 -38
  197. package/dist/es6/shader-modules/blur-filters/tiltshift.js.map +0 -1
  198. package/dist/es6/shader-modules/blur-filters/triangleblur.js +0 -31
  199. package/dist/es6/shader-modules/blur-filters/triangleblur.js.map +0 -1
  200. package/dist/es6/shader-modules/blur-filters/zoomblur.js +0 -20
  201. package/dist/es6/shader-modules/blur-filters/zoomblur.js.map +0 -1
  202. package/dist/es6/shader-modules/fun-filters/colorhalftone.js +0 -24
  203. package/dist/es6/shader-modules/fun-filters/colorhalftone.js.map +0 -1
  204. package/dist/es6/shader-modules/fun-filters/dotscreen.js +0 -24
  205. package/dist/es6/shader-modules/fun-filters/dotscreen.js.map +0 -1
  206. package/dist/es6/shader-modules/fun-filters/edgework.js +0 -31
  207. package/dist/es6/shader-modules/fun-filters/edgework.js.map +0 -1
  208. package/dist/es6/shader-modules/fun-filters/hexagonalpixelate.js +0 -22
  209. package/dist/es6/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
  210. package/dist/es6/shader-modules/fun-filters/ink.js +0 -17
  211. package/dist/es6/shader-modules/fun-filters/ink.js.map +0 -1
  212. package/dist/es6/shader-modules/fxaa/fxaa.js +0 -39
  213. package/dist/es6/shader-modules/fxaa/fxaa.js.map +0 -1
  214. package/dist/es6/shader-modules/utils/random.js +0 -6
  215. package/dist/es6/shader-modules/utils/random.js.map +0 -1
  216. package/dist/es6/shader-modules/warp-filters/bulgepinch.js +0 -25
  217. package/dist/es6/shader-modules/warp-filters/bulgepinch.js.map +0 -1
  218. package/dist/es6/shader-modules/warp-filters/swirl.js +0 -25
  219. package/dist/es6/shader-modules/warp-filters/swirl.js.map +0 -1
  220. package/dist/es6/shader-modules/warp-filters/warp.js +0 -6
  221. package/dist/es6/shader-modules/warp-filters/warp.js.map +0 -1
  222. package/dist/esm/experimental/passes/outline-pass.js +0 -114
  223. package/dist/esm/experimental/passes/outline-pass.js.map +0 -1
  224. package/dist/esm/experimental/passes/ssao-pass.js +0 -120
  225. package/dist/esm/experimental/passes/ssao-pass.js.map +0 -1
  226. package/dist/esm/experimental/shader-modules/convolution.js +0 -39
  227. package/dist/esm/experimental/shader-modules/convolution.js.map +0 -1
  228. package/dist/esm/experimental/shader-modules/depth.js +0 -16
  229. package/dist/esm/experimental/shader-modules/depth.js.map +0 -1
  230. package/dist/esm/experimental/shader-modules/pack.js +0 -12
  231. package/dist/esm/experimental/shader-modules/pack.js.map +0 -1
  232. package/dist/esm/experimental/shader-modules/ssao.js +0 -21
  233. package/dist/esm/experimental/shader-modules/ssao.js.map +0 -1
  234. package/dist/esm/index.js +0 -23
  235. package/dist/esm/index.js.map +0 -1
  236. package/dist/esm/shader-modules/adjust-filters/brightnesscontrast.js +0 -22
  237. package/dist/esm/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
  238. package/dist/esm/shader-modules/adjust-filters/denoise.js +0 -22
  239. package/dist/esm/shader-modules/adjust-filters/denoise.js.map +0 -1
  240. package/dist/esm/shader-modules/adjust-filters/huesaturation.js +0 -22
  241. package/dist/esm/shader-modules/adjust-filters/huesaturation.js.map +0 -1
  242. package/dist/esm/shader-modules/adjust-filters/noise.js +0 -17
  243. package/dist/esm/shader-modules/adjust-filters/noise.js.map +0 -1
  244. package/dist/esm/shader-modules/adjust-filters/sepia.js +0 -17
  245. package/dist/esm/shader-modules/adjust-filters/sepia.js.map +0 -1
  246. package/dist/esm/shader-modules/adjust-filters/vibrance.js +0 -17
  247. package/dist/esm/shader-modules/adjust-filters/vibrance.js.map +0 -1
  248. package/dist/esm/shader-modules/adjust-filters/vignette.js +0 -22
  249. package/dist/esm/shader-modules/adjust-filters/vignette.js.map +0 -1
  250. package/dist/esm/shader-modules/blur-filters/tiltshift.js +0 -38
  251. package/dist/esm/shader-modules/blur-filters/tiltshift.js.map +0 -1
  252. package/dist/esm/shader-modules/blur-filters/triangleblur.js +0 -31
  253. package/dist/esm/shader-modules/blur-filters/triangleblur.js.map +0 -1
  254. package/dist/esm/shader-modules/blur-filters/zoomblur.js +0 -20
  255. package/dist/esm/shader-modules/blur-filters/zoomblur.js.map +0 -1
  256. package/dist/esm/shader-modules/fun-filters/colorhalftone.js +0 -24
  257. package/dist/esm/shader-modules/fun-filters/colorhalftone.js.map +0 -1
  258. package/dist/esm/shader-modules/fun-filters/dotscreen.js +0 -24
  259. package/dist/esm/shader-modules/fun-filters/dotscreen.js.map +0 -1
  260. package/dist/esm/shader-modules/fun-filters/edgework.js +0 -31
  261. package/dist/esm/shader-modules/fun-filters/edgework.js.map +0 -1
  262. package/dist/esm/shader-modules/fun-filters/hexagonalpixelate.js +0 -22
  263. package/dist/esm/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
  264. package/dist/esm/shader-modules/fun-filters/ink.js +0 -17
  265. package/dist/esm/shader-modules/fun-filters/ink.js.map +0 -1
  266. package/dist/esm/shader-modules/fxaa/fxaa.js +0 -39
  267. package/dist/esm/shader-modules/fxaa/fxaa.js.map +0 -1
  268. package/dist/esm/shader-modules/utils/random.js +0 -6
  269. package/dist/esm/shader-modules/utils/random.js.map +0 -1
  270. package/dist/esm/shader-modules/warp-filters/bulgepinch.js +0 -25
  271. package/dist/esm/shader-modules/warp-filters/bulgepinch.js.map +0 -1
  272. package/dist/esm/shader-modules/warp-filters/swirl.js +0 -25
  273. package/dist/esm/shader-modules/warp-filters/swirl.js.map +0 -1
  274. package/dist/esm/shader-modules/warp-filters/warp.js +0 -6
  275. package/dist/esm/shader-modules/warp-filters/warp.js.map +0 -1
  276. package/src/experimental/passes/outline-pass.js +0 -58
  277. package/src/experimental/passes/ssao-pass.js +0 -73
  278. package/src/experimental/passes/ssao-pass.md +0 -15
  279. package/src/experimental/shader-modules/convolution.js +0 -96
  280. package/src/experimental/shader-modules/convolution.md +0 -15
  281. package/src/experimental/shader-modules/depth.js +0 -84
  282. package/src/experimental/shader-modules/depth.md +0 -76
  283. package/src/experimental/shader-modules/pack.js +0 -32
  284. package/src/experimental/shader-modules/pack.md +0 -15
  285. package/src/experimental/shader-modules/ssao.js +0 -183
  286. package/src/experimental/shader-modules/ssao.md +0 -4
  287. package/src/index.js +0 -35
  288. package/src/shader-modules/adjust-filters/brightnesscontrast.js +0 -38
  289. package/src/shader-modules/adjust-filters/denoise.js +0 -49
  290. package/src/shader-modules/adjust-filters/huesaturation.js +0 -57
  291. package/src/shader-modules/adjust-filters/noise.js +0 -36
  292. package/src/shader-modules/adjust-filters/sepia.js +0 -37
  293. package/src/shader-modules/adjust-filters/vibrance.js +0 -32
  294. package/src/shader-modules/adjust-filters/vignette.js +0 -33
  295. package/src/shader-modules/blur-filters/tiltshift.js +0 -105
  296. package/src/shader-modules/blur-filters/triangleblur.js +0 -55
  297. package/src/shader-modules/blur-filters/zoomblur.js +0 -56
  298. package/src/shader-modules/fun-filters/colorhalftone.js +0 -60
  299. package/src/shader-modules/fun-filters/dotscreen.js +0 -45
  300. package/src/shader-modules/fun-filters/edgework.js +0 -84
  301. package/src/shader-modules/fun-filters/hexagonalpixelate.js +0 -63
  302. package/src/shader-modules/fun-filters/ink.js +0 -49
  303. package/src/shader-modules/utils/random.js +0 -12
  304. package/src/shader-modules/warp-filters/bulgepinch.js +0 -52
  305. package/src/shader-modules/warp-filters/swirl.js +0 -55
  306. package/src/shader-modules/warp-filters/warp.js +0 -19
@@ -1,105 +0,0 @@
1
- /**
2
- * @filter Tilt Shift
3
- * @description Simulates the shallow depth of field normally encountered in close-up
4
- * photography, which makes the scene seem much smaller than it actually
5
- * is. This filter assumes the scene is relatively planar, in which case
6
- * the part of the scene that is completely in focus can be described by
7
- * a line (the intersection of the focal plane and the scene). An example
8
- * of a planar scene might be looking at a road from above at a downward
9
- * angle. The image is then blurred with a blur radius that starts at zero
10
- * on the line and increases further from the line.
11
- * @param startX The x coordinate of the start of the line segment.
12
- * @param startY The y coordinate of the start of the line segment.
13
- * @param endX The x coordinate of the end of the line segment.
14
- * @param endY The y coordinate of the end of the line segment.
15
- * @param blurRadius The maximum radius of the pyramid blur.
16
- * @param gradientRadius The distance from the line at which the maximum blur radius is reached.
17
- */
18
- import random from '../utils/random';
19
-
20
- const fs = `\
21
- uniform float blurRadius;
22
- uniform float gradientRadius;
23
- uniform vec2 start;
24
- uniform vec2 end;
25
- uniform bool invert;
26
-
27
- vec2 tiltShift_getDelta(vec2 texSize) {
28
- vec2 vector = normalize((end - start) * texSize);
29
- return invert ? vec2(-vector.y, vector.x) : vector;
30
- }
31
-
32
- vec4 tiltShift_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
33
- vec4 color = vec4(0.0);
34
- float total = 0.0;
35
-
36
- /* randomize the lookup values to hide the fixed number of samples */
37
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
38
-
39
- vec2 normal = normalize(vec2((start.y - end.y) * texSize.y, (end.x - start.x) * texSize.x));
40
- float radius = smoothstep(0.0, 1.0,
41
- abs(dot(texCoord * texSize - start * texSize, normal)) / gradientRadius) * blurRadius;
42
-
43
- for (float t = -30.0; t <= 30.0; t++) {
44
- float percent = (t + offset - 0.5) / 30.0;
45
- float weight = 1.0 - abs(percent);
46
- vec4 sample = texture2D(texture, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);
47
-
48
- /* switch to pre-multiplied alpha to correctly blur transparent images */
49
- sample.rgb *= sample.a;
50
-
51
- color += sample * weight;
52
- total += weight;
53
- }
54
-
55
- color = color / total;
56
-
57
- /* switch back from pre-multiplied alpha */
58
- color.rgb /= color.a + 0.00001;
59
-
60
- return color;
61
- }
62
- `;
63
-
64
- const uniforms = {
65
- blurRadius: {value: 15, min: 0, max: 50},
66
- gradientRadius: {value: 200, min: 0, max: 400},
67
- start: [0, 0],
68
- end: [1, 1],
69
- invert: {value: false, private: true}
70
- };
71
-
72
- export default {
73
- name: 'tiltShift',
74
- uniforms,
75
- fs,
76
- dependencies: [random],
77
-
78
- passes: [{sampler: true, uniforms: {invert: false}}, {sampler: true, uniforms: {invert: true}}]
79
- };
80
-
81
- /*
82
- function tiltShift(startX, startY, endX, endY, blurRadius, gradientRadius) {
83
- var dx = endX - startX;
84
- var dy = endY - startY;
85
- var d = Math.sqrt(dx * dx + dy * dy);
86
- simpleShader.call(this, gl.tiltShift, {
87
- blurRadius: blurRadius,
88
- gradientRadius: gradientRadius,
89
- start: [startX, startY],
90
- end: [endX, endY],
91
- delta: [dx / d, dy / d],
92
- texSize: [this.width, this.height]
93
- });
94
- simpleShader.call(this, gl.tiltShift, {
95
- blurRadius: blurRadius,
96
- gradientRadius: gradientRadius,
97
- start: [startX, startY],
98
- end: [endX, endY],
99
- delta: [-dy / d, dx / d],
100
- texSize: [this.width, this.height]
101
- });
102
-
103
- return this;
104
- }
105
- */
@@ -1,55 +0,0 @@
1
- /**
2
- * @filter Triangle Blur
3
- * @description This is the most basic blur filter, which convolves the image with a
4
- * pyramid filter. The pyramid filter is separable and is applied as two
5
- * perpendicular triangle filters.
6
- * @param radius The radius of the pyramid convolved with the image.
7
- */
8
- import random from '../utils/random';
9
-
10
- const fs = `\
11
- uniform float radius;
12
- uniform vec2 delta;
13
-
14
- vec4 triangleBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
15
- vec2 adjustedDelta = delta * radius / texSize;
16
-
17
- vec4 color = vec4(0.0);
18
- float total = 0.0;
19
-
20
- /* randomize the lookup values to hide the fixed number of samples */
21
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
22
-
23
- for (float t = -30.0; t <= 30.0; t++) {
24
- float percent = (t + offset - 0.5) / 30.0;
25
- float weight = 1.0 - abs(percent);
26
- vec4 sample = texture2D(texture, texCoord + adjustedDelta * percent);
27
-
28
- /* switch to pre-multiplied alpha to correctly blur transparent images */
29
- sample.rgb *= sample.a;
30
-
31
- color += sample * weight;
32
- total += weight;
33
- }
34
-
35
- color = color / total;
36
-
37
- /* switch back from pre-multiplied alpha */
38
- color.rgb /= color.a + 0.00001;
39
-
40
- return color;
41
- }
42
- `;
43
-
44
- const uniforms = {
45
- radius: {value: 20, min: 0, softMax: 100},
46
- delta: {value: [1, 0], private: true}
47
- };
48
-
49
- export default {
50
- name: 'triangleBlur',
51
- uniforms,
52
- fs,
53
- dependencies: [random],
54
- passes: [{sampler: true, uniforms: {delta: [1, 0]}}, {sampler: true, uniforms: {delta: [0, 1]}}]
55
- };
@@ -1,56 +0,0 @@
1
- /**
2
- * @filter Zoom Blur
3
- * @description Blurs the image away from a certain point, which looks like radial motion blur.
4
- * @param centerX The x coordinate of the blur origin.
5
- * @param centerY The y coordinate of the blur origin.
6
- * @param strength The strength of the blur. Values in the range 0 to 1 are usually sufficient,
7
- * where 0 doesn't change the image and 1 creates a highly blurred image.
8
- */
9
- import random from '../utils/random';
10
-
11
- const fs = `
12
- uniform vec2 center;
13
- uniform float strength;
14
-
15
- vec4 zoomBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
16
- vec4 color = vec4(0.0);
17
- float total = 0.0;
18
- vec2 toCenter = center * texSize - texCoord * texSize;
19
-
20
- /* randomize the lookup values to hide the fixed number of samples */
21
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
22
-
23
- for (float t = 0.0; t <= 40.0; t++) {
24
- float percent = (t + offset) / 40.0;
25
- float weight = 4.0 * (percent - percent * percent);
26
- vec4 sample = texture2D(texture, texCoord + toCenter * percent * strength / texSize);
27
-
28
- /* switch to pre-multiplied alpha to correctly blur transparent images */
29
- sample.rgb *= sample.a;
30
-
31
- color += sample * weight;
32
- total += weight;
33
- }
34
-
35
- color = color / total;
36
-
37
- /* switch back from pre-multiplied alpha */
38
- color.rgb /= color.a + 0.00001;
39
-
40
- return color;
41
- }
42
- `;
43
-
44
- const uniforms = {
45
- center: [0.5, 0.5],
46
- strength: {value: 0.3, min: 0, softMax: 1}
47
- };
48
-
49
- export default {
50
- name: 'zoomBlur',
51
- uniforms,
52
- fs,
53
- dependencies: [random],
54
-
55
- passes: [{sampler: true}]
56
- };
@@ -1,60 +0,0 @@
1
- /**
2
- * @filter Color Halftone
3
- * @description Simulates a CMYK halftone rendering of the image by multiplying pixel values
4
- * with a four rotated 2D sine wave patterns, one each for cyan, magenta, yellow,
5
- * and black.
6
- * @param centerX The x coordinate of the pattern origin.
7
- * @param centerY The y coordinate of the pattern origin.
8
- * @param angle The rotation of the pattern in radians.
9
- * @param size The diameter of a dot in pixels.
10
- */
11
-
12
- // TODO pass texCoord to angle
13
- const fs = `\
14
- uniform vec2 center;
15
- uniform float angle;
16
- uniform float size;
17
-
18
- float scale = 3.1514 / size;
19
-
20
- float pattern(float angle, vec2 texSize, vec2 texCoord) {
21
- float s = sin(angle), c = cos(angle);
22
- vec2 tex = texCoord * texSize - center * texSize;
23
- vec2 point = vec2(
24
- c * tex.x - s * tex.y,
25
- s * tex.x + c * tex.y
26
- ) * scale;
27
- return (sin(point.x) * sin(point.y)) * 4.0;
28
- }
29
-
30
- vec4 colorHalftone_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
31
- vec3 cmy = 1.0 - color.rgb;
32
- float k = min(cmy.x, min(cmy.y, cmy.z));
33
- cmy = (cmy - k) / (1.0 - k);
34
- cmy = clamp(
35
- cmy * 10.0 - 3.0 + vec3(
36
- pattern(angle + 0.26179, texSize, texCoord),
37
- pattern(angle + 1.30899, texSize, texCoord),
38
- pattern(angle, texSize, texCoord)
39
- ),
40
- 0.0,
41
- 1.0
42
- );
43
- k = clamp(k * 10.0 - 5.0 + pattern(angle + 0.78539, texSize, texCoord), 0.0, 1.0);
44
- return vec4(1.0 - cmy - k, color.a);
45
- }
46
- `;
47
-
48
- const uniforms = {
49
- center: [0.5, 0.5],
50
- angle: {value: 1.1, softMin: 0, softMax: Math.PI / 2},
51
- size: {value: 4, min: 1, softMin: 3, softMax: 20}
52
- };
53
-
54
- export default {
55
- name: 'colorHalftone',
56
- uniforms,
57
- fs,
58
-
59
- passes: [{filter: true}]
60
- };
@@ -1,45 +0,0 @@
1
- /**
2
- * @filter Dot Screen
3
- * @description Simulates a black and white halftone rendering of the image by multiplying
4
- * pixel values with a rotated 2D sine wave pattern.
5
- * @param centerX The x coordinate of the pattern origin.
6
- * @param centerY The y coordinate of the pattern origin.
7
- * @param angle The rotation of the pattern in radians.
8
- * @param size The diameter of a dot in pixels.
9
- */
10
- const fs = `\
11
- uniform vec2 center;
12
- uniform float angle;
13
- uniform float size;
14
-
15
- float pattern(vec2 texSize, vec2 texCoord) {
16
- float scale = 3.1415 / size;
17
-
18
- float s = sin(angle), c = cos(angle);
19
- vec2 tex = texCoord * texSize - center * texSize;
20
- vec2 point = vec2(
21
- c * tex.x - s * tex.y,
22
- s * tex.x + c * tex.y
23
- ) * scale;
24
- return (sin(point.x) * sin(point.y)) * 4.0;
25
- }
26
-
27
- vec4 dotScreen_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
28
- float average = (color.r + color.g + color.b) / 3.0;
29
- return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);
30
- }
31
- `;
32
-
33
- const uniforms = {
34
- center: [0.5, 0.5],
35
- angle: {value: 1.1, softMin: 0, softMax: Math.PI / 2},
36
- size: {value: 3, min: 1, softMin: 3, softMax: 20}
37
- };
38
-
39
- export default {
40
- name: 'dotScreen',
41
- uniforms,
42
- fs,
43
-
44
- passes: [{filter: true}]
45
- };
@@ -1,84 +0,0 @@
1
- /**
2
- * @filter Edge Work
3
- * @description Picks out different frequencies in the image by subtracting two
4
- * copies of the image blurred with different radii.
5
- * @param radius The radius of the effect in pixels.
6
- */
7
- import random from '../utils/random';
8
-
9
- const fs = `\
10
- uniform float radius;
11
- uniform vec2 delta;
12
-
13
- vec4 edgeWork_sampleColor1(sampler2D source, vec2 texSize, vec2 texCoord) {
14
- vec2 relativeDelta = radius * delta / texSize;
15
-
16
- vec2 color = vec2(0.0);
17
- vec2 total = vec2(0.0);
18
-
19
- /* randomize the lookup values to hide the fixed number of samples */
20
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
21
-
22
- for (float t = -30.0; t <= 30.0; t++) {
23
- float percent = (t + offset - 0.5) / 30.0;
24
- float weight = 1.0 - abs(percent);
25
- vec3 sampleColor = texture2D(source, texCoord + relativeDelta * percent).rgb;
26
- float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;
27
- color.x += average * weight;
28
- total.x += weight;
29
- if (abs(t) < 15.0) {
30
- weight = weight * 2.0 - 1.0;
31
- color.y += average * weight;
32
- total.y += weight;
33
- }
34
- }
35
- return vec4(color / total, 0.0, 1.0);
36
- }
37
-
38
- vec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {
39
- vec2 relativeDelta = radius * delta / texSize;
40
-
41
- vec2 color = vec2(0.0);
42
- vec2 total = vec2(0.0);
43
-
44
- /* randomize the lookup values to hide the fixed number of samples */
45
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
46
-
47
- for (float t = -30.0; t <= 30.0; t++) {
48
- float percent = (t + offset - 0.5) / 30.0;
49
- float weight = 1.0 - abs(percent);
50
- vec2 sampleColor = texture2D(source, texCoord + relativeDelta * percent).xy;
51
- color.x += sampleColor.x * weight;
52
- total.x += weight;
53
- if (abs(t) < 15.0) {
54
- weight = weight * 2.0 - 1.0;
55
- color.y += sampleColor.y * weight;
56
- total.y += weight;
57
- }
58
- }
59
- float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);
60
- return vec4(c, c, c, 1.0);
61
- }
62
- `;
63
-
64
- const uniforms = {
65
- radius: {value: 2, min: 1, softMax: 50},
66
- delta: {value: [1, 0], private: true}
67
- };
68
-
69
- export default {
70
- name: 'edgeWork',
71
- uniforms,
72
- fs,
73
- dependencies: [random],
74
- passes: [
75
- {
76
- sampler: 'edgeWork_sampleColor1',
77
- uniforms: {delta: [1, 0]}
78
- },
79
- {
80
- sampler: 'edgeWork_sampleColor2',
81
- uniforms: {delta: [0, 1]}
82
- }
83
- ]
84
- };
@@ -1,63 +0,0 @@
1
- /**
2
- * @filter Hexagonal Pixelate
3
- * @description Renders the image using a pattern of hexagonal tiles. Tile colors
4
- * are nearest-neighbor sampled from the centers of the tiles.
5
- * @param centerX The x coordinate of the pattern center.
6
- * @param centerY The y coordinate of the pattern center.
7
- * @param scale The width of an individual tile, in pixels.
8
- */
9
- const fs = `\
10
- uniform vec2 center;
11
- uniform float scale;
12
-
13
- vec4 hexagonalPixelate_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
14
- vec2 tex = (texCoord * texSize - center * texSize) / scale;
15
- tex.y /= 0.866025404;
16
- tex.x -= tex.y * 0.5;
17
-
18
- vec2 a;
19
- if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {
20
- a = vec2(floor(tex.x), floor(tex.y));
21
- }
22
- else a = vec2(ceil(tex.x), ceil(tex.y));
23
- vec2 b = vec2(ceil(tex.x), floor(tex.y));
24
- vec2 c = vec2(floor(tex.x), ceil(tex.y));
25
-
26
- vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);
27
- vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);
28
- vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);
29
- vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);
30
-
31
- float alen = length(TEX - A);
32
- float blen = length(TEX - B);
33
- float clen = length(TEX - C);
34
-
35
- vec2 choice;
36
- if (alen < blen) {
37
- if (alen < clen) choice = a;
38
- else choice = c;
39
- } else {
40
- if (blen < clen) choice = b;
41
- else choice = c;
42
- }
43
-
44
- choice.x += choice.y * 0.5;
45
- choice.y *= 0.866025404;
46
- choice *= scale / texSize;
47
-
48
- return texture2D(texture, choice + center);
49
- }
50
- `;
51
-
52
- const uniforms = {
53
- center: {value: [0.5, 0.5], hint: 'screenspace'},
54
- scale: {value: 10, min: 1, softMin: 5, softMax: 50}
55
- };
56
-
57
- export default {
58
- name: 'hexagonalPixelate',
59
- uniforms,
60
- fs,
61
-
62
- passes: [{sampler: true}]
63
- };
@@ -1,49 +0,0 @@
1
- /**
2
- * @filter Ink
3
- * @description Simulates outlining the image in ink by darkening edges stronger than a
4
- * certain threshold. The edge detection value is the difference of two
5
- * copies of the image, each blurred using a blur of a different radius.
6
- * @param strength The multiplicative scale of the ink edges. Values in the range 0 to 1
7
- * are usually sufficient, where 0 doesn't change the image and 1 adds lots
8
- * of black edges. Negative strength values will create white ink edges
9
- * instead of black ones.
10
- */
11
- const fs = `\
12
- uniform float strength;
13
-
14
- vec4 ink_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
15
- vec2 dx = vec2(1.0 / texSize.x, 0.0);
16
- vec2 dy = vec2(0.0, 1.0 / texSize.y);
17
- vec4 color = texture2D(texture, texCoord);
18
- float bigTotal = 0.0;
19
- float smallTotal = 0.0;
20
- vec3 bigAverage = vec3(0.0);
21
- vec3 smallAverage = vec3(0.0);
22
- for (float x = -2.0; x <= 2.0; x += 1.0) {
23
- for (float y = -2.0; y <= 2.0; y += 1.0) {
24
- vec3 sample = texture2D(texture, texCoord + dx * x + dy * y).rgb;
25
- bigAverage += sample;
26
- bigTotal += 1.0;
27
- if (abs(x) + abs(y) < 2.0) {
28
- smallAverage += sample;
29
- smallTotal += 1.0;
30
- }
31
- }
32
- }
33
- vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);
34
- float power = strength * strength * strength * strength * strength;
35
- return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);
36
- }
37
- `;
38
-
39
- const uniforms = {
40
- strength: {value: 0.25, min: 0, softMax: 1}
41
- };
42
-
43
- export default {
44
- name: 'ink',
45
- uniforms,
46
- fs,
47
-
48
- passes: [{sampler: true}]
49
- };
@@ -1,12 +0,0 @@
1
- // Quick random generator for fragment shaders
2
- const fs = `\
3
- float random(vec3 scale, float seed) {
4
- /* use the fragment position for a different seed per-pixel */
5
- return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
6
- }
7
- `;
8
-
9
- export default {
10
- name: 'random',
11
- fs
12
- };
@@ -1,52 +0,0 @@
1
- /**
2
- * @filter Bulge / Pinch
3
- * @description Bulges or pinches the image in a circle.
4
- * @param centerX The x coordinate of the center of the circle of effect.
5
- * @param centerY The y coordinate of the center of the circle of effect.
6
- * @param radius The radius of the circle of effect.
7
- * @param strength -1 to 1 (-1 is strong pinch, 0 is no effect, 1 is strong bulge)
8
- */
9
- import warp from './warp';
10
-
11
- const fs = `\
12
- uniform float radius;
13
- uniform float strength;
14
- uniform vec2 center;
15
-
16
- vec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {
17
- coord -= texCenter;
18
- float distance = length(coord);
19
- if (distance < radius) {
20
- float percent = distance / radius;
21
- if (strength > 0.0) {
22
- coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);
23
- } else {
24
- coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);
25
- }
26
- }
27
- coord += texCenter;
28
- return coord;
29
- }
30
-
31
- vec4 bulgePinch_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
32
- vec2 coord = texCoord * texSize;
33
- coord = bulgePinch_warp(coord, center * texSize);
34
-
35
- return warp_sampleColor(texture, texSize, coord);
36
- }
37
- `;
38
-
39
- const uniforms = {
40
- center: [0.5, 0.5],
41
- radius: {value: 200, min: 1, softMax: 600},
42
- strength: {value: 0.5, min: -1, max: 1}
43
- };
44
-
45
- export default {
46
- name: 'bulgePinch',
47
- fs,
48
- uniforms,
49
- dependencies: [warp],
50
-
51
- passes: [{sampler: true}]
52
- };
@@ -1,55 +0,0 @@
1
- /**
2
- * @filter Swirl
3
- * @description Warps a circular region of the image in a swirl.
4
- * @param centerX The x coordinate of the center of the circular region.
5
- * @param centerY The y coordinate of the center of the circular region.
6
- * @param radius The radius of the circular region.
7
- * @param angle The angle in radians that the pixels in the center of
8
- * the circular region will be rotated by.
9
- */
10
- import warp from './warp';
11
-
12
- const fs = `\
13
- uniform float radius;
14
- uniform float angle;
15
- uniform vec2 center;
16
-
17
- vec2 swirl_warp(vec2 coord, vec2 texCenter) {
18
- coord -= texCenter;
19
- float distance = length(coord);
20
- if (distance < radius) {
21
- float percent = (radius - distance) / radius;
22
- float theta = percent * percent * angle;
23
- float s = sin(theta);
24
- float c = cos(theta);
25
- coord = vec2(
26
- coord.x * c - coord.y * s,
27
- coord.x * s + coord.y * c
28
- );
29
- }
30
- coord += texCenter;
31
- return coord;
32
- }
33
-
34
- vec4 swirl_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
35
- vec2 coord = texCoord * texSize;
36
- coord = swirl_warp(coord, center * texSize);
37
-
38
- return warp_sampleColor(texture, texSize, coord);
39
- }
40
- `;
41
-
42
- const uniforms = {
43
- center: [0.5, 0.5],
44
- radius: {value: 200, min: 1, softMax: 600},
45
- angle: {value: 3, softMin: -25, softMax: 25}
46
- };
47
-
48
- export default {
49
- name: 'swirl',
50
- uniforms,
51
- fs,
52
- dependencies: [warp],
53
-
54
- passes: [{sampler: true}]
55
- };
@@ -1,19 +0,0 @@
1
- // TODO: FIXME
2
- /* eslint-disable */
3
- const fs = `\
4
- vec4 warp_sampleColor(sampler2D texture, vec2 texSize, vec2 coord) {
5
- vec4 color = texture2D(texture, coord / texSize);
6
- vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);
7
- if (coord != clampedCoord) {
8
- /* fade to transparent if we are outside the image */
9
- color.a *= max(0.0, 1.0 - length(coord - clampedCoord));
10
- }
11
-
12
- return color;
13
- }
14
- `;
15
-
16
- export default {
17
- name: 'warp',
18
- fs
19
- };