@luma.gl/shadertools 9.1.0-alpha.1 → 9.1.0-alpha.10

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 (232) hide show
  1. package/dist/dist.dev.js +816 -483
  2. package/dist/dist.min.js +2325 -1622
  3. package/dist/index.cjs +2669 -1808
  4. package/dist/index.cjs.map +4 -4
  5. package/dist/index.d.ts +29 -28
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +8 -12
  8. package/dist/lib/glsl-utils/shader-utils.d.ts.map +1 -1
  9. package/dist/lib/glsl-utils/shader-utils.js +2 -3
  10. package/dist/lib/shader-assembler.d.ts +3 -4
  11. package/dist/lib/shader-assembler.d.ts.map +1 -1
  12. package/dist/lib/shader-assembler.js +3 -2
  13. package/dist/lib/shader-assembly/assemble-shaders.d.ts +4 -3
  14. package/dist/lib/shader-assembly/assemble-shaders.d.ts.map +1 -1
  15. package/dist/lib/shader-assembly/assemble-shaders.js +43 -16
  16. package/dist/lib/shader-assembly/platform-defines.d.ts.map +1 -1
  17. package/dist/lib/shader-assembly/platform-defines.js +14 -6
  18. package/dist/lib/shader-module/shader-module-dependencies.d.ts +53 -0
  19. package/dist/lib/shader-module/shader-module-dependencies.d.ts.map +1 -0
  20. package/dist/lib/{shader-assembly/resolve-modules.js → shader-module/shader-module-dependencies.js} +38 -14
  21. package/dist/lib/shader-module/shader-module.d.ts +29 -11
  22. package/dist/lib/shader-module/shader-module.d.ts.map +1 -1
  23. package/dist/lib/shader-module/shader-module.js +76 -6
  24. package/dist/lib/shader-module/shader-pass.d.ts +3 -2
  25. package/dist/lib/shader-module/shader-pass.d.ts.map +1 -1
  26. package/dist/module-injectors.d.ts +2 -2
  27. package/dist/module-injectors.d.ts.map +1 -1
  28. package/dist/module-injectors.js +13 -10
  29. package/dist/modules/engine/geometry/geometry.d.ts.map +1 -1
  30. package/dist/modules/engine/geometry/geometry.js +12 -8
  31. package/dist/modules/engine/picking/picking.d.ts +4 -4
  32. package/dist/modules/engine/picking/picking.d.ts.map +1 -1
  33. package/dist/modules/engine/picking/picking.js +103 -66
  34. package/dist/modules/engine/project/project.d.ts +2 -2
  35. package/dist/modules/engine/project/project.d.ts.map +1 -1
  36. package/dist/modules/engine/project/project.js +36 -22
  37. package/dist/modules/engine/transform/transform.d.ts.map +1 -1
  38. package/dist/modules/engine/transform/transform.js +28 -16
  39. package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts +9 -7
  40. package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -1
  41. package/dist/modules/lighting/gouraud-material/gouraud-material.js +2 -0
  42. package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts +2 -2
  43. package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts.map +1 -1
  44. package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.js +79 -53
  45. package/dist/modules/lighting/lights/lighting-uniforms-glsl.d.ts +1 -1
  46. package/dist/modules/lighting/lights/lighting-uniforms-glsl.d.ts.map +1 -1
  47. package/dist/modules/lighting/lights/lighting-uniforms-glsl.js +38 -23
  48. package/dist/modules/lighting/lights/lighting.d.ts +4 -4
  49. package/dist/modules/lighting/lights/lighting.d.ts.map +1 -1
  50. package/dist/modules/lighting/lights/lighting.js +2 -2
  51. package/dist/modules/lighting/no-material/dirlight.d.ts +4 -4
  52. package/dist/modules/lighting/no-material/dirlight.d.ts.map +1 -1
  53. package/dist/modules/lighting/no-material/dirlight.js +12 -9
  54. package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.d.ts +1 -1
  55. package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.d.ts.map +1 -1
  56. package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.js +304 -181
  57. package/dist/modules/lighting/pbr-material/pbr-material.d.ts +71 -69
  58. package/dist/modules/lighting/pbr-material/pbr-material.d.ts.map +1 -1
  59. package/dist/modules/lighting/pbr-material/pbr-material.js +4 -2
  60. package/dist/modules/lighting/pbr-material/pbr-uniforms-glsl.d.ts +1 -1
  61. package/dist/modules/lighting/pbr-material/pbr-uniforms-glsl.d.ts.map +1 -1
  62. package/dist/modules/lighting/pbr-material/pbr-uniforms-glsl.js +38 -20
  63. package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.d.ts +1 -1
  64. package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.d.ts.map +1 -1
  65. package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.js +21 -16
  66. package/dist/modules/lighting/phong-material/phong-material.d.ts +12 -12
  67. package/dist/modules/lighting/phong-material/phong-material.d.ts.map +1 -1
  68. package/dist/modules/lighting/phong-material/phong-material.js +3 -3
  69. package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts +2 -2
  70. package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts.map +1 -1
  71. package/dist/modules/lighting/phong-material/phong-shaders-glsl.js +82 -54
  72. package/dist/modules/math/fp32/fp32.d.ts.map +1 -1
  73. package/dist/modules/math/fp32/fp32.js +127 -100
  74. package/dist/modules/math/random/random.d.ts +1 -1
  75. package/dist/modules/math/random/random.d.ts.map +1 -1
  76. package/dist/modules/math/random/random.js +3 -3
  77. package/dist/modules/module-injectors.d.ts +2 -2
  78. package/dist/modules/module-injectors.d.ts.map +1 -1
  79. package/dist/modules/module-injectors.js +13 -10
  80. package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +4 -1
  81. package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
  82. package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.js +16 -12
  83. package/dist/modules/postprocessing/image-adjust-filters/denoise.d.ts +4 -1
  84. package/dist/modules/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
  85. package/dist/modules/postprocessing/image-adjust-filters/denoise.js +21 -17
  86. package/dist/modules/postprocessing/image-adjust-filters/huesaturation.d.ts +5 -2
  87. package/dist/modules/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
  88. package/dist/modules/postprocessing/image-adjust-filters/huesaturation.js +29 -22
  89. package/dist/modules/postprocessing/image-adjust-filters/noise.d.ts +4 -1
  90. package/dist/modules/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
  91. package/dist/modules/postprocessing/image-adjust-filters/noise.js +14 -10
  92. package/dist/modules/postprocessing/image-adjust-filters/sepia.d.ts +4 -1
  93. package/dist/modules/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
  94. package/dist/modules/postprocessing/image-adjust-filters/sepia.js +17 -12
  95. package/dist/modules/postprocessing/image-adjust-filters/vibrance.d.ts +4 -1
  96. package/dist/modules/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
  97. package/dist/modules/postprocessing/image-adjust-filters/vibrance.js +12 -9
  98. package/dist/modules/postprocessing/image-adjust-filters/vignette.d.ts +4 -1
  99. package/dist/modules/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
  100. package/dist/modules/postprocessing/image-adjust-filters/vignette.js +13 -10
  101. package/dist/modules/postprocessing/image-blur-filters/tiltshift.d.ts +5 -2
  102. package/dist/modules/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
  103. package/dist/modules/postprocessing/image-blur-filters/tiltshift.js +40 -26
  104. package/dist/modules/postprocessing/image-blur-filters/triangleblur.d.ts +5 -2
  105. package/dist/modules/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -1
  106. package/dist/modules/postprocessing/image-blur-filters/triangleblur.js +32 -19
  107. package/dist/modules/postprocessing/image-blur-filters/zoomblur.d.ts +4 -1
  108. package/dist/modules/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
  109. package/dist/modules/postprocessing/image-blur-filters/zoomblur.js +2 -0
  110. package/dist/modules/postprocessing/image-fun-filters/colorhalftone.d.ts +4 -1
  111. package/dist/modules/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -1
  112. package/dist/modules/postprocessing/image-fun-filters/colorhalftone.js +31 -27
  113. package/dist/modules/postprocessing/image-fun-filters/dotscreen.d.ts +4 -1
  114. package/dist/modules/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -1
  115. package/dist/modules/postprocessing/image-fun-filters/dotscreen.js +19 -15
  116. package/dist/modules/postprocessing/image-fun-filters/edgework.d.ts +8 -5
  117. package/dist/modules/postprocessing/image-fun-filters/edgework.d.ts.map +1 -1
  118. package/dist/modules/postprocessing/image-fun-filters/edgework.js +53 -42
  119. package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +4 -1
  120. package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -1
  121. package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.js +41 -33
  122. package/dist/modules/postprocessing/image-fun-filters/ink.d.ts +4 -1
  123. package/dist/modules/postprocessing/image-fun-filters/ink.d.ts.map +1 -1
  124. package/dist/modules/postprocessing/image-fun-filters/ink.js +27 -25
  125. package/dist/modules/postprocessing/image-fun-filters/magnify.d.ts +2 -1
  126. package/dist/modules/postprocessing/image-fun-filters/magnify.d.ts.map +1 -1
  127. package/dist/modules/postprocessing/image-fun-filters/magnify.js +17 -16
  128. package/dist/modules/postprocessing/image-warp-filters/bulgepinch.d.ts +5 -2
  129. package/dist/modules/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -1
  130. package/dist/modules/postprocessing/image-warp-filters/bulgepinch.js +24 -20
  131. package/dist/modules/postprocessing/image-warp-filters/swirl.d.ts +5 -2
  132. package/dist/modules/postprocessing/image-warp-filters/swirl.d.ts.map +1 -1
  133. package/dist/modules/postprocessing/image-warp-filters/swirl.js +26 -22
  134. package/dist/modules/postprocessing/image-warp-filters/warp.d.ts +2 -1
  135. package/dist/modules/postprocessing/image-warp-filters/warp.d.ts.map +1 -1
  136. package/dist/modules/postprocessing/image-warp-filters/warp.js +9 -8
  137. package/dist/modules-webgl1/geometry/geometry.d.ts.map +1 -1
  138. package/dist/modules-webgl1/geometry/geometry.js +12 -8
  139. package/dist/modules-webgl1/lighting/dirlight/dirlight.d.ts.map +1 -1
  140. package/dist/modules-webgl1/lighting/dirlight/dirlight.js +8 -5
  141. package/dist/modules-webgl1/lighting/lights/lights-glsl.d.ts +1 -1
  142. package/dist/modules-webgl1/lighting/lights/lights-glsl.d.ts.map +1 -1
  143. package/dist/modules-webgl1/lighting/lights/lights-glsl.js +19 -11
  144. package/dist/modules-webgl1/lighting/pbr/pbr-fragment-glsl.d.ts +1 -1
  145. package/dist/modules-webgl1/lighting/pbr/pbr-fragment-glsl.d.ts.map +1 -1
  146. package/dist/modules-webgl1/lighting/pbr/pbr-fragment-glsl.js +268 -157
  147. package/dist/modules-webgl1/lighting/pbr/pbr-vertex-glsl.d.ts +1 -1
  148. package/dist/modules-webgl1/lighting/pbr/pbr-vertex-glsl.d.ts.map +1 -1
  149. package/dist/modules-webgl1/lighting/pbr/pbr-vertex-glsl.js +16 -12
  150. package/dist/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.d.ts +1 -1
  151. package/dist/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.d.ts.map +1 -1
  152. package/dist/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.js +64 -55
  153. package/dist/modules-webgl1/math/fp64/fp64-arithmetic-glsl.d.ts +1 -1
  154. package/dist/modules-webgl1/math/fp64/fp64-arithmetic-glsl.d.ts.map +1 -1
  155. package/dist/modules-webgl1/math/fp64/fp64-arithmetic-glsl.js +113 -81
  156. package/dist/modules-webgl1/math/fp64/fp64-functions-glsl.d.ts +1 -1
  157. package/dist/modules-webgl1/math/fp64/fp64-functions-glsl.d.ts.map +1 -1
  158. package/dist/modules-webgl1/math/fp64/fp64-functions-glsl.js +588 -433
  159. package/dist/modules-webgl1/project/project.d.ts +2 -2
  160. package/dist/modules-webgl1/project/project.d.ts.map +1 -1
  161. package/dist/modules-webgl1/project/project.js +5 -4
  162. package/package.json +2 -2
  163. package/src/index.ts +78 -32
  164. package/src/lib/glsl-utils/shader-utils.ts +1 -3
  165. package/src/lib/shader-assembler.ts +7 -8
  166. package/src/lib/shader-assembly/assemble-shaders.ts +52 -20
  167. package/src/lib/shader-assembly/platform-defines.ts +5 -6
  168. package/src/lib/shader-module/shader-module-dependencies.ts +112 -0
  169. package/src/lib/shader-module/shader-module.ts +129 -18
  170. package/src/lib/shader-module/shader-pass.ts +3 -2
  171. package/src/module-injectors.ts +2 -4
  172. package/src/modules/engine/geometry/geometry.ts +2 -3
  173. package/src/modules/engine/picking/picking.ts +7 -5
  174. package/src/modules/engine/project/project.ts +2 -3
  175. package/src/modules/engine/transform/transform.ts +1 -3
  176. package/src/modules/lighting/gouraud-material/gouraud-material.ts +4 -0
  177. package/src/modules/lighting/gouraud-material/gouraud-shaders-glsl.ts +2 -4
  178. package/src/modules/lighting/lights/lighting-uniforms-glsl.ts +1 -3
  179. package/src/modules/lighting/lights/lighting.ts +4 -2
  180. package/src/modules/lighting/no-material/dirlight.ts +6 -5
  181. package/src/modules/lighting/pbr-material/pbr-fragment-glsl.ts +1 -2
  182. package/src/modules/lighting/pbr-material/pbr-material.ts +44 -38
  183. package/src/modules/lighting/pbr-material/pbr-uniforms-glsl.ts +1 -3
  184. package/src/modules/lighting/pbr-material/pbr-vertex-glsl.ts +1 -3
  185. package/src/modules/lighting/phong-material/phong-material.ts +4 -3
  186. package/src/modules/lighting/phong-material/phong-shaders-glsl.ts +2 -4
  187. package/src/modules/math/fp32/fp32.ts +1 -2
  188. package/src/modules/math/random/random.ts +1 -2
  189. package/src/modules/module-injectors.ts +2 -4
  190. package/src/modules/postprocessing/image-adjust-filters/brightnesscontrast.ts +6 -2
  191. package/src/modules/postprocessing/image-adjust-filters/denoise.ts +7 -3
  192. package/src/modules/postprocessing/image-adjust-filters/huesaturation.ts +9 -4
  193. package/src/modules/postprocessing/image-adjust-filters/noise.ts +6 -2
  194. package/src/modules/postprocessing/image-adjust-filters/sepia.ts +6 -2
  195. package/src/modules/postprocessing/image-adjust-filters/vibrance.ts +5 -2
  196. package/src/modules/postprocessing/image-adjust-filters/vignette.ts +11 -4
  197. package/src/modules/postprocessing/image-blur-filters/tiltshift.ts +6 -2
  198. package/src/modules/postprocessing/image-blur-filters/triangleblur.ts +6 -2
  199. package/src/modules/postprocessing/image-blur-filters/zoomblur.ts +5 -0
  200. package/src/modules/postprocessing/image-fun-filters/colorhalftone.ts +6 -2
  201. package/src/modules/postprocessing/image-fun-filters/dotscreen.ts +6 -2
  202. package/src/modules/postprocessing/image-fun-filters/edgework.ts +10 -4
  203. package/src/modules/postprocessing/image-fun-filters/hexagonalpixelate.ts +6 -2
  204. package/src/modules/postprocessing/image-fun-filters/ink.ts +8 -3
  205. package/src/modules/postprocessing/image-fun-filters/magnify.ts +3 -2
  206. package/src/modules/postprocessing/image-warp-filters/bulgepinch.ts +6 -2
  207. package/src/modules/postprocessing/image-warp-filters/swirl.ts +8 -2
  208. package/src/modules/postprocessing/image-warp-filters/warp.ts +3 -2
  209. package/src/modules-webgl1/geometry/geometry.ts +2 -3
  210. package/src/modules-webgl1/lighting/dirlight/dirlight.ts +1 -2
  211. package/src/modules-webgl1/lighting/lights/lights-glsl.ts +1 -3
  212. package/src/modules-webgl1/lighting/pbr/pbr-fragment-glsl.ts +1 -2
  213. package/src/modules-webgl1/lighting/pbr/pbr-vertex-glsl.ts +1 -3
  214. package/src/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.ts +1 -3
  215. package/src/modules-webgl1/math/fp64/fp64-arithmetic-glsl.ts +1 -3
  216. package/src/modules-webgl1/math/fp64/fp64-functions-glsl.ts +1 -3
  217. package/src/modules-webgl1/project/project.ts +1 -2
  218. package/dist/lib/glsl-utils/highlight.d.ts +0 -6
  219. package/dist/lib/glsl-utils/highlight.d.ts.map +0 -1
  220. package/dist/lib/glsl-utils/highlight.js +0 -9
  221. package/dist/lib/shader-assembly/resolve-modules.d.ts +0 -40
  222. package/dist/lib/shader-assembly/resolve-modules.d.ts.map +0 -1
  223. package/dist/lib/shader-module/normalize-shader-module.d.ts +0 -3
  224. package/dist/lib/shader-module/normalize-shader-module.d.ts.map +0 -1
  225. package/dist/lib/shader-module/normalize-shader-module.js +0 -14
  226. package/dist/lib/shader-module/shader-module-instance.d.ts +0 -28
  227. package/dist/lib/shader-module/shader-module-instance.d.ts.map +0 -1
  228. package/dist/lib/shader-module/shader-module-instance.js +0 -126
  229. package/src/lib/glsl-utils/highlight.ts +0 -11
  230. package/src/lib/shader-assembly/resolve-modules.ts +0 -81
  231. package/src/lib/shader-module/normalize-shader-module.ts +0 -17
  232. package/src/lib/shader-module/shader-module-instance.ts +0 -167
@@ -18,14 +18,17 @@ export type PhongMaterialUniforms = {
18
18
 
19
19
  /** In Phong shading, the normal vector is linearly interpolated across the surface of the polygon from the polygon's vertex normals. */
20
20
  export const phongMaterial = {
21
+ props: {} as PhongMaterialProps,
22
+ uniforms: {} as PhongMaterialUniforms,
23
+
21
24
  name: 'phong-lighting',
25
+ dependencies: [lighting],
22
26
  // Note these are switched between phong and gouraud
23
27
  vs: PHONG_VS,
24
28
  fs: PHONG_FS,
25
29
  defines: {
26
30
  LIGHTING_FRAGMENT: 1
27
31
  },
28
- dependencies: [lighting],
29
32
  uniformTypes: {
30
33
  ambient: 'f32',
31
34
  diffuse: 'f32',
@@ -38,8 +41,6 @@ export const phongMaterial = {
38
41
  shininess: 32,
39
42
  specularColor: [0.15, 0.15, 0.15]
40
43
  },
41
- props: {} as Required<PhongMaterialProps>,
42
- uniforms: {} as PhongMaterialUniforms,
43
44
  getUniforms(props?: PhongMaterialProps): PhongMaterialUniforms {
44
45
  return {...phongMaterial.defaultUniforms, ...props};
45
46
  }
@@ -2,9 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {glsl} from '../../../lib/glsl-utils/highlight';
6
-
7
- export const PHONG_VS = glsl`\
5
+ export const PHONG_VS = /* glsl */ `\
8
6
  uniform phongMaterialUniforms {
9
7
  uniform float ambient;
10
8
  uniform float diffuse;
@@ -13,7 +11,7 @@ uniform phongMaterialUniforms {
13
11
  } material;
14
12
  `;
15
13
 
16
- export const PHONG_FS = glsl`\
14
+ export const PHONG_FS = /* glsl */ `\
17
15
  uniform phongMaterialUniforms {
18
16
  uniform float ambient;
19
17
  uniform float diffuse;
@@ -2,10 +2,9 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {glsl} from '../../../lib/glsl-utils/highlight';
6
5
  // import {ShaderModule} from '../../types';
7
6
 
8
- const fp32shader = glsl`\
7
+ const fp32shader = /* glsl */ `\
9
8
  #ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
10
9
 
11
10
  // All these functions are for substituting tan() function from Intel GPU only
@@ -2,10 +2,9 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {glsl} from '../../../lib/glsl-utils/highlight';
6
5
  import {ShaderModule} from '../../../lib/shader-module/shader-module';
7
6
 
8
- const fs = glsl`\
7
+ const fs = /* glsl */ `\
9
8
  float random(vec3 scale, float seed) {
10
9
  /* use the fragment position for a different seed per-pixel */
11
10
  return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
@@ -2,15 +2,13 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {glsl} from '../lib/glsl-utils/highlight';
6
-
7
- export const MODULE_INJECTORS_VS = glsl`\
5
+ export const MODULE_INJECTORS_VS = /* glsl */ `\
8
6
  #ifdef MODULE_LOGDEPTH
9
7
  logdepth_adjustPosition(gl_Position);
10
8
  #endif
11
9
  `;
12
10
 
13
- export const MODULE_INJECTORS_FS = glsl`\
11
+ export const MODULE_INJECTORS_FS = /* glsl */ `\
14
12
  #ifdef MODULE_MATERIAL
15
13
  gl_FragColor = material_filterColor(gl_FragColor);
16
14
  #endif
@@ -3,9 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
- const fs = glsl`\
7
+ const fs = /* glsl */ `\
9
8
 
10
9
  uniform brightnessContrastUniforms {
11
10
  float brightness;
@@ -32,6 +31,8 @@ export type BrightnessContrastProps = {
32
31
  contrast?: number;
33
32
  };
34
33
 
34
+ export type BrightnessContrastUniforms = BrightnessContrastProps;
35
+
35
36
  /**
36
37
  * Brightness / Contrast -
37
38
  * Provides additive brightness and multiplicative contrast control.
@@ -39,6 +40,9 @@ export type BrightnessContrastProps = {
39
40
  * @param contrast -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
40
41
  */
41
42
  export const brightnessContrast = {
43
+ props: {} as BrightnessContrastProps,
44
+ uniforms: {} as BrightnessContrastUniforms,
45
+
42
46
  name: 'brightnessContrast',
43
47
  uniformTypes: {
44
48
  brightness: 'f32',
@@ -3,10 +3,9 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
7
  // Do a 9x9 bilateral box filter
9
- const fs = glsl`\
8
+ const fs = /* glsl */ `\
10
9
  uniform denoiseUniforms {
11
10
  float strength;
12
11
  } noise;
@@ -45,12 +44,17 @@ export type DenoiseProps = {
45
44
  strength?: number;
46
45
  };
47
46
 
47
+ export type DenoiseUniforms = DenoiseProps;
48
+
48
49
  /**
49
50
  * Denoise -
50
51
  * Smooths over grainy noise in dark images using an 9x9 box filter
51
52
  * weighted by color intensity, similar to a bilateral filter.
52
53
  */
53
54
  export const denoise = {
55
+ props: {} as DenoiseProps,
56
+ uniforms: {} as DenoiseUniforms,
57
+
54
58
  name: 'denoise',
55
59
  uniformTypes: {
56
60
  strength: 'f32'
@@ -61,4 +65,4 @@ export const denoise = {
61
65
  },
62
66
  fs,
63
67
  passes: [{sampler: true}, {sampler: true}]
64
- } as const satisfies ShaderPass<DenoiseProps>;
68
+ } as const satisfies ShaderPass<DenoiseProps, DenoiseUniforms>;
@@ -3,9 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
- const fs = glsl`\
7
+ const fs = /* glsl */ `\
9
8
  uniform hueSaturationUniforms {
10
9
  float hue;
11
10
  float saturation;
@@ -46,10 +45,12 @@ export type HueSaturationProps = {
46
45
  /** -1 to 1 (-1 is 180 degree rotation in the negative direction, 0 is no change,
47
46
  * and 1 is 180 degree rotation in the positive direction) */
48
47
  hue?: number;
49
- /** @param saturation -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) */
48
+ /** -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) */
50
49
  saturation?: number;
51
50
  };
52
51
 
52
+ export type HueSaturationUniforms = HueSaturationProps;
53
+
53
54
  /**
54
55
  * Hue / Saturation
55
56
  * Provides rotational hue and multiplicative saturation control. RGB color space
@@ -60,7 +61,12 @@ export type HueSaturationProps = {
60
61
  * or away from the average color channel value.
61
62
  */
62
63
  export const hueSaturation = {
64
+ props: {} as HueSaturationProps,
65
+ uniforms: {} as HueSaturationUniforms,
66
+
63
67
  name: 'hueSaturation',
68
+ fs,
69
+
64
70
  uniformTypes: {
65
71
  hue: 'f32',
66
72
  saturation: 'f32'
@@ -69,6 +75,5 @@ export const hueSaturation = {
69
75
  hue: {value: 0, min: -1, max: 1},
70
76
  saturation: {value: 0, min: -1, max: 1}
71
77
  },
72
- fs,
73
78
  passes: [{filter: true}]
74
79
  } as const satisfies ShaderPass<HueSaturationProps>;
@@ -3,9 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
- const fs = glsl`\
7
+ const fs = /* glsl */ `\
9
8
  uniform noiseUniforms {
10
9
  float amount;
11
10
  } noise;
@@ -35,11 +34,16 @@ export type NoiseProps = {
35
34
  amount?: number;
36
35
  };
37
36
 
37
+ export type NoiseUniforms = NoiseProps;
38
+
38
39
  /**
39
40
  * Noise
40
41
  * Adds black and white noise to the image.
41
42
  */
42
43
  export const noise = {
44
+ props: {} as NoiseProps,
45
+ uniforms: {} as NoiseUniforms,
46
+
43
47
  name: 'noise',
44
48
  uniformTypes: {
45
49
  amount: 'f32'
@@ -3,9 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
- const fs = glsl`\
7
+ const fs = /* glsl */ `\
9
8
  uniform sepiaUniforms {
10
9
  float amount;
11
10
  } sepia;
@@ -32,12 +31,17 @@ export type SepiaProps = {
32
31
  amount?: number;
33
32
  };
34
33
 
34
+ export type SepiaUniforms = SepiaProps;
35
+
35
36
  /**
36
37
  * @filter Sepia
37
38
  * @description Gives the image a reddish-brown monochrome tint that imitates an old photograph.
38
39
  * @param amount 0 to 1 (0 for no effect, 1 for full sepia coloring)
39
40
  */
40
41
  export const sepia = {
42
+ props: {} as SepiaProps,
43
+ uniforms: {} as SepiaUniforms,
44
+
41
45
  name: 'sepia',
42
46
  uniformTypes: {
43
47
  amount: 'f32'
@@ -3,9 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
- const fs = glsl`\
7
+ const fs = /* glsl */ `\
9
8
  uniform vibranceUniforms {
10
9
  float amount;
11
10
  } vibrance;
@@ -31,8 +30,12 @@ export type VibranceProps = {
31
30
  amount?: number;
32
31
  };
33
32
 
33
+ export type VibranceUniforms = VibranceProps;
34
+
34
35
  /** Vibrance - Modifies the saturation of desaturated colors, leaving saturated colors unmodified. */
35
36
  export const vibrance = {
37
+ props: {} as VibranceProps,
38
+ uniforms: {} as VibranceUniforms,
36
39
  name: 'vibrance',
37
40
  uniformPropTypes: {
38
41
  amount: {value: 0, min: -1, max: 1}
@@ -3,9 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
- const fs = glsl`\
7
+ const fs = /* glsl */ `\
9
8
  uniform vignetteUniforms {
10
9
  float radius;
11
10
  float amount;
@@ -32,13 +31,18 @@ export type VignetteProps = {
32
31
  amount?: number;
33
32
  };
34
33
 
34
+ export type VignetteUniforms = VignetteProps;
35
+
35
36
  /**
36
37
  * Vignette -
37
38
  * Adds a simulated lens edge darkening effect.
38
39
  */
39
40
  export const vignette = {
41
+ props: {} as VignetteProps,
42
+ uniforms: {} as VignetteUniforms,
43
+
40
44
  name: 'vignette',
41
- fs,
45
+
42
46
  uniformTypes: {
43
47
  radius: 'f32',
44
48
  amount: 'f32'
@@ -47,5 +51,8 @@ export const vignette = {
47
51
  radius: {value: 0.5, min: 0, max: 1},
48
52
  amount: {value: 0.5, min: 0, max: 1}
49
53
  },
50
- passes: [{filter: true}]
54
+
55
+ passes: [{filter: true}],
56
+
57
+ fs
51
58
  } as const satisfies ShaderPass<VignetteProps, VignetteProps>;
@@ -2,11 +2,10 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {glsl} from '../../../lib/glsl-utils/highlight';
6
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
7
6
  import {random} from '../..//math/random/random';
8
7
 
9
- const fs = glsl`\
8
+ const fs = /* glsl */ `\
10
9
  uniform tiltShiftUniforms {
11
10
  float blurRadius;
12
11
  float gradientRadius;
@@ -69,6 +68,8 @@ export type TiltShiftProps = {
69
68
  invert?: number;
70
69
  };
71
70
 
71
+ export type TiltShiftUniforms = TiltShiftProps;
72
+
72
73
  /**
73
74
  * Tilt Shift
74
75
  * Simulates the shallow depth of field normally encountered in close-up
@@ -81,6 +82,9 @@ export type TiltShiftProps = {
81
82
  * on the line and increases further from the line.
82
83
  */
83
84
  export const tiltShift = {
85
+ props: {} as TiltShiftProps,
86
+ uniforms: {} as TiltShiftUniforms,
87
+
84
88
  name: 'tiltShift',
85
89
  dependencies: [random],
86
90
  uniformTypes: {
@@ -3,10 +3,9 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
  import {random} from '../..//math/random/random';
8
7
 
9
- const fs = glsl`\
8
+ const fs = /* glsl */ `\
10
9
  uniform triangleBlurUniforms {
11
10
  float radius;
12
11
  vec2 delta;
@@ -55,6 +54,8 @@ export type TriangleBlurProps = {
55
54
  delta?: number[];
56
55
  };
57
56
 
57
+ export type TriangleBlurUniforms = TriangleBlurProps;
58
+
58
59
  /**
59
60
  * @filter Triangle Blur
60
61
  * @description This is the most basic blur filter, which convolves the image with a
@@ -62,6 +63,9 @@ export type TriangleBlurProps = {
62
63
  * perpendicular triangle filters.
63
64
  */
64
65
  export const triangleBlur = {
66
+ props: {} as TriangleBlurProps,
67
+ uniforms: {} as TriangleBlurUniforms,
68
+
65
69
  name: 'triangleBlur',
66
70
  uniformTypes: {
67
71
  radius: 'f32',
@@ -50,11 +50,16 @@ export type ZoomBlurProps = {
50
50
  strength?: number;
51
51
  };
52
52
 
53
+ export type ZoomBlurUniforms = ZoomBlurProps;
54
+
53
55
  /**
54
56
  * Zoom Blur
55
57
  * Blurs the image away from a certain point, which looks like radial motion blur.
56
58
  */
57
59
  export const zoomBlur = {
60
+ props: {} as ZoomBlurProps,
61
+ uniforms: {} as ZoomBlurUniforms,
62
+
58
63
  name: 'zoomBlur',
59
64
  uniformTypes: {
60
65
  center: 'vec2<f32>',
@@ -3,10 +3,9 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
7
  // TODO pass texCoord to angle
9
- const fs = glsl`\
8
+ const fs = /* glsl */ `\
10
9
  uniform colorHalftoneUniforms {
11
10
  vec2 center;
12
11
  float angle;
@@ -58,6 +57,8 @@ export type ColorHalftoneProps = {
58
57
  size?: number;
59
58
  };
60
59
 
60
+ export type ColorHalftoneUniforms = ColorHalftoneProps;
61
+
61
62
  /**
62
63
  * Color Halftone -
63
64
  * Simulates a CMYK halftone rendering of the image by multiplying pixel values
@@ -65,6 +66,9 @@ export type ColorHalftoneProps = {
65
66
  * and black.
66
67
  */
67
68
  export const colorHalftone = {
69
+ props: {} as ColorHalftoneProps,
70
+ uniforms: {} as ColorHalftoneUniforms,
71
+
68
72
  name: 'colorHalftone',
69
73
  uniformTypes: {
70
74
  center: 'vec2<f32>',
@@ -3,9 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
- const fs = glsl`\
7
+ const fs = /* glsl */ `\
9
8
  uniform dotScreenUniforms {
10
9
  vec2 center;
11
10
  float angle;
@@ -44,12 +43,17 @@ export type DotScreenProps = {
44
43
  size?: number;
45
44
  };
46
45
 
46
+ export type DotScreenUniforms = DotScreenProps;
47
+
47
48
  /**
48
49
  * Dot Screen -
49
50
  * Simulates a black and white halftone rendering of the image by multiplying
50
51
  * pixel values with a rotated 2D sine wave pattern.
51
52
  */
52
53
  export const dotScreen = {
54
+ props: {} as DotScreenProps,
55
+ uniforms: {} as DotScreenUniforms,
56
+
53
57
  name: 'dotScreen',
54
58
  uniformTypes: {
55
59
  center: 'vec2<f32>',
@@ -3,10 +3,9 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
  import {random} from '../../math/random/random';
8
7
 
9
- const fs = glsl`\
8
+ const fs = /* glsl */ `\
10
9
  uniform edgeWorkUniforms {
11
10
  float radius;
12
11
  vec2 delta;
@@ -75,19 +74,26 @@ export type EdgeWorkProps = {
75
74
  delta?: number;
76
75
  };
77
76
 
77
+ export type EdgeWorkUniforms = EdgeWorkProps;
78
+
78
79
  /**
79
80
  * Edge Work -
80
81
  * Picks out different frequencies in the image by subtracting two
81
82
  * copies of the image blurred with different radii.
82
83
  */
83
84
  export const edgeWork = {
85
+ props: {} as EdgeWorkProps,
86
+ uniforms: {} as EdgeWorkProps,
87
+
84
88
  name: 'edgeWork',
89
+ dependencies: [random],
90
+ fs,
91
+
85
92
  uniformPropTypes: {
86
93
  radius: {value: 2, min: 1, softMax: 50},
87
94
  delta: {value: [1, 0], private: true}
88
95
  },
89
- fs,
90
- dependencies: [random],
96
+
91
97
  passes: [
92
98
  {
93
99
  // @ts-expect-error
@@ -3,9 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
- const fs = glsl`\
7
+ const fs = /* glsl */ `\
9
8
  uniform hexagonalPixelateUniforms {
10
9
  vec2 center;
11
10
  float scale;
@@ -62,12 +61,17 @@ export type HexagonalPixelateProps = {
62
61
  scale?: number;
63
62
  };
64
63
 
64
+ export type HexagonalPixelateUniforms = HexagonalPixelateProps;
65
+
65
66
  /**
66
67
  * Hexagonal Pixelate
67
68
  * Renders the image using a pattern of hexagonal tiles. Tile colors
68
69
  * are nearest-neighbor sampled from the centers of the tiles.
69
70
  */
70
71
  export const hexagonalPixelate = {
72
+ props: {} as HexagonalPixelateProps,
73
+ uniforms: {} as HexagonalPixelateUniforms,
74
+
71
75
  name: 'hexagonalPixelate',
72
76
  uniformTypes: {
73
77
  center: 'vec2<f32>',
@@ -3,9 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
- const fs = glsl`\
7
+ const fs = /* glsl */ `\
9
8
  uniform inkUniforms {
10
9
  float strength;
11
10
  } ink;
@@ -49,6 +48,8 @@ export type InkProps = {
49
48
  strength?: number;
50
49
  };
51
50
 
51
+ export type InkUniforms = InkProps;
52
+
52
53
  /**
53
54
  * Ink -
54
55
  * Simulates outlining the image in ink by darkening edges stronger than a
@@ -56,13 +57,17 @@ export type InkProps = {
56
57
  * copies of the image, each blurred using a blur of a different radius.
57
58
  */
58
59
  export const ink = {
60
+ props: {} as InkProps,
61
+ uniforms: {} as InkUniforms,
62
+
59
63
  name: 'ink',
64
+ fs,
65
+
60
66
  uniformTypes: {
61
67
  strength: 'f32'
62
68
  },
63
69
  uniformPropTypes: {
64
70
  strength: {value: 0.25, min: 0, softMax: 1}
65
71
  },
66
- fs,
67
72
  passes: [{sampler: true}]
68
73
  } as const satisfies ShaderPass<InkProps, InkProps>;
@@ -3,9 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
 
8
- const fs = glsl`\
7
+ const fs = /* glsl */ `\
9
8
  uniform magnifyUniforms {
10
9
  vec2 screenXY;
11
10
  float radiusPixels;
@@ -44,6 +43,8 @@ export type MagnifyProps = {
44
43
  borderColor?: number[];
45
44
  };
46
45
 
46
+ export type MagnifyUniforms = MagnifyProps;
47
+
47
48
  /**
48
49
  * Magnify - display a circle with magnify effect applied to surrounding the pixels given position
49
50
  */
@@ -3,10 +3,9 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
  import {warp} from './warp';
8
7
 
9
- const fs = glsl`\
8
+ const fs = /* glsl */ `\
10
9
  uniform bulgePinchUniforms {
11
10
  float radius;
12
11
  float strength;
@@ -46,11 +45,16 @@ export type BulgePinchProps = {
46
45
  strength?: number;
47
46
  };
48
47
 
48
+ export type BulgePinchUniforms = BulgePinchProps;
49
+
49
50
  /**
50
51
  * Bulge / Pinch -
51
52
  * Bulges or pinches the image in a circle.
52
53
  */
53
54
  export const bulgePinch = {
55
+ props: {} as BulgePinchProps,
56
+ uniforms: {} as BulgePinchUniforms,
57
+
54
58
  name: 'bulgePinch',
55
59
  dependencies: [warp],
56
60
  fs,
@@ -3,10 +3,9 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {ShaderPass} from '../../../lib/shader-module/shader-pass';
6
- import {glsl} from '../../../lib/glsl-utils/highlight';
7
6
  import {warp} from './warp';
8
7
 
9
- const fs = glsl`\
8
+ const fs = /* glsl */ `\
10
9
  uniform swirlUniforms {
11
10
  float radius;
12
11
  float angle;
@@ -50,13 +49,19 @@ export type SwirlProps = {
50
49
  angle?: number;
51
50
  };
52
51
 
52
+ export type SwirlUniforms = SwirlProps;
53
+
53
54
  /**
54
55
  * Warps a circular region of the image in a swirl.
55
56
  */
56
57
  export const swirl = {
58
+ props: {} as SwirlProps,
59
+ uniforms: {} as SwirlProps,
60
+
57
61
  name: 'swirl',
58
62
  dependencies: [warp],
59
63
  fs,
64
+
60
65
  uniformTypes: {
61
66
  center: 'vec2<f32>',
62
67
  radius: 'f32',
@@ -67,5 +72,6 @@ export const swirl = {
67
72
  radius: {value: 200, min: 1, softMax: 600},
68
73
  angle: {value: 3, softMin: -25, softMax: 25}
69
74
  },
75
+
70
76
  passes: [{sampler: true}]
71
77
  } as const satisfies ShaderPass<SwirlProps, SwirlProps>;