@luma.gl/shaders 0.0.0-stage → 10.0.0-alpha.5

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 (692) hide show
  1. package/README.md +25 -2
  2. package/dist/dist.dev.js +19686 -0
  3. package/dist/dist.min.js +12180 -0
  4. package/dist/glsl.cjs +33 -0
  5. package/dist/glsl.cjs.map +6 -0
  6. package/dist/glsl.d.ts +6 -0
  7. package/dist/glsl.d.ts.map +1 -0
  8. package/dist/glsl.js +7 -0
  9. package/dist/glsl.js.map +1 -0
  10. package/dist/index.cjs +243 -0
  11. package/dist/index.cjs.map +6 -0
  12. package/dist/index.d.ts +91 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +65 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/lib/color/normalize-byte-colors.cjs +50 -0
  17. package/dist/lib/color/normalize-byte-colors.d.ts +23 -0
  18. package/dist/lib/color/normalize-byte-colors.d.ts.map +1 -0
  19. package/dist/lib/color/normalize-byte-colors.js +42 -0
  20. package/dist/lib/color/normalize-byte-colors.js.map +1 -0
  21. package/dist/lib/filters/prop-types.cjs +90 -0
  22. package/dist/lib/filters/prop-types.d.ts +44 -0
  23. package/dist/lib/filters/prop-types.d.ts.map +1 -0
  24. package/dist/lib/filters/prop-types.js +96 -0
  25. package/dist/lib/filters/prop-types.js.map +1 -0
  26. package/dist/lib/glsl-shader-assembler.cjs +50 -0
  27. package/dist/lib/glsl-shader-assembler.d.ts +19 -0
  28. package/dist/lib/glsl-shader-assembler.d.ts.map +1 -0
  29. package/dist/lib/glsl-shader-assembler.js +29 -0
  30. package/dist/lib/glsl-shader-assembler.js.map +1 -0
  31. package/dist/lib/glsl-utils/get-shader-info.cjs +52 -0
  32. package/dist/lib/glsl-utils/get-shader-info.d.ts +9 -0
  33. package/dist/lib/glsl-utils/get-shader-info.d.ts.map +1 -0
  34. package/dist/lib/glsl-utils/get-shader-info.js +33 -0
  35. package/dist/lib/glsl-utils/get-shader-info.js.map +1 -0
  36. package/dist/lib/glsl-utils/shader-utils.cjs +126 -0
  37. package/dist/lib/glsl-utils/shader-utils.d.ts +23 -0
  38. package/dist/lib/glsl-utils/shader-utils.d.ts.map +1 -0
  39. package/dist/lib/glsl-utils/shader-utils.js +92 -0
  40. package/dist/lib/glsl-utils/shader-utils.js.map +1 -0
  41. package/dist/lib/preprocessor/preprocessor.cjs +107 -0
  42. package/dist/lib/preprocessor/preprocessor.d.ts +15 -0
  43. package/dist/lib/preprocessor/preprocessor.d.ts.map +1 -0
  44. package/dist/lib/preprocessor/preprocessor.js +99 -0
  45. package/dist/lib/preprocessor/preprocessor.js.map +1 -0
  46. package/dist/lib/shader-assembler-base.cjs +133 -0
  47. package/dist/lib/shader-assembler-base.d.ts +52 -0
  48. package/dist/lib/shader-assembler-base.d.ts.map +1 -0
  49. package/dist/lib/shader-assembler-base.js +128 -0
  50. package/dist/lib/shader-assembler-base.js.map +1 -0
  51. package/dist/lib/shader-assembler.cjs +33 -0
  52. package/dist/lib/shader-assembler.d.ts +4 -0
  53. package/dist/lib/shader-assembler.d.ts.map +1 -0
  54. package/dist/lib/shader-assembler.js +7 -0
  55. package/dist/lib/shader-assembler.js.map +1 -0
  56. package/dist/lib/shader-assembly/assemble-glsl-shaders.cjs +200 -0
  57. package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts +69 -0
  58. package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts.map +1 -0
  59. package/dist/lib/shader-assembly/assemble-glsl-shaders.js +221 -0
  60. package/dist/lib/shader-assembly/assemble-glsl-shaders.js.map +1 -0
  61. package/dist/lib/shader-assembly/assemble-shaders.cjs +42 -0
  62. package/dist/lib/shader-assembly/assemble-shaders.d.ts +10 -0
  63. package/dist/lib/shader-assembly/assemble-shaders.d.ts.map +1 -0
  64. package/dist/lib/shader-assembly/assemble-shaders.js +10 -0
  65. package/dist/lib/shader-assembly/assemble-shaders.js.map +1 -0
  66. package/dist/lib/shader-assembly/assemble-wgsl-shaders.cjs +501 -0
  67. package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts +71 -0
  68. package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts.map +1 -0
  69. package/dist/lib/shader-assembly/assemble-wgsl-shaders.js +473 -0
  70. package/dist/lib/shader-assembly/assemble-wgsl-shaders.js.map +1 -0
  71. package/dist/lib/shader-assembly/platform-defines.cjs +79 -0
  72. package/dist/lib/shader-assembly/platform-defines.d.ts +4 -0
  73. package/dist/lib/shader-assembly/platform-defines.d.ts.map +1 -0
  74. package/dist/lib/shader-assembly/platform-defines.js +52 -0
  75. package/dist/lib/shader-assembly/platform-defines.js.map +1 -0
  76. package/dist/lib/shader-assembly/platform-info.cjs +15 -0
  77. package/dist/lib/shader-assembly/platform-info.d.ts +20 -0
  78. package/dist/lib/shader-assembly/platform-info.d.ts.map +1 -0
  79. package/dist/lib/shader-assembly/platform-info.js +5 -0
  80. package/dist/lib/shader-assembly/platform-info.js.map +1 -0
  81. package/dist/lib/shader-assembly/shader-assembly-shared.cjs +96 -0
  82. package/dist/lib/shader-assembly/shader-assembly-shared.d.ts +16 -0
  83. package/dist/lib/shader-assembly/shader-assembly-shared.d.ts.map +1 -0
  84. package/dist/lib/shader-assembly/shader-assembly-shared.js +79 -0
  85. package/dist/lib/shader-assembly/shader-assembly-shared.js.map +1 -0
  86. package/dist/lib/shader-assembly/shader-assembly-types.cjs +15 -0
  87. package/dist/lib/shader-assembly/shader-assembly-types.d.ts +128 -0
  88. package/dist/lib/shader-assembly/shader-assembly-types.d.ts.map +1 -0
  89. package/dist/lib/shader-assembly/shader-assembly-types.js +5 -0
  90. package/dist/lib/shader-assembly/shader-assembly-types.js.map +1 -0
  91. package/dist/lib/shader-assembly/shader-hooks.cjs +103 -0
  92. package/dist/lib/shader-assembly/shader-hooks.d.ts +45 -0
  93. package/dist/lib/shader-assembly/shader-hooks.d.ts.map +1 -0
  94. package/dist/lib/shader-assembly/shader-hooks.js +84 -0
  95. package/dist/lib/shader-assembly/shader-hooks.js.map +1 -0
  96. package/dist/lib/shader-assembly/shader-injections.cjs +180 -0
  97. package/dist/lib/shader-assembly/shader-injections.d.ts +34 -0
  98. package/dist/lib/shader-assembly/shader-injections.d.ts.map +1 -0
  99. package/dist/lib/shader-assembly/shader-injections.js +183 -0
  100. package/dist/lib/shader-assembly/shader-injections.js.map +1 -0
  101. package/dist/lib/shader-assembly/shader-plugin-varyings.cjs +417 -0
  102. package/dist/lib/shader-assembly/shader-plugin-varyings.d.ts +15 -0
  103. package/dist/lib/shader-assembly/shader-plugin-varyings.d.ts.map +1 -0
  104. package/dist/lib/shader-assembly/shader-plugin-varyings.js +412 -0
  105. package/dist/lib/shader-assembly/shader-plugin-varyings.js.map +1 -0
  106. package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.cjs +254 -0
  107. package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.d.ts +12 -0
  108. package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.d.ts.map +1 -0
  109. package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.js +237 -0
  110. package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.js.map +1 -0
  111. package/dist/lib/shader-assembly/wgsl-binding-debug.cjs +166 -0
  112. package/dist/lib/shader-assembly/wgsl-binding-debug.d.ts +37 -0
  113. package/dist/lib/shader-assembly/wgsl-binding-debug.d.ts.map +1 -0
  114. package/dist/lib/shader-assembly/wgsl-binding-debug.js +144 -0
  115. package/dist/lib/shader-assembly/wgsl-binding-debug.js.map +1 -0
  116. package/dist/lib/shader-assembly/wgsl-binding-scan.cjs +184 -0
  117. package/dist/lib/shader-assembly/wgsl-binding-scan.d.ts +19 -0
  118. package/dist/lib/shader-assembly/wgsl-binding-scan.d.ts.map +1 -0
  119. package/dist/lib/shader-assembly/wgsl-binding-scan.js +151 -0
  120. package/dist/lib/shader-assembly/wgsl-binding-scan.js.map +1 -0
  121. package/dist/lib/shader-assembly/wgsl-interface-scan.cjs +502 -0
  122. package/dist/lib/shader-assembly/wgsl-interface-scan.d.ts +14 -0
  123. package/dist/lib/shader-assembly/wgsl-interface-scan.d.ts.map +1 -0
  124. package/dist/lib/shader-assembly/wgsl-interface-scan.js +498 -0
  125. package/dist/lib/shader-assembly/wgsl-interface-scan.js.map +1 -0
  126. package/dist/lib/shader-generator/generate-shader.cjs +36 -0
  127. package/dist/lib/shader-generator/generate-shader.d.ts +8 -0
  128. package/dist/lib/shader-generator/generate-shader.d.ts.map +1 -0
  129. package/dist/lib/shader-generator/generate-shader.js +15 -0
  130. package/dist/lib/shader-generator/generate-shader.js.map +1 -0
  131. package/dist/lib/shader-generator/glsl/generate-glsl.cjs +94 -0
  132. package/dist/lib/shader-generator/glsl/generate-glsl.d.ts +7 -0
  133. package/dist/lib/shader-generator/glsl/generate-glsl.d.ts.map +1 -0
  134. package/dist/lib/shader-generator/glsl/generate-glsl.js +79 -0
  135. package/dist/lib/shader-generator/glsl/generate-glsl.js.map +1 -0
  136. package/dist/lib/shader-generator/utils/capitalize.cjs +29 -0
  137. package/dist/lib/shader-generator/utils/capitalize.d.ts +7 -0
  138. package/dist/lib/shader-generator/utils/capitalize.d.ts.map +1 -0
  139. package/dist/lib/shader-generator/utils/capitalize.js +12 -0
  140. package/dist/lib/shader-generator/utils/capitalize.js.map +1 -0
  141. package/dist/lib/shader-generator/wgsl/generate-wgsl.cjs +46 -0
  142. package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts +7 -0
  143. package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts.map +1 -0
  144. package/dist/lib/shader-generator/wgsl/generate-wgsl.js +23 -0
  145. package/dist/lib/shader-generator/wgsl/generate-wgsl.js.map +1 -0
  146. package/dist/lib/shader-module/composite-shader-pass.cjs +15 -0
  147. package/dist/lib/shader-module/composite-shader-pass.d.ts +41 -0
  148. package/dist/lib/shader-module/composite-shader-pass.d.ts.map +1 -0
  149. package/dist/lib/shader-module/composite-shader-pass.js +5 -0
  150. package/dist/lib/shader-module/composite-shader-pass.js.map +1 -0
  151. package/dist/lib/shader-module/shader-module-dependencies.cjs +83 -0
  152. package/dist/lib/shader-module/shader-module-dependencies.d.ts +39 -0
  153. package/dist/lib/shader-module/shader-module-dependencies.d.ts.map +1 -0
  154. package/dist/lib/shader-module/shader-module-dependencies.js +103 -0
  155. package/dist/lib/shader-module/shader-module-dependencies.js.map +1 -0
  156. package/dist/lib/shader-module/shader-module-uniform-layout.cjs +224 -0
  157. package/dist/lib/shader-module/shader-module-uniform-layout.d.ts +91 -0
  158. package/dist/lib/shader-module/shader-module-uniform-layout.d.ts.map +1 -0
  159. package/dist/lib/shader-module/shader-module-uniform-layout.js +253 -0
  160. package/dist/lib/shader-module/shader-module-uniform-layout.js.map +1 -0
  161. package/dist/lib/shader-module/shader-module.cjs +105 -0
  162. package/dist/lib/shader-module/shader-module.d.ts +98 -0
  163. package/dist/lib/shader-module/shader-module.d.ts.map +1 -0
  164. package/dist/lib/shader-module/shader-module.js +104 -0
  165. package/dist/lib/shader-module/shader-module.js.map +1 -0
  166. package/dist/lib/shader-module/shader-pass.cjs +15 -0
  167. package/dist/lib/shader-module/shader-pass.d.ts +48 -0
  168. package/dist/lib/shader-module/shader-pass.d.ts.map +1 -0
  169. package/dist/lib/shader-module/shader-pass.js +5 -0
  170. package/dist/lib/shader-module/shader-pass.js.map +1 -0
  171. package/dist/lib/shader-plugin.cjs +117 -0
  172. package/dist/lib/shader-plugin.d.ts +68 -0
  173. package/dist/lib/shader-plugin.d.ts.map +1 -0
  174. package/dist/lib/shader-plugin.js +98 -0
  175. package/dist/lib/shader-plugin.js.map +1 -0
  176. package/dist/lib/shader-transpiler/shader-transpiler.cjs +15 -0
  177. package/dist/lib/shader-transpiler/shader-transpiler.d.ts +27 -0
  178. package/dist/lib/shader-transpiler/shader-transpiler.d.ts.map +1 -0
  179. package/dist/lib/shader-transpiler/shader-transpiler.js +5 -0
  180. package/dist/lib/shader-transpiler/shader-transpiler.js.map +1 -0
  181. package/dist/lib/shader-transpiler/transpile-glsl-shader.cjs +71 -0
  182. package/dist/lib/shader-transpiler/transpile-glsl-shader.d.ts +9 -0
  183. package/dist/lib/shader-transpiler/transpile-glsl-shader.d.ts.map +1 -0
  184. package/dist/lib/shader-transpiler/transpile-glsl-shader.js +69 -0
  185. package/dist/lib/shader-transpiler/transpile-glsl-shader.js.map +1 -0
  186. package/dist/lib/utils/assert.cjs +34 -0
  187. package/dist/lib/utils/assert.d.ts +2 -0
  188. package/dist/lib/utils/assert.d.ts.map +1 -0
  189. package/dist/lib/utils/assert.js +13 -0
  190. package/dist/lib/utils/assert.js.map +1 -0
  191. package/dist/lib/utils/uniform-types.cjs +15 -0
  192. package/dist/lib/utils/uniform-types.d.ts +18 -0
  193. package/dist/lib/utils/uniform-types.d.ts.map +1 -0
  194. package/dist/lib/utils/uniform-types.js +5 -0
  195. package/dist/lib/utils/uniform-types.js.map +1 -0
  196. package/dist/lib/wgsl-shader-assembler.cjs +99 -0
  197. package/dist/lib/wgsl-shader-assembler.d.ts +34 -0
  198. package/dist/lib/wgsl-shader-assembler.d.ts.map +1 -0
  199. package/dist/lib/wgsl-shader-assembler.js +84 -0
  200. package/dist/lib/wgsl-shader-assembler.js.map +1 -0
  201. package/dist/module-injectors.cjs +59 -0
  202. package/dist/module-injectors.d.ts +3 -0
  203. package/dist/module-injectors.d.ts.map +1 -0
  204. package/dist/module-injectors.js +31 -0
  205. package/dist/module-injectors.js.map +1 -0
  206. package/dist/modules/color/float-colors.cjs +275 -0
  207. package/dist/modules/color/float-colors.d.ts +132 -0
  208. package/dist/modules/color/float-colors.d.ts.map +1 -0
  209. package/dist/modules/color/float-colors.js +248 -0
  210. package/dist/modules/color/float-colors.js.map +1 -0
  211. package/dist/modules/engine/clip/clip.cjs +152 -0
  212. package/dist/modules/engine/clip/clip.d.ts +12 -0
  213. package/dist/modules/engine/clip/clip.d.ts.map +1 -0
  214. package/dist/modules/engine/clip/clip.js +129 -0
  215. package/dist/modules/engine/clip/clip.js.map +1 -0
  216. package/dist/modules/engine/filter/filter.cjs +111 -0
  217. package/dist/modules/engine/filter/filter.d.ts +12 -0
  218. package/dist/modules/engine/filter/filter.d.ts.map +1 -0
  219. package/dist/modules/engine/filter/filter.js +88 -0
  220. package/dist/modules/engine/filter/filter.js.map +1 -0
  221. package/dist/modules/engine/geometry/geometry.cjs +63 -0
  222. package/dist/modules/engine/geometry/geometry.d.ts +9 -0
  223. package/dist/modules/engine/geometry/geometry.d.ts.map +1 -0
  224. package/dist/modules/engine/geometry/geometry.js +42 -0
  225. package/dist/modules/engine/geometry/geometry.js.map +1 -0
  226. package/dist/modules/engine/gpu-animation/gpu-animation.cjs +255 -0
  227. package/dist/modules/engine/gpu-animation/gpu-animation.d.ts +34 -0
  228. package/dist/modules/engine/gpu-animation/gpu-animation.d.ts.map +1 -0
  229. package/dist/modules/engine/gpu-animation/gpu-animation.js +228 -0
  230. package/dist/modules/engine/gpu-animation/gpu-animation.js.map +1 -0
  231. package/dist/modules/engine/picking/picking.cjs +210 -0
  232. package/dist/modules/engine/picking/picking.d.ts +77 -0
  233. package/dist/modules/engine/picking/picking.d.ts.map +1 -0
  234. package/dist/modules/engine/picking/picking.js +198 -0
  235. package/dist/modules/engine/picking/picking.js.map +1 -0
  236. package/dist/modules/engine/project/project.cjs +138 -0
  237. package/dist/modules/engine/project/project.d.ts +39 -0
  238. package/dist/modules/engine/project/project.d.ts.map +1 -0
  239. package/dist/modules/engine/project/project.js +129 -0
  240. package/dist/modules/engine/project/project.js.map +1 -0
  241. package/dist/modules/engine/skin/skin.cjs +212 -0
  242. package/dist/modules/engine/skin/skin.d.ts +52 -0
  243. package/dist/modules/engine/skin/skin.d.ts.map +1 -0
  244. package/dist/modules/engine/skin/skin.js +179 -0
  245. package/dist/modules/engine/skin/skin.js.map +1 -0
  246. package/dist/modules/engine/transform/transform.cjs +72 -0
  247. package/dist/modules/engine/transform/transform.d.ts +6 -0
  248. package/dist/modules/engine/transform/transform.d.ts.map +1 -0
  249. package/dist/modules/engine/transform/transform.js +49 -0
  250. package/dist/modules/engine/transform/transform.js.map +1 -0
  251. package/dist/modules/geometry/path-dash/path-dash.cjs +93 -0
  252. package/dist/modules/geometry/path-dash/path-dash.d.ts +10 -0
  253. package/dist/modules/geometry/path-dash/path-dash.d.ts.map +1 -0
  254. package/dist/modules/geometry/path-dash/path-dash.js +66 -0
  255. package/dist/modules/geometry/path-dash/path-dash.js.map +1 -0
  256. package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.cjs +117 -0
  257. package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.d.ts +3 -0
  258. package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.d.ts.map +1 -0
  259. package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.js +87 -0
  260. package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.js.map +1 -0
  261. package/dist/modules/geometry/pattern-fill/pattern-fill.cjs +64 -0
  262. package/dist/modules/geometry/pattern-fill/pattern-fill.d.ts +14 -0
  263. package/dist/modules/geometry/pattern-fill/pattern-fill.d.ts.map +1 -0
  264. package/dist/modules/geometry/pattern-fill/pattern-fill.js +43 -0
  265. package/dist/modules/geometry/pattern-fill/pattern-fill.js.map +1 -0
  266. package/dist/modules/geometry/point-glow/point-glow.cjs +104 -0
  267. package/dist/modules/geometry/point-glow/point-glow.d.ts +11 -0
  268. package/dist/modules/geometry/point-glow/point-glow.d.ts.map +1 -0
  269. package/dist/modules/geometry/point-glow/point-glow.js +77 -0
  270. package/dist/modules/geometry/point-glow/point-glow.js.map +1 -0
  271. package/dist/modules/geometry/precipitation/precipitation.cjs +122 -0
  272. package/dist/modules/geometry/precipitation/precipitation.d.ts +40 -0
  273. package/dist/modules/geometry/precipitation/precipitation.d.ts.map +1 -0
  274. package/dist/modules/geometry/precipitation/precipitation.js +95 -0
  275. package/dist/modules/geometry/precipitation/precipitation.js.map +1 -0
  276. package/dist/modules/geometry/sketch-stroke/sketch-stroke.cjs +158 -0
  277. package/dist/modules/geometry/sketch-stroke/sketch-stroke.d.ts +60 -0
  278. package/dist/modules/geometry/sketch-stroke/sketch-stroke.d.ts.map +1 -0
  279. package/dist/modules/geometry/sketch-stroke/sketch-stroke.js +137 -0
  280. package/dist/modules/geometry/sketch-stroke/sketch-stroke.js.map +1 -0
  281. package/dist/modules/geospatial/dggs/dggs-wgsl.cjs +2304 -0
  282. package/dist/modules/geospatial/dggs/dggs-wgsl.d.ts +3 -0
  283. package/dist/modules/geospatial/dggs/dggs-wgsl.d.ts.map +1 -0
  284. package/dist/modules/geospatial/dggs/dggs-wgsl.js +2283 -0
  285. package/dist/modules/geospatial/dggs/dggs-wgsl.js.map +1 -0
  286. package/dist/modules/geospatial/dggs/dggs.cjs +31 -0
  287. package/dist/modules/geospatial/dggs/dggs.d.ts +6 -0
  288. package/dist/modules/geospatial/dggs/dggs.d.ts.map +1 -0
  289. package/dist/modules/geospatial/dggs/dggs.js +10 -0
  290. package/dist/modules/geospatial/dggs/dggs.js.map +1 -0
  291. package/dist/modules/lighting/area-lighting/area-light-types.cjs +68 -0
  292. package/dist/modules/lighting/area-lighting/area-light-types.d.ts +34 -0
  293. package/dist/modules/lighting/area-lighting/area-light-types.d.ts.map +1 -0
  294. package/dist/modules/lighting/area-lighting/area-light-types.js +40 -0
  295. package/dist/modules/lighting/area-lighting/area-light-types.js.map +1 -0
  296. package/dist/modules/lighting/area-lighting/area-lighting-shaders.cjs +101 -0
  297. package/dist/modules/lighting/area-lighting/area-lighting-shaders.d.ts +3 -0
  298. package/dist/modules/lighting/area-lighting/area-lighting-shaders.d.ts.map +1 -0
  299. package/dist/modules/lighting/area-lighting/area-lighting-shaders.js +71 -0
  300. package/dist/modules/lighting/area-lighting/area-lighting-shaders.js.map +1 -0
  301. package/dist/modules/lighting/area-lighting/area-lighting.cjs +62 -0
  302. package/dist/modules/lighting/area-lighting/area-lighting.d.ts +89 -0
  303. package/dist/modules/lighting/area-lighting/area-lighting.d.ts.map +1 -0
  304. package/dist/modules/lighting/area-lighting/area-lighting.js +41 -0
  305. package/dist/modules/lighting/area-lighting/area-lighting.js.map +1 -0
  306. package/dist/modules/lighting/area-lighting/ltc-shaders.cjs +192 -0
  307. package/dist/modules/lighting/area-lighting/ltc-shaders.d.ts +3 -0
  308. package/dist/modules/lighting/area-lighting/ltc-shaders.d.ts.map +1 -0
  309. package/dist/modules/lighting/area-lighting/ltc-shaders.js +162 -0
  310. package/dist/modules/lighting/area-lighting/ltc-shaders.js.map +1 -0
  311. package/dist/modules/lighting/atmosphere/atmosphere.cjs +253 -0
  312. package/dist/modules/lighting/atmosphere/atmosphere.d.ts +45 -0
  313. package/dist/modules/lighting/atmosphere/atmosphere.d.ts.map +1 -0
  314. package/dist/modules/lighting/atmosphere/atmosphere.js +228 -0
  315. package/dist/modules/lighting/atmosphere/atmosphere.js.map +1 -0
  316. package/dist/modules/lighting/clouds/clouds.cjs +216 -0
  317. package/dist/modules/lighting/clouds/clouds.d.ts +58 -0
  318. package/dist/modules/lighting/clouds/clouds.d.ts.map +1 -0
  319. package/dist/modules/lighting/clouds/clouds.js +192 -0
  320. package/dist/modules/lighting/clouds/clouds.js.map +1 -0
  321. package/dist/modules/lighting/firefly/firefly.cjs +74 -0
  322. package/dist/modules/lighting/firefly/firefly.d.ts +36 -0
  323. package/dist/modules/lighting/firefly/firefly.d.ts.map +1 -0
  324. package/dist/modules/lighting/firefly/firefly.js +53 -0
  325. package/dist/modules/lighting/firefly/firefly.js.map +1 -0
  326. package/dist/modules/lighting/globe-clouds/globe-clouds.cjs +143 -0
  327. package/dist/modules/lighting/globe-clouds/globe-clouds.d.ts +53 -0
  328. package/dist/modules/lighting/globe-clouds/globe-clouds.d.ts.map +1 -0
  329. package/dist/modules/lighting/globe-clouds/globe-clouds.js +119 -0
  330. package/dist/modules/lighting/globe-clouds/globe-clouds.js.map +1 -0
  331. package/dist/modules/lighting/gouraud-material/gouraud-material.cjs +61 -0
  332. package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts +12 -0
  333. package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -0
  334. package/dist/modules/lighting/gouraud-material/gouraud-material.js +40 -0
  335. package/dist/modules/lighting/gouraud-material/gouraud-material.js.map +1 -0
  336. package/dist/modules/lighting/height-fog/height-fog-functions.cjs +139 -0
  337. package/dist/modules/lighting/height-fog/height-fog-functions.d.ts +14 -0
  338. package/dist/modules/lighting/height-fog/height-fog-functions.d.ts.map +1 -0
  339. package/dist/modules/lighting/height-fog/height-fog-functions.js +114 -0
  340. package/dist/modules/lighting/height-fog/height-fog-functions.js.map +1 -0
  341. package/dist/modules/lighting/height-fog/height-fog.cjs +104 -0
  342. package/dist/modules/lighting/height-fog/height-fog.d.ts +60 -0
  343. package/dist/modules/lighting/height-fog/height-fog.d.ts.map +1 -0
  344. package/dist/modules/lighting/height-fog/height-fog.js +77 -0
  345. package/dist/modules/lighting/height-fog/height-fog.js.map +1 -0
  346. package/dist/modules/lighting/ibl/ibl.cjs +63 -0
  347. package/dist/modules/lighting/ibl/ibl.d.ts +25 -0
  348. package/dist/modules/lighting/ibl/ibl.d.ts.map +1 -0
  349. package/dist/modules/lighting/ibl/ibl.js +33 -0
  350. package/dist/modules/lighting/ibl/ibl.js.map +1 -0
  351. package/dist/modules/lighting/lambert-material/lambert-material.cjs +54 -0
  352. package/dist/modules/lighting/lambert-material/lambert-material.d.ts +10 -0
  353. package/dist/modules/lighting/lambert-material/lambert-material.d.ts.map +1 -0
  354. package/dist/modules/lighting/lambert-material/lambert-material.js +33 -0
  355. package/dist/modules/lighting/lambert-material/lambert-material.js.map +1 -0
  356. package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.cjs +88 -0
  357. package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.d.ts +3 -0
  358. package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.d.ts.map +1 -0
  359. package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.js +60 -0
  360. package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.js.map +1 -0
  361. package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.cjs +97 -0
  362. package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.d.ts +2 -0
  363. package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.d.ts.map +1 -0
  364. package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.js +73 -0
  365. package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.js.map +1 -0
  366. package/dist/modules/lighting/lights/lighting-glsl.cjs +116 -0
  367. package/dist/modules/lighting/lights/lighting-glsl.d.ts +2 -0
  368. package/dist/modules/lighting/lights/lighting-glsl.d.ts.map +1 -0
  369. package/dist/modules/lighting/lights/lighting-glsl.js +92 -0
  370. package/dist/modules/lighting/lights/lighting-glsl.js.map +1 -0
  371. package/dist/modules/lighting/lights/lighting-wgsl.cjs +115 -0
  372. package/dist/modules/lighting/lights/lighting-wgsl.d.ts +2 -0
  373. package/dist/modules/lighting/lights/lighting-wgsl.d.ts.map +1 -0
  374. package/dist/modules/lighting/lights/lighting-wgsl.js +91 -0
  375. package/dist/modules/lighting/lights/lighting-wgsl.js.map +1 -0
  376. package/dist/modules/lighting/lights/lighting.cjs +210 -0
  377. package/dist/modules/lighting/lights/lighting.d.ts +163 -0
  378. package/dist/modules/lighting/lights/lighting.d.ts.map +1 -0
  379. package/dist/modules/lighting/lights/lighting.js +208 -0
  380. package/dist/modules/lighting/lights/lighting.js.map +1 -0
  381. package/dist/modules/lighting/no-material/dirlight.cjs +112 -0
  382. package/dist/modules/lighting/no-material/dirlight.d.ts +33 -0
  383. package/dist/modules/lighting/no-material/dirlight.d.ts.map +1 -0
  384. package/dist/modules/lighting/no-material/dirlight.js +86 -0
  385. package/dist/modules/lighting/no-material/dirlight.js.map +1 -0
  386. package/dist/modules/lighting/pbr-material/pbr-material-glsl.cjs +1767 -0
  387. package/dist/modules/lighting/pbr-material/pbr-material-glsl.d.ts +3 -0
  388. package/dist/modules/lighting/pbr-material/pbr-material-glsl.d.ts.map +1 -0
  389. package/dist/modules/lighting/pbr-material/pbr-material-glsl.js +1745 -0
  390. package/dist/modules/lighting/pbr-material/pbr-material-glsl.js.map +1 -0
  391. package/dist/modules/lighting/pbr-material/pbr-material-wgsl.cjs +2062 -0
  392. package/dist/modules/lighting/pbr-material/pbr-material-wgsl.d.ts +3 -0
  393. package/dist/modules/lighting/pbr-material/pbr-material-wgsl.d.ts.map +1 -0
  394. package/dist/modules/lighting/pbr-material/pbr-material-wgsl.js +2040 -0
  395. package/dist/modules/lighting/pbr-material/pbr-material-wgsl.js.map +1 -0
  396. package/dist/modules/lighting/pbr-material/pbr-material.cjs +315 -0
  397. package/dist/modules/lighting/pbr-material/pbr-material.d.ts +516 -0
  398. package/dist/modules/lighting/pbr-material/pbr-material.d.ts.map +1 -0
  399. package/dist/modules/lighting/pbr-material/pbr-material.js +292 -0
  400. package/dist/modules/lighting/pbr-material/pbr-material.js.map +1 -0
  401. package/dist/modules/lighting/pbr-material/pbr-projection.cjs +63 -0
  402. package/dist/modules/lighting/pbr-material/pbr-projection.d.ts +10 -0
  403. package/dist/modules/lighting/pbr-material/pbr-projection.d.ts.map +1 -0
  404. package/dist/modules/lighting/pbr-material/pbr-projection.js +37 -0
  405. package/dist/modules/lighting/pbr-material/pbr-projection.js.map +1 -0
  406. package/dist/modules/lighting/pbr-material/pbr-scene.cjs +109 -0
  407. package/dist/modules/lighting/pbr-material/pbr-scene.d.ts +52 -0
  408. package/dist/modules/lighting/pbr-material/pbr-scene.d.ts.map +1 -0
  409. package/dist/modules/lighting/pbr-material/pbr-scene.js +83 -0
  410. package/dist/modules/lighting/pbr-material/pbr-scene.js.map +1 -0
  411. package/dist/modules/lighting/phong-material/phong-material.cjs +61 -0
  412. package/dist/modules/lighting/phong-material/phong-material.d.ts +13 -0
  413. package/dist/modules/lighting/phong-material/phong-material.d.ts.map +1 -0
  414. package/dist/modules/lighting/phong-material/phong-material.js +40 -0
  415. package/dist/modules/lighting/phong-material/phong-material.js.map +1 -0
  416. package/dist/modules/lighting/phong-material/phong-shaders-glsl.cjs +100 -0
  417. package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts +3 -0
  418. package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts.map +1 -0
  419. package/dist/modules/lighting/phong-material/phong-shaders-glsl.js +72 -0
  420. package/dist/modules/lighting/phong-material/phong-shaders-glsl.js.map +1 -0
  421. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.cjs +153 -0
  422. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts +2 -0
  423. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts.map +1 -0
  424. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.js +129 -0
  425. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.js.map +1 -0
  426. package/dist/modules/lighting/surface-weather/surface-weather.cjs +199 -0
  427. package/dist/modules/lighting/surface-weather/surface-weather.d.ts +54 -0
  428. package/dist/modules/lighting/surface-weather/surface-weather.d.ts.map +1 -0
  429. package/dist/modules/lighting/surface-weather/surface-weather.js +175 -0
  430. package/dist/modules/lighting/surface-weather/surface-weather.js.map +1 -0
  431. package/dist/modules/lighting/water-material/river-water-material.cjs +56 -0
  432. package/dist/modules/lighting/water-material/river-water-material.d.ts +21 -0
  433. package/dist/modules/lighting/water-material/river-water-material.d.ts.map +1 -0
  434. package/dist/modules/lighting/water-material/river-water-material.js +36 -0
  435. package/dist/modules/lighting/water-material/river-water-material.js.map +1 -0
  436. package/dist/modules/lighting/water-material/river-water-shaders.cjs +261 -0
  437. package/dist/modules/lighting/water-material/river-water-shaders.d.ts +3 -0
  438. package/dist/modules/lighting/water-material/river-water-shaders.d.ts.map +1 -0
  439. package/dist/modules/lighting/water-material/river-water-shaders.js +233 -0
  440. package/dist/modules/lighting/water-material/river-water-shaders.js.map +1 -0
  441. package/dist/modules/lighting/water-material/water-material.cjs +188 -0
  442. package/dist/modules/lighting/water-material/water-material.d.ts +28 -0
  443. package/dist/modules/lighting/water-material/water-material.d.ts.map +1 -0
  444. package/dist/modules/lighting/water-material/water-material.js +179 -0
  445. package/dist/modules/lighting/water-material/water-material.js.map +1 -0
  446. package/dist/modules/lighting/water-material/water-shaders-glsl.cjs +260 -0
  447. package/dist/modules/lighting/water-material/water-shaders-glsl.d.ts +3 -0
  448. package/dist/modules/lighting/water-material/water-shaders-glsl.d.ts.map +1 -0
  449. package/dist/modules/lighting/water-material/water-shaders-glsl.js +232 -0
  450. package/dist/modules/lighting/water-material/water-shaders-glsl.js.map +1 -0
  451. package/dist/modules/lighting/water-material/water-shaders-wgsl.cjs +254 -0
  452. package/dist/modules/lighting/water-material/water-shaders-wgsl.d.ts +2 -0
  453. package/dist/modules/lighting/water-material/water-shaders-wgsl.d.ts.map +1 -0
  454. package/dist/modules/lighting/water-material/water-shaders-wgsl.js +230 -0
  455. package/dist/modules/lighting/water-material/water-shaders-wgsl.js.map +1 -0
  456. package/dist/modules/math/fp16/fp16-utils.cjs +112 -0
  457. package/dist/modules/math/fp16/fp16-utils.d.ts +13 -0
  458. package/dist/modules/math/fp16/fp16-utils.d.ts.map +1 -0
  459. package/dist/modules/math/fp16/fp16-utils.js +118 -0
  460. package/dist/modules/math/fp16/fp16-utils.js.map +1 -0
  461. package/dist/modules/math/fp32/fp32.cjs +310 -0
  462. package/dist/modules/math/fp32/fp32.d.ts +9 -0
  463. package/dist/modules/math/fp32/fp32.d.ts.map +1 -0
  464. package/dist/modules/math/fp32/fp32.js +288 -0
  465. package/dist/modules/math/fp32/fp32.js.map +1 -0
  466. package/dist/modules/math/fp64/fp64-arithmetic-glsl.cjs +229 -0
  467. package/dist/modules/math/fp64/fp64-arithmetic-glsl.d.ts +2 -0
  468. package/dist/modules/math/fp64/fp64-arithmetic-glsl.d.ts.map +1 -0
  469. package/dist/modules/math/fp64/fp64-arithmetic-glsl.js +205 -0
  470. package/dist/modules/math/fp64/fp64-arithmetic-glsl.js.map +1 -0
  471. package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.cjs +144 -0
  472. package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.d.ts +10 -0
  473. package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.d.ts.map +1 -0
  474. package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.js +128 -0
  475. package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.js.map +1 -0
  476. package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.cjs +583 -0
  477. package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.d.ts +11 -0
  478. package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.d.ts.map +1 -0
  479. package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.js +563 -0
  480. package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.js.map +1 -0
  481. package/dist/modules/math/fp64/fp64-arithmetic-wgsl.cjs +946 -0
  482. package/dist/modules/math/fp64/fp64-arithmetic-wgsl.d.ts +3 -0
  483. package/dist/modules/math/fp64/fp64-arithmetic-wgsl.d.ts.map +1 -0
  484. package/dist/modules/math/fp64/fp64-arithmetic-wgsl.js +923 -0
  485. package/dist/modules/math/fp64/fp64-arithmetic-wgsl.js.map +1 -0
  486. package/dist/modules/math/fp64/fp64-functions-glsl.cjs +699 -0
  487. package/dist/modules/math/fp64/fp64-functions-glsl.d.ts +2 -0
  488. package/dist/modules/math/fp64/fp64-functions-glsl.d.ts.map +1 -0
  489. package/dist/modules/math/fp64/fp64-functions-glsl.js +675 -0
  490. package/dist/modules/math/fp64/fp64-functions-glsl.js.map +1 -0
  491. package/dist/modules/math/fp64/fp64-functions-wgsl.cjs +180 -0
  492. package/dist/modules/math/fp64/fp64-functions-wgsl.d.ts +3 -0
  493. package/dist/modules/math/fp64/fp64-functions-wgsl.d.ts.map +1 -0
  494. package/dist/modules/math/fp64/fp64-functions-wgsl.js +157 -0
  495. package/dist/modules/math/fp64/fp64-functions-wgsl.js.map +1 -0
  496. package/dist/modules/math/fp64/fp64-utils.cjs +50 -0
  497. package/dist/modules/math/fp64/fp64-utils.d.ts +22 -0
  498. package/dist/modules/math/fp64/fp64-utils.d.ts.map +1 -0
  499. package/dist/modules/math/fp64/fp64-utils.js +42 -0
  500. package/dist/modules/math/fp64/fp64-utils.js.map +1 -0
  501. package/dist/modules/math/fp64/fp64.cjs +68 -0
  502. package/dist/modules/math/fp64/fp64.d.ts +24 -0
  503. package/dist/modules/math/fp64/fp64.d.ts.map +1 -0
  504. package/dist/modules/math/fp64/fp64.js +46 -0
  505. package/dist/modules/math/fp64/fp64.js.map +1 -0
  506. package/dist/modules/math/random/random.cjs +46 -0
  507. package/dist/modules/math/random/random.d.ts +7 -0
  508. package/dist/modules/math/random/random.d.ts.map +1 -0
  509. package/dist/modules/math/random/random.js +21 -0
  510. package/dist/modules/math/random/random.js.map +1 -0
  511. package/dist/modules/math/value-noise/value-noise.cjs +95 -0
  512. package/dist/modules/math/value-noise/value-noise.d.ts +7 -0
  513. package/dist/modules/math/value-noise/value-noise.d.ts.map +1 -0
  514. package/dist/modules/math/value-noise/value-noise.js +68 -0
  515. package/dist/modules/math/value-noise/value-noise.js.map +1 -0
  516. package/dist/modules/volume/volume-raymarch.cjs +107 -0
  517. package/dist/modules/volume/volume-raymarch.d.ts +6 -0
  518. package/dist/modules/volume/volume-raymarch.d.ts.map +1 -0
  519. package/dist/modules/volume/volume-raymarch.js +84 -0
  520. package/dist/modules/volume/volume-raymarch.js.map +1 -0
  521. package/dist/types/align-to.cjs +38 -0
  522. package/dist/types/align-to.d.ts +3 -0
  523. package/dist/types/align-to.d.ts.map +1 -0
  524. package/dist/types/align-to.js +13 -0
  525. package/dist/types/align-to.js.map +1 -0
  526. package/dist/types/primitive-data-types.cjs +15 -0
  527. package/dist/types/primitive-data-types.d.ts +7 -0
  528. package/dist/types/primitive-data-types.d.ts.map +1 -0
  529. package/dist/types/primitive-data-types.js +5 -0
  530. package/dist/types/primitive-data-types.js.map +1 -0
  531. package/dist/types/sampler-props.cjs +15 -0
  532. package/dist/types/sampler-props.d.ts +26 -0
  533. package/dist/types/sampler-props.d.ts.map +1 -0
  534. package/dist/types/sampler-props.js +5 -0
  535. package/dist/types/sampler-props.js.map +1 -0
  536. package/dist/types/shader-block-layout.cjs +184 -0
  537. package/dist/types/shader-block-layout.d.ts +72 -0
  538. package/dist/types/shader-block-layout.d.ts.map +1 -0
  539. package/dist/types/shader-block-layout.js +209 -0
  540. package/dist/types/shader-block-layout.js.map +1 -0
  541. package/dist/types/shader-layout.cjs +15 -0
  542. package/dist/types/shader-layout.d.ts +178 -0
  543. package/dist/types/shader-layout.d.ts.map +1 -0
  544. package/dist/types/shader-layout.js +5 -0
  545. package/dist/types/shader-layout.js.map +1 -0
  546. package/dist/types/shader-type-decoder.cjs +240 -0
  547. package/dist/types/shader-type-decoder.d.ts +41 -0
  548. package/dist/types/shader-type-decoder.d.ts.map +1 -0
  549. package/dist/types/shader-type-decoder.js +210 -0
  550. package/dist/types/shader-type-decoder.js.map +1 -0
  551. package/dist/types/shader-types.cjs +15 -0
  552. package/dist/types/shader-types.d.ts +101 -0
  553. package/dist/types/shader-types.d.ts.map +1 -0
  554. package/dist/types/shader-types.js +30 -0
  555. package/dist/types/shader-types.js.map +1 -0
  556. package/dist/types/texture-formats.cjs +15 -0
  557. package/dist/types/texture-formats.d.ts +24 -0
  558. package/dist/types/texture-formats.d.ts.map +1 -0
  559. package/dist/types/texture-formats.js +5 -0
  560. package/dist/types/texture-formats.js.map +1 -0
  561. package/dist/types.cjs +42 -0
  562. package/dist/types.cjs.map +6 -0
  563. package/dist/types.d.ts +14 -0
  564. package/dist/types.d.ts.map +1 -0
  565. package/dist/types.js +12 -0
  566. package/dist/types.js.map +1 -0
  567. package/dist/wgsl.cjs +39 -0
  568. package/dist/wgsl.cjs.map +6 -0
  569. package/dist/wgsl.d.ts +8 -0
  570. package/dist/wgsl.d.ts.map +1 -0
  571. package/dist/wgsl.js +9 -0
  572. package/dist/wgsl.js.map +1 -0
  573. package/package.json +65 -4
  574. package/src/glsl.ts +13 -0
  575. package/src/index.ts +259 -0
  576. package/src/lib/color/normalize-byte-colors.ts +57 -0
  577. package/src/lib/filters/prop-types.ts +150 -0
  578. package/src/lib/glsl-shader-assembler.ts +39 -0
  579. package/src/lib/glsl-utils/get-shader-info.ts +42 -0
  580. package/src/lib/glsl-utils/shader-utils.ts +110 -0
  581. package/src/lib/preprocessor/preprocessor.ts +132 -0
  582. package/src/lib/shader-assembler-base.ts +170 -0
  583. package/src/lib/shader-assembler.ts +7 -0
  584. package/src/lib/shader-assembly/assemble-glsl-shaders.ts +305 -0
  585. package/src/lib/shader-assembly/assemble-shaders.ts +13 -0
  586. package/src/lib/shader-assembly/assemble-wgsl-shaders.ts +801 -0
  587. package/src/lib/shader-assembly/platform-defines.ts +58 -0
  588. package/src/lib/shader-assembly/platform-info.ts +23 -0
  589. package/src/lib/shader-assembly/shader-assembly-shared.ts +95 -0
  590. package/src/lib/shader-assembly/shader-assembly-types.ts +142 -0
  591. package/src/lib/shader-assembly/shader-hooks.ts +141 -0
  592. package/src/lib/shader-assembly/shader-injections.ts +250 -0
  593. package/src/lib/shader-assembly/shader-plugin-varyings.ts +524 -0
  594. package/src/lib/shader-assembly/shader-plugin-vertex-inputs.ts +279 -0
  595. package/src/lib/shader-assembly/wgsl-binding-debug.ts +227 -0
  596. package/src/lib/shader-assembly/wgsl-binding-scan.ts +228 -0
  597. package/src/lib/shader-assembly/wgsl-interface-scan.ts +676 -0
  598. package/src/lib/shader-generator/generate-shader.ts +27 -0
  599. package/src/lib/shader-generator/glsl/generate-glsl.ts +101 -0
  600. package/src/lib/shader-generator/utils/capitalize.ts +12 -0
  601. package/src/lib/shader-generator/wgsl/generate-wgsl.ts +40 -0
  602. package/src/lib/shader-module/composite-shader-pass.ts +47 -0
  603. package/src/lib/shader-module/shader-module-dependencies.ts +128 -0
  604. package/src/lib/shader-module/shader-module-uniform-layout.ts +420 -0
  605. package/src/lib/shader-module/shader-module.ts +244 -0
  606. package/src/lib/shader-module/shader-pass.ts +69 -0
  607. package/src/lib/shader-plugin.ts +214 -0
  608. package/src/lib/shader-transpiler/shader-transpiler.ts +34 -0
  609. package/src/lib/shader-transpiler/transpile-glsl-shader.ts +78 -0
  610. package/src/lib/utils/assert.ts +13 -0
  611. package/src/lib/utils/uniform-types.ts +89 -0
  612. package/src/lib/wgsl-shader-assembler.ts +122 -0
  613. package/src/module-injectors.ts +32 -0
  614. package/src/modules/color/float-colors.ts +334 -0
  615. package/src/modules/engine/clip/clip.ts +149 -0
  616. package/src/modules/engine/filter/filter.ts +107 -0
  617. package/src/modules/engine/geometry/geometry.ts +45 -0
  618. package/src/modules/engine/gpu-animation/gpu-animation.ts +244 -0
  619. package/src/modules/engine/picking/README.md +88 -0
  620. package/src/modules/engine/picking/picking.ts +252 -0
  621. package/src/modules/engine/project/project.ts +166 -0
  622. package/src/modules/engine/skin/skin.ts +233 -0
  623. package/src/modules/engine/transform/transform.ts +50 -0
  624. package/src/modules/geometry/path-dash/path-dash.ts +68 -0
  625. package/src/modules/geometry/pattern-fill/pattern-fill-shaders.ts +88 -0
  626. package/src/modules/geometry/pattern-fill/pattern-fill.ts +54 -0
  627. package/src/modules/geometry/point-glow/point-glow.ts +87 -0
  628. package/src/modules/geometry/precipitation/README.md +19 -0
  629. package/src/modules/geometry/precipitation/precipitation.ts +108 -0
  630. package/src/modules/geometry/sketch-stroke/sketch-stroke.ts +160 -0
  631. package/src/modules/geospatial/dggs/dggs-wgsl.ts +2284 -0
  632. package/src/modules/geospatial/dggs/dggs.ts +12 -0
  633. package/src/modules/lighting/area-lighting/area-light-types.ts +71 -0
  634. package/src/modules/lighting/area-lighting/area-lighting-shaders.ts +72 -0
  635. package/src/modules/lighting/area-lighting/area-lighting.ts +63 -0
  636. package/src/modules/lighting/area-lighting/ltc-shaders.ts +163 -0
  637. package/src/modules/lighting/atmosphere/README.md +25 -0
  638. package/src/modules/lighting/atmosphere/atmosphere.ts +246 -0
  639. package/src/modules/lighting/clouds/README.md +24 -0
  640. package/src/modules/lighting/clouds/clouds.ts +216 -0
  641. package/src/modules/lighting/firefly/firefly.ts +64 -0
  642. package/src/modules/lighting/globe-clouds/globe-clouds.ts +124 -0
  643. package/src/modules/lighting/gouraud-material/gouraud-material.ts +55 -0
  644. package/src/modules/lighting/height-fog/README.md +36 -0
  645. package/src/modules/lighting/height-fog/height-fog-functions.ts +116 -0
  646. package/src/modules/lighting/height-fog/height-fog.ts +96 -0
  647. package/src/modules/lighting/ibl/ibl.ts +43 -0
  648. package/src/modules/lighting/lambert-material/lambert-material.ts +42 -0
  649. package/src/modules/lighting/lambert-material/lambert-shaders-glsl.ts +61 -0
  650. package/src/modules/lighting/lambert-material/lambert-shaders-wgsl.ts +73 -0
  651. package/src/modules/lighting/lights/lighting-glsl.ts +92 -0
  652. package/src/modules/lighting/lights/lighting-wgsl.ts +91 -0
  653. package/src/modules/lighting/lights/lighting.ts +385 -0
  654. package/src/modules/lighting/no-material/dirlight.ts +101 -0
  655. package/src/modules/lighting/pbr-material/pbr-material-glsl.ts +1748 -0
  656. package/src/modules/lighting/pbr-material/pbr-material-wgsl.ts +2043 -0
  657. package/src/modules/lighting/pbr-material/pbr-material.ts +517 -0
  658. package/src/modules/lighting/pbr-material/pbr-projection.ts +50 -0
  659. package/src/modules/lighting/pbr-material/pbr-scene.ts +112 -0
  660. package/src/modules/lighting/phong-material/phong-material.ts +53 -0
  661. package/src/modules/lighting/phong-material/phong-shaders-glsl.ts +73 -0
  662. package/src/modules/lighting/phong-material/phong-shaders-wgsl.ts +129 -0
  663. package/src/modules/lighting/surface-weather/README.md +28 -0
  664. package/src/modules/lighting/surface-weather/surface-weather.ts +198 -0
  665. package/src/modules/lighting/water-material/river-water-material.ts +58 -0
  666. package/src/modules/lighting/water-material/river-water-shaders.ts +234 -0
  667. package/src/modules/lighting/water-material/water-material.ts +234 -0
  668. package/src/modules/lighting/water-material/water-shaders-glsl.ts +233 -0
  669. package/src/modules/lighting/water-material/water-shaders-wgsl.ts +230 -0
  670. package/src/modules/math/fp16/fp16-utils.ts +156 -0
  671. package/src/modules/math/fp32/fp32.ts +291 -0
  672. package/src/modules/math/fp64/fp64-arithmetic-glsl.ts +205 -0
  673. package/src/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.ts +129 -0
  674. package/src/modules/math/fp64/fp64-arithmetic-wgsl-integer.ts +564 -0
  675. package/src/modules/math/fp64/fp64-arithmetic-wgsl.ts +924 -0
  676. package/src/modules/math/fp64/fp64-functions-glsl.ts +675 -0
  677. package/src/modules/math/fp64/fp64-functions-wgsl.ts +157 -0
  678. package/src/modules/math/fp64/fp64-utils.ts +46 -0
  679. package/src/modules/math/fp64/fp64.ts +64 -0
  680. package/src/modules/math/random/random.ts +25 -0
  681. package/src/modules/math/value-noise/value-noise.ts +70 -0
  682. package/src/modules/volume/volume-raymarch.ts +87 -0
  683. package/src/types/align-to.ts +13 -0
  684. package/src/types/primitive-data-types.ts +10 -0
  685. package/src/types/sampler-props.ts +39 -0
  686. package/src/types/shader-block-layout.ts +340 -0
  687. package/src/types/shader-layout.ts +208 -0
  688. package/src/types/shader-type-decoder.ts +285 -0
  689. package/src/types/shader-types.ts +207 -0
  690. package/src/types/texture-formats.ts +155 -0
  691. package/src/types.ts +48 -0
  692. package/src/wgsl.ts +23 -0
@@ -0,0 +1,105 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var shader_module_exports = {};
19
+ __export(shader_module_exports, {
20
+ checkShaderModuleDeprecations: () => checkShaderModuleDeprecations,
21
+ getShaderModuleUniforms: () => getShaderModuleUniforms,
22
+ initializeShaderModule: () => initializeShaderModule,
23
+ initializeShaderModules: () => initializeShaderModules
24
+ });
25
+ module.exports = __toCommonJS(shader_module_exports);
26
+ var import_prop_types = require("../filters/prop-types.cjs");
27
+ var import_shader_injections = require("../shader-assembly/shader-injections.cjs");
28
+ function initializeShaderModules(modules) {
29
+ modules.map((module2) => initializeShaderModule(module2));
30
+ }
31
+ function initializeShaderModule(module2) {
32
+ if (module2.instance) {
33
+ return;
34
+ }
35
+ initializeShaderModules(module2.dependencies || []);
36
+ const {
37
+ propTypes = {},
38
+ deprecations = [],
39
+ // defines = {},
40
+ inject = {}
41
+ } = module2;
42
+ const instance = {
43
+ normalizedInjections: (0, import_shader_injections.normalizeInjections)(inject),
44
+ parsedDeprecations: parseDeprecationDefinitions(deprecations)
45
+ };
46
+ if (propTypes) {
47
+ instance.propValidators = (0, import_prop_types.makePropValidators)(propTypes);
48
+ }
49
+ module2.instance = instance;
50
+ let defaultProps = {};
51
+ if (propTypes) {
52
+ defaultProps = Object.entries(propTypes).reduce((obj, [key, propType]) => {
53
+ const value = propType == null ? void 0 : propType.value;
54
+ if (value) {
55
+ obj[key] = value;
56
+ }
57
+ return obj;
58
+ }, {});
59
+ }
60
+ module2.defaultUniforms = {
61
+ ...module2.defaultUniforms,
62
+ ...defaultProps
63
+ };
64
+ }
65
+ function getShaderModuleUniforms(module2, props, oldUniforms) {
66
+ var _a;
67
+ initializeShaderModule(module2);
68
+ const uniforms = oldUniforms || { ...module2.defaultUniforms };
69
+ if (props && module2.getUniforms) {
70
+ return module2.getUniforms(props, uniforms);
71
+ }
72
+ return (0, import_prop_types.getValidatedProperties)(props, (_a = module2.instance) == null ? void 0 : _a.propValidators, module2.name);
73
+ }
74
+ function checkShaderModuleDeprecations(shaderModule, shaderSource, log) {
75
+ var _a;
76
+ (_a = shaderModule.deprecations) == null ? void 0 : _a.forEach((def) => {
77
+ var _a2;
78
+ if ((_a2 = def.regex) == null ? void 0 : _a2.test(shaderSource)) {
79
+ if (def.deprecated) {
80
+ log.deprecated(def.old, def.new)();
81
+ } else {
82
+ log.removed(def.old, def.new)();
83
+ }
84
+ }
85
+ });
86
+ }
87
+ function parseDeprecationDefinitions(deprecations) {
88
+ deprecations.forEach((def) => {
89
+ switch (def.type) {
90
+ case "function":
91
+ def.regex = new RegExp(`\\b${def.old}\\(`);
92
+ break;
93
+ default:
94
+ def.regex = new RegExp(`${def.type} ${def.old};`);
95
+ }
96
+ });
97
+ return deprecations;
98
+ }
99
+ // Annotate the CommonJS export names for ESM import in node:
100
+ 0 && (module.exports = {
101
+ checkShaderModuleDeprecations,
102
+ getShaderModuleUniforms,
103
+ initializeShaderModule,
104
+ initializeShaderModules
105
+ });
@@ -0,0 +1,98 @@
1
+ import { UniformFormat } from "../../types.js";
2
+ import { PropType, PropValidator } from "../filters/prop-types.js";
3
+ import type { ShaderModuleUniformValue, UniformTypes, UniformValue } from "../utils/uniform-types.js";
4
+ import { ShaderInjection } from "../shader-assembly/shader-injections.js";
5
+ import type { ShaderBinding as Binding } from "../../types.js";
6
+ export type UniformInfo = {
7
+ format?: UniformFormat;
8
+ } & PropType;
9
+ export type ShaderModuleBindingLayout = {
10
+ name: string;
11
+ group: number;
12
+ /** Which shader stages can access this binding. Uses GPUShaderStage bit flags. */
13
+ visibility?: number;
14
+ };
15
+ type BindingKeys<T> = {
16
+ [K in keyof T]: T[K] extends UniformValue ? never : K;
17
+ }[keyof T];
18
+ type UniformKeys<T> = {
19
+ [K in keyof T]: T[K] extends UniformValue ? K : never;
20
+ }[keyof T];
21
+ export type PickBindings<T> = {
22
+ [K in BindingKeys<Required<T>>]: T[K];
23
+ };
24
+ export type PickUniforms<T> = {
25
+ [K in UniformKeys<Required<T>>]: T[K];
26
+ };
27
+ /**
28
+ * A shader module definition object
29
+ *
30
+ * @note Needs to be initialized with `initializeShaderModules`
31
+ * @note `UniformsT` & `BindingsT` are deduced from `PropsT` by default. If
32
+ * a custom type for `UniformsT` is used, `BindingsT` should be also be provided.
33
+ */
34
+ export type ShaderModule<PropsT extends Record<string, any> = Record<string, any>, UniformsT extends Record<string, ShaderModuleUniformValue> = PickUniforms<PropsT>, BindingsT extends Record<string, Binding> = PickBindings<PropsT>> = {
35
+ /** Used for type inference not for values */
36
+ props?: PropsT;
37
+ /** Used for type inference, not currently used for values */
38
+ uniforms?: UniformsT;
39
+ /** Used for type inference, not currently used for values */
40
+ bindings?: BindingsT;
41
+ /** Logical bind-group assignment for bindings declared by this module */
42
+ bindingLayout?: readonly ShaderModuleBindingLayout[];
43
+ /** Preferred starting binding slot for this module's WGSL `@binding(auto)` declarations. */
44
+ firstBindingSlot?: number;
45
+ name: string;
46
+ /** Exclusive named shader interface provided by this module. */
47
+ implements?: string;
48
+ /** Language of source when an application-owned transpiler is required. */
49
+ sourceLanguage?: string;
50
+ /** WGSL code, or reusable code in sourceLanguage combined with the application source. */
51
+ source?: string;
52
+ /** GLSL fragment shader code */
53
+ fs?: string;
54
+ /** GLSL vertex shader code */
55
+ vs?: string;
56
+ /** Uniform shader types @note: Both order and types MUST match uniform block declarations in shader */
57
+ uniformTypes?: Required<UniformTypes<UniformsT>>;
58
+ /** Uniform JS prop types */
59
+ propTypes?: Record<keyof UniformsT, UniformInfo>;
60
+ /** Default uniform values */
61
+ defaultUniforms?: Required<UniformsT>;
62
+ /** Function that maps props to uniforms & bindings */
63
+ getUniforms?: (props: Partial<PropsT>, prevUniforms?: UniformsT) => Partial<UniformsT & BindingsT>;
64
+ /** Boolean or numeric preprocessor defines contributed by this shader module. */
65
+ defines?: Record<string, boolean | number>;
66
+ /** Injections */
67
+ inject?: Record<string, string | {
68
+ injection: string;
69
+ order: number;
70
+ }>;
71
+ dependencies?: ShaderModule<any, any>[];
72
+ /** Information on deprecated properties */
73
+ deprecations?: ShaderModuleDeprecation[];
74
+ /** The instance field contains information that is generated at run-time */
75
+ instance?: {
76
+ propValidators?: Record<string, PropValidator>;
77
+ parsedDeprecations: ShaderModuleDeprecation[];
78
+ normalizedInjections: {
79
+ vertex: Record<string, ShaderInjection>;
80
+ fragment: Record<string, ShaderInjection>;
81
+ };
82
+ };
83
+ };
84
+ /** Use to generate deprecations when shader module is used */
85
+ export type ShaderModuleDeprecation = {
86
+ type: string;
87
+ regex?: RegExp;
88
+ new: string;
89
+ old: string;
90
+ deprecated?: boolean;
91
+ };
92
+ export declare function initializeShaderModules(modules: ShaderModule[]): void;
93
+ export declare function initializeShaderModule(module: ShaderModule): void;
94
+ /** Convert module props to uniforms */
95
+ export declare function getShaderModuleUniforms<ShaderModuleT extends ShaderModule<Record<string, unknown>, Record<string, ShaderModuleUniformValue>>>(module: ShaderModuleT, props?: ShaderModuleT['props'], oldUniforms?: ShaderModuleT['uniforms']): Record<string, Binding | ShaderModuleUniformValue>;
96
+ export declare function checkShaderModuleDeprecations(shaderModule: ShaderModule, shaderSource: string, log: any): void;
97
+ export {};
98
+ //# sourceMappingURL=shader-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-module/shader-module.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,aAAa,EAAC,uBAAoB;AAC1C,OAAO,EACL,QAAQ,EACR,aAAa,EAGd,iCAA8B;AAC/B,OAAO,KAAK,EAAC,wBAAwB,EAAE,YAAY,EAAE,YAAY,EAAC,kCAA+B;AACjG,OAAO,EAAC,eAAe,EAAsB,gDAA6C;AAE1F,OAAO,KAAK,EAAC,aAAa,IAAI,OAAO,EAAC,uBAAoB;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,GAAG,QAAQ,CAAC;AAEb,MAAM,MA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perties } from "../filters/prop-types.js";
5
+ import { normalizeInjections } from "../shader-assembly/shader-injections.js";
6
+ // SHNDER MODULE API
7
+ export function initializeShaderModules(modules) {
8
+ modules.map((module) => initializeShaderModule(module));
9
+ }
10
+ export function initializeShaderModule(module) {
11
+ if (module.instance) {
12
+ return;
13
+ }
14
+ initializeShaderModules(module.dependencies || []);
15
+ const { propTypes = {}, deprecations = [],
16
+ // defines = {},
17
+ inject = {} } = module;
18
+ const instance = {
19
+ normalizedInjections: normalizeInjections(inject),
20
+ parsedDeprecations: parseDeprecationDefinitions(deprecations)
21
+ };
22
+ if (propTypes) {
23
+ instance.propValidators = makePropValidators(propTypes);
24
+ }
25
+ module.instance = instance;
26
+ // TODO(ib) - we need to apply the original prop types to the default uniforms
27
+ let defaultProps = {};
28
+ if (propTypes) {
29
+ defaultProps = Object.entries(propTypes).reduce((obj, [key, propType]) => {
30
+ // @ts-expect-error
31
+ const value = propType?.value;
32
+ if (value) {
33
+ // @ts-expect-error
34
+ obj[key] = value;
35
+ }
36
+ return obj;
37
+ }, {});
38
+ }
39
+ // Merge validated default props with existing uniforms. Type assertion needed due to complex generics.
40
+ module.defaultUniforms = {
41
+ ...module.defaultUniforms,
42
+ ...defaultProps
43
+ };
44
+ }
45
+ /** Convert module props to uniforms */
46
+ export function getShaderModuleUniforms(module, props, oldUniforms) {
47
+ initializeShaderModule(module);
48
+ const uniforms = oldUniforms || { ...module.defaultUniforms };
49
+ // If module has a getUniforms function, use it
50
+ if (props && module.getUniforms) {
51
+ return module.getUniforms(props, uniforms);
52
+ }
53
+ // Build uniforms from the uniforms array
54
+ // @ts-expect-error
55
+ return getValidatedProperties(props, module.instance?.propValidators, module.name);
56
+ }
57
+ /* TODO this looks like it was unused code
58
+ _defaultGetUniforms(opts: Record<string, any> = {}): Record<string, any> {
59
+ const uniforms: Record<string, any> = {};
60
+ const propTypes = this.uniforms;
61
+
62
+ for (const key in propTypes) {
63
+ const propDef = propTypes[key];
64
+ if (key in opts && !propDef.private) {
65
+ if (propDef.validate) {
66
+ assert(propDef.validate(opts[key], propDef), `${this.name}: invalid ${key}`);
67
+ }
68
+ uniforms[key] = opts[key];
69
+ } else {
70
+ uniforms[key] = propDef.value;
71
+ }
72
+ }
73
+
74
+ return uniforms;
75
+ }
76
+ }
77
+ */
78
+ // Warn about deprecated uniforms or functions
79
+ export function checkShaderModuleDeprecations(shaderModule, shaderSource, log) {
80
+ shaderModule.deprecations?.forEach(def => {
81
+ if (def.regex?.test(shaderSource)) {
82
+ if (def.deprecated) {
83
+ log.deprecated(def.old, def.new)();
84
+ }
85
+ else {
86
+ log.removed(def.old, def.new)();
87
+ }
88
+ }
89
+ });
90
+ }
91
+ // HELPERS
92
+ function parseDeprecationDefinitions(deprecations) {
93
+ deprecations.forEach(def => {
94
+ switch (def.type) {
95
+ case 'function':
96
+ def.regex = new RegExp(`\\b${def.old}\\(`);
97
+ break;
98
+ default:
99
+ def.regex = new RegExp(`${def.type} ${def.old};`);
100
+ }
101
+ });
102
+ return deprecations;
103
+ }
104
+ //# sourceMappingURL=shader-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader-module.js","sourceRoot":"","sources":["../../../src/lib/shader-module/shader-module.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAG5D,OAAO,EAGL,kBAAkB,EAClB,sBAAsB,EACvB,iCAA8B;AAE/B,OAAO,EAAkB,mBAAmB,EAAC,gDAA6C;AAoG1F,oBAAoB;AAEpB,MAAM,UAAU,uBAAuB,CAAC,OAAuB;IAC7D,OAAO,CAAC,GAAG,CAAC,CAAC,MAAoB,EAAE,EAAE,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,MAAoB;IACzD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO;IACT,CAAC;IAED,uBAAuB,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAA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H,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var shader_pass_exports = {};
15
+ module.exports = __toCommonJS(shader_pass_exports);
@@ -0,0 +1,48 @@
1
+ import type { ShaderBinding as Binding, SamplerProps, TextureFormat } from "../../types.js";
2
+ import type { PickBindings, PickUniforms, ShaderModule } from "./shader-module.js";
3
+ import type { UniformValue } from "../utils/uniform-types.js";
4
+ export type ShaderPassRenderTarget = {
5
+ /** Width and height scale relative to the renderer output size. */
6
+ scale?: [number, number];
7
+ /** Render target format. Defaults to the device preferred color format. */
8
+ format?: TextureFormat;
9
+ /** Optional sampling behavior when later passes read this target. */
10
+ sampler?: SamplerProps;
11
+ /** Reuse an earlier transient target with an identical size, format, and sampler. */
12
+ aliasFor?: string;
13
+ /** Allow WebGPU compute shaders to write this target as a storage texture. */
14
+ storage?: boolean;
15
+ /** Resource lifetime. History targets retain their last successfully rendered value. */
16
+ lifetime?: 'transient' | 'history';
17
+ /** Initial value used after construction, resize, or an explicit history reset. */
18
+ initialize?: 'original' | {
19
+ clearColor: [number, number, number, number];
20
+ };
21
+ };
22
+ export type ShaderPassInputSource<TargetNameT extends string = string> = 'original' | 'previous' | TargetNameT;
23
+ /**
24
+ * A ShaderPass is a ShaderModule that can be run "standalone" (e.g. post processing effects)
25
+ * It adds additional information on how to run the module.
26
+ * A ShaderPass can require one or more sub passes.
27
+ */
28
+ export type ShaderPass<PropsT extends Record<string, any> = Record<string, any>, UniformsT extends Record<string, UniformValue> = PickUniforms<PropsT>, BindingsT extends Record<string, Binding> = PickBindings<PropsT>, RenderTargetNameT extends string = never> = ShaderModule<PropsT, UniformsT, BindingsT> & {
29
+ /** A shader pass can run multiple sub passes */
30
+ passes?: ShaderSubPass<UniformsT, Extract<keyof BindingsT, string>, RenderTargetNameT>[];
31
+ };
32
+ /** Information on how to run a specific sub pass */
33
+ export type ShaderSubPass<UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>, BindingNameT extends string = string, RenderTargetNameT extends string = string> = {
34
+ /**
35
+ * Action indicates whether this pass:
36
+ * - filters the color in each pixel (provides a `<pass.name>_filterColor()` shader function)
37
+ * - performs its own sampling (provides a `<pass.name>_sampleColor()` shader function)
38
+ */
39
+ action?: 'filter' | 'sample';
40
+ sampler?: boolean;
41
+ filter?: boolean;
42
+ uniforms?: UniformsT;
43
+ /** Mapping from shader binding name to the logical texture source. */
44
+ inputs?: Partial<Record<BindingNameT | 'sourceTexture', ShaderPassInputSource<RenderTargetNameT>>>;
45
+ /** Output target for this sub pass. Defaults to the shared "previous" chain. */
46
+ output?: 'previous' | RenderTargetNameT;
47
+ };
48
+ //# sourceMappingURL=shader-pass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader-pass.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-module/shader-pass.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,IAAI,OAAO,EAAE,YAAY,EAAE,aAAa,EAAC,uBAAoB;AACvF,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAC,2BAAwB;AAC9E,OAAO,KAAK,EAAC,YAAY,EAAC,kCAA+B;AAEzD,MAAM,MAAM,sBAAsB,GAAG;IACnC,mEAAmE;IACnE,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,C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,YAAY,SAAS,MAAM,GAAG,MAAM,EACpC,iBAAiB,SAAS,MAAM,GAAG,MAAM,IACvC;IACF;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CACd,MAAM,CAAC,YAAY,GAAG,eAAe,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,CAAC,CACjF,CAAC;IACF,gFAAgF;IAChF,MAAM,CAAC,EAAE,UAAU,GAAG,iBAAiB,CAAC;CACzC,CAAC"}
@@ -0,0 +1,5 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ export {};
5
+ //# sourceMappingURL=shader-pass.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader-pass.js","sourceRoot":"","sources":["../../../src/lib/shader-module/shader-pass.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D"}
@@ -0,0 +1,117 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var shader_plugin_exports = {};
19
+ __export(shader_plugin_exports, {
20
+ mergeShaderPluginModules: () => mergeShaderPluginModules,
21
+ resolveShaderPlugins: () => resolveShaderPlugins
22
+ });
23
+ module.exports = __toCommonJS(shader_plugin_exports);
24
+ var import_types = require("../types.cjs");
25
+ const SHADER_PLUGIN_INJECTION_TARGET_REGEX = /^(vs|fs):(?:#(?:decl|main-start|main-end)|[A-Za-z_][\w-]*)$/;
26
+ function resolveShaderPlugins(plugins = [], shaderLanguage) {
27
+ const modules = [];
28
+ const defines = {};
29
+ const injections = {};
30
+ const vertexInputs = {};
31
+ const varyings = {};
32
+ for (const plugin of plugins) {
33
+ appendShaderPluginVariant({ modules, defines, injections, vertexInputs, varyings }, plugin);
34
+ appendShaderPluginVariant({ modules, defines, injections, vertexInputs, varyings }, plugin[shaderLanguage]);
35
+ }
36
+ for (const name of Object.keys(varyings)) {
37
+ if (vertexInputs[name]) {
38
+ throw new Error(`ShaderPlugin name "${name}" cannot be both a vertex input and a varying`);
39
+ }
40
+ }
41
+ return { modules, defines, injections, vertexInputs, varyings };
42
+ }
43
+ function mergeShaderPluginModules(modules = [], pluginModules = []) {
44
+ const mergedModules = [...modules];
45
+ const seenModuleNames = new Set(mergedModules.map((module2) => module2.name));
46
+ for (const pluginModule of pluginModules) {
47
+ if (!seenModuleNames.has(pluginModule.name)) {
48
+ mergedModules.push(pluginModule);
49
+ seenModuleNames.add(pluginModule.name);
50
+ }
51
+ }
52
+ return mergedModules;
53
+ }
54
+ function appendShaderPluginVariant(resolved, variant) {
55
+ var _a;
56
+ if (!variant) {
57
+ return;
58
+ }
59
+ if ((_a = variant.modules) == null ? void 0 : _a.length) {
60
+ resolved.modules.push(...variant.modules);
61
+ }
62
+ if (variant.defines) {
63
+ Object.assign(resolved.defines, variant.defines);
64
+ }
65
+ for (const [name, type] of Object.entries(variant.vertexInputs || {})) {
66
+ assertShaderPluginInterfaceName(name, "vertex input");
67
+ const existingType = resolved.vertexInputs[name];
68
+ if (existingType && existingType !== type) {
69
+ throw new Error(`ShaderPlugin vertex input "${name}" has conflicting types "${existingType}" and "${type}"`);
70
+ }
71
+ resolved.vertexInputs[name] = type;
72
+ }
73
+ for (const [name, varying] of Object.entries(variant.varyings || {})) {
74
+ assertShaderPluginInterfaceName(name, "varying");
75
+ const normalizedVarying = normalizeShaderPluginVarying(name, varying);
76
+ const existingVarying = resolved.varyings[name];
77
+ if (existingVarying && (existingVarying.type !== normalizedVarying.type || existingVarying.interpolation !== normalizedVarying.interpolation)) {
78
+ throw new Error(`ShaderPlugin varying "${name}" has conflicting declarations "${existingVarying.type}/${existingVarying.interpolation}" and "${normalizedVarying.type}/${normalizedVarying.interpolation}"`);
79
+ }
80
+ resolved.varyings[name] = normalizedVarying;
81
+ }
82
+ for (const injection of variant.injections || []) {
83
+ assertNamedShaderPluginInjectionTarget(injection.target);
84
+ if (!resolved.injections[injection.target]) {
85
+ resolved.injections[injection.target] = [];
86
+ }
87
+ const injections = resolved.injections[injection.target];
88
+ injections.push({
89
+ injection: injection.injection,
90
+ order: injection.order ?? 0
91
+ });
92
+ }
93
+ }
94
+ function assertShaderPluginInterfaceName(name, kind) {
95
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name) || name.startsWith("_luma_")) {
96
+ throw new Error(`ShaderPlugin ${kind} "${name}" must be a valid non-reserved identifier`);
97
+ }
98
+ }
99
+ function normalizeShaderPluginVarying(name, varying) {
100
+ const { primitiveType } = import_types.shaderTypeDecoder.getAttributeShaderTypeInfo(varying.type);
101
+ const integerType = primitiveType === "i32" || primitiveType === "u32";
102
+ const interpolation = varying.interpolation || (integerType ? "flat" : "smooth");
103
+ if (integerType && interpolation === "smooth") {
104
+ throw new Error(`ShaderPlugin integer varying "${name}" must use flat interpolation`);
105
+ }
106
+ return { type: varying.type, interpolation };
107
+ }
108
+ function assertNamedShaderPluginInjectionTarget(target) {
109
+ if (!SHADER_PLUGIN_INJECTION_TARGET_REGEX.test(target)) {
110
+ throw new Error(`ShaderPlugin injection target "${target}" must be a named shader anchor or hook`);
111
+ }
112
+ }
113
+ // Annotate the CommonJS export names for ESM import in node:
114
+ 0 && (module.exports = {
115
+ mergeShaderPluginModules,
116
+ resolveShaderPlugins
117
+ });
@@ -0,0 +1,68 @@
1
+ import type { ShaderInjection } from "./shader-assembly/shader-injections.js";
2
+ import type { ShaderModule } from "./shader-module/shader-module.js";
3
+ import { type AttributeShaderType } from "../types.js";
4
+ /** Named shader anchor or hook target accepted by ShaderPlugin injections. */
5
+ export type ShaderPluginInjectionTarget = 'vs:#decl' | 'vs:#main-start' | 'vs:#main-end' | 'fs:#decl' | 'fs:#main-start' | 'fs:#main-end' | `vs:${string}` | `fs:${string}`;
6
+ /** Named shader source injection contributed by a ShaderPlugin. */
7
+ export type ShaderPluginInjection = {
8
+ /** Named shader anchor or hook that receives this source. */
9
+ target: ShaderPluginInjectionTarget;
10
+ /** Shader source to inject at the target. */
11
+ injection: string;
12
+ /** Relative injection order within the target. */
13
+ order?: number;
14
+ };
15
+ /** Portable interpolation modes for ShaderPlugin varyings. */
16
+ export type ShaderPluginVaryingInterpolation = 'smooth' | 'flat';
17
+ /** Cross-stage value contributed by a ShaderPlugin. */
18
+ export type ShaderPluginVarying = {
19
+ /** Portable scalar or vector shader type. */
20
+ type: AttributeShaderType;
21
+ /** Defaults to smooth for floating-point types and flat for integer types. */
22
+ interpolation?: ShaderPluginVaryingInterpolation;
23
+ };
24
+ /** Fully normalized ShaderPlugin varying declaration. */
25
+ export type ResolvedShaderPluginVarying = {
26
+ type: AttributeShaderType;
27
+ interpolation: ShaderPluginVaryingInterpolation;
28
+ };
29
+ /** Shared or backend-specific shader assembly contributions. */
30
+ export type ShaderPluginVariant = {
31
+ /** Shader modules added to shader assembly. */
32
+ modules?: ShaderModule[];
33
+ /** Boolean preprocessor defines added to shader assembly. */
34
+ defines?: Record<string, boolean>;
35
+ /** Named code injections added to shader assembly. */
36
+ injections?: ShaderPluginInjection[];
37
+ /** Shader-facing vertex inputs added by this plugin. Buffer ownership remains with the caller. */
38
+ vertexInputs?: Record<string, AttributeShaderType>;
39
+ /** Values transported from the selected vertex entry point to the fragment entry point. */
40
+ varyings?: Record<string, ShaderPluginVarying>;
41
+ };
42
+ /** Reusable cross-backend shader assembly descriptor. */
43
+ export type ShaderPlugin = ShaderPluginVariant & {
44
+ /** Stable plugin identifier. */
45
+ name: string;
46
+ /** GLSL-only shader assembly contributions. */
47
+ glsl?: ShaderPluginVariant;
48
+ /** WGSL-only shader assembly contributions. */
49
+ wgsl?: ShaderPluginVariant;
50
+ };
51
+ /** ShaderPlugin contributions resolved for one shader language. */
52
+ export type ResolvedShaderPlugins = {
53
+ /** Resolved shader modules in plugin declaration order. */
54
+ modules: ShaderModule[];
55
+ /** Resolved boolean preprocessor defines. */
56
+ defines: Record<string, boolean>;
57
+ /** Resolved named code injections grouped by target. */
58
+ injections: Record<string, ShaderInjection[]>;
59
+ /** Resolved shader-facing vertex inputs in plugin declaration order. */
60
+ vertexInputs: Record<string, AttributeShaderType>;
61
+ /** Resolved cross-stage varyings in plugin declaration order. */
62
+ varyings: Record<string, ResolvedShaderPluginVarying>;
63
+ };
64
+ /** Resolve shared and backend-specific contributions from shader plugins. */
65
+ export declare function resolveShaderPlugins(plugins: readonly ShaderPlugin[] | undefined, shaderLanguage: 'glsl' | 'wgsl'): ResolvedShaderPlugins;
66
+ /** Preserve explicit module inputs while appending plugin modules by first-seen name. */
67
+ export declare function mergeShaderPluginModules(modules?: readonly ShaderModule[], pluginModules?: readonly ShaderModule[]): ShaderModule[];
68
+ //# sourceMappingURL=shader-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader-plugin.d.ts","sourceRoot":"","sources":["../../src/lib/shader-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,+CAA4C;AACzE,OAAO,KAAK,EAAC,YAAY,EAAC,yCAAsC;AAChE,OAAO,EAAoB,KAAK,mBAAm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