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

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
package/dist/dist.js DELETED
@@ -1,3621 +0,0 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("luma"));
4
- else if(typeof define === 'function' && define.amd)
5
- define(["luma"], factory);
6
- else {
7
- var a = typeof exports === 'object' ? factory(require("luma")) : factory(root["luma"]);
8
- for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
- }
10
- })(window, function(__WEBPACK_EXTERNAL_MODULE__luma_gl_core__) {
11
- return /******/ (function(modules) { // webpackBootstrap
12
- /******/ // The module cache
13
- /******/ var installedModules = {};
14
- /******/
15
- /******/ // The require function
16
- /******/ function __webpack_require__(moduleId) {
17
- /******/
18
- /******/ // Check if module is in cache
19
- /******/ if(installedModules[moduleId]) {
20
- /******/ return installedModules[moduleId].exports;
21
- /******/ }
22
- /******/ // Create a new module (and put it into the cache)
23
- /******/ var module = installedModules[moduleId] = {
24
- /******/ i: moduleId,
25
- /******/ l: false,
26
- /******/ exports: {}
27
- /******/ };
28
- /******/
29
- /******/ // Execute the module function
30
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
- /******/
32
- /******/ // Flag the module as loaded
33
- /******/ module.l = true;
34
- /******/
35
- /******/ // Return the exports of the module
36
- /******/ return module.exports;
37
- /******/ }
38
- /******/
39
- /******/
40
- /******/ // expose the modules object (__webpack_modules__)
41
- /******/ __webpack_require__.m = modules;
42
- /******/
43
- /******/ // expose the module cache
44
- /******/ __webpack_require__.c = installedModules;
45
- /******/
46
- /******/ // define getter function for harmony exports
47
- /******/ __webpack_require__.d = function(exports, name, getter) {
48
- /******/ if(!__webpack_require__.o(exports, name)) {
49
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50
- /******/ }
51
- /******/ };
52
- /******/
53
- /******/ // define __esModule on exports
54
- /******/ __webpack_require__.r = function(exports) {
55
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57
- /******/ }
58
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
59
- /******/ };
60
- /******/
61
- /******/ // create a fake namespace object
62
- /******/ // mode & 1: value is a module id, require it
63
- /******/ // mode & 2: merge all properties of value into the ns
64
- /******/ // mode & 4: return value when already ns object
65
- /******/ // mode & 8|1: behave like require
66
- /******/ __webpack_require__.t = function(value, mode) {
67
- /******/ if(mode & 1) value = __webpack_require__(value);
68
- /******/ if(mode & 8) return value;
69
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70
- /******/ var ns = Object.create(null);
71
- /******/ __webpack_require__.r(ns);
72
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74
- /******/ return ns;
75
- /******/ };
76
- /******/
77
- /******/ // getDefaultExport function for compatibility with non-harmony modules
78
- /******/ __webpack_require__.n = function(module) {
79
- /******/ var getter = module && module.__esModule ?
80
- /******/ function getDefault() { return module['default']; } :
81
- /******/ function getModuleExports() { return module; };
82
- /******/ __webpack_require__.d(getter, 'a', getter);
83
- /******/ return getter;
84
- /******/ };
85
- /******/
86
- /******/ // Object.prototype.hasOwnProperty.call
87
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88
- /******/
89
- /******/ // __webpack_public_path__
90
- /******/ __webpack_require__.p = "";
91
- /******/
92
- /******/
93
- /******/ // Load entry module and return exports
94
- /******/ return __webpack_require__(__webpack_require__.s = "./bundle.js");
95
- /******/ })
96
- /************************************************************************/
97
- /******/ ({
98
-
99
- /***/ "../../node_modules/webpack/buildin/global.js":
100
- /*!***********************************!*\
101
- !*** (webpack)/buildin/global.js ***!
102
- \***********************************/
103
- /*! no static exports found */
104
- /***/ (function(module, exports) {
105
-
106
- var g;
107
-
108
- // This works in non-strict mode
109
- g = (function() {
110
- return this;
111
- })();
112
-
113
- try {
114
- // This works if eval is allowed (see CSP)
115
- g = g || new Function("return this")();
116
- } catch (e) {
117
- // This works if the window reference is available
118
- if (typeof window === "object") g = window;
119
- }
120
-
121
- // g can still be undefined, but nothing to do about it...
122
- // We return undefined, instead of nothing here, so it's
123
- // easier to handle this case. if(!global) { ...}
124
-
125
- module.exports = g;
126
-
127
-
128
- /***/ }),
129
-
130
- /***/ "../constants/src/index.js":
131
- /*!*********************************!*\
132
- !*** ../constants/src/index.js ***!
133
- \*********************************/
134
- /*! no static exports found */
135
- /***/ (function(module, exports) {
136
-
137
- // GL constants, copied from Mozilla documentation
138
- // https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants
139
-
140
- // Standard WebGL 1 constants
141
- // These constants are defined on the WebGLRenderingContext interface.
142
-
143
- /* eslint-disable key-spacing, max-len, no-inline-comments, camelcase */
144
- // eslint-disable-next-line
145
- module.exports = {
146
- // Clearing buffers
147
- // Constants passed to clear() to clear buffer masks.
148
-
149
- DEPTH_BUFFER_BIT: 0x00000100,
150
- STENCIL_BUFFER_BIT: 0x00000400,
151
- COLOR_BUFFER_BIT: 0x00004000,
152
-
153
- // Rendering primitives
154
- // Constants passed to drawElements() or drawArrays() to specify what kind of primitive to render.
155
-
156
- POINTS: 0x0000,
157
- LINES: 0x0001,
158
- LINE_LOOP: 0x0002,
159
- LINE_STRIP: 0x0003,
160
- TRIANGLES: 0x0004,
161
- TRIANGLE_STRIP: 0x0005,
162
- TRIANGLE_FAN: 0x0006,
163
-
164
- // Blending modes
165
- // Constants passed to blendFunc() or blendFuncSeparate() to specify the blending mode (for both, RBG and alpha, or separately).
166
-
167
- ZERO: 0,
168
- ONE: 1,
169
- SRC_COLOR: 0x0300,
170
- ONE_MINUS_SRC_COLOR: 0x0301,
171
- SRC_ALPHA: 0x0302,
172
- ONE_MINUS_SRC_ALPHA: 0x0303,
173
- DST_ALPHA: 0x0304,
174
- ONE_MINUS_DST_ALPHA: 0x0305,
175
- DST_COLOR: 0x0306,
176
- ONE_MINUS_DST_COLOR: 0x0307,
177
- SRC_ALPHA_SATURATE: 0x0308,
178
- CONSTANT_COLOR: 0x8001,
179
- ONE_MINUS_CONSTANT_COLOR: 0x8002,
180
- CONSTANT_ALPHA: 0x8003,
181
- ONE_MINUS_CONSTANT_ALPHA: 0x8004,
182
-
183
- // Blending equations
184
- // Constants passed to blendEquation() or blendEquationSeparate() to control
185
- // how the blending is calculated (for both, RBG and alpha, or separately).
186
-
187
- FUNC_ADD: 0x8006,
188
- FUNC_SUBTRACT: 0x800a,
189
- FUNC_REVERSE_SUBTRACT: 0x800b,
190
-
191
- // Getting GL parameter information
192
- // Constants passed to getParameter() to specify what information to return.
193
-
194
- BLEND_EQUATION: 0x8009,
195
- BLEND_EQUATION_RGB: 0x8009,
196
- BLEND_EQUATION_ALPHA: 0x883d,
197
- BLEND_DST_RGB: 0x80c8,
198
- BLEND_SRC_RGB: 0x80c9,
199
- BLEND_DST_ALPHA: 0x80ca,
200
- BLEND_SRC_ALPHA: 0x80cb,
201
- BLEND_COLOR: 0x8005,
202
- ARRAY_BUFFER_BINDING: 0x8894,
203
- ELEMENT_ARRAY_BUFFER_BINDING: 0x8895,
204
- LINE_WIDTH: 0x0b21,
205
- ALIASED_POINT_SIZE_RANGE: 0x846d,
206
- ALIASED_LINE_WIDTH_RANGE: 0x846e,
207
- CULL_FACE_MODE: 0x0b45,
208
- FRONT_FACE: 0x0b46,
209
- DEPTH_RANGE: 0x0b70,
210
- DEPTH_WRITEMASK: 0x0b72,
211
- DEPTH_CLEAR_VALUE: 0x0b73,
212
- DEPTH_FUNC: 0x0b74,
213
- STENCIL_CLEAR_VALUE: 0x0b91,
214
- STENCIL_FUNC: 0x0b92,
215
- STENCIL_FAIL: 0x0b94,
216
- STENCIL_PASS_DEPTH_FAIL: 0x0b95,
217
- STENCIL_PASS_DEPTH_PASS: 0x0b96,
218
- STENCIL_REF: 0x0b97,
219
- STENCIL_VALUE_MASK: 0x0b93,
220
- STENCIL_WRITEMASK: 0x0b98,
221
- STENCIL_BACK_FUNC: 0x8800,
222
- STENCIL_BACK_FAIL: 0x8801,
223
- STENCIL_BACK_PASS_DEPTH_FAIL: 0x8802,
224
- STENCIL_BACK_PASS_DEPTH_PASS: 0x8803,
225
- STENCIL_BACK_REF: 0x8ca3,
226
- STENCIL_BACK_VALUE_MASK: 0x8ca4,
227
- STENCIL_BACK_WRITEMASK: 0x8ca5,
228
- VIEWPORT: 0x0ba2,
229
- SCISSOR_BOX: 0x0c10,
230
- COLOR_CLEAR_VALUE: 0x0c22,
231
- COLOR_WRITEMASK: 0x0c23,
232
- UNPACK_ALIGNMENT: 0x0cf5,
233
- PACK_ALIGNMENT: 0x0d05,
234
- MAX_TEXTURE_SIZE: 0x0d33,
235
- MAX_VIEWPORT_DIMS: 0x0d3a,
236
- SUBPIXEL_BITS: 0x0d50,
237
- RED_BITS: 0x0d52,
238
- GREEN_BITS: 0x0d53,
239
- BLUE_BITS: 0x0d54,
240
- ALPHA_BITS: 0x0d55,
241
- DEPTH_BITS: 0x0d56,
242
- STENCIL_BITS: 0x0d57,
243
- POLYGON_OFFSET_UNITS: 0x2a00,
244
- POLYGON_OFFSET_FACTOR: 0x8038,
245
- TEXTURE_BINDING_2D: 0x8069,
246
- SAMPLE_BUFFERS: 0x80a8,
247
- SAMPLES: 0x80a9,
248
- SAMPLE_COVERAGE_VALUE: 0x80aa,
249
- SAMPLE_COVERAGE_INVERT: 0x80ab,
250
- COMPRESSED_TEXTURE_FORMATS: 0x86a3,
251
- VENDOR: 0x1f00,
252
- RENDERER: 0x1f01,
253
- VERSION: 0x1f02,
254
- IMPLEMENTATION_COLOR_READ_TYPE: 0x8b9a,
255
- IMPLEMENTATION_COLOR_READ_FORMAT: 0x8b9b,
256
- BROWSER_DEFAULT_WEBGL: 0x9244,
257
-
258
- // Buffers
259
- // Constants passed to bufferData(), bufferSubData(), bindBuffer(), or
260
- // getBufferParameter().
261
-
262
- STATIC_DRAW: 0x88e4,
263
- STREAM_DRAW: 0x88e0,
264
- DYNAMIC_DRAW: 0x88e8,
265
- ARRAY_BUFFER: 0x8892,
266
- ELEMENT_ARRAY_BUFFER: 0x8893,
267
- BUFFER_SIZE: 0x8764,
268
- BUFFER_USAGE: 0x8765,
269
-
270
- // Vertex attributes
271
- // Constants passed to getVertexAttrib().
272
-
273
- CURRENT_VERTEX_ATTRIB: 0x8626,
274
- VERTEX_ATTRIB_ARRAY_ENABLED: 0x8622,
275
- VERTEX_ATTRIB_ARRAY_SIZE: 0x8623,
276
- VERTEX_ATTRIB_ARRAY_STRIDE: 0x8624,
277
- VERTEX_ATTRIB_ARRAY_TYPE: 0x8625,
278
- VERTEX_ATTRIB_ARRAY_NORMALIZED: 0x886a,
279
- VERTEX_ATTRIB_ARRAY_POINTER: 0x8645,
280
- VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 0x889f,
281
-
282
- // Culling
283
- // Constants passed to cullFace().
284
-
285
- CULL_FACE: 0x0b44,
286
- FRONT: 0x0404,
287
- BACK: 0x0405,
288
- FRONT_AND_BACK: 0x0408,
289
-
290
- // Enabling and disabling
291
- // Constants passed to enable() or disable().
292
-
293
- BLEND: 0x0be2,
294
- DEPTH_TEST: 0x0b71,
295
- DITHER: 0x0bd0,
296
- POLYGON_OFFSET_FILL: 0x8037,
297
- SAMPLE_ALPHA_TO_COVERAGE: 0x809e,
298
- SAMPLE_COVERAGE: 0x80a0,
299
- SCISSOR_TEST: 0x0c11,
300
- STENCIL_TEST: 0x0b90,
301
-
302
- // Errors
303
- // Constants returned from getError().
304
-
305
- NO_ERROR: 0,
306
- INVALID_ENUM: 0x0500,
307
- INVALID_VALUE: 0x0501,
308
- INVALID_OPERATION: 0x0502,
309
- OUT_OF_MEMORY: 0x0505,
310
- CONTEXT_LOST_WEBGL: 0x9242,
311
-
312
- // Front face directions
313
- // Constants passed to frontFace().
314
-
315
- CW: 0x0900,
316
- CCW: 0x0901,
317
-
318
- // Hints
319
- // Constants passed to hint()
320
-
321
- DONT_CARE: 0x1100,
322
- FASTEST: 0x1101,
323
- NICEST: 0x1102,
324
- GENERATE_MIPMAP_HINT: 0x8192,
325
-
326
- // Data types
327
-
328
- BYTE: 0x1400,
329
- UNSIGNED_BYTE: 0x1401,
330
- SHORT: 0x1402,
331
- UNSIGNED_SHORT: 0x1403,
332
- INT: 0x1404,
333
- UNSIGNED_INT: 0x1405,
334
- FLOAT: 0x1406,
335
- DOUBLE: 0x140a,
336
-
337
- // Pixel formats
338
-
339
- DEPTH_COMPONENT: 0x1902,
340
- ALPHA: 0x1906,
341
- RGB: 0x1907,
342
- RGBA: 0x1908,
343
- LUMINANCE: 0x1909,
344
- LUMINANCE_ALPHA: 0x190a,
345
-
346
- // Pixel types
347
-
348
- // UNSIGNED_BYTE: 0x1401,
349
- UNSIGNED_SHORT_4_4_4_4: 0x8033,
350
- UNSIGNED_SHORT_5_5_5_1: 0x8034,
351
- UNSIGNED_SHORT_5_6_5: 0x8363,
352
-
353
- // Shaders
354
- // Constants passed to createShader() or getShaderParameter()
355
-
356
- FRAGMENT_SHADER: 0x8b30,
357
- VERTEX_SHADER: 0x8b31,
358
- COMPILE_STATUS: 0x8b81,
359
- DELETE_STATUS: 0x8b80,
360
- LINK_STATUS: 0x8b82,
361
- VALIDATE_STATUS: 0x8b83,
362
- ATTACHED_SHADERS: 0x8b85,
363
- ACTIVE_ATTRIBUTES: 0x8b89,
364
- ACTIVE_UNIFORMS: 0x8b86,
365
- MAX_VERTEX_ATTRIBS: 0x8869,
366
- MAX_VERTEX_UNIFORM_VECTORS: 0x8dfb,
367
- MAX_VARYING_VECTORS: 0x8dfc,
368
- MAX_COMBINED_TEXTURE_IMAGE_UNITS: 0x8b4d,
369
- MAX_VERTEX_TEXTURE_IMAGE_UNITS: 0x8b4c,
370
- MAX_TEXTURE_IMAGE_UNITS: 0x8872,
371
- MAX_FRAGMENT_UNIFORM_VECTORS: 0x8dfd,
372
- SHADER_TYPE: 0x8b4f,
373
- SHADING_LANGUAGE_VERSION: 0x8b8c,
374
- CURRENT_PROGRAM: 0x8b8d,
375
-
376
- // Depth or stencil tests
377
- // Constants passed to depthFunc() or stencilFunc().
378
-
379
- NEVER: 0x0200,
380
- ALWAYS: 0x0207,
381
- LESS: 0x0201,
382
- EQUAL: 0x0202,
383
- LEQUAL: 0x0203,
384
- GREATER: 0x0204,
385
- GEQUAL: 0x0206,
386
- NOTEQUAL: 0x0205,
387
-
388
- // Stencil actions
389
- // Constants passed to stencilOp().
390
-
391
- KEEP: 0x1e00,
392
- REPLACE: 0x1e01,
393
- INCR: 0x1e02,
394
- DECR: 0x1e03,
395
- INVERT: 0x150a,
396
- INCR_WRAP: 0x8507,
397
- DECR_WRAP: 0x8508,
398
-
399
- // Textures
400
- // Constants passed to texParameteri(),
401
- // texParameterf(), bindTexture(), texImage2D(), and others.
402
-
403
- NEAREST: 0x2600,
404
- LINEAR: 0x2601,
405
- NEAREST_MIPMAP_NEAREST: 0x2700,
406
- LINEAR_MIPMAP_NEAREST: 0x2701,
407
- NEAREST_MIPMAP_LINEAR: 0x2702,
408
- LINEAR_MIPMAP_LINEAR: 0x2703,
409
- TEXTURE_MAG_FILTER: 0x2800,
410
- TEXTURE_MIN_FILTER: 0x2801,
411
- TEXTURE_WRAP_S: 0x2802,
412
- TEXTURE_WRAP_T: 0x2803,
413
- TEXTURE_2D: 0x0de1,
414
- TEXTURE: 0x1702,
415
- TEXTURE_CUBE_MAP: 0x8513,
416
- TEXTURE_BINDING_CUBE_MAP: 0x8514,
417
- TEXTURE_CUBE_MAP_POSITIVE_X: 0x8515,
418
- TEXTURE_CUBE_MAP_NEGATIVE_X: 0x8516,
419
- TEXTURE_CUBE_MAP_POSITIVE_Y: 0x8517,
420
- TEXTURE_CUBE_MAP_NEGATIVE_Y: 0x8518,
421
- TEXTURE_CUBE_MAP_POSITIVE_Z: 0x8519,
422
- TEXTURE_CUBE_MAP_NEGATIVE_Z: 0x851a,
423
- MAX_CUBE_MAP_TEXTURE_SIZE: 0x851c,
424
- // TEXTURE0 - 31 0x84C0 - 0x84DF A texture unit.
425
- TEXTURE0: 0x84c0,
426
- ACTIVE_TEXTURE: 0x84e0,
427
- REPEAT: 0x2901,
428
- CLAMP_TO_EDGE: 0x812f,
429
- MIRRORED_REPEAT: 0x8370,
430
-
431
- // Emulation
432
- TEXTURE_WIDTH: 0x1000,
433
- TEXTURE_HEIGHT: 0x1001,
434
-
435
- // Uniform types
436
-
437
- FLOAT_VEC2: 0x8b50,
438
- FLOAT_VEC3: 0x8b51,
439
- FLOAT_VEC4: 0x8b52,
440
- INT_VEC2: 0x8b53,
441
- INT_VEC3: 0x8b54,
442
- INT_VEC4: 0x8b55,
443
- BOOL: 0x8b56,
444
- BOOL_VEC2: 0x8b57,
445
- BOOL_VEC3: 0x8b58,
446
- BOOL_VEC4: 0x8b59,
447
- FLOAT_MAT2: 0x8b5a,
448
- FLOAT_MAT3: 0x8b5b,
449
- FLOAT_MAT4: 0x8b5c,
450
- SAMPLER_2D: 0x8b5e,
451
- SAMPLER_CUBE: 0x8b60,
452
-
453
- // Shader precision-specified types
454
-
455
- LOW_FLOAT: 0x8df0,
456
- MEDIUM_FLOAT: 0x8df1,
457
- HIGH_FLOAT: 0x8df2,
458
- LOW_INT: 0x8df3,
459
- MEDIUM_INT: 0x8df4,
460
- HIGH_INT: 0x8df5,
461
-
462
- // Framebuffers and renderbuffers
463
-
464
- FRAMEBUFFER: 0x8d40,
465
- RENDERBUFFER: 0x8d41,
466
- RGBA4: 0x8056,
467
- RGB5_A1: 0x8057,
468
- RGB565: 0x8d62,
469
- DEPTH_COMPONENT16: 0x81a5,
470
- STENCIL_INDEX: 0x1901,
471
- STENCIL_INDEX8: 0x8d48,
472
- DEPTH_STENCIL: 0x84f9,
473
- RENDERBUFFER_WIDTH: 0x8d42,
474
- RENDERBUFFER_HEIGHT: 0x8d43,
475
- RENDERBUFFER_INTERNAL_FORMAT: 0x8d44,
476
- RENDERBUFFER_RED_SIZE: 0x8d50,
477
- RENDERBUFFER_GREEN_SIZE: 0x8d51,
478
- RENDERBUFFER_BLUE_SIZE: 0x8d52,
479
- RENDERBUFFER_ALPHA_SIZE: 0x8d53,
480
- RENDERBUFFER_DEPTH_SIZE: 0x8d54,
481
- RENDERBUFFER_STENCIL_SIZE: 0x8d55,
482
- FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 0x8cd0,
483
- FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 0x8cd1,
484
- FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 0x8cd2,
485
- FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 0x8cd3,
486
- COLOR_ATTACHMENT0: 0x8ce0,
487
- DEPTH_ATTACHMENT: 0x8d00,
488
- STENCIL_ATTACHMENT: 0x8d20,
489
- DEPTH_STENCIL_ATTACHMENT: 0x821a,
490
- NONE: 0,
491
- FRAMEBUFFER_COMPLETE: 0x8cd5,
492
- FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 0x8cd6,
493
- FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 0x8cd7,
494
- FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 0x8cd9,
495
- FRAMEBUFFER_UNSUPPORTED: 0x8cdd,
496
- FRAMEBUFFER_BINDING: 0x8ca6,
497
- RENDERBUFFER_BINDING: 0x8ca7,
498
- READ_FRAMEBUFFER: 0x8ca8,
499
- DRAW_FRAMEBUFFER: 0x8ca9,
500
- MAX_RENDERBUFFER_SIZE: 0x84e8,
501
- INVALID_FRAMEBUFFER_OPERATION: 0x0506,
502
-
503
- // Pixel storage modes
504
- // Constants passed to pixelStorei().
505
-
506
- UNPACK_FLIP_Y_WEBGL: 0x9240,
507
- UNPACK_PREMULTIPLY_ALPHA_WEBGL: 0x9241,
508
- UNPACK_COLORSPACE_CONVERSION_WEBGL: 0x9243,
509
-
510
- // /////////////////////////////////////////////////////
511
- // Additional constants defined WebGL 2
512
- // These constants are defined on the WebGL2RenderingContext interface.
513
- // All WebGL 1 constants are also available in a WebGL 2 context.
514
- // /////////////////////////////////////////////////////
515
-
516
- // Getting GL parameter information
517
- // Constants passed to getParameter()
518
- // to specify what information to return.
519
-
520
- READ_BUFFER: 0x0c02,
521
- UNPACK_ROW_LENGTH: 0x0cf2,
522
- UNPACK_SKIP_ROWS: 0x0cf3,
523
- UNPACK_SKIP_PIXELS: 0x0cf4,
524
- PACK_ROW_LENGTH: 0x0d02,
525
- PACK_SKIP_ROWS: 0x0d03,
526
- PACK_SKIP_PIXELS: 0x0d04,
527
- TEXTURE_BINDING_3D: 0x806a,
528
- UNPACK_SKIP_IMAGES: 0x806d,
529
- UNPACK_IMAGE_HEIGHT: 0x806e,
530
- MAX_3D_TEXTURE_SIZE: 0x8073,
531
- MAX_ELEMENTS_VERTICES: 0x80e8,
532
- MAX_ELEMENTS_INDICES: 0x80e9,
533
- MAX_TEXTURE_LOD_BIAS: 0x84fd,
534
- MAX_FRAGMENT_UNIFORM_COMPONENTS: 0x8b49,
535
- MAX_VERTEX_UNIFORM_COMPONENTS: 0x8b4a,
536
- MAX_ARRAY_TEXTURE_LAYERS: 0x88ff,
537
- MIN_PROGRAM_TEXEL_OFFSET: 0x8904,
538
- MAX_PROGRAM_TEXEL_OFFSET: 0x8905,
539
- MAX_VARYING_COMPONENTS: 0x8b4b,
540
- FRAGMENT_SHADER_DERIVATIVE_HINT: 0x8b8b,
541
- RASTERIZER_DISCARD: 0x8c89,
542
- VERTEX_ARRAY_BINDING: 0x85b5,
543
- MAX_VERTEX_OUTPUT_COMPONENTS: 0x9122,
544
- MAX_FRAGMENT_INPUT_COMPONENTS: 0x9125,
545
- MAX_SERVER_WAIT_TIMEOUT: 0x9111,
546
- MAX_ELEMENT_INDEX: 0x8d6b,
547
-
548
- // Textures
549
- // Constants passed to texParameteri(),
550
- // texParameterf(), bindTexture(), texImage2D(), and others.
551
-
552
- RED: 0x1903,
553
- RGB8: 0x8051,
554
- RGBA8: 0x8058,
555
- RGB10_A2: 0x8059,
556
- TEXTURE_3D: 0x806f,
557
- TEXTURE_WRAP_R: 0x8072,
558
- TEXTURE_MIN_LOD: 0x813a,
559
- TEXTURE_MAX_LOD: 0x813b,
560
- TEXTURE_BASE_LEVEL: 0x813c,
561
- TEXTURE_MAX_LEVEL: 0x813d,
562
- TEXTURE_COMPARE_MODE: 0x884c,
563
- TEXTURE_COMPARE_FUNC: 0x884d,
564
- SRGB: 0x8c40,
565
- SRGB8: 0x8c41,
566
- SRGB8_ALPHA8: 0x8c43,
567
- COMPARE_REF_TO_TEXTURE: 0x884e,
568
- RGBA32F: 0x8814,
569
- RGB32F: 0x8815,
570
- RGBA16F: 0x881a,
571
- RGB16F: 0x881b,
572
- TEXTURE_2D_ARRAY: 0x8c1a,
573
- TEXTURE_BINDING_2D_ARRAY: 0x8c1d,
574
- R11F_G11F_B10F: 0x8c3a,
575
- RGB9_E5: 0x8c3d,
576
- RGBA32UI: 0x8d70,
577
- RGB32UI: 0x8d71,
578
- RGBA16UI: 0x8d76,
579
- RGB16UI: 0x8d77,
580
- RGBA8UI: 0x8d7c,
581
- RGB8UI: 0x8d7d,
582
- RGBA32I: 0x8d82,
583
- RGB32I: 0x8d83,
584
- RGBA16I: 0x8d88,
585
- RGB16I: 0x8d89,
586
- RGBA8I: 0x8d8e,
587
- RGB8I: 0x8d8f,
588
- RED_INTEGER: 0x8d94,
589
- RGB_INTEGER: 0x8d98,
590
- RGBA_INTEGER: 0x8d99,
591
- R8: 0x8229,
592
- RG8: 0x822b,
593
- R16F: 0x822d,
594
- R32F: 0x822e,
595
- RG16F: 0x822f,
596
- RG32F: 0x8230,
597
- R8I: 0x8231,
598
- R8UI: 0x8232,
599
- R16I: 0x8233,
600
- R16UI: 0x8234,
601
- R32I: 0x8235,
602
- R32UI: 0x8236,
603
- RG8I: 0x8237,
604
- RG8UI: 0x8238,
605
- RG16I: 0x8239,
606
- RG16UI: 0x823a,
607
- RG32I: 0x823b,
608
- RG32UI: 0x823c,
609
- R8_SNORM: 0x8f94,
610
- RG8_SNORM: 0x8f95,
611
- RGB8_SNORM: 0x8f96,
612
- RGBA8_SNORM: 0x8f97,
613
- RGB10_A2UI: 0x906f,
614
-
615
- /* covered by extension
616
- COMPRESSED_R11_EAC : 0x9270,
617
- COMPRESSED_SIGNED_R11_EAC: 0x9271,
618
- COMPRESSED_RG11_EAC: 0x9272,
619
- COMPRESSED_SIGNED_RG11_EAC : 0x9273,
620
- COMPRESSED_RGB8_ETC2 : 0x9274,
621
- COMPRESSED_SRGB8_ETC2: 0x9275,
622
- COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 : 0x9276,
623
- COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC : 0x9277,
624
- COMPRESSED_RGBA8_ETC2_EAC: 0x9278,
625
- COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : 0x9279,
626
- */
627
- TEXTURE_IMMUTABLE_FORMAT: 0x912f,
628
- TEXTURE_IMMUTABLE_LEVELS: 0x82df,
629
-
630
- // Pixel types
631
-
632
- UNSIGNED_INT_2_10_10_10_REV: 0x8368,
633
- UNSIGNED_INT_10F_11F_11F_REV: 0x8c3b,
634
- UNSIGNED_INT_5_9_9_9_REV: 0x8c3e,
635
- FLOAT_32_UNSIGNED_INT_24_8_REV: 0x8dad,
636
- UNSIGNED_INT_24_8: 0x84fa,
637
- HALF_FLOAT: 0x140b,
638
- RG: 0x8227,
639
- RG_INTEGER: 0x8228,
640
- INT_2_10_10_10_REV: 0x8d9f,
641
-
642
- // Queries
643
-
644
- CURRENT_QUERY: 0x8865,
645
- QUERY_RESULT: 0x8866,
646
- QUERY_RESULT_AVAILABLE: 0x8867,
647
- ANY_SAMPLES_PASSED: 0x8c2f,
648
- ANY_SAMPLES_PASSED_CONSERVATIVE: 0x8d6a,
649
-
650
- // Draw buffers
651
-
652
- MAX_DRAW_BUFFERS: 0x8824,
653
- DRAW_BUFFER0: 0x8825,
654
- DRAW_BUFFER1: 0x8826,
655
- DRAW_BUFFER2: 0x8827,
656
- DRAW_BUFFER3: 0x8828,
657
- DRAW_BUFFER4: 0x8829,
658
- DRAW_BUFFER5: 0x882a,
659
- DRAW_BUFFER6: 0x882b,
660
- DRAW_BUFFER7: 0x882c,
661
- DRAW_BUFFER8: 0x882d,
662
- DRAW_BUFFER9: 0x882e,
663
- DRAW_BUFFER10: 0x882f,
664
- DRAW_BUFFER11: 0x8830,
665
- DRAW_BUFFER12: 0x8831,
666
- DRAW_BUFFER13: 0x8832,
667
- DRAW_BUFFER14: 0x8833,
668
- DRAW_BUFFER15: 0x8834,
669
- MAX_COLOR_ATTACHMENTS: 0x8cdf,
670
- COLOR_ATTACHMENT1: 0x8ce1,
671
- COLOR_ATTACHMENT2: 0x8ce2,
672
- COLOR_ATTACHMENT3: 0x8ce3,
673
- COLOR_ATTACHMENT4: 0x8ce4,
674
- COLOR_ATTACHMENT5: 0x8ce5,
675
- COLOR_ATTACHMENT6: 0x8ce6,
676
- COLOR_ATTACHMENT7: 0x8ce7,
677
- COLOR_ATTACHMENT8: 0x8ce8,
678
- COLOR_ATTACHMENT9: 0x8ce9,
679
- COLOR_ATTACHMENT10: 0x8cea,
680
- COLOR_ATTACHMENT11: 0x8ceb,
681
- COLOR_ATTACHMENT12: 0x8cec,
682
- COLOR_ATTACHMENT13: 0x8ced,
683
- COLOR_ATTACHMENT14: 0x8cee,
684
- COLOR_ATTACHMENT15: 0x8cef,
685
-
686
- // Samplers
687
-
688
- SAMPLER_3D: 0x8b5f,
689
- SAMPLER_2D_SHADOW: 0x8b62,
690
- SAMPLER_2D_ARRAY: 0x8dc1,
691
- SAMPLER_2D_ARRAY_SHADOW: 0x8dc4,
692
- SAMPLER_CUBE_SHADOW: 0x8dc5,
693
- INT_SAMPLER_2D: 0x8dca,
694
- INT_SAMPLER_3D: 0x8dcb,
695
- INT_SAMPLER_CUBE: 0x8dcc,
696
- INT_SAMPLER_2D_ARRAY: 0x8dcf,
697
- UNSIGNED_INT_SAMPLER_2D: 0x8dd2,
698
- UNSIGNED_INT_SAMPLER_3D: 0x8dd3,
699
- UNSIGNED_INT_SAMPLER_CUBE: 0x8dd4,
700
- UNSIGNED_INT_SAMPLER_2D_ARRAY: 0x8dd7,
701
- MAX_SAMPLES: 0x8d57,
702
- SAMPLER_BINDING: 0x8919,
703
-
704
- // Buffers
705
-
706
- PIXEL_PACK_BUFFER: 0x88eb,
707
- PIXEL_UNPACK_BUFFER: 0x88ec,
708
- PIXEL_PACK_BUFFER_BINDING: 0x88ed,
709
- PIXEL_UNPACK_BUFFER_BINDING: 0x88ef,
710
- COPY_READ_BUFFER: 0x8f36,
711
- COPY_WRITE_BUFFER: 0x8f37,
712
- COPY_READ_BUFFER_BINDING: 0x8f36,
713
- COPY_WRITE_BUFFER_BINDING: 0x8f37,
714
-
715
- // Data types
716
-
717
- FLOAT_MAT2x3: 0x8b65,
718
- FLOAT_MAT2x4: 0x8b66,
719
- FLOAT_MAT3x2: 0x8b67,
720
- FLOAT_MAT3x4: 0x8b68,
721
- FLOAT_MAT4x2: 0x8b69,
722
- FLOAT_MAT4x3: 0x8b6a,
723
- UNSIGNED_INT_VEC2: 0x8dc6,
724
- UNSIGNED_INT_VEC3: 0x8dc7,
725
- UNSIGNED_INT_VEC4: 0x8dc8,
726
- UNSIGNED_NORMALIZED: 0x8c17,
727
- SIGNED_NORMALIZED: 0x8f9c,
728
-
729
- // Vertex attributes
730
-
731
- VERTEX_ATTRIB_ARRAY_INTEGER: 0x88fd,
732
- VERTEX_ATTRIB_ARRAY_DIVISOR: 0x88fe,
733
-
734
- // Transform feedback
735
-
736
- TRANSFORM_FEEDBACK_BUFFER_MODE: 0x8c7f,
737
- MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 0x8c80,
738
- TRANSFORM_FEEDBACK_VARYINGS: 0x8c83,
739
- TRANSFORM_FEEDBACK_BUFFER_START: 0x8c84,
740
- TRANSFORM_FEEDBACK_BUFFER_SIZE: 0x8c85,
741
- TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 0x8c88,
742
- MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 0x8c8a,
743
- MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 0x8c8b,
744
- INTERLEAVED_ATTRIBS: 0x8c8c,
745
- SEPARATE_ATTRIBS: 0x8c8d,
746
- TRANSFORM_FEEDBACK_BUFFER: 0x8c8e,
747
- TRANSFORM_FEEDBACK_BUFFER_BINDING: 0x8c8f,
748
- TRANSFORM_FEEDBACK: 0x8e22,
749
- TRANSFORM_FEEDBACK_PAUSED: 0x8e23,
750
- TRANSFORM_FEEDBACK_ACTIVE: 0x8e24,
751
- TRANSFORM_FEEDBACK_BINDING: 0x8e25,
752
-
753
- // Framebuffers and renderbuffers
754
-
755
- FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 0x8210,
756
- FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 0x8211,
757
- FRAMEBUFFER_ATTACHMENT_RED_SIZE: 0x8212,
758
- FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 0x8213,
759
- FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 0x8214,
760
- FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 0x8215,
761
- FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 0x8216,
762
- FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 0x8217,
763
- FRAMEBUFFER_DEFAULT: 0x8218,
764
- // DEPTH_STENCIL_ATTACHMENT : 0x821A,
765
- // DEPTH_STENCIL: 0x84F9,
766
- DEPTH24_STENCIL8: 0x88f0,
767
- DRAW_FRAMEBUFFER_BINDING: 0x8ca6,
768
- READ_FRAMEBUFFER_BINDING: 0x8caa,
769
- RENDERBUFFER_SAMPLES: 0x8cab,
770
- FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 0x8cd4,
771
- FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 0x8d56,
772
-
773
- // Uniforms
774
-
775
- UNIFORM_BUFFER: 0x8a11,
776
- UNIFORM_BUFFER_BINDING: 0x8a28,
777
- UNIFORM_BUFFER_START: 0x8a29,
778
- UNIFORM_BUFFER_SIZE: 0x8a2a,
779
- MAX_VERTEX_UNIFORM_BLOCKS: 0x8a2b,
780
- MAX_FRAGMENT_UNIFORM_BLOCKS: 0x8a2d,
781
- MAX_COMBINED_UNIFORM_BLOCKS: 0x8a2e,
782
- MAX_UNIFORM_BUFFER_BINDINGS: 0x8a2f,
783
- MAX_UNIFORM_BLOCK_SIZE: 0x8a30,
784
- MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 0x8a31,
785
- MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 0x8a33,
786
- UNIFORM_BUFFER_OFFSET_ALIGNMENT: 0x8a34,
787
- ACTIVE_UNIFORM_BLOCKS: 0x8a36,
788
- UNIFORM_TYPE: 0x8a37,
789
- UNIFORM_SIZE: 0x8a38,
790
- UNIFORM_BLOCK_INDEX: 0x8a3a,
791
- UNIFORM_OFFSET: 0x8a3b,
792
- UNIFORM_ARRAY_STRIDE: 0x8a3c,
793
- UNIFORM_MATRIX_STRIDE: 0x8a3d,
794
- UNIFORM_IS_ROW_MAJOR: 0x8a3e,
795
- UNIFORM_BLOCK_BINDING: 0x8a3f,
796
- UNIFORM_BLOCK_DATA_SIZE: 0x8a40,
797
- UNIFORM_BLOCK_ACTIVE_UNIFORMS: 0x8a42,
798
- UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 0x8a43,
799
- UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 0x8a44,
800
- UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 0x8a46,
801
-
802
- // Sync objects
803
-
804
- OBJECT_TYPE: 0x9112,
805
- SYNC_CONDITION: 0x9113,
806
- SYNC_STATUS: 0x9114,
807
- SYNC_FLAGS: 0x9115,
808
- SYNC_FENCE: 0x9116,
809
- SYNC_GPU_COMMANDS_COMPLETE: 0x9117,
810
- UNSIGNALED: 0x9118,
811
- SIGNALED: 0x9119,
812
- ALREADY_SIGNALED: 0x911a,
813
- TIMEOUT_EXPIRED: 0x911b,
814
- CONDITION_SATISFIED: 0x911c,
815
- WAIT_FAILED: 0x911d,
816
- SYNC_FLUSH_COMMANDS_BIT: 0x00000001,
817
-
818
- // Miscellaneous constants
819
-
820
- COLOR: 0x1800,
821
- DEPTH: 0x1801,
822
- STENCIL: 0x1802,
823
- MIN: 0x8007,
824
- MAX: 0x8008,
825
- DEPTH_COMPONENT24: 0x81a6,
826
- STREAM_READ: 0x88e1,
827
- STREAM_COPY: 0x88e2,
828
- STATIC_READ: 0x88e5,
829
- STATIC_COPY: 0x88e6,
830
- DYNAMIC_READ: 0x88e9,
831
- DYNAMIC_COPY: 0x88ea,
832
- DEPTH_COMPONENT32F: 0x8cac,
833
- DEPTH32F_STENCIL8: 0x8cad,
834
- INVALID_INDEX: 0xffffffff,
835
- TIMEOUT_IGNORED: -1,
836
- MAX_CLIENT_WAIT_TIMEOUT_WEBGL: 0x9247,
837
-
838
- // Constants defined in WebGL extensions
839
-
840
- // ANGLE_instanced_arrays
841
-
842
- VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: 0x88fe,
843
-
844
- // WEBGL_debug_renderer_info
845
-
846
- UNMASKED_VENDOR_WEBGL: 0x9245,
847
- UNMASKED_RENDERER_WEBGL: 0x9246,
848
-
849
- // EXT_texture_filter_anisotropic
850
-
851
- MAX_TEXTURE_MAX_ANISOTROPY_EXT: 0x84ff,
852
- TEXTURE_MAX_ANISOTROPY_EXT: 0x84fe,
853
-
854
- // WEBGL_compressed_texture_s3tc
855
-
856
- COMPRESSED_RGB_S3TC_DXT1_EXT: 0x83f0,
857
- COMPRESSED_RGBA_S3TC_DXT1_EXT: 0x83f1,
858
- COMPRESSED_RGBA_S3TC_DXT3_EXT: 0x83f2,
859
- COMPRESSED_RGBA_S3TC_DXT5_EXT: 0x83f3,
860
-
861
- // WEBGL_compressed_texture_es3
862
-
863
- COMPRESSED_R11_EAC: 0x9270,
864
- COMPRESSED_SIGNED_R11_EAC: 0x9271,
865
- COMPRESSED_RG11_EAC: 0x9272,
866
- COMPRESSED_SIGNED_RG11_EAC: 0x9273,
867
- COMPRESSED_RGB8_ETC2: 0x9274,
868
- COMPRESSED_RGBA8_ETC2_EAC: 0x9275,
869
- COMPRESSED_SRGB8_ETC2: 0x9276,
870
- COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 0x9277,
871
- COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 0x9278,
872
- COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 0x9279,
873
-
874
- // WEBGL_compressed_texture_pvrtc
875
-
876
- COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 0x8c00,
877
- COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 0x8c02,
878
- COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 0x8c01,
879
- COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 0x8c03,
880
-
881
- // WEBGL_compressed_texture_etc1
882
-
883
- COMPRESSED_RGB_ETC1_WEBGL: 0x8d64,
884
-
885
- // WEBGL_compressed_texture_atc
886
-
887
- COMPRESSED_RGB_ATC_WEBGL: 0x8c92,
888
- COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 0x8c92,
889
- COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 0x87ee,
890
-
891
- // WEBGL_depth_texture
892
-
893
- UNSIGNED_INT_24_8_WEBGL: 0x84fa,
894
-
895
- // OES_texture_half_float
896
-
897
- HALF_FLOAT_OES: 0x8d61,
898
-
899
- // WEBGL_color_buffer_float
900
-
901
- RGBA32F_EXT: 0x8814,
902
- RGB32F_EXT: 0x8815,
903
- FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: 0x8211,
904
- UNSIGNED_NORMALIZED_EXT: 0x8c17,
905
-
906
- // EXT_blend_minmax
907
-
908
- MIN_EXT: 0x8007,
909
- MAX_EXT: 0x8008,
910
-
911
- // EXT_sRGB
912
-
913
- SRGB_EXT: 0x8c40,
914
- SRGB_ALPHA_EXT: 0x8c42,
915
- SRGB8_ALPHA8_EXT: 0x8c43,
916
- FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 0x8210,
917
-
918
- // OES_standard_derivatives
919
-
920
- FRAGMENT_SHADER_DERIVATIVE_HINT_OES: 0x8b8b,
921
-
922
- // WEBGL_draw_buffers
923
-
924
- COLOR_ATTACHMENT0_WEBGL: 0x8ce0,
925
- COLOR_ATTACHMENT1_WEBGL: 0x8ce1,
926
- COLOR_ATTACHMENT2_WEBGL: 0x8ce2,
927
- COLOR_ATTACHMENT3_WEBGL: 0x8ce3,
928
- COLOR_ATTACHMENT4_WEBGL: 0x8ce4,
929
- COLOR_ATTACHMENT5_WEBGL: 0x8ce5,
930
- COLOR_ATTACHMENT6_WEBGL: 0x8ce6,
931
- COLOR_ATTACHMENT7_WEBGL: 0x8ce7,
932
- COLOR_ATTACHMENT8_WEBGL: 0x8ce8,
933
- COLOR_ATTACHMENT9_WEBGL: 0x8ce9,
934
- COLOR_ATTACHMENT10_WEBGL: 0x8cea,
935
- COLOR_ATTACHMENT11_WEBGL: 0x8ceb,
936
- COLOR_ATTACHMENT12_WEBGL: 0x8cec,
937
- COLOR_ATTACHMENT13_WEBGL: 0x8ced,
938
- COLOR_ATTACHMENT14_WEBGL: 0x8cee,
939
- COLOR_ATTACHMENT15_WEBGL: 0x8cef,
940
- DRAW_BUFFER0_WEBGL: 0x8825,
941
- DRAW_BUFFER1_WEBGL: 0x8826,
942
- DRAW_BUFFER2_WEBGL: 0x8827,
943
- DRAW_BUFFER3_WEBGL: 0x8828,
944
- DRAW_BUFFER4_WEBGL: 0x8829,
945
- DRAW_BUFFER5_WEBGL: 0x882a,
946
- DRAW_BUFFER6_WEBGL: 0x882b,
947
- DRAW_BUFFER7_WEBGL: 0x882c,
948
- DRAW_BUFFER8_WEBGL: 0x882d,
949
- DRAW_BUFFER9_WEBGL: 0x882e,
950
- DRAW_BUFFER10_WEBGL: 0x882f,
951
- DRAW_BUFFER11_WEBGL: 0x8830,
952
- DRAW_BUFFER12_WEBGL: 0x8831,
953
- DRAW_BUFFER13_WEBGL: 0x8832,
954
- DRAW_BUFFER14_WEBGL: 0x8833,
955
- DRAW_BUFFER15_WEBGL: 0x8834,
956
- MAX_COLOR_ATTACHMENTS_WEBGL: 0x8cdf,
957
- MAX_DRAW_BUFFERS_WEBGL: 0x8824,
958
-
959
- // OES_vertex_array_object
960
-
961
- VERTEX_ARRAY_BINDING_OES: 0x85b5,
962
-
963
- // EXT_disjoint_timer_query
964
-
965
- QUERY_COUNTER_BITS_EXT: 0x8864,
966
- CURRENT_QUERY_EXT: 0x8865,
967
- QUERY_RESULT_EXT: 0x8866,
968
- QUERY_RESULT_AVAILABLE_EXT: 0x8867,
969
- TIME_ELAPSED_EXT: 0x88bf,
970
- TIMESTAMP_EXT: 0x8e28,
971
- GPU_DISJOINT_EXT: 0x8fbb // A Boolean indicating whether or not the GPU performed any disjoint operation.
972
- };
973
-
974
-
975
- /***/ }),
976
-
977
- /***/ "./bundle.js":
978
- /*!*******************!*\
979
- !*** ./bundle.js ***!
980
- \*******************/
981
- /*! no static exports found */
982
- /***/ (function(module, exports, __webpack_require__) {
983
-
984
- /* WEBPACK VAR INJECTION */(function(global) {/* global window, global */
985
- const moduleExports = __webpack_require__(/*! ./src */ "./src/index.js");
986
-
987
- const _global = typeof window === 'undefined' ? global : window;
988
- _global.loaders = _global.luma || {};
989
-
990
- module.exports = Object.assign(_global.luma, moduleExports);
991
-
992
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js")))
993
-
994
- /***/ }),
995
-
996
- /***/ "./src/experimental/passes/outline-pass.js":
997
- /*!*************************************************!*\
998
- !*** ./src/experimental/passes/outline-pass.js ***!
999
- \*************************************************/
1000
- /*! exports provided: default */
1001
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1002
-
1003
- "use strict";
1004
- __webpack_require__.r(__webpack_exports__);
1005
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return OutlinePass; });
1006
- /* harmony import */ var _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @luma.gl/constants */ "../constants/src/index.js");
1007
- /* harmony import */ var _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__);
1008
- /* harmony import */ var _luma_gl_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @luma.gl/core */ "@luma.gl/core");
1009
- /* harmony import */ var _luma_gl_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_luma_gl_core__WEBPACK_IMPORTED_MODULE_1__);
1010
- /**
1011
- * A traditional stencil buffer based outline pass.
1012
- */
1013
-
1014
-
1015
-
1016
-
1017
- class OutlinePass extends _luma_gl_core__WEBPACK_IMPORTED_MODULE_1__["_Pass"] {
1018
- constructor(gl, props = {}) {
1019
- super(gl, Object.assign({id: 'simple-outline-pass'}, props));
1020
- this.setProps(props);
1021
- }
1022
-
1023
- setProps(props) {
1024
- this.props = Object.assign(this.props, props);
1025
- // this.clipspace.setUniforms(pixelation.getUniforms(this.props));
1026
- }
1027
-
1028
- _renderPass({gl, animationProps}) {
1029
- Object(_luma_gl_core__WEBPACK_IMPORTED_MODULE_1__["withParameters"])(
1030
- gl,
1031
- {
1032
- stencilTest: true, // turn on stencil buffers
1033
- stencilOp: [_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0___default.a.KEEP, _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0___default.a.KEEP, _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0___default.a.REPLACE] // update stencil if both stencil+depth tests pass
1034
- },
1035
- () => {
1036
- // Enable writing to stencil buffer plane 0
1037
- Object(_luma_gl_core__WEBPACK_IMPORTED_MODULE_1__["setParameters"])(gl, {
1038
- stencilFunc: [_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0___default.a.ALWAYS, 1, 0xff], // update stencil buffer, regardless of current value
1039
- stencilMask: 0x01
1040
- });
1041
-
1042
- gl.clear(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0___default.a.STENCIL_BUFFER_BIT);
1043
-
1044
- // draw
1045
- for (const model of this.props.models) {
1046
- model.setUniforms(this.props.normalUniforms);
1047
- model.draw(this.props.drawParams);
1048
- }
1049
-
1050
- // Disable stencil writing, mask to stencil plane 0
1051
- Object(_luma_gl_core__WEBPACK_IMPORTED_MODULE_1__["setParameters"])(gl, {
1052
- stencilFunc: [_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0___default.a.NOTEQUAL, 1, 0x01],
1053
- stencilMask: 0x00, // disable writing to the stencil buffer
1054
- depthTest: false
1055
- });
1056
-
1057
- for (const model of this.props.models) {
1058
- model.setUniforms(this.props.outlineUniforms);
1059
- model.draw(this.props.drawParams);
1060
- model.setUniforms(this.props.normalUniforms);
1061
- }
1062
-
1063
- // All GL settings will reset here...
1064
- }
1065
- );
1066
- }
1067
- }
1068
-
1069
-
1070
- /***/ }),
1071
-
1072
- /***/ "./src/experimental/passes/ssao-pass.js":
1073
- /*!**********************************************!*\
1074
- !*** ./src/experimental/passes/ssao-pass.js ***!
1075
- \**********************************************/
1076
- /*! exports provided: default */
1077
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1078
-
1079
- "use strict";
1080
- __webpack_require__.r(__webpack_exports__);
1081
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return SSAOPass; });
1082
- /* harmony import */ var _luma_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @luma.gl/core */ "@luma.gl/core");
1083
- /* harmony import */ var _luma_gl_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_luma_gl_core__WEBPACK_IMPORTED_MODULE_0__);
1084
- /* harmony import */ var _shader_modules_ssao__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shader-modules/ssao */ "./src/experimental/shader-modules/ssao.js");
1085
- /**
1086
- * Screen-space ambient occlusion pass.
1087
- *
1088
- * Ported to luma.gl from THREE.js (MIT license).
1089
- * Attributions (per comments in original THREE.js files):
1090
- * @author alteredq / http://alteredqualia.com/
1091
- * @author tentone
1092
- */
1093
-
1094
- /* eslint-disable camelcase */
1095
-
1096
-
1097
-
1098
- class SSAOPass extends _luma_gl_core__WEBPACK_IMPORTED_MODULE_0__["_Pass"] {
1099
- constructor(gl, props) {
1100
- super(gl, Object.assign({id: 'ssao-pass', swap: true}, _shader_modules_ssao__WEBPACK_IMPORTED_MODULE_1__["default"].DEFAULT_PROPS, props));
1101
-
1102
- this.renderToScreen = false;
1103
-
1104
- // Depth render target, for `depth` shader module
1105
- this.depthFramebuffer = new _luma_gl_core__WEBPACK_IMPORTED_MODULE_0__["Framebuffer"](gl, {id: 'ssao-pass-depth-map'});
1106
-
1107
- this.clipspace = new _luma_gl_core__WEBPACK_IMPORTED_MODULE_0__["ClipSpace"](gl, {
1108
- id: 'ssao-pass',
1109
- modules: [_shader_modules_ssao__WEBPACK_IMPORTED_MODULE_1__["default"]],
1110
- fs: `
1111
- varying vec2 uv;
1112
- void main() {
1113
- gl_FragColor = ssao_getColor(uv);
1114
- }
1115
- `
1116
- });
1117
-
1118
- this.setProps(props);
1119
- }
1120
-
1121
- setProps(props) {
1122
- super.setProps(props);
1123
-
1124
- const {width = 512, height = 512} = this.props;
1125
- this.depthFramebuffer.resize({width, height});
1126
- this.clipspace.setUniforms(this.props);
1127
-
1128
- // Shader uniforms
1129
- // this.uniforms['cameraNear' ].value = this.camera2.near;
1130
- // this.uniforms[ 'cameraFar' ].value = this.camera2.far;
1131
- }
1132
-
1133
- _renderPass({inputBuffer, outputBuffer, animationProps}) {
1134
- const {width, height} = inputBuffer;
1135
- this.depthFramebuffer.resize({width, height});
1136
-
1137
- // Render depth into depthRenderTarget
1138
- Object(_luma_gl_core__WEBPACK_IMPORTED_MODULE_0__["withParameters"])(this.gl, {framebuffer: this.depthFramebuffer}, () => {
1139
- this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);
1140
- for (const model of this.props.models) {
1141
- model.setUniforms({depth_uEnabled: true});
1142
- model.draw(Object.assign({}, this.props.drawParams, {animationProps}));
1143
- model.setUniforms({depth_uEnabled: false});
1144
- }
1145
- });
1146
-
1147
- this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);
1148
- this.clipspace.draw({
1149
- animationProps,
1150
- uniforms: {
1151
- tDepth: this.depthFramebuffer,
1152
- tDiffuse: inputBuffer,
1153
- size: [this.depthFramebuffer.width, this.depthFramebuffer.height]
1154
- }
1155
- });
1156
- }
1157
- }
1158
-
1159
-
1160
- /***/ }),
1161
-
1162
- /***/ "./src/experimental/shader-modules/convolution.js":
1163
- /*!********************************************************!*\
1164
- !*** ./src/experimental/shader-modules/convolution.js ***!
1165
- \********************************************************/
1166
- /*! exports provided: default */
1167
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1168
-
1169
- "use strict";
1170
- __webpack_require__.r(__webpack_exports__);
1171
- // A convolution shader
1172
- // Based on https://webglfundamentals.org/webgl/lessons/webgl-image-processing-continued.html
1173
-
1174
- /*
1175
- # Copyright 2012, Gregg Tavares.
1176
- # All rights reserved.
1177
- #
1178
- # Redistribution and use in source and binary forms, with or without
1179
- # modification, are permitted provided that the following conditions are
1180
- # met:
1181
- #
1182
- # * Redistributions of source code must retain the above copyright
1183
- # notice, this list of conditions and the following disclaimer.
1184
- # * Redistributions in binary form must reproduce the above
1185
- # copyright notice, this list of conditions and the following disclaimer
1186
- # in the documentation and/or other materials provided with the
1187
- # distribution.
1188
- # * Neither the name of Gregg Tavares. nor the names of his
1189
- # contributors may be used to endorse or promote products derived from
1190
- # this software without specific prior written permission.
1191
- #
1192
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1193
- # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1194
- # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1195
- # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1196
- # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1197
- # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1198
- # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1199
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1200
- # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1201
- # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1202
- # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1203
- */
1204
-
1205
- // Pre-defined convolution kernels
1206
- /* eslint-disable */
1207
- const KERNEL = {
1208
- NORMAL: [0, 0, 0, 0, 1, 0, 0, 0, 0],
1209
- GAUSSIAN_BLUR: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
1210
- GAUSSIAN_BLUR_2: [1, 2, 1, 2, 4, 2, 1, 2, 1],
1211
- GAUSSIAN_BLUR_3: [0, 1, 0, 1, 1, 1, 0, 1, 0],
1212
- UNSHARPEN: [-1, -1, -1, -1, 9, -1, -1, -1, -1],
1213
- SHARPNESS: [0, -1, 0, -1, 5, -1, 0, -1, 0],
1214
- SHARPEN: [-1, -1, -1, -1, 16, -1, -1, -1, -1],
1215
- EDGE_DETECT: [-0.125, -0.125, -0.125, -0.125, 1, -0.125, -0.125, -0.125, -0.125],
1216
- EDGE_DETECT_2: [-1, -1, -1, -1, 8, -1, -1, -1, -1],
1217
- EDGE_DETECT_3: [-5, 0, 0, 0, 0, 0, 0, 0, 5],
1218
- EDGE_DETECT_4: [-1, -1, -1, 0, 0, 0, 1, 1, 1],
1219
- EDGE_DETECT_5: [-1, -1, -1, 2, 2, 2, -1, -1, -1],
1220
- EDGE_DETECT_6: [-5, -5, -5, -5, 39, -5, -5, -5, -5],
1221
- SOBEL_HORIZONTAL: [1, 2, 1, 0, 0, 0, -1, -2, -1],
1222
- SOBEL_VERTICAL: [1, 0, -1, 2, 0, -2, 1, 0, -1],
1223
- PREVIT_HORIZONTAL: [1, 1, 1, 0, 0, 0, -1, -1, -1],
1224
- PREVIT_VERTICAL: [1, 0, -1, 1, 0, -1, 1, 0, -1],
1225
- BOX_BLUR: [0.111, 0.111, 0.111, 0.111, 0.111, 0.111, 0.111, 0.111, 0.111],
1226
- TRIANGLE_BLUR: [0.0625, 0.125, 0.0625, 0.125, 0.25, 0.125, 0.0625, 0.125, 0.0625],
1227
- EMBOSS: [-2, -1, 0, -1, 1, 1, 0, 1, 2]
1228
- };
1229
- /* eslint-enable */
1230
-
1231
- const fs = `
1232
- precision highp float;
1233
-
1234
- uniform float kernel[9];
1235
- uniform float kernelWeight;
1236
-
1237
- vec4 convolution_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoords) {
1238
- vec2 onePixel = vec2(1.0, 1.0) / texSize;
1239
- vec4 colorSum =
1240
- texture2D(texture, texCoords + onePixel * vec2(-1, -1)) * kernel[0] +
1241
- texture2D(texture, texCoords + onePixel * vec2( 0, -1)) * kernel[1] +
1242
- texture2D(texture, texCoords + onePixel * vec2( 1, -1)) * kernel[2] +
1243
- texture2D(texture, texCoords + onePixel * vec2(-1, 0)) * kernel[3] +
1244
- texture2D(texture, texCoords + onePixel * vec2( 0, 0)) * kernel[4] +
1245
- texture2D(texture, texCoords + onePixel * vec2( 1, 0)) * kernel[5] +
1246
- texture2D(texture, texCoords + onePixel * vec2(-1, 1)) * kernel[6] +
1247
- texture2D(texture, texCoords + onePixel * vec2( 0, 1)) * kernel[7] +
1248
- texture2D(texture, texCoords + onePixel * vec2( 1, 1)) * kernel[8] ;
1249
-
1250
- // Divide the sum by the weight but just use rgb, set alpha to 1.0
1251
- return vec4((colorSum / kernelWeight).rgb, colorSum.a);
1252
- }
1253
- `;
1254
-
1255
- const uniforms = {
1256
- kernel: KERNEL.NORMAL,
1257
- kernelWeight: KERNEL.NORMAL.reduce((sum, x) => sum + x, 0)
1258
- };
1259
-
1260
- /* harmony default export */ __webpack_exports__["default"] = ({
1261
- name: 'convolution',
1262
- uniforms,
1263
- fs,
1264
- KERNEL,
1265
- passes: [{sampler: true}]
1266
- });
1267
-
1268
-
1269
- /***/ }),
1270
-
1271
- /***/ "./src/experimental/shader-modules/depth.js":
1272
- /*!**************************************************!*\
1273
- !*** ./src/experimental/shader-modules/depth.js ***!
1274
- \**************************************************/
1275
- /*! exports provided: default */
1276
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1277
-
1278
- "use strict";
1279
- __webpack_require__.r(__webpack_exports__);
1280
- /* harmony import */ var _pack__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pack */ "./src/experimental/shader-modules/pack.js");
1281
- // depth buffer utilities
1282
- // initial version ported from THREE.js
1283
-
1284
- /* eslint-disable camelcase */
1285
-
1286
-
1287
- const fs = `\
1288
- #define DEPTH_PACKING 3201
1289
-
1290
- uniform bool depth_uEnabled;
1291
-
1292
- #ifdef USE_LOGDEPTHBUF
1293
- uniform float logDepthBufFC;
1294
- #endif
1295
-
1296
- #if DEPTH_PACKING == 3200
1297
- uniform float opacity;
1298
- #endif
1299
-
1300
-
1301
- // NOTE: viewZ/eyeZ is < 0 when in front of the camera per OpenGL conventions
1302
-
1303
- float depth_viewZToOrthographicDepth(
1304
- const in float viewZ, const in float near, const in float far
1305
- ) {
1306
- return ( viewZ + near ) / ( near - far );
1307
- }
1308
-
1309
- float depth_orthographicDepthToViewZ(
1310
- const in float linearClipZ, const in float near, const in float far
1311
- ) {
1312
- return linearClipZ * ( near - far ) - near;
1313
- }
1314
-
1315
- float depth_viewZToPerspectiveDepth(
1316
- const in float viewZ, const in float near, const in float far
1317
- ) {
1318
- return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
1319
- }
1320
-
1321
- float depth_perspectiveDepthToViewZ(
1322
- const in float invClipZ, const in float near, const in float far
1323
- ) {
1324
- return ( near * far ) / ( ( far - near ) * invClipZ - far );
1325
- }
1326
-
1327
- // Sample depth buffer and convert to float
1328
- float depth_getDepth(sampler2D tDepth, vec2 coord) {
1329
- float depthValue = pack_RGBA8ToFloat(texture2D(tDepth, coord));
1330
- #ifdef USE_LOGDEPTHBUF
1331
- float logz = depthValue;
1332
- float w = pow(2.0, (logz / logDepthBufFC)) - 1.0;
1333
- float z = (logz / w) + 1.0;
1334
- #else
1335
- float z = depthValue;
1336
- #endif
1337
- return z;
1338
- }
1339
-
1340
- //
1341
- vec4 depth_getColor() {
1342
- #if DEPTH_PACKING == 3200
1343
- return vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );
1344
- #elif DEPTH_PACKING == 3201
1345
- return pack_floatToRGBA8( gl_FragCoord.z );
1346
- #endif
1347
- }
1348
-
1349
- vec4 depth_filterColor(vec4 color) {
1350
- return depth_uEnabled ? depth_getColor() : color;
1351
- }
1352
- `;
1353
-
1354
- const DEFAULT_PROPS = {
1355
- depth_uEnabled: false
1356
- };
1357
-
1358
- /* harmony default export */ __webpack_exports__["default"] = ({
1359
- name: 'depth',
1360
- dependencies: [_pack__WEBPACK_IMPORTED_MODULE_0__["default"]],
1361
- fs,
1362
- DEFAULT_PROPS,
1363
- getUniforms: (props = DEFAULT_PROPS) => props
1364
- });
1365
-
1366
-
1367
- /***/ }),
1368
-
1369
- /***/ "./src/experimental/shader-modules/pack.js":
1370
- /*!*************************************************!*\
1371
- !*** ./src/experimental/shader-modules/pack.js ***!
1372
- \*************************************************/
1373
- /*! exports provided: default */
1374
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1375
-
1376
- "use strict";
1377
- __webpack_require__.r(__webpack_exports__);
1378
- // Packing of floats into RGBA8
1379
- /* eslint-disable camelcase */
1380
-
1381
- const fs = `\
1382
- const float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)
1383
- const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
1384
-
1385
- const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)
1386
- const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
1387
-
1388
- const float ShiftRight8 = 1. / 256.;
1389
-
1390
- vec4 pack_floatToRGBA8( const in float v ) {
1391
- vec4 r = vec4( fract( v * PackFactors ), v );
1392
- r.yzw -= r.xyz * ShiftRight8; // tidy overflow
1393
- return r * PackUpscale;
1394
- }
1395
-
1396
- float pack_RGBA8ToFloat( const in vec4 v ) {
1397
- return dot(v, UnpackFactors);
1398
- }
1399
- `;
1400
-
1401
- const DEFAULT_PROPS = {};
1402
-
1403
- /* harmony default export */ __webpack_exports__["default"] = ({
1404
- name: 'pack',
1405
- fs,
1406
- vs: fs,
1407
- DEFAULT_PROPS,
1408
- getUniforms: props => props
1409
- });
1410
-
1411
-
1412
- /***/ }),
1413
-
1414
- /***/ "./src/experimental/shader-modules/ssao.js":
1415
- /*!*************************************************!*\
1416
- !*** ./src/experimental/shader-modules/ssao.js ***!
1417
- \*************************************************/
1418
- /*! exports provided: default */
1419
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1420
-
1421
- "use strict";
1422
- __webpack_require__.r(__webpack_exports__);
1423
- /* harmony import */ var _depth__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./depth */ "./src/experimental/shader-modules/depth.js");
1424
- /**
1425
- * Screen-space ambient occlusion shader
1426
- *
1427
- * Ported to luma.gl from THREE.js
1428
- *
1429
- * Attributions: (per comments in original THREE.js files)
1430
- * - ported to THREE.js from SSAO GLSL shader v1.2 by alteredq / http://alteredqualia.com/
1431
- * assembled by Martins Upitis (martinsh) (http://devlog-martinsh.blogspot.com)
1432
- * - original technique by ArKano22 http://www.gamedev.net/topic/550699-ssao-no-halo-artifacts/
1433
- * - modifications
1434
- * - modified to use RGBA packed depth texture (use clear color 1,1,1,1 for depth pass)
1435
- * - refactoring and optimizations
1436
- */
1437
-
1438
- /* eslint-disable camelcase */
1439
-
1440
-
1441
- const DEFAULT_PROPS = {
1442
- ssao_uEnabled: true,
1443
- tDiffuse: null,
1444
- tDepth: null,
1445
- size: [512, 512],
1446
- cameraNear: 1,
1447
- cameraFar: 100,
1448
- radius: 32, // 4
1449
- onlyAO: false,
1450
- aoClamp: 0.25,
1451
- lumInfluence: 0.7
1452
- };
1453
-
1454
- const fsSSAO = `\
1455
- // Inputs
1456
- uniform sampler2D tDiffuse;
1457
- uniform sampler2D tDepth;
1458
- uniform vec2 size; // texture width, height
1459
-
1460
- // TODO - move to 'camera' module?
1461
- uniform float cameraNear;
1462
- uniform float cameraFar;
1463
-
1464
- // SSAO
1465
- uniform bool ssao_uEnabled;
1466
- uniform float radius; // ao radius
1467
- uniform float aoClamp; // depth clamp - reduces haloing at screen edges
1468
- uniform float lumInfluence; // how much luminance affects occlusion
1469
-
1470
- uniform bool onlyAO; // use only ambient occlusion pass?
1471
-
1472
- #define DL 2.399963229728653 // PI * ( 3.0 - sqrt( 5.0 ) )
1473
- #define EULER 2.718281828459045
1474
-
1475
- const int samples = 64; // ao sample count
1476
- const bool useNoise = true; // use noise instead of pattern for sample dithering
1477
- const float noiseAmount = 0.0004; // dithering amount
1478
- const float diffArea = 0.4; // self-shadowing reduction
1479
- const float gDisplace = 0.4; // gauss bell center
1480
-
1481
- // Random noise generating: pattern texture for dithering
1482
- vec2 rand( const vec2 coord ) {
1483
- vec2 noise;
1484
-
1485
- if ( useNoise ) {
1486
- float nx = dot ( coord, vec2( 12.9898, 78.233 ) );
1487
- float ny = dot ( coord, vec2( 12.9898, 78.233 ) * 2.0 );
1488
- noise = clamp( fract ( 43758.5453 * sin( vec2( nx, ny ) ) ), 0.0, 1.0 );
1489
- } else {
1490
- float ff = fract( 1.0 - coord.s * ( size.x / 2.0 ) );
1491
- float gg = fract( coord.t * ( size.y / 2.0 ) );
1492
- noise = vec2( 0.25, 0.75 ) * vec2( ff ) + vec2( 0.75, 0.25 ) * gg;
1493
- }
1494
-
1495
- return ( noise * 2.0 - 1.0 ) * noiseAmount;
1496
- }
1497
-
1498
- // RGBA depth
1499
-
1500
- float readDepth( const in vec2 coord ) {
1501
- float z = depth_getDepth(tDepth, coord);
1502
-
1503
- float cameraFarPlusNear = cameraFar + cameraNear;
1504
- float cameraFarMinusNear = cameraFar - cameraNear;
1505
- float cameraCoef = 2.0 * cameraNear;
1506
- return cameraCoef / ( cameraFarPlusNear - z * cameraFarMinusNear );
1507
- }
1508
-
1509
- float compareDepths( const in float depth1, const in float depth2, inout int far ) {
1510
- float garea = 8.0; // gauss bell width
1511
- float diff = ( depth1 - depth2 ) * 100.0; // depth difference (0-100)
1512
-
1513
- // reduce left bell width to avoid self-shadowing
1514
-
1515
- if ( diff < gDisplace ) {
1516
- garea = diffArea;
1517
- } else {
1518
- far = 1;
1519
- }
1520
-
1521
- float dd = diff - gDisplace;
1522
- float gauss = pow( EULER, -2.0 * ( dd * dd ) / ( garea * garea ) );
1523
- return gauss;
1524
- }
1525
-
1526
- float calcAO( float depth, float dw, float dh, vec2 uv ) {
1527
- vec2 vv = vec2( dw, dh );
1528
-
1529
- vec2 coord1 = uv + radius * vv;
1530
- vec2 coord2 = uv - radius * vv;
1531
-
1532
- float temp1 = 0.0;
1533
- float temp2 = 0.0;
1534
-
1535
- int far = 0;
1536
- temp1 = compareDepths( depth, readDepth( coord1 ), far );
1537
-
1538
- // DEPTH EXTRAPOLATION
1539
- if ( far > 0 ) {
1540
- temp2 = compareDepths( readDepth( coord2 ), depth, far );
1541
- temp1 += ( 1.0 - temp1 ) * temp2;
1542
- }
1543
-
1544
- return temp1;
1545
- }
1546
-
1547
- vec4 ssao_filterColor(vec4 color4, vec2 uv) {
1548
-
1549
- vec2 noise = rand( uv );
1550
- float depth = readDepth( uv );
1551
-
1552
- float tt = clamp( depth, aoClamp, 1.0 );
1553
-
1554
- float w = ( 1.0 / size.x ) / tt + ( noise.x * ( 1.0 - noise.x ) );
1555
- float h = ( 1.0 / size.y ) / tt + ( noise.y * ( 1.0 - noise.y ) );
1556
-
1557
- float ao = 0.0;
1558
-
1559
- float dz = 1.0 / float( samples );
1560
- float l = 0.0;
1561
- float z = 1.0 - dz / 2.0;
1562
-
1563
- for ( int i = 0; i <= samples; i ++ ) {
1564
- float r = sqrt( 1.0 - z );
1565
-
1566
- float pw = cos( l ) * r;
1567
- float ph = sin( l ) * r;
1568
- ao += calcAO( depth, pw * w, ph * h, uv );
1569
- z = z - dz;
1570
- l = l + DL;
1571
- }
1572
-
1573
- ao /= float( samples );
1574
- ao = 1.0 - ao;
1575
-
1576
- vec3 color = color4.rgb;
1577
-
1578
- vec3 final = color;
1579
-
1580
- vec3 lumcoeff = vec3( 0.299, 0.587, 0.114 );
1581
- float lum = dot( color.rgb, lumcoeff );
1582
- vec3 luminance = vec3( lum );
1583
-
1584
- // mix( color * ao, white, luminance )
1585
- final = vec3( color * mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );
1586
-
1587
- if ( onlyAO ) {
1588
- // ambient occlusion only
1589
- final = vec3( mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );
1590
- }
1591
-
1592
- return vec4( final, 1.0 );
1593
- }
1594
-
1595
- vec4 ssao_getColor(vec2 uv) {
1596
- vec4 color = texture2D( tDiffuse, uv );
1597
- return ssao_uEnabled ? ssao_filterColor(color, uv) : color;
1598
- }
1599
- `;
1600
-
1601
- /* harmony default export */ __webpack_exports__["default"] = ({
1602
- name: 'ssao',
1603
- dependencies: [_depth__WEBPACK_IMPORTED_MODULE_0__["default"]],
1604
- DEFAULT_PROPS,
1605
- fs: fsSSAO
1606
- });
1607
-
1608
-
1609
- /***/ }),
1610
-
1611
- /***/ "./src/index.js":
1612
- /*!**********************!*\
1613
- !*** ./src/index.js ***!
1614
- \**********************/
1615
- /*! exports provided: brightnessContrast, denoise, hueSaturation, noise, sepia, vibrance, vignette, tiltShift, triangleBlur, zoomBlur, colorHalftone, dotScreen, edgeWork, hexagonalPixelate, ink, bulgePinch, swirl, fxaa, _depth, _convolution, _OutlinePass, _SSAOPass */
1616
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1617
-
1618
- "use strict";
1619
- __webpack_require__.r(__webpack_exports__);
1620
- /* harmony import */ var _shader_modules_adjust_filters_brightnesscontrast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./shader-modules/adjust-filters/brightnesscontrast */ "./src/shader-modules/adjust-filters/brightnesscontrast.js");
1621
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "brightnessContrast", function() { return _shader_modules_adjust_filters_brightnesscontrast__WEBPACK_IMPORTED_MODULE_0__["default"]; });
1622
-
1623
- /* harmony import */ var _shader_modules_adjust_filters_denoise__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shader-modules/adjust-filters/denoise */ "./src/shader-modules/adjust-filters/denoise.js");
1624
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "denoise", function() { return _shader_modules_adjust_filters_denoise__WEBPACK_IMPORTED_MODULE_1__["default"]; });
1625
-
1626
- /* harmony import */ var _shader_modules_adjust_filters_huesaturation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./shader-modules/adjust-filters/huesaturation */ "./src/shader-modules/adjust-filters/huesaturation.js");
1627
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hueSaturation", function() { return _shader_modules_adjust_filters_huesaturation__WEBPACK_IMPORTED_MODULE_2__["default"]; });
1628
-
1629
- /* harmony import */ var _shader_modules_adjust_filters_noise__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shader-modules/adjust-filters/noise */ "./src/shader-modules/adjust-filters/noise.js");
1630
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "noise", function() { return _shader_modules_adjust_filters_noise__WEBPACK_IMPORTED_MODULE_3__["default"]; });
1631
-
1632
- /* harmony import */ var _shader_modules_adjust_filters_sepia__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./shader-modules/adjust-filters/sepia */ "./src/shader-modules/adjust-filters/sepia.js");
1633
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sepia", function() { return _shader_modules_adjust_filters_sepia__WEBPACK_IMPORTED_MODULE_4__["default"]; });
1634
-
1635
- /* harmony import */ var _shader_modules_adjust_filters_vibrance__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./shader-modules/adjust-filters/vibrance */ "./src/shader-modules/adjust-filters/vibrance.js");
1636
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "vibrance", function() { return _shader_modules_adjust_filters_vibrance__WEBPACK_IMPORTED_MODULE_5__["default"]; });
1637
-
1638
- /* harmony import */ var _shader_modules_adjust_filters_vignette__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./shader-modules/adjust-filters/vignette */ "./src/shader-modules/adjust-filters/vignette.js");
1639
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "vignette", function() { return _shader_modules_adjust_filters_vignette__WEBPACK_IMPORTED_MODULE_6__["default"]; });
1640
-
1641
- /* harmony import */ var _shader_modules_blur_filters_tiltshift__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./shader-modules/blur-filters/tiltshift */ "./src/shader-modules/blur-filters/tiltshift.js");
1642
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "tiltShift", function() { return _shader_modules_blur_filters_tiltshift__WEBPACK_IMPORTED_MODULE_7__["default"]; });
1643
-
1644
- /* harmony import */ var _shader_modules_blur_filters_triangleblur__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./shader-modules/blur-filters/triangleblur */ "./src/shader-modules/blur-filters/triangleblur.js");
1645
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "triangleBlur", function() { return _shader_modules_blur_filters_triangleblur__WEBPACK_IMPORTED_MODULE_8__["default"]; });
1646
-
1647
- /* harmony import */ var _shader_modules_blur_filters_zoomblur__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./shader-modules/blur-filters/zoomblur */ "./src/shader-modules/blur-filters/zoomblur.js");
1648
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zoomBlur", function() { return _shader_modules_blur_filters_zoomblur__WEBPACK_IMPORTED_MODULE_9__["default"]; });
1649
-
1650
- /* harmony import */ var _shader_modules_fun_filters_colorhalftone__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./shader-modules/fun-filters/colorhalftone */ "./src/shader-modules/fun-filters/colorhalftone.js");
1651
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorHalftone", function() { return _shader_modules_fun_filters_colorhalftone__WEBPACK_IMPORTED_MODULE_10__["default"]; });
1652
-
1653
- /* harmony import */ var _shader_modules_fun_filters_dotscreen__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./shader-modules/fun-filters/dotscreen */ "./src/shader-modules/fun-filters/dotscreen.js");
1654
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "dotScreen", function() { return _shader_modules_fun_filters_dotscreen__WEBPACK_IMPORTED_MODULE_11__["default"]; });
1655
-
1656
- /* harmony import */ var _shader_modules_fun_filters_edgework__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./shader-modules/fun-filters/edgework */ "./src/shader-modules/fun-filters/edgework.js");
1657
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "edgeWork", function() { return _shader_modules_fun_filters_edgework__WEBPACK_IMPORTED_MODULE_12__["default"]; });
1658
-
1659
- /* harmony import */ var _shader_modules_fun_filters_hexagonalpixelate__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./shader-modules/fun-filters/hexagonalpixelate */ "./src/shader-modules/fun-filters/hexagonalpixelate.js");
1660
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hexagonalPixelate", function() { return _shader_modules_fun_filters_hexagonalpixelate__WEBPACK_IMPORTED_MODULE_13__["default"]; });
1661
-
1662
- /* harmony import */ var _shader_modules_fun_filters_ink__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./shader-modules/fun-filters/ink */ "./src/shader-modules/fun-filters/ink.js");
1663
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ink", function() { return _shader_modules_fun_filters_ink__WEBPACK_IMPORTED_MODULE_14__["default"]; });
1664
-
1665
- /* harmony import */ var _shader_modules_warp_filters_bulgepinch__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./shader-modules/warp-filters/bulgepinch */ "./src/shader-modules/warp-filters/bulgepinch.js");
1666
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bulgePinch", function() { return _shader_modules_warp_filters_bulgepinch__WEBPACK_IMPORTED_MODULE_15__["default"]; });
1667
-
1668
- /* harmony import */ var _shader_modules_warp_filters_swirl__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./shader-modules/warp-filters/swirl */ "./src/shader-modules/warp-filters/swirl.js");
1669
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "swirl", function() { return _shader_modules_warp_filters_swirl__WEBPACK_IMPORTED_MODULE_16__["default"]; });
1670
-
1671
- /* harmony import */ var _shader_modules_fxaa_fxaa__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./shader-modules/fxaa/fxaa */ "./src/shader-modules/fxaa/fxaa.js");
1672
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fxaa", function() { return _shader_modules_fxaa_fxaa__WEBPACK_IMPORTED_MODULE_17__["default"]; });
1673
-
1674
- /* harmony import */ var _experimental_shader_modules_depth__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./experimental/shader-modules/depth */ "./src/experimental/shader-modules/depth.js");
1675
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_depth", function() { return _experimental_shader_modules_depth__WEBPACK_IMPORTED_MODULE_18__["default"]; });
1676
-
1677
- /* harmony import */ var _experimental_shader_modules_convolution__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./experimental/shader-modules/convolution */ "./src/experimental/shader-modules/convolution.js");
1678
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_convolution", function() { return _experimental_shader_modules_convolution__WEBPACK_IMPORTED_MODULE_19__["default"]; });
1679
-
1680
- /* harmony import */ var _experimental_passes_outline_pass__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./experimental/passes/outline-pass */ "./src/experimental/passes/outline-pass.js");
1681
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_OutlinePass", function() { return _experimental_passes_outline_pass__WEBPACK_IMPORTED_MODULE_20__["default"]; });
1682
-
1683
- /* harmony import */ var _experimental_passes_ssao_pass__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./experimental/passes/ssao-pass */ "./src/experimental/passes/ssao-pass.js");
1684
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_SSAOPass", function() { return _experimental_passes_ssao_pass__WEBPACK_IMPORTED_MODULE_21__["default"]; });
1685
-
1686
- // Shader modules
1687
-
1688
- // glfx ADJUST shader modules
1689
-
1690
-
1691
-
1692
-
1693
-
1694
-
1695
-
1696
-
1697
- // glfx BLUR shader modules
1698
-
1699
-
1700
-
1701
-
1702
- // glfx FUN shader modules
1703
-
1704
-
1705
-
1706
-
1707
-
1708
-
1709
- // glfx WARP shader modules
1710
-
1711
-
1712
-
1713
- // Postprocessing
1714
-
1715
-
1716
- // experimental shader modules and passes
1717
-
1718
-
1719
-
1720
-
1721
-
1722
-
1723
- /***/ }),
1724
-
1725
- /***/ "./src/shader-modules/adjust-filters/brightnesscontrast.js":
1726
- /*!*****************************************************************!*\
1727
- !*** ./src/shader-modules/adjust-filters/brightnesscontrast.js ***!
1728
- \*****************************************************************/
1729
- /*! exports provided: default */
1730
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1731
-
1732
- "use strict";
1733
- __webpack_require__.r(__webpack_exports__);
1734
- /**
1735
- * @filter Brightness / Contrast
1736
- * @description Provides additive brightness and multiplicative contrast control.
1737
- * @param brightness -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)
1738
- * @param contrast -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
1739
- */
1740
-
1741
- const fs = `\
1742
- uniform float brightness;
1743
- uniform float contrast;
1744
-
1745
- vec4 brightnessContrast_filterColor(vec4 color) {
1746
- color.rgb += brightness;
1747
- if (contrast > 0.0) {
1748
- color.rgb = (color.rgb - 0.5) / (1.0 - contrast) + 0.5;
1749
- } else {
1750
- color.rgb = (color.rgb - 0.5) * (1.0 + contrast) + 0.5;
1751
- }
1752
- return color;
1753
- }
1754
-
1755
- vec4 brightnessContrast_filterColor(vec4 color, vec2 texSize, vec2 texCoords) {
1756
- return brightnessContrast_filterColor(color);
1757
- }
1758
- `;
1759
-
1760
- const uniforms = {
1761
- brightness: {value: 0, min: -1, max: 1},
1762
- contrast: {value: 0, min: -1, max: 1}
1763
- };
1764
-
1765
- /* harmony default export */ __webpack_exports__["default"] = ({
1766
- name: 'brightnessContrast',
1767
- uniforms,
1768
- fs,
1769
-
1770
- passes: [{filter: true}]
1771
- });
1772
-
1773
-
1774
- /***/ }),
1775
-
1776
- /***/ "./src/shader-modules/adjust-filters/denoise.js":
1777
- /*!******************************************************!*\
1778
- !*** ./src/shader-modules/adjust-filters/denoise.js ***!
1779
- \******************************************************/
1780
- /*! exports provided: default */
1781
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1782
-
1783
- "use strict";
1784
- __webpack_require__.r(__webpack_exports__);
1785
- /**
1786
- * @filter Denoise
1787
- * @description Smooths over grainy noise in dark images using an 9x9 box filter
1788
- * weighted by color intensity, similar to a bilateral filter.
1789
- * @param exponent The exponent of the color intensity difference, should be greater
1790
- * than zero. A value of zero just gives an 9x9 box blur and high values
1791
- * give the original image, but ideal values are usually around 10-20.
1792
- */
1793
-
1794
- // Do a 9x9 bilateral box filter
1795
- const fs = `\
1796
- uniform float strength;
1797
-
1798
- vec4 denoise_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
1799
- float adjustedExponent = 3. + 200. * pow(1. - strength, 4.);
1800
-
1801
- vec4 center = texture2D(texture, texCoord);
1802
- vec4 color = vec4(0.0);
1803
- float total = 0.0;
1804
- for (float x = -4.0; x <= 4.0; x += 1.0) {
1805
- for (float y = -4.0; y <= 4.0; y += 1.0) {
1806
- vec4 sample = texture2D(texture, texCoord + vec2(x, y) / texSize);
1807
- float weight = 1.0 - abs(dot(sample.rgb - center.rgb, vec3(0.25)));
1808
- weight = pow(weight, adjustedExponent);
1809
- color += sample * weight;
1810
- total += weight;
1811
- }
1812
- }
1813
-
1814
- return color / total;
1815
- }
1816
- `;
1817
-
1818
- const uniforms = {
1819
- strength: {
1820
- value: 0.5,
1821
- min: 0,
1822
- max: 0.1,
1823
- adjust: strength => 0.53 + 200 * Math.pow(1 - strength, 4) // TODO - JS preprocessing
1824
- }
1825
- };
1826
-
1827
- /* harmony default export */ __webpack_exports__["default"] = ({
1828
- name: 'denoise',
1829
- uniforms,
1830
- fs,
1831
-
1832
- passes: [{sampler: true}, {sampler: true}]
1833
- });
1834
-
1835
-
1836
- /***/ }),
1837
-
1838
- /***/ "./src/shader-modules/adjust-filters/huesaturation.js":
1839
- /*!************************************************************!*\
1840
- !*** ./src/shader-modules/adjust-filters/huesaturation.js ***!
1841
- \************************************************************/
1842
- /*! exports provided: default */
1843
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1844
-
1845
- "use strict";
1846
- __webpack_require__.r(__webpack_exports__);
1847
- /**
1848
- * @filter Hue / Saturation
1849
- * @description Provides rotational hue and multiplicative saturation control. RGB color space
1850
- * can be imagined as a cube where the axes are the red, green, and blue color
1851
- * values. Hue changing works by rotating the color vector around the grayscale
1852
- * line, which is the straight line from black (0, 0, 0) to white (1, 1, 1).
1853
- * Saturation is implemented by scaling all color channel values either toward
1854
- * or away from the average color channel value.
1855
- * @param hue -1 to 1 (-1 is 180 degree rotation in the negative direction, 0 is no change,
1856
- * and 1 is 180 degree rotation in the positive direction)
1857
- * @param saturation -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
1858
- */
1859
-
1860
- const fs = `\
1861
- uniform float hue;
1862
- uniform float saturation;
1863
-
1864
- vec4 hueSaturation_filterColor(vec4 color) {
1865
- // hue adjustment, wolfram alpha: RotationTransform[angle, {1, 1, 1}][{x, y, z}]
1866
- float angle = hue * 3.14159265;
1867
- float s = sin(angle), c = cos(angle);
1868
- vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;
1869
- float len = length(color.rgb);
1870
- color.rgb = vec3(
1871
- dot(color.rgb, weights.xyz),
1872
- dot(color.rgb, weights.zxy),
1873
- dot(color.rgb, weights.yzx)
1874
- );
1875
-
1876
- // saturation adjustment
1877
- float average = (color.r + color.g + color.b) / 3.0;
1878
- if (saturation > 0.0) {
1879
- color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - saturation));
1880
- } else {
1881
- color.rgb += (average - color.rgb) * (-saturation);
1882
- }
1883
-
1884
- return color;
1885
- }
1886
-
1887
- vec4 hueSaturation_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
1888
- return hueSaturation_filterColor(color);
1889
- }
1890
- `;
1891
-
1892
- const uniforms = {
1893
- hue: {value: 0, min: -1, max: 1},
1894
- saturation: {value: 0, min: -1, max: 1}
1895
- };
1896
-
1897
- /* harmony default export */ __webpack_exports__["default"] = ({
1898
- name: 'hueSaturation',
1899
- uniforms,
1900
- fs,
1901
-
1902
- passes: [{filter: true}]
1903
- });
1904
-
1905
-
1906
- /***/ }),
1907
-
1908
- /***/ "./src/shader-modules/adjust-filters/noise.js":
1909
- /*!****************************************************!*\
1910
- !*** ./src/shader-modules/adjust-filters/noise.js ***!
1911
- \****************************************************/
1912
- /*! exports provided: default */
1913
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1914
-
1915
- "use strict";
1916
- __webpack_require__.r(__webpack_exports__);
1917
- /**
1918
- * @filter Noise
1919
- * @description Adds black and white noise to the image.
1920
- * @param amount 0 to 1 (0 for no effect, 1 for maximum noise)
1921
- */
1922
- const fs = `\
1923
- uniform float amount;
1924
-
1925
- float rand(vec2 co) {
1926
- return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
1927
- }
1928
-
1929
- vec4 noise_filterColor(vec4 color, vec2 texCoord) {
1930
- float diff = (rand(texCoord) - 0.5) * amount;
1931
- color.r += diff;
1932
- color.g += diff;
1933
- color.b += diff;
1934
- return color;
1935
- }
1936
-
1937
- vec4 noise_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
1938
- return noise_filterColor(color, texCoord);
1939
- }
1940
- `;
1941
-
1942
- const uniforms = {
1943
- amount: {value: 0.5, min: 0, max: 1}
1944
- };
1945
-
1946
- /* harmony default export */ __webpack_exports__["default"] = ({
1947
- name: 'noise',
1948
- uniforms,
1949
- fs,
1950
-
1951
- passes: [{filter: true}]
1952
- });
1953
-
1954
-
1955
- /***/ }),
1956
-
1957
- /***/ "./src/shader-modules/adjust-filters/sepia.js":
1958
- /*!****************************************************!*\
1959
- !*** ./src/shader-modules/adjust-filters/sepia.js ***!
1960
- \****************************************************/
1961
- /*! exports provided: default */
1962
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1963
-
1964
- "use strict";
1965
- __webpack_require__.r(__webpack_exports__);
1966
- /**
1967
- * @filter Sepia
1968
- * @description Gives the image a reddish-brown monochrome tint that imitates an old photograph.
1969
- * @param amount 0 to 1 (0 for no effect, 1 for full sepia coloring)
1970
- */
1971
- const fs = `\
1972
- uniform float amount;
1973
-
1974
- vec4 sepia_filterColor(vec4 color) {
1975
- float r = color.r;
1976
- float g = color.g;
1977
- float b = color.b;
1978
-
1979
- color.r =
1980
- min(1.0, (r * (1.0 - (0.607 * amount))) + (g * (0.769 * amount)) + (b * (0.189 * amount)));
1981
- color.g = min(1.0, (r * 0.349 * amount) + (g * (1.0 - (0.314 * amount))) + (b * 0.168 * amount));
1982
- color.b = min(1.0, (r * 0.272 * amount) + (g * 0.534 * amount) + (b * (1.0 - (0.869 * amount))));
1983
-
1984
- return color;
1985
- }
1986
-
1987
- vec4 sepia_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
1988
- return sepia_filterColor(color);
1989
- }
1990
- `;
1991
-
1992
- const uniforms = {
1993
- amount: {value: 0.5, min: 0, max: 1}
1994
- };
1995
-
1996
- /* harmony default export */ __webpack_exports__["default"] = ({
1997
- name: 'sepia',
1998
- uniforms,
1999
- fs,
2000
-
2001
- passes: [{filter: true}]
2002
- });
2003
-
2004
-
2005
- /***/ }),
2006
-
2007
- /***/ "./src/shader-modules/adjust-filters/vibrance.js":
2008
- /*!*******************************************************!*\
2009
- !*** ./src/shader-modules/adjust-filters/vibrance.js ***!
2010
- \*******************************************************/
2011
- /*! exports provided: default */
2012
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2013
-
2014
- "use strict";
2015
- __webpack_require__.r(__webpack_exports__);
2016
- /**
2017
- * @filter Vibrance
2018
- * @description Modifies the saturation of desaturated colors, leaving saturated colors unmodified.
2019
- * @param amount -1 to 1 (-1 is minimum vibrance, 0 is no change, and 1 is maximum vibrance)
2020
- */
2021
- const fs = `\
2022
- uniform float amount;
2023
-
2024
- vec4 vibrance_filterColor(vec4 color) {
2025
- float average = (color.r + color.g + color.b) / 3.0;
2026
- float mx = max(color.r, max(color.g, color.b));
2027
- float amt = (mx - average) * (-amount * 3.0);
2028
- color.rgb = mix(color.rgb, vec3(mx), amt);
2029
- return color;
2030
- }
2031
-
2032
- vec4 vibrance_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
2033
- return vibrance_filterColor(color);
2034
- }
2035
- `;
2036
-
2037
- const uniforms = {
2038
- amount: {value: 0, min: -1, max: 1}
2039
- };
2040
-
2041
- /* harmony default export */ __webpack_exports__["default"] = ({
2042
- name: 'vibrance',
2043
- uniforms,
2044
- fs,
2045
-
2046
- passes: [{filter: true}]
2047
- });
2048
-
2049
-
2050
- /***/ }),
2051
-
2052
- /***/ "./src/shader-modules/adjust-filters/vignette.js":
2053
- /*!*******************************************************!*\
2054
- !*** ./src/shader-modules/adjust-filters/vignette.js ***!
2055
- \*******************************************************/
2056
- /*! exports provided: default */
2057
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2058
-
2059
- "use strict";
2060
- __webpack_require__.r(__webpack_exports__);
2061
- /**
2062
- * @filter Vignette
2063
- * @description Adds a simulated lens edge darkening effect.
2064
- * @param radius 0 to 1 (0 for center of frame, 1 for edge of frame)
2065
- * @param amount 0 to 1 (0 for no effect, 1 for maximum lens darkening)
2066
- */
2067
- const fs = `\
2068
- uniform float radius;
2069
- uniform float amount;
2070
-
2071
- vec4 vignette_filterColor(vec4 color, vec2 texCoord) {
2072
- float dist = distance(texCoord, vec2(0.5, 0.5));
2073
- float ratio = smoothstep(0.8, radius * 0.799, dist * (amount + radius));
2074
- return color.rgba * ratio + (1.0 - ratio)*vec4(0.0, 0.0, 0.0, 1.0);
2075
- }
2076
-
2077
- vec4 vignette_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
2078
- return vignette_filterColor(color, texCoord);
2079
- }
2080
- `;
2081
-
2082
- const uniforms = {
2083
- radius: {value: 0.5, min: 0, max: 1},
2084
- amount: {value: 0.5, min: 0, max: 1}
2085
- };
2086
-
2087
- /* harmony default export */ __webpack_exports__["default"] = ({
2088
- name: 'vignette',
2089
- fs,
2090
- uniforms,
2091
-
2092
- passes: [{filter: true}]
2093
- });
2094
-
2095
-
2096
- /***/ }),
2097
-
2098
- /***/ "./src/shader-modules/blur-filters/tiltshift.js":
2099
- /*!******************************************************!*\
2100
- !*** ./src/shader-modules/blur-filters/tiltshift.js ***!
2101
- \******************************************************/
2102
- /*! exports provided: default */
2103
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2104
-
2105
- "use strict";
2106
- __webpack_require__.r(__webpack_exports__);
2107
- /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "./src/shader-modules/utils/random.js");
2108
- /**
2109
- * @filter Tilt Shift
2110
- * @description Simulates the shallow depth of field normally encountered in close-up
2111
- * photography, which makes the scene seem much smaller than it actually
2112
- * is. This filter assumes the scene is relatively planar, in which case
2113
- * the part of the scene that is completely in focus can be described by
2114
- * a line (the intersection of the focal plane and the scene). An example
2115
- * of a planar scene might be looking at a road from above at a downward
2116
- * angle. The image is then blurred with a blur radius that starts at zero
2117
- * on the line and increases further from the line.
2118
- * @param startX The x coordinate of the start of the line segment.
2119
- * @param startY The y coordinate of the start of the line segment.
2120
- * @param endX The x coordinate of the end of the line segment.
2121
- * @param endY The y coordinate of the end of the line segment.
2122
- * @param blurRadius The maximum radius of the pyramid blur.
2123
- * @param gradientRadius The distance from the line at which the maximum blur radius is reached.
2124
- */
2125
-
2126
-
2127
- const fs = `\
2128
- uniform float blurRadius;
2129
- uniform float gradientRadius;
2130
- uniform vec2 start;
2131
- uniform vec2 end;
2132
- uniform bool invert;
2133
-
2134
- vec2 tiltShift_getDelta(vec2 texSize) {
2135
- vec2 vector = normalize((end - start) * texSize);
2136
- return invert ? vec2(-vector.y, vector.x) : vector;
2137
- }
2138
-
2139
- vec4 tiltShift_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
2140
- vec4 color = vec4(0.0);
2141
- float total = 0.0;
2142
-
2143
- /* randomize the lookup values to hide the fixed number of samples */
2144
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
2145
-
2146
- vec2 normal = normalize(vec2((start.y - end.y) * texSize.y, (end.x - start.x) * texSize.x));
2147
- float radius = smoothstep(0.0, 1.0,
2148
- abs(dot(texCoord * texSize - start * texSize, normal)) / gradientRadius) * blurRadius;
2149
-
2150
- for (float t = -30.0; t <= 30.0; t++) {
2151
- float percent = (t + offset - 0.5) / 30.0;
2152
- float weight = 1.0 - abs(percent);
2153
- vec4 sample = texture2D(texture, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);
2154
-
2155
- /* switch to pre-multiplied alpha to correctly blur transparent images */
2156
- sample.rgb *= sample.a;
2157
-
2158
- color += sample * weight;
2159
- total += weight;
2160
- }
2161
-
2162
- color = color / total;
2163
-
2164
- /* switch back from pre-multiplied alpha */
2165
- color.rgb /= color.a + 0.00001;
2166
-
2167
- return color;
2168
- }
2169
- `;
2170
-
2171
- const uniforms = {
2172
- blurRadius: {value: 15, min: 0, max: 50},
2173
- gradientRadius: {value: 200, min: 0, max: 400},
2174
- start: [0, 0],
2175
- end: [1, 1],
2176
- invert: {value: false, private: true}
2177
- };
2178
-
2179
- /* harmony default export */ __webpack_exports__["default"] = ({
2180
- name: 'tiltShift',
2181
- uniforms,
2182
- fs,
2183
- dependencies: [_utils_random__WEBPACK_IMPORTED_MODULE_0__["default"]],
2184
-
2185
- passes: [{sampler: true, uniforms: {invert: false}}, {sampler: true, uniforms: {invert: true}}]
2186
- });
2187
-
2188
- /*
2189
- function tiltShift(startX, startY, endX, endY, blurRadius, gradientRadius) {
2190
- var dx = endX - startX;
2191
- var dy = endY - startY;
2192
- var d = Math.sqrt(dx * dx + dy * dy);
2193
- simpleShader.call(this, gl.tiltShift, {
2194
- blurRadius: blurRadius,
2195
- gradientRadius: gradientRadius,
2196
- start: [startX, startY],
2197
- end: [endX, endY],
2198
- delta: [dx / d, dy / d],
2199
- texSize: [this.width, this.height]
2200
- });
2201
- simpleShader.call(this, gl.tiltShift, {
2202
- blurRadius: blurRadius,
2203
- gradientRadius: gradientRadius,
2204
- start: [startX, startY],
2205
- end: [endX, endY],
2206
- delta: [-dy / d, dx / d],
2207
- texSize: [this.width, this.height]
2208
- });
2209
-
2210
- return this;
2211
- }
2212
- */
2213
-
2214
-
2215
- /***/ }),
2216
-
2217
- /***/ "./src/shader-modules/blur-filters/triangleblur.js":
2218
- /*!*********************************************************!*\
2219
- !*** ./src/shader-modules/blur-filters/triangleblur.js ***!
2220
- \*********************************************************/
2221
- /*! exports provided: default */
2222
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2223
-
2224
- "use strict";
2225
- __webpack_require__.r(__webpack_exports__);
2226
- /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "./src/shader-modules/utils/random.js");
2227
- /**
2228
- * @filter Triangle Blur
2229
- * @description This is the most basic blur filter, which convolves the image with a
2230
- * pyramid filter. The pyramid filter is separable and is applied as two
2231
- * perpendicular triangle filters.
2232
- * @param radius The radius of the pyramid convolved with the image.
2233
- */
2234
-
2235
-
2236
- const fs = `\
2237
- uniform float radius;
2238
- uniform vec2 delta;
2239
-
2240
- vec4 triangleBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
2241
- vec2 adjustedDelta = delta * radius / texSize;
2242
-
2243
- vec4 color = vec4(0.0);
2244
- float total = 0.0;
2245
-
2246
- /* randomize the lookup values to hide the fixed number of samples */
2247
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
2248
-
2249
- for (float t = -30.0; t <= 30.0; t++) {
2250
- float percent = (t + offset - 0.5) / 30.0;
2251
- float weight = 1.0 - abs(percent);
2252
- vec4 sample = texture2D(texture, texCoord + adjustedDelta * percent);
2253
-
2254
- /* switch to pre-multiplied alpha to correctly blur transparent images */
2255
- sample.rgb *= sample.a;
2256
-
2257
- color += sample * weight;
2258
- total += weight;
2259
- }
2260
-
2261
- color = color / total;
2262
-
2263
- /* switch back from pre-multiplied alpha */
2264
- color.rgb /= color.a + 0.00001;
2265
-
2266
- return color;
2267
- }
2268
- `;
2269
-
2270
- const uniforms = {
2271
- radius: {value: 20, min: 0, softMax: 100},
2272
- delta: {value: [1, 0], private: true}
2273
- };
2274
-
2275
- /* harmony default export */ __webpack_exports__["default"] = ({
2276
- name: 'triangleBlur',
2277
- uniforms,
2278
- fs,
2279
- dependencies: [_utils_random__WEBPACK_IMPORTED_MODULE_0__["default"]],
2280
- passes: [{sampler: true, uniforms: {delta: [1, 0]}}, {sampler: true, uniforms: {delta: [0, 1]}}]
2281
- });
2282
-
2283
-
2284
- /***/ }),
2285
-
2286
- /***/ "./src/shader-modules/blur-filters/zoomblur.js":
2287
- /*!*****************************************************!*\
2288
- !*** ./src/shader-modules/blur-filters/zoomblur.js ***!
2289
- \*****************************************************/
2290
- /*! exports provided: default */
2291
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2292
-
2293
- "use strict";
2294
- __webpack_require__.r(__webpack_exports__);
2295
- /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "./src/shader-modules/utils/random.js");
2296
- /**
2297
- * @filter Zoom Blur
2298
- * @description Blurs the image away from a certain point, which looks like radial motion blur.
2299
- * @param centerX The x coordinate of the blur origin.
2300
- * @param centerY The y coordinate of the blur origin.
2301
- * @param strength The strength of the blur. Values in the range 0 to 1 are usually sufficient,
2302
- * where 0 doesn't change the image and 1 creates a highly blurred image.
2303
- */
2304
-
2305
-
2306
- const fs = `
2307
- uniform vec2 center;
2308
- uniform float strength;
2309
-
2310
- vec4 zoomBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
2311
- vec4 color = vec4(0.0);
2312
- float total = 0.0;
2313
- vec2 toCenter = center * texSize - texCoord * texSize;
2314
-
2315
- /* randomize the lookup values to hide the fixed number of samples */
2316
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
2317
-
2318
- for (float t = 0.0; t <= 40.0; t++) {
2319
- float percent = (t + offset) / 40.0;
2320
- float weight = 4.0 * (percent - percent * percent);
2321
- vec4 sample = texture2D(texture, texCoord + toCenter * percent * strength / texSize);
2322
-
2323
- /* switch to pre-multiplied alpha to correctly blur transparent images */
2324
- sample.rgb *= sample.a;
2325
-
2326
- color += sample * weight;
2327
- total += weight;
2328
- }
2329
-
2330
- color = color / total;
2331
-
2332
- /* switch back from pre-multiplied alpha */
2333
- color.rgb /= color.a + 0.00001;
2334
-
2335
- return color;
2336
- }
2337
- `;
2338
-
2339
- const uniforms = {
2340
- center: [0.5, 0.5],
2341
- strength: {value: 0.3, min: 0, softMax: 1}
2342
- };
2343
-
2344
- /* harmony default export */ __webpack_exports__["default"] = ({
2345
- name: 'zoomBlur',
2346
- uniforms,
2347
- fs,
2348
- dependencies: [_utils_random__WEBPACK_IMPORTED_MODULE_0__["default"]],
2349
-
2350
- passes: [{sampler: true}]
2351
- });
2352
-
2353
-
2354
- /***/ }),
2355
-
2356
- /***/ "./src/shader-modules/fun-filters/colorhalftone.js":
2357
- /*!*********************************************************!*\
2358
- !*** ./src/shader-modules/fun-filters/colorhalftone.js ***!
2359
- \*********************************************************/
2360
- /*! exports provided: default */
2361
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2362
-
2363
- "use strict";
2364
- __webpack_require__.r(__webpack_exports__);
2365
- /**
2366
- * @filter Color Halftone
2367
- * @description Simulates a CMYK halftone rendering of the image by multiplying pixel values
2368
- * with a four rotated 2D sine wave patterns, one each for cyan, magenta, yellow,
2369
- * and black.
2370
- * @param centerX The x coordinate of the pattern origin.
2371
- * @param centerY The y coordinate of the pattern origin.
2372
- * @param angle The rotation of the pattern in radians.
2373
- * @param size The diameter of a dot in pixels.
2374
- */
2375
-
2376
- // TODO pass texCoord to angle
2377
- const fs = `\
2378
- uniform vec2 center;
2379
- uniform float angle;
2380
- uniform float size;
2381
-
2382
- float scale = 3.1514 / size;
2383
-
2384
- float pattern(float angle, vec2 texSize, vec2 texCoord) {
2385
- float s = sin(angle), c = cos(angle);
2386
- vec2 tex = texCoord * texSize - center * texSize;
2387
- vec2 point = vec2(
2388
- c * tex.x - s * tex.y,
2389
- s * tex.x + c * tex.y
2390
- ) * scale;
2391
- return (sin(point.x) * sin(point.y)) * 4.0;
2392
- }
2393
-
2394
- vec4 colorHalftone_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
2395
- vec3 cmy = 1.0 - color.rgb;
2396
- float k = min(cmy.x, min(cmy.y, cmy.z));
2397
- cmy = (cmy - k) / (1.0 - k);
2398
- cmy = clamp(
2399
- cmy * 10.0 - 3.0 + vec3(
2400
- pattern(angle + 0.26179, texSize, texCoord),
2401
- pattern(angle + 1.30899, texSize, texCoord),
2402
- pattern(angle, texSize, texCoord)
2403
- ),
2404
- 0.0,
2405
- 1.0
2406
- );
2407
- k = clamp(k * 10.0 - 5.0 + pattern(angle + 0.78539, texSize, texCoord), 0.0, 1.0);
2408
- return vec4(1.0 - cmy - k, color.a);
2409
- }
2410
- `;
2411
-
2412
- const uniforms = {
2413
- center: [0.5, 0.5],
2414
- angle: {value: 1.1, softMin: 0, softMax: Math.PI / 2},
2415
- size: {value: 4, min: 1, softMin: 3, softMax: 20}
2416
- };
2417
-
2418
- /* harmony default export */ __webpack_exports__["default"] = ({
2419
- name: 'colorHalftone',
2420
- uniforms,
2421
- fs,
2422
-
2423
- passes: [{filter: true}]
2424
- });
2425
-
2426
-
2427
- /***/ }),
2428
-
2429
- /***/ "./src/shader-modules/fun-filters/dotscreen.js":
2430
- /*!*****************************************************!*\
2431
- !*** ./src/shader-modules/fun-filters/dotscreen.js ***!
2432
- \*****************************************************/
2433
- /*! exports provided: default */
2434
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2435
-
2436
- "use strict";
2437
- __webpack_require__.r(__webpack_exports__);
2438
- /**
2439
- * @filter Dot Screen
2440
- * @description Simulates a black and white halftone rendering of the image by multiplying
2441
- * pixel values with a rotated 2D sine wave pattern.
2442
- * @param centerX The x coordinate of the pattern origin.
2443
- * @param centerY The y coordinate of the pattern origin.
2444
- * @param angle The rotation of the pattern in radians.
2445
- * @param size The diameter of a dot in pixels.
2446
- */
2447
- const fs = `\
2448
- uniform vec2 center;
2449
- uniform float angle;
2450
- uniform float size;
2451
-
2452
- float pattern(vec2 texSize, vec2 texCoord) {
2453
- float scale = 3.1415 / size;
2454
-
2455
- float s = sin(angle), c = cos(angle);
2456
- vec2 tex = texCoord * texSize - center * texSize;
2457
- vec2 point = vec2(
2458
- c * tex.x - s * tex.y,
2459
- s * tex.x + c * tex.y
2460
- ) * scale;
2461
- return (sin(point.x) * sin(point.y)) * 4.0;
2462
- }
2463
-
2464
- vec4 dotScreen_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
2465
- float average = (color.r + color.g + color.b) / 3.0;
2466
- return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);
2467
- }
2468
- `;
2469
-
2470
- const uniforms = {
2471
- center: [0.5, 0.5],
2472
- angle: {value: 1.1, softMin: 0, softMax: Math.PI / 2},
2473
- size: {value: 3, min: 1, softMin: 3, softMax: 20}
2474
- };
2475
-
2476
- /* harmony default export */ __webpack_exports__["default"] = ({
2477
- name: 'dotScreen',
2478
- uniforms,
2479
- fs,
2480
-
2481
- passes: [{filter: true}]
2482
- });
2483
-
2484
-
2485
- /***/ }),
2486
-
2487
- /***/ "./src/shader-modules/fun-filters/edgework.js":
2488
- /*!****************************************************!*\
2489
- !*** ./src/shader-modules/fun-filters/edgework.js ***!
2490
- \****************************************************/
2491
- /*! exports provided: default */
2492
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2493
-
2494
- "use strict";
2495
- __webpack_require__.r(__webpack_exports__);
2496
- /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "./src/shader-modules/utils/random.js");
2497
- /**
2498
- * @filter Edge Work
2499
- * @description Picks out different frequencies in the image by subtracting two
2500
- * copies of the image blurred with different radii.
2501
- * @param radius The radius of the effect in pixels.
2502
- */
2503
-
2504
-
2505
- const fs = `\
2506
- uniform float radius;
2507
- uniform vec2 delta;
2508
-
2509
- vec4 edgeWork_sampleColor1(sampler2D source, vec2 texSize, vec2 texCoord) {
2510
- vec2 relativeDelta = radius * delta / texSize;
2511
-
2512
- vec2 color = vec2(0.0);
2513
- vec2 total = vec2(0.0);
2514
-
2515
- /* randomize the lookup values to hide the fixed number of samples */
2516
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
2517
-
2518
- for (float t = -30.0; t <= 30.0; t++) {
2519
- float percent = (t + offset - 0.5) / 30.0;
2520
- float weight = 1.0 - abs(percent);
2521
- vec3 sampleColor = texture2D(source, texCoord + relativeDelta * percent).rgb;
2522
- float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;
2523
- color.x += average * weight;
2524
- total.x += weight;
2525
- if (abs(t) < 15.0) {
2526
- weight = weight * 2.0 - 1.0;
2527
- color.y += average * weight;
2528
- total.y += weight;
2529
- }
2530
- }
2531
- return vec4(color / total, 0.0, 1.0);
2532
- }
2533
-
2534
- vec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {
2535
- vec2 relativeDelta = radius * delta / texSize;
2536
-
2537
- vec2 color = vec2(0.0);
2538
- vec2 total = vec2(0.0);
2539
-
2540
- /* randomize the lookup values to hide the fixed number of samples */
2541
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
2542
-
2543
- for (float t = -30.0; t <= 30.0; t++) {
2544
- float percent = (t + offset - 0.5) / 30.0;
2545
- float weight = 1.0 - abs(percent);
2546
- vec2 sampleColor = texture2D(source, texCoord + relativeDelta * percent).xy;
2547
- color.x += sampleColor.x * weight;
2548
- total.x += weight;
2549
- if (abs(t) < 15.0) {
2550
- weight = weight * 2.0 - 1.0;
2551
- color.y += sampleColor.y * weight;
2552
- total.y += weight;
2553
- }
2554
- }
2555
- float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);
2556
- return vec4(c, c, c, 1.0);
2557
- }
2558
- `;
2559
-
2560
- const uniforms = {
2561
- radius: {value: 2, min: 1, softMax: 50},
2562
- delta: {value: [1, 0], private: true}
2563
- };
2564
-
2565
- /* harmony default export */ __webpack_exports__["default"] = ({
2566
- name: 'edgeWork',
2567
- uniforms,
2568
- fs,
2569
- dependencies: [_utils_random__WEBPACK_IMPORTED_MODULE_0__["default"]],
2570
- passes: [
2571
- {
2572
- sampler: 'edgeWork_sampleColor1',
2573
- uniforms: {delta: [1, 0]}
2574
- },
2575
- {
2576
- sampler: 'edgeWork_sampleColor2',
2577
- uniforms: {delta: [0, 1]}
2578
- }
2579
- ]
2580
- });
2581
-
2582
-
2583
- /***/ }),
2584
-
2585
- /***/ "./src/shader-modules/fun-filters/hexagonalpixelate.js":
2586
- /*!*************************************************************!*\
2587
- !*** ./src/shader-modules/fun-filters/hexagonalpixelate.js ***!
2588
- \*************************************************************/
2589
- /*! exports provided: default */
2590
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2591
-
2592
- "use strict";
2593
- __webpack_require__.r(__webpack_exports__);
2594
- /**
2595
- * @filter Hexagonal Pixelate
2596
- * @description Renders the image using a pattern of hexagonal tiles. Tile colors
2597
- * are nearest-neighbor sampled from the centers of the tiles.
2598
- * @param centerX The x coordinate of the pattern center.
2599
- * @param centerY The y coordinate of the pattern center.
2600
- * @param scale The width of an individual tile, in pixels.
2601
- */
2602
- const fs = `\
2603
- uniform vec2 center;
2604
- uniform float scale;
2605
-
2606
- vec4 hexagonalPixelate_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
2607
- vec2 tex = (texCoord * texSize - center * texSize) / scale;
2608
- tex.y /= 0.866025404;
2609
- tex.x -= tex.y * 0.5;
2610
-
2611
- vec2 a;
2612
- if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {
2613
- a = vec2(floor(tex.x), floor(tex.y));
2614
- }
2615
- else a = vec2(ceil(tex.x), ceil(tex.y));
2616
- vec2 b = vec2(ceil(tex.x), floor(tex.y));
2617
- vec2 c = vec2(floor(tex.x), ceil(tex.y));
2618
-
2619
- vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);
2620
- vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);
2621
- vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);
2622
- vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);
2623
-
2624
- float alen = length(TEX - A);
2625
- float blen = length(TEX - B);
2626
- float clen = length(TEX - C);
2627
-
2628
- vec2 choice;
2629
- if (alen < blen) {
2630
- if (alen < clen) choice = a;
2631
- else choice = c;
2632
- } else {
2633
- if (blen < clen) choice = b;
2634
- else choice = c;
2635
- }
2636
-
2637
- choice.x += choice.y * 0.5;
2638
- choice.y *= 0.866025404;
2639
- choice *= scale / texSize;
2640
-
2641
- return texture2D(texture, choice + center);
2642
- }
2643
- `;
2644
-
2645
- const uniforms = {
2646
- center: {value: [0.5, 0.5], hint: 'screenspace'},
2647
- scale: {value: 10, min: 1, softMin: 5, softMax: 50}
2648
- };
2649
-
2650
- /* harmony default export */ __webpack_exports__["default"] = ({
2651
- name: 'hexagonalPixelate',
2652
- uniforms,
2653
- fs,
2654
-
2655
- passes: [{sampler: true}]
2656
- });
2657
-
2658
-
2659
- /***/ }),
2660
-
2661
- /***/ "./src/shader-modules/fun-filters/ink.js":
2662
- /*!***********************************************!*\
2663
- !*** ./src/shader-modules/fun-filters/ink.js ***!
2664
- \***********************************************/
2665
- /*! exports provided: default */
2666
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2667
-
2668
- "use strict";
2669
- __webpack_require__.r(__webpack_exports__);
2670
- /**
2671
- * @filter Ink
2672
- * @description Simulates outlining the image in ink by darkening edges stronger than a
2673
- * certain threshold. The edge detection value is the difference of two
2674
- * copies of the image, each blurred using a blur of a different radius.
2675
- * @param strength The multiplicative scale of the ink edges. Values in the range 0 to 1
2676
- * are usually sufficient, where 0 doesn't change the image and 1 adds lots
2677
- * of black edges. Negative strength values will create white ink edges
2678
- * instead of black ones.
2679
- */
2680
- const fs = `\
2681
- uniform float strength;
2682
-
2683
- vec4 ink_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
2684
- vec2 dx = vec2(1.0 / texSize.x, 0.0);
2685
- vec2 dy = vec2(0.0, 1.0 / texSize.y);
2686
- vec4 color = texture2D(texture, texCoord);
2687
- float bigTotal = 0.0;
2688
- float smallTotal = 0.0;
2689
- vec3 bigAverage = vec3(0.0);
2690
- vec3 smallAverage = vec3(0.0);
2691
- for (float x = -2.0; x <= 2.0; x += 1.0) {
2692
- for (float y = -2.0; y <= 2.0; y += 1.0) {
2693
- vec3 sample = texture2D(texture, texCoord + dx * x + dy * y).rgb;
2694
- bigAverage += sample;
2695
- bigTotal += 1.0;
2696
- if (abs(x) + abs(y) < 2.0) {
2697
- smallAverage += sample;
2698
- smallTotal += 1.0;
2699
- }
2700
- }
2701
- }
2702
- vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);
2703
- float power = strength * strength * strength * strength * strength;
2704
- return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);
2705
- }
2706
- `;
2707
-
2708
- const uniforms = {
2709
- strength: {value: 0.25, min: 0, softMax: 1}
2710
- };
2711
-
2712
- /* harmony default export */ __webpack_exports__["default"] = ({
2713
- name: 'ink',
2714
- uniforms,
2715
- fs,
2716
-
2717
- passes: [{sampler: true}]
2718
- });
2719
-
2720
-
2721
- /***/ }),
2722
-
2723
- /***/ "./src/shader-modules/fxaa/fxaa.js":
2724
- /*!*****************************************!*\
2725
- !*** ./src/shader-modules/fxaa/fxaa.js ***!
2726
- \*****************************************/
2727
- /*! exports provided: default */
2728
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2729
-
2730
- "use strict";
2731
- __webpack_require__.r(__webpack_exports__);
2732
- /**
2733
- * ORIGINAL LICENCE
2734
- * @license
2735
- * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
2736
- *
2737
- * Redistribution and use in source and binary forms, with or without
2738
- * modification, are permitted provided that the following conditions
2739
- * are met:
2740
- * * Redistributions of source code must retain the above copyright
2741
- * notice, this list of conditions and the following disclaimer.
2742
- * * Redistributions in binary form must reproduce the above copyright
2743
- * notice, this list of conditions and the following disclaimer in the
2744
- * documentation and/or other materials provided with the distribution.
2745
- * * Neither the name of NVIDIA CORPORATION nor the names of its
2746
- * contributors may be used to endorse or promote products derived
2747
- * from this software without specific prior written permission.
2748
- *
2749
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
2750
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2751
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2752
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
2753
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2754
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2755
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2756
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2757
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2758
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2759
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2760
- */
2761
-
2762
- // LUMA.GL
2763
- // WebGL version from cesium.js, used under Apached 2.0 License
2764
- // https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
2765
- // with the following modifications:
2766
- // - fxaa_sampleColor to integrate with luma.gl
2767
- // - Return color value with alpha to avoid another tap
2768
- // - Calculate luminance in FxaaLuma
2769
-
2770
- // COMMENTS FROM CESIUM VERSION
2771
- // NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples
2772
- // Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h
2773
- //
2774
- // Steps used to integrate into Cesium:
2775
- // * The following defines are set:
2776
- // #define FXAA_PC 1
2777
- // #define FXAA_WEBGL_1 1
2778
- // #define FXAA_GREEN_AS_LUMA 1
2779
- // #define FXAA_EARLY_EXIT 1
2780
- // #define FXAA_GLSL_120 1
2781
- // * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed.
2782
- // * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace
2783
- // /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/.
2784
- // * There are no implicit conversions from ivec* to vec* so replace:
2785
- // #define FxaaInt2 ivec2
2786
- // with
2787
- // #define FxaaInt2 vec2
2788
- // * The texture2DLod function is only available in vertex shaders so replace:
2789
- // #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
2790
- // #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
2791
- // with
2792
- // #define FxaaTexTop(t, p) texture2D(t, p)
2793
- // #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))
2794
- // * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future.
2795
- // * The following parameters to FxaaPixelShader_ are unused and can be removed:
2796
- // fxaaConsolePosPos
2797
- // fxaaConsoleRcpFrameOpt
2798
- // fxaaConsoleRcpFrameOpt2
2799
- // fxaaConsole360RcpFrameOpt2
2800
- // fxaaConsoleEdgeSharpness
2801
- // fxaaConsoleEdgeThreshold
2802
- // fxaaConsoleEdgeThresholdMi
2803
- // fxaaConsole360ConstDir
2804
- //
2805
- // Choose the quality preset.
2806
- // This needs to be compiled into the shader as it effects code.
2807
- // Best option to include multiple presets is to
2808
- // in each shader define the preset, then include this file.
2809
- //
2810
- // OPTIONS
2811
- // -----------------------------------------------------------------------
2812
- // 10 to 15 - default medium dither (10=fastest, 15=highest quality)
2813
- // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
2814
- // 39 - no dither, very expensive
2815
- //
2816
- // NOTES
2817
- // -----------------------------------------------------------------------
2818
- // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
2819
- // 13 = about same speed as FXAA 3.9 and better than 12
2820
- // 23 = closest to FXAA 3.9 visually and performance wise
2821
- // _ = the lowest digit is directly related to performance
2822
- // _ = the highest digit is directly related to style
2823
- //
2824
-
2825
- const fs = `
2826
- #define FXAA_QUALITY_PRESET 29
2827
-
2828
- #if (FXAA_QUALITY_PRESET == 10)
2829
- #define FXAA_QUALITY_PS 3
2830
- #define FXAA_QUALITY_P0 1.5
2831
- #define FXAA_QUALITY_P1 3.0
2832
- #define FXAA_QUALITY_P2 12.0
2833
- #endif
2834
- #if (FXAA_QUALITY_PRESET == 11)
2835
- #define FXAA_QUALITY_PS 4
2836
- #define FXAA_QUALITY_P0 1.0
2837
- #define FXAA_QUALITY_P1 1.5
2838
- #define FXAA_QUALITY_P2 3.0
2839
- #define FXAA_QUALITY_P3 12.0
2840
- #endif
2841
- #if (FXAA_QUALITY_PRESET == 12)
2842
- #define FXAA_QUALITY_PS 5
2843
- #define FXAA_QUALITY_P0 1.0
2844
- #define FXAA_QUALITY_P1 1.5
2845
- #define FXAA_QUALITY_P2 2.0
2846
- #define FXAA_QUALITY_P3 4.0
2847
- #define FXAA_QUALITY_P4 12.0
2848
- #endif
2849
- #if (FXAA_QUALITY_PRESET == 13)
2850
- #define FXAA_QUALITY_PS 6
2851
- #define FXAA_QUALITY_P0 1.0
2852
- #define FXAA_QUALITY_P1 1.5
2853
- #define FXAA_QUALITY_P2 2.0
2854
- #define FXAA_QUALITY_P3 2.0
2855
- #define FXAA_QUALITY_P4 4.0
2856
- #define FXAA_QUALITY_P5 12.0
2857
- #endif
2858
- #if (FXAA_QUALITY_PRESET == 14)
2859
- #define FXAA_QUALITY_PS 7
2860
- #define FXAA_QUALITY_P0 1.0
2861
- #define FXAA_QUALITY_P1 1.5
2862
- #define FXAA_QUALITY_P2 2.0
2863
- #define FXAA_QUALITY_P3 2.0
2864
- #define FXAA_QUALITY_P4 2.0
2865
- #define FXAA_QUALITY_P5 4.0
2866
- #define FXAA_QUALITY_P6 12.0
2867
- #endif
2868
- #if (FXAA_QUALITY_PRESET == 15)
2869
- #define FXAA_QUALITY_PS 8
2870
- #define FXAA_QUALITY_P0 1.0
2871
- #define FXAA_QUALITY_P1 1.5
2872
- #define FXAA_QUALITY_P2 2.0
2873
- #define FXAA_QUALITY_P3 2.0
2874
- #define FXAA_QUALITY_P4 2.0
2875
- #define FXAA_QUALITY_P5 2.0
2876
- #define FXAA_QUALITY_P6 4.0
2877
- #define FXAA_QUALITY_P7 12.0
2878
- #endif
2879
- #if (FXAA_QUALITY_PRESET == 20)
2880
- #define FXAA_QUALITY_PS 3
2881
- #define FXAA_QUALITY_P0 1.5
2882
- #define FXAA_QUALITY_P1 2.0
2883
- #define FXAA_QUALITY_P2 8.0
2884
- #endif
2885
- #if (FXAA_QUALITY_PRESET == 21)
2886
- #define FXAA_QUALITY_PS 4
2887
- #define FXAA_QUALITY_P0 1.0
2888
- #define FXAA_QUALITY_P1 1.5
2889
- #define FXAA_QUALITY_P2 2.0
2890
- #define FXAA_QUALITY_P3 8.0
2891
- #endif
2892
- #if (FXAA_QUALITY_PRESET == 22)
2893
- #define FXAA_QUALITY_PS 5
2894
- #define FXAA_QUALITY_P0 1.0
2895
- #define FXAA_QUALITY_P1 1.5
2896
- #define FXAA_QUALITY_P2 2.0
2897
- #define FXAA_QUALITY_P3 2.0
2898
- #define FXAA_QUALITY_P4 8.0
2899
- #endif
2900
- #if (FXAA_QUALITY_PRESET == 23)
2901
- #define FXAA_QUALITY_PS 6
2902
- #define FXAA_QUALITY_P0 1.0
2903
- #define FXAA_QUALITY_P1 1.5
2904
- #define FXAA_QUALITY_P2 2.0
2905
- #define FXAA_QUALITY_P3 2.0
2906
- #define FXAA_QUALITY_P4 2.0
2907
- #define FXAA_QUALITY_P5 8.0
2908
- #endif
2909
- #if (FXAA_QUALITY_PRESET == 24)
2910
- #define FXAA_QUALITY_PS 7
2911
- #define FXAA_QUALITY_P0 1.0
2912
- #define FXAA_QUALITY_P1 1.5
2913
- #define FXAA_QUALITY_P2 2.0
2914
- #define FXAA_QUALITY_P3 2.0
2915
- #define FXAA_QUALITY_P4 2.0
2916
- #define FXAA_QUALITY_P5 3.0
2917
- #define FXAA_QUALITY_P6 8.0
2918
- #endif
2919
- #if (FXAA_QUALITY_PRESET == 25)
2920
- #define FXAA_QUALITY_PS 8
2921
- #define FXAA_QUALITY_P0 1.0
2922
- #define FXAA_QUALITY_P1 1.5
2923
- #define FXAA_QUALITY_P2 2.0
2924
- #define FXAA_QUALITY_P3 2.0
2925
- #define FXAA_QUALITY_P4 2.0
2926
- #define FXAA_QUALITY_P5 2.0
2927
- #define FXAA_QUALITY_P6 4.0
2928
- #define FXAA_QUALITY_P7 8.0
2929
- #endif
2930
- #if (FXAA_QUALITY_PRESET == 26)
2931
- #define FXAA_QUALITY_PS 9
2932
- #define FXAA_QUALITY_P0 1.0
2933
- #define FXAA_QUALITY_P1 1.5
2934
- #define FXAA_QUALITY_P2 2.0
2935
- #define FXAA_QUALITY_P3 2.0
2936
- #define FXAA_QUALITY_P4 2.0
2937
- #define FXAA_QUALITY_P5 2.0
2938
- #define FXAA_QUALITY_P6 2.0
2939
- #define FXAA_QUALITY_P7 4.0
2940
- #define FXAA_QUALITY_P8 8.0
2941
- #endif
2942
- #if (FXAA_QUALITY_PRESET == 27)
2943
- #define FXAA_QUALITY_PS 10
2944
- #define FXAA_QUALITY_P0 1.0
2945
- #define FXAA_QUALITY_P1 1.5
2946
- #define FXAA_QUALITY_P2 2.0
2947
- #define FXAA_QUALITY_P3 2.0
2948
- #define FXAA_QUALITY_P4 2.0
2949
- #define FXAA_QUALITY_P5 2.0
2950
- #define FXAA_QUALITY_P6 2.0
2951
- #define FXAA_QUALITY_P7 2.0
2952
- #define FXAA_QUALITY_P8 4.0
2953
- #define FXAA_QUALITY_P9 8.0
2954
- #endif
2955
- #if (FXAA_QUALITY_PRESET == 28)
2956
- #define FXAA_QUALITY_PS 11
2957
- #define FXAA_QUALITY_P0 1.0
2958
- #define FXAA_QUALITY_P1 1.5
2959
- #define FXAA_QUALITY_P2 2.0
2960
- #define FXAA_QUALITY_P3 2.0
2961
- #define FXAA_QUALITY_P4 2.0
2962
- #define FXAA_QUALITY_P5 2.0
2963
- #define FXAA_QUALITY_P6 2.0
2964
- #define FXAA_QUALITY_P7 2.0
2965
- #define FXAA_QUALITY_P8 2.0
2966
- #define FXAA_QUALITY_P9 4.0
2967
- #define FXAA_QUALITY_P10 8.0
2968
- #endif
2969
- #if (FXAA_QUALITY_PRESET == 29)
2970
- #define FXAA_QUALITY_PS 12
2971
- #define FXAA_QUALITY_P0 1.0
2972
- #define FXAA_QUALITY_P1 1.5
2973
- #define FXAA_QUALITY_P2 2.0
2974
- #define FXAA_QUALITY_P3 2.0
2975
- #define FXAA_QUALITY_P4 2.0
2976
- #define FXAA_QUALITY_P5 2.0
2977
- #define FXAA_QUALITY_P6 2.0
2978
- #define FXAA_QUALITY_P7 2.0
2979
- #define FXAA_QUALITY_P8 2.0
2980
- #define FXAA_QUALITY_P9 2.0
2981
- #define FXAA_QUALITY_P10 4.0
2982
- #define FXAA_QUALITY_P11 8.0
2983
- #endif
2984
- #if (FXAA_QUALITY_PRESET == 39)
2985
- #define FXAA_QUALITY_PS 12
2986
- #define FXAA_QUALITY_P0 1.0
2987
- #define FXAA_QUALITY_P1 1.0
2988
- #define FXAA_QUALITY_P2 1.0
2989
- #define FXAA_QUALITY_P3 1.0
2990
- #define FXAA_QUALITY_P4 1.0
2991
- #define FXAA_QUALITY_P5 1.5
2992
- #define FXAA_QUALITY_P6 2.0
2993
- #define FXAA_QUALITY_P7 2.0
2994
- #define FXAA_QUALITY_P8 2.0
2995
- #define FXAA_QUALITY_P9 2.0
2996
- #define FXAA_QUALITY_P10 4.0
2997
- #define FXAA_QUALITY_P11 8.0
2998
- #endif
2999
-
3000
- #define FxaaBool bool
3001
- #define FxaaFloat float
3002
- #define FxaaFloat2 vec2
3003
- #define FxaaFloat3 vec3
3004
- #define FxaaFloat4 vec4
3005
- #define FxaaHalf float
3006
- #define FxaaHalf2 vec2
3007
- #define FxaaHalf3 vec3
3008
- #define FxaaHalf4 vec4
3009
- #define FxaaInt2 vec2
3010
- #define FxaaTex sampler2D
3011
-
3012
- #define FxaaSat(x) clamp(x, 0.0, 1.0)
3013
- #define FxaaTexTop(t, p) texture2D(t, p)
3014
- #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))
3015
-
3016
- FxaaFloat FxaaLuma_(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }
3017
-
3018
- FxaaFloat4 FxaaPixelShader_(
3019
- //
3020
- // Use noperspective interpolation here (turn off perspective interpolation).
3021
- // {xy} = center of pixel
3022
- FxaaFloat2 pos,
3023
- //
3024
- // Input color texture.
3025
- // {rgb_} = color in linear or perceptual color space
3026
- // if (FXAA_GREEN_AS_LUMA == 0)
3027
- // {___a} = luma in perceptual color space (not linear)
3028
- FxaaTex tex,
3029
- //
3030
- // Only used on FXAA Quality.
3031
- // This must be from a constant/uniform.
3032
- // {x_} = 1.0/screenWidthInPixels
3033
- // {_y} = 1.0/screenHeightInPixels
3034
- FxaaFloat2 fxaaQualityRcpFrame,
3035
- //
3036
- // Only used on FXAA Quality.
3037
- // This used to be the FXAA_QUALITY_SUBPIX define.
3038
- // It is here now to allow easier tuning.
3039
- // Choose the amount of sub-pixel aliasing removal.
3040
- // This can effect sharpness.
3041
- // 1.00 - upper limit (softer)
3042
- // 0.75 - default amount of filtering
3043
- // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)
3044
- // 0.25 - almost off
3045
- // 0.00 - completely off
3046
- FxaaFloat fxaaQualitySubpix,
3047
- //
3048
- // Only used on FXAA Quality.
3049
- // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.
3050
- // It is here now to allow easier tuning.
3051
- // The minimum amount of local contrast required to apply algorithm.
3052
- // 0.333 - too little (faster)
3053
- // 0.250 - low quality
3054
- // 0.166 - default
3055
- // 0.125 - high quality
3056
- // 0.063 - overkill (slower)
3057
- FxaaFloat fxaaQualityEdgeThreshold,
3058
- //
3059
- // Only used on FXAA Quality.
3060
- // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.
3061
- // It is here now to allow easier tuning.
3062
- // Trims the algorithm from processing darks.
3063
- // 0.0833 - upper limit (default, the start of visible unfiltered edges)
3064
- // 0.0625 - high quality (faster)
3065
- // 0.0312 - visible limit (slower)
3066
- // Special notes when using FXAA_GREEN_AS_LUMA,
3067
- // Likely want to set this to zero.
3068
- // As colors that are mostly not-green
3069
- // will appear very dark in the green channel!
3070
- // Tune by looking at mostly non-green content,
3071
- // then start at zero and increase until aliasing is a problem.
3072
- FxaaFloat fxaaQualityEdgeThresholdMin
3073
- ) {
3074
- /*--------------------------------------------------------------------------*/
3075
- FxaaFloat2 posM;
3076
- posM.x = pos.x;
3077
- posM.y = pos.y;
3078
- FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
3079
- #define lumaM rgbyM.y
3080
- FxaaFloat lumaS = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
3081
- FxaaFloat lumaE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
3082
- FxaaFloat lumaN = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
3083
- FxaaFloat lumaW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
3084
- /*--------------------------------------------------------------------------*/
3085
- FxaaFloat maxSM = max(lumaS, lumaM);
3086
- FxaaFloat minSM = min(lumaS, lumaM);
3087
- FxaaFloat maxESM = max(lumaE, maxSM);
3088
- FxaaFloat minESM = min(lumaE, minSM);
3089
- FxaaFloat maxWN = max(lumaN, lumaW);
3090
- FxaaFloat minWN = min(lumaN, lumaW);
3091
- FxaaFloat rangeMax = max(maxWN, maxESM);
3092
- FxaaFloat rangeMin = min(minWN, minESM);
3093
- FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
3094
- FxaaFloat range = rangeMax - rangeMin;
3095
- FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
3096
- FxaaBool earlyExit = range < rangeMaxClamped;
3097
- /*--------------------------------------------------------------------------*/
3098
- if(earlyExit)
3099
- return rgbyM;
3100
- /*--------------------------------------------------------------------------*/
3101
- FxaaFloat lumaNW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
3102
- FxaaFloat lumaSE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
3103
- FxaaFloat lumaNE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
3104
- FxaaFloat lumaSW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
3105
- /*--------------------------------------------------------------------------*/
3106
- FxaaFloat lumaNS = lumaN + lumaS;
3107
- FxaaFloat lumaWE = lumaW + lumaE;
3108
- FxaaFloat subpixRcpRange = 1.0/range;
3109
- FxaaFloat subpixNSWE = lumaNS + lumaWE;
3110
- FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
3111
- FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
3112
- /*--------------------------------------------------------------------------*/
3113
- FxaaFloat lumaNESE = lumaNE + lumaSE;
3114
- FxaaFloat lumaNWNE = lumaNW + lumaNE;
3115
- FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
3116
- FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
3117
- /*--------------------------------------------------------------------------*/
3118
- FxaaFloat lumaNWSW = lumaNW + lumaSW;
3119
- FxaaFloat lumaSWSE = lumaSW + lumaSE;
3120
- FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
3121
- FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
3122
- FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
3123
- FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
3124
- FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
3125
- FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
3126
- /*--------------------------------------------------------------------------*/
3127
- FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
3128
- FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
3129
- FxaaBool horzSpan = edgeHorz >= edgeVert;
3130
- FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
3131
- /*--------------------------------------------------------------------------*/
3132
- if(!horzSpan) lumaN = lumaW;
3133
- if(!horzSpan) lumaS = lumaE;
3134
- if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
3135
- FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
3136
- /*--------------------------------------------------------------------------*/
3137
- FxaaFloat gradientN = lumaN - lumaM;
3138
- FxaaFloat gradientS = lumaS - lumaM;
3139
- FxaaFloat lumaNN = lumaN + lumaM;
3140
- FxaaFloat lumaSS = lumaS + lumaM;
3141
- FxaaBool pairN = abs(gradientN) >= abs(gradientS);
3142
- FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
3143
- if(pairN) lengthSign = -lengthSign;
3144
- FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
3145
- /*--------------------------------------------------------------------------*/
3146
- FxaaFloat2 posB;
3147
- posB.x = posM.x;
3148
- posB.y = posM.y;
3149
- FxaaFloat2 offNP;
3150
- offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
3151
- offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
3152
- if(!horzSpan) posB.x += lengthSign * 0.5;
3153
- if( horzSpan) posB.y += lengthSign * 0.5;
3154
- /*--------------------------------------------------------------------------*/
3155
- FxaaFloat2 posN;
3156
- posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
3157
- posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
3158
- FxaaFloat2 posP;
3159
- posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
3160
- posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
3161
- FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
3162
- FxaaFloat lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN));
3163
- FxaaFloat subpixE = subpixC * subpixC;
3164
- FxaaFloat lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP));
3165
- /*--------------------------------------------------------------------------*/
3166
- if(!pairN) lumaNN = lumaSS;
3167
- FxaaFloat gradientScaled = gradient * 1.0/4.0;
3168
- FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
3169
- FxaaFloat subpixF = subpixD * subpixE;
3170
- FxaaBool lumaMLTZero = lumaMM < 0.0;
3171
- /*--------------------------------------------------------------------------*/
3172
- lumaEndN -= lumaNN * 0.5;
3173
- lumaEndP -= lumaNN * 0.5;
3174
- FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
3175
- FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
3176
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
3177
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
3178
- FxaaBool doneNP = (!doneN) || (!doneP);
3179
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
3180
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
3181
- /*--------------------------------------------------------------------------*/
3182
- if(doneNP) {
3183
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3184
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3185
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3186
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3187
- doneN = abs(lumaEndN) >= gradientScaled;
3188
- doneP = abs(lumaEndP) >= gradientScaled;
3189
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
3190
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
3191
- doneNP = (!doneN) || (!doneP);
3192
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
3193
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
3194
- /*--------------------------------------------------------------------------*/
3195
- #if (FXAA_QUALITY_PS > 3)
3196
- if(doneNP) {
3197
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3198
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3199
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3200
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3201
- doneN = abs(lumaEndN) >= gradientScaled;
3202
- doneP = abs(lumaEndP) >= gradientScaled;
3203
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
3204
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
3205
- doneNP = (!doneN) || (!doneP);
3206
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
3207
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
3208
- /*--------------------------------------------------------------------------*/
3209
- #if (FXAA_QUALITY_PS > 4)
3210
- if(doneNP) {
3211
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3212
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3213
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3214
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3215
- doneN = abs(lumaEndN) >= gradientScaled;
3216
- doneP = abs(lumaEndP) >= gradientScaled;
3217
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
3218
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
3219
- doneNP = (!doneN) || (!doneP);
3220
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
3221
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
3222
- /*--------------------------------------------------------------------------*/
3223
- #if (FXAA_QUALITY_PS > 5)
3224
- if(doneNP) {
3225
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3226
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3227
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3228
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3229
- doneN = abs(lumaEndN) >= gradientScaled;
3230
- doneP = abs(lumaEndP) >= gradientScaled;
3231
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
3232
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
3233
- doneNP = (!doneN) || (!doneP);
3234
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
3235
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
3236
- /*--------------------------------------------------------------------------*/
3237
- #if (FXAA_QUALITY_PS > 6)
3238
- if(doneNP) {
3239
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3240
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3241
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3242
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3243
- doneN = abs(lumaEndN) >= gradientScaled;
3244
- doneP = abs(lumaEndP) >= gradientScaled;
3245
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
3246
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
3247
- doneNP = (!doneN) || (!doneP);
3248
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
3249
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
3250
- /*--------------------------------------------------------------------------*/
3251
- #if (FXAA_QUALITY_PS > 7)
3252
- if(doneNP) {
3253
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3254
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3255
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3256
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3257
- doneN = abs(lumaEndN) >= gradientScaled;
3258
- doneP = abs(lumaEndP) >= gradientScaled;
3259
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
3260
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
3261
- doneNP = (!doneN) || (!doneP);
3262
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
3263
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
3264
- /*--------------------------------------------------------------------------*/
3265
- #if (FXAA_QUALITY_PS > 8)
3266
- if(doneNP) {
3267
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3268
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3269
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3270
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3271
- doneN = abs(lumaEndN) >= gradientScaled;
3272
- doneP = abs(lumaEndP) >= gradientScaled;
3273
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
3274
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
3275
- doneNP = (!doneN) || (!doneP);
3276
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
3277
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
3278
- /*--------------------------------------------------------------------------*/
3279
- #if (FXAA_QUALITY_PS > 9)
3280
- if(doneNP) {
3281
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3282
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3283
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3284
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3285
- doneN = abs(lumaEndN) >= gradientScaled;
3286
- doneP = abs(lumaEndP) >= gradientScaled;
3287
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
3288
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
3289
- doneNP = (!doneN) || (!doneP);
3290
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
3291
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
3292
- /*--------------------------------------------------------------------------*/
3293
- #if (FXAA_QUALITY_PS > 10)
3294
- if(doneNP) {
3295
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3296
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3297
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3298
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3299
- doneN = abs(lumaEndN) >= gradientScaled;
3300
- doneP = abs(lumaEndP) >= gradientScaled;
3301
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
3302
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
3303
- doneNP = (!doneN) || (!doneP);
3304
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
3305
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
3306
- /*--------------------------------------------------------------------------*/
3307
- #if (FXAA_QUALITY_PS > 11)
3308
- if(doneNP) {
3309
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3310
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3311
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3312
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3313
- doneN = abs(lumaEndN) >= gradientScaled;
3314
- doneP = abs(lumaEndP) >= gradientScaled;
3315
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
3316
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
3317
- doneNP = (!doneN) || (!doneP);
3318
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
3319
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
3320
- /*--------------------------------------------------------------------------*/
3321
- #if (FXAA_QUALITY_PS > 12)
3322
- if(doneNP) {
3323
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3324
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3325
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3326
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3327
- doneN = abs(lumaEndN) >= gradientScaled;
3328
- doneP = abs(lumaEndP) >= gradientScaled;
3329
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
3330
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
3331
- doneNP = (!doneN) || (!doneP);
3332
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
3333
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
3334
- /*--------------------------------------------------------------------------*/
3335
- }
3336
- #endif
3337
- /*--------------------------------------------------------------------------*/
3338
- }
3339
- #endif
3340
- /*--------------------------------------------------------------------------*/
3341
- }
3342
- #endif
3343
- /*--------------------------------------------------------------------------*/
3344
- }
3345
- #endif
3346
- /*--------------------------------------------------------------------------*/
3347
- }
3348
- #endif
3349
- /*--------------------------------------------------------------------------*/
3350
- }
3351
- #endif
3352
- /*--------------------------------------------------------------------------*/
3353
- }
3354
- #endif
3355
- /*--------------------------------------------------------------------------*/
3356
- }
3357
- #endif
3358
- /*--------------------------------------------------------------------------*/
3359
- }
3360
- #endif
3361
- /*--------------------------------------------------------------------------*/
3362
- }
3363
- #endif
3364
- /*--------------------------------------------------------------------------*/
3365
- }
3366
- /*--------------------------------------------------------------------------*/
3367
- FxaaFloat dstN = posM.x - posN.x;
3368
- FxaaFloat dstP = posP.x - posM.x;
3369
- if(!horzSpan) dstN = posM.y - posN.y;
3370
- if(!horzSpan) dstP = posP.y - posM.y;
3371
- /*--------------------------------------------------------------------------*/
3372
- FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
3373
- FxaaFloat spanLength = (dstP + dstN);
3374
- FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
3375
- FxaaFloat spanLengthRcp = 1.0/spanLength;
3376
- /*--------------------------------------------------------------------------*/
3377
- FxaaBool directionN = dstN < dstP;
3378
- FxaaFloat dst = min(dstN, dstP);
3379
- FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
3380
- FxaaFloat subpixG = subpixF * subpixF;
3381
- FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
3382
- FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
3383
- /*--------------------------------------------------------------------------*/
3384
- FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
3385
- FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
3386
- if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
3387
- if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
3388
- return FxaaTexTop(tex, posM);
3389
- }
3390
-
3391
- vec4 fxaa_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
3392
- const float fxaa_QualitySubpix = 0.5;
3393
- const float fxaa_QualityEdgeThreshold = 0.125;
3394
- const float fxaa_QualityEdgeThresholdMin = 0.0833;
3395
-
3396
- return FxaaPixelShader_(
3397
- texCoord,
3398
- texture,
3399
- vec2(1.0) / texSize,
3400
- fxaa_QualitySubpix,
3401
- fxaa_QualityEdgeThreshold,
3402
- fxaa_QualityEdgeThresholdMin
3403
- );
3404
- }
3405
- `;
3406
-
3407
- /* harmony default export */ __webpack_exports__["default"] = ({
3408
- name: 'fxaa',
3409
- uniforms: {},
3410
- fs,
3411
- passes: [{sampler: true}]
3412
- });
3413
-
3414
-
3415
- /***/ }),
3416
-
3417
- /***/ "./src/shader-modules/utils/random.js":
3418
- /*!********************************************!*\
3419
- !*** ./src/shader-modules/utils/random.js ***!
3420
- \********************************************/
3421
- /*! exports provided: default */
3422
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3423
-
3424
- "use strict";
3425
- __webpack_require__.r(__webpack_exports__);
3426
- // Quick random generator for fragment shaders
3427
- const fs = `\
3428
- float random(vec3 scale, float seed) {
3429
- /* use the fragment position for a different seed per-pixel */
3430
- return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
3431
- }
3432
- `;
3433
-
3434
- /* harmony default export */ __webpack_exports__["default"] = ({
3435
- name: 'random',
3436
- fs
3437
- });
3438
-
3439
-
3440
- /***/ }),
3441
-
3442
- /***/ "./src/shader-modules/warp-filters/bulgepinch.js":
3443
- /*!*******************************************************!*\
3444
- !*** ./src/shader-modules/warp-filters/bulgepinch.js ***!
3445
- \*******************************************************/
3446
- /*! exports provided: default */
3447
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3448
-
3449
- "use strict";
3450
- __webpack_require__.r(__webpack_exports__);
3451
- /* harmony import */ var _warp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./warp */ "./src/shader-modules/warp-filters/warp.js");
3452
- /**
3453
- * @filter Bulge / Pinch
3454
- * @description Bulges or pinches the image in a circle.
3455
- * @param centerX The x coordinate of the center of the circle of effect.
3456
- * @param centerY The y coordinate of the center of the circle of effect.
3457
- * @param radius The radius of the circle of effect.
3458
- * @param strength -1 to 1 (-1 is strong pinch, 0 is no effect, 1 is strong bulge)
3459
- */
3460
-
3461
-
3462
- const fs = `\
3463
- uniform float radius;
3464
- uniform float strength;
3465
- uniform vec2 center;
3466
-
3467
- vec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {
3468
- coord -= texCenter;
3469
- float distance = length(coord);
3470
- if (distance < radius) {
3471
- float percent = distance / radius;
3472
- if (strength > 0.0) {
3473
- coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);
3474
- } else {
3475
- coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);
3476
- }
3477
- }
3478
- coord += texCenter;
3479
- return coord;
3480
- }
3481
-
3482
- vec4 bulgePinch_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
3483
- vec2 coord = texCoord * texSize;
3484
- coord = bulgePinch_warp(coord, center * texSize);
3485
-
3486
- return warp_sampleColor(texture, texSize, coord);
3487
- }
3488
- `;
3489
-
3490
- const uniforms = {
3491
- center: [0.5, 0.5],
3492
- radius: {value: 200, min: 1, softMax: 600},
3493
- strength: {value: 0.5, min: -1, max: 1}
3494
- };
3495
-
3496
- /* harmony default export */ __webpack_exports__["default"] = ({
3497
- name: 'bulgePinch',
3498
- fs,
3499
- uniforms,
3500
- dependencies: [_warp__WEBPACK_IMPORTED_MODULE_0__["default"]],
3501
-
3502
- passes: [{sampler: true}]
3503
- });
3504
-
3505
-
3506
- /***/ }),
3507
-
3508
- /***/ "./src/shader-modules/warp-filters/swirl.js":
3509
- /*!**************************************************!*\
3510
- !*** ./src/shader-modules/warp-filters/swirl.js ***!
3511
- \**************************************************/
3512
- /*! exports provided: default */
3513
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3514
-
3515
- "use strict";
3516
- __webpack_require__.r(__webpack_exports__);
3517
- /* harmony import */ var _warp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./warp */ "./src/shader-modules/warp-filters/warp.js");
3518
- /**
3519
- * @filter Swirl
3520
- * @description Warps a circular region of the image in a swirl.
3521
- * @param centerX The x coordinate of the center of the circular region.
3522
- * @param centerY The y coordinate of the center of the circular region.
3523
- * @param radius The radius of the circular region.
3524
- * @param angle The angle in radians that the pixels in the center of
3525
- * the circular region will be rotated by.
3526
- */
3527
-
3528
-
3529
- const fs = `\
3530
- uniform float radius;
3531
- uniform float angle;
3532
- uniform vec2 center;
3533
-
3534
- vec2 swirl_warp(vec2 coord, vec2 texCenter) {
3535
- coord -= texCenter;
3536
- float distance = length(coord);
3537
- if (distance < radius) {
3538
- float percent = (radius - distance) / radius;
3539
- float theta = percent * percent * angle;
3540
- float s = sin(theta);
3541
- float c = cos(theta);
3542
- coord = vec2(
3543
- coord.x * c - coord.y * s,
3544
- coord.x * s + coord.y * c
3545
- );
3546
- }
3547
- coord += texCenter;
3548
- return coord;
3549
- }
3550
-
3551
- vec4 swirl_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
3552
- vec2 coord = texCoord * texSize;
3553
- coord = swirl_warp(coord, center * texSize);
3554
-
3555
- return warp_sampleColor(texture, texSize, coord);
3556
- }
3557
- `;
3558
-
3559
- const uniforms = {
3560
- center: [0.5, 0.5],
3561
- radius: {value: 200, min: 1, softMax: 600},
3562
- angle: {value: 3, softMin: -25, softMax: 25}
3563
- };
3564
-
3565
- /* harmony default export */ __webpack_exports__["default"] = ({
3566
- name: 'swirl',
3567
- uniforms,
3568
- fs,
3569
- dependencies: [_warp__WEBPACK_IMPORTED_MODULE_0__["default"]],
3570
-
3571
- passes: [{sampler: true}]
3572
- });
3573
-
3574
-
3575
- /***/ }),
3576
-
3577
- /***/ "./src/shader-modules/warp-filters/warp.js":
3578
- /*!*************************************************!*\
3579
- !*** ./src/shader-modules/warp-filters/warp.js ***!
3580
- \*************************************************/
3581
- /*! exports provided: default */
3582
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3583
-
3584
- "use strict";
3585
- __webpack_require__.r(__webpack_exports__);
3586
- // TODO: FIXME
3587
- /* eslint-disable */
3588
- const fs = `\
3589
- vec4 warp_sampleColor(sampler2D texture, vec2 texSize, vec2 coord) {
3590
- vec4 color = texture2D(texture, coord / texSize);
3591
- vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);
3592
- if (coord != clampedCoord) {
3593
- /* fade to transparent if we are outside the image */
3594
- color.a *= max(0.0, 1.0 - length(coord - clampedCoord));
3595
- }
3596
-
3597
- return color;
3598
- }
3599
- `;
3600
-
3601
- /* harmony default export */ __webpack_exports__["default"] = ({
3602
- name: 'warp',
3603
- fs
3604
- });
3605
-
3606
-
3607
- /***/ }),
3608
-
3609
- /***/ "@luma.gl/core":
3610
- /*!***********************!*\
3611
- !*** external "luma" ***!
3612
- \***********************/
3613
- /*! no static exports found */
3614
- /***/ (function(module, exports) {
3615
-
3616
- module.exports = __WEBPACK_EXTERNAL_MODULE__luma_gl_core__;
3617
-
3618
- /***/ })
3619
-
3620
- /******/ });
3621
- });