@lightningjs/renderer 2.13.1 → 2.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (353) hide show
  1. package/COPYING +1 -0
  2. package/LICENSE +202 -202
  3. package/NOTICE +3 -3
  4. package/README.md +147 -147
  5. package/dist/exports/canvas-shaders.d.ts +10 -0
  6. package/dist/exports/canvas-shaders.js +27 -0
  7. package/dist/exports/canvas-shaders.js.map +1 -0
  8. package/dist/exports/webgl-shaders.d.ts +11 -0
  9. package/dist/exports/webgl-shaders.js +28 -0
  10. package/dist/exports/webgl-shaders.js.map +1 -0
  11. package/dist/src/core/CoreTextureManager.js +6 -0
  12. package/dist/src/core/CoreTextureManager.js.map +1 -1
  13. package/dist/src/core/platforms/Platform.d.ts +37 -0
  14. package/dist/src/{main-api/texture-usage-trackers/TextureUsageTracker.js → core/platforms/Platform.js} +3 -9
  15. package/dist/src/core/platforms/Platform.js.map +1 -0
  16. package/dist/src/core/platforms/web/WebPlatform.d.ts +9 -0
  17. package/dist/src/core/platforms/web/WebPlatform.js +58 -0
  18. package/dist/src/core/platforms/web/WebPlatform.js.map +1 -0
  19. package/dist/src/core/renderers/CoreShaderNode.d.ts +58 -0
  20. package/dist/src/core/renderers/CoreShaderNode.js +104 -0
  21. package/dist/src/core/renderers/CoreShaderNode.js.map +1 -0
  22. package/dist/src/core/renderers/CoreShaderProgram.d.ts +4 -0
  23. package/dist/src/{main-api/ICoreDriver.js → core/renderers/CoreShaderProgram.js} +1 -1
  24. package/dist/src/core/renderers/CoreShaderProgram.js.map +1 -0
  25. package/dist/src/core/renderers/canvas/CanvasRenderer.d.ts +36 -0
  26. package/dist/src/core/renderers/canvas/CanvasRenderer.js +212 -0
  27. package/dist/src/core/renderers/canvas/CanvasRenderer.js.map +1 -0
  28. package/dist/src/core/renderers/canvas/CanvasShaderNode.d.ts +21 -0
  29. package/dist/src/core/renderers/canvas/CanvasShaderNode.js +60 -0
  30. package/dist/src/core/renderers/canvas/CanvasShaderNode.js.map +1 -0
  31. package/dist/src/core/renderers/canvas/CanvasTexture.d.ts +16 -0
  32. package/dist/src/core/renderers/canvas/CanvasTexture.js +124 -0
  33. package/dist/src/core/renderers/canvas/CanvasTexture.js.map +1 -0
  34. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.d.ts +12 -0
  35. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js +55 -0
  36. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js.map +1 -0
  37. package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.d.ts +9 -0
  38. package/dist/src/core/{CoreExtension.js → renderers/webgl/WebGlCtxSubTexture.js} +19 -10
  39. package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.js.map +1 -0
  40. package/dist/src/core/renderers/webgl/WebGlCtxTexture.d.ts +57 -0
  41. package/dist/src/core/renderers/webgl/WebGlCtxTexture.js +227 -0
  42. package/dist/src/core/renderers/webgl/WebGlCtxTexture.js.map +1 -0
  43. package/dist/src/core/renderers/webgl/WebGlRenderOp.d.ts +44 -0
  44. package/dist/src/core/renderers/webgl/WebGlRenderOp.js +118 -0
  45. package/dist/src/core/renderers/webgl/WebGlRenderOp.js.map +1 -0
  46. package/dist/src/core/renderers/webgl/WebGlRenderer.d.ts +135 -0
  47. package/dist/src/core/renderers/webgl/WebGlRenderer.js +571 -0
  48. package/dist/src/core/renderers/webgl/WebGlRenderer.js.map +1 -0
  49. package/dist/src/core/renderers/webgl/WebGlShaderNode.d.ts +222 -0
  50. package/dist/src/core/renderers/webgl/WebGlShaderNode.js +334 -0
  51. package/dist/src/core/renderers/webgl/WebGlShaderNode.js.map +1 -0
  52. package/dist/src/core/renderers/webgl/WebGlShaderProgram.d.ts +35 -0
  53. package/dist/src/core/renderers/webgl/WebGlShaderProgram.js +201 -0
  54. package/dist/src/core/renderers/webgl/WebGlShaderProgram.js.map +1 -0
  55. package/dist/src/core/renderers/webgl/shaders/DefaultShader.js +45 -45
  56. package/dist/src/core/renderers/webgl/shaders/DefaultShaderBatched.js +61 -61
  57. package/dist/src/core/renderers/webgl/shaders/DynamicShader.js +93 -93
  58. package/dist/src/core/renderers/webgl/shaders/RoundedRectangle.js +63 -63
  59. package/dist/src/core/renderers/webgl/shaders/SdfShader.js +62 -62
  60. package/dist/src/core/renderers/webgl/shaders/effects/BorderBottomEffect.js +15 -15
  61. package/dist/src/core/renderers/webgl/shaders/effects/BorderEffect.js +6 -6
  62. package/dist/src/core/renderers/webgl/shaders/effects/BorderLeftEffect.js +15 -15
  63. package/dist/src/core/renderers/webgl/shaders/effects/BorderRightEffect.js +15 -15
  64. package/dist/src/core/renderers/webgl/shaders/effects/BorderTopEffect.js +15 -15
  65. package/dist/src/core/renderers/webgl/shaders/effects/FadeOutEffect.js +42 -42
  66. package/dist/src/core/renderers/webgl/shaders/effects/GlitchEffect.js +44 -44
  67. package/dist/src/core/renderers/webgl/shaders/effects/GrayscaleEffect.js +3 -3
  68. package/dist/src/core/renderers/webgl/shaders/effects/HolePunchEffect.js +22 -22
  69. package/dist/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.js +28 -28
  70. package/dist/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.js +10 -10
  71. package/dist/src/core/renderers/webgl/shaders/effects/RadialProgressEffect.js +37 -37
  72. package/dist/src/core/renderers/webgl/shaders/effects/RadiusEffect.js +19 -19
  73. package/dist/src/core/shaders/canvas/Border.d.ts +9 -0
  74. package/dist/src/core/shaders/canvas/Border.js +57 -0
  75. package/dist/src/core/shaders/canvas/Border.js.map +1 -0
  76. package/dist/src/core/shaders/canvas/HolePunch.d.ts +7 -0
  77. package/dist/src/core/shaders/canvas/HolePunch.js +38 -0
  78. package/dist/src/core/shaders/canvas/HolePunch.js.map +1 -0
  79. package/dist/src/core/shaders/canvas/LinearGradient.d.ts +10 -0
  80. package/dist/src/core/shaders/canvas/LinearGradient.js +46 -0
  81. package/dist/src/core/shaders/canvas/LinearGradient.js.map +1 -0
  82. package/dist/src/core/shaders/canvas/RadialGradient.d.ts +11 -0
  83. package/dist/src/core/shaders/canvas/RadialGradient.js +68 -0
  84. package/dist/src/core/shaders/canvas/RadialGradient.js.map +1 -0
  85. package/dist/src/core/shaders/canvas/Rounded.d.ts +7 -0
  86. package/dist/src/core/shaders/canvas/Rounded.js +33 -0
  87. package/dist/src/core/shaders/canvas/Rounded.js.map +1 -0
  88. package/dist/src/core/shaders/canvas/RoundedWithBorder.d.ts +7 -0
  89. package/dist/src/core/shaders/canvas/RoundedWithBorder.js +41 -0
  90. package/dist/src/core/shaders/canvas/RoundedWithBorder.js.map +1 -0
  91. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.d.ts +8 -0
  92. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js +39 -0
  93. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js.map +1 -0
  94. package/dist/src/core/shaders/canvas/RoundedWithShadow.d.ts +7 -0
  95. package/dist/src/core/shaders/canvas/RoundedWithShadow.js +38 -0
  96. package/dist/src/core/shaders/canvas/RoundedWithShadow.js.map +1 -0
  97. package/dist/src/core/shaders/canvas/Shadow.d.ts +8 -0
  98. package/dist/src/core/shaders/canvas/Shadow.js +31 -0
  99. package/dist/src/core/shaders/canvas/Shadow.js.map +1 -0
  100. package/dist/src/core/shaders/canvas/utils/render.d.ts +5 -0
  101. package/dist/src/core/shaders/canvas/utils/render.js +84 -0
  102. package/dist/src/core/shaders/canvas/utils/render.js.map +1 -0
  103. package/dist/src/core/shaders/templates/BorderTemplate.d.ts +37 -0
  104. package/dist/src/core/shaders/templates/BorderTemplate.js +73 -0
  105. package/dist/src/core/shaders/templates/BorderTemplate.js.map +1 -0
  106. package/dist/src/core/shaders/templates/HolePunchTemplate.d.ts +46 -0
  107. package/dist/src/core/shaders/templates/HolePunchTemplate.js +35 -0
  108. package/dist/src/core/shaders/templates/HolePunchTemplate.js.map +1 -0
  109. package/dist/src/core/shaders/templates/LinearGradientTemplate.d.ts +23 -0
  110. package/dist/src/core/shaders/templates/LinearGradientTemplate.js +47 -0
  111. package/dist/src/core/shaders/templates/LinearGradientTemplate.js.map +1 -0
  112. package/dist/src/core/shaders/templates/RadialGradientTemplate.d.ts +31 -0
  113. package/dist/src/core/shaders/templates/RadialGradientTemplate.js +49 -0
  114. package/dist/src/core/shaders/templates/RadialGradientTemplate.js.map +1 -0
  115. package/dist/src/core/shaders/templates/RoundedTemplate.d.ts +29 -0
  116. package/dist/src/core/shaders/templates/RoundedTemplate.js +67 -0
  117. package/dist/src/core/shaders/templates/RoundedTemplate.js.map +1 -0
  118. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.d.ts +7 -0
  119. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js +24 -0
  120. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js.map +1 -0
  121. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.d.ts +6 -0
  122. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js +23 -0
  123. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js.map +1 -0
  124. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.d.ts +6 -0
  125. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js +23 -0
  126. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js.map +1 -0
  127. package/dist/src/core/shaders/templates/ShadowTemplate.d.ts +34 -0
  128. package/dist/src/core/shaders/templates/ShadowTemplate.js +66 -0
  129. package/dist/src/core/shaders/templates/ShadowTemplate.js.map +1 -0
  130. package/dist/src/core/shaders/templates/shaderUtils.d.ts +5 -0
  131. package/dist/src/core/shaders/templates/shaderUtils.js +41 -0
  132. package/dist/src/core/shaders/templates/shaderUtils.js.map +1 -0
  133. package/dist/src/core/shaders/webgl/Border.d.ts +3 -0
  134. package/dist/src/core/shaders/webgl/Border.js +110 -0
  135. package/dist/src/core/shaders/webgl/Border.js.map +1 -0
  136. package/dist/src/core/shaders/webgl/Default.d.ts +2 -0
  137. package/dist/src/core/shaders/webgl/Default.js +86 -0
  138. package/dist/src/core/shaders/webgl/Default.js.map +1 -0
  139. package/dist/src/core/shaders/webgl/DefaultBatched.d.ts +2 -0
  140. package/dist/src/core/shaders/webgl/DefaultBatched.js +104 -0
  141. package/dist/src/core/shaders/webgl/DefaultBatched.js.map +1 -0
  142. package/dist/src/core/shaders/webgl/HolePunch.d.ts +3 -0
  143. package/dist/src/core/shaders/webgl/HolePunch.js +64 -0
  144. package/dist/src/core/shaders/webgl/HolePunch.js.map +1 -0
  145. package/dist/src/core/shaders/webgl/LinearGradient.d.ts +3 -0
  146. package/dist/src/core/shaders/webgl/LinearGradient.js +75 -0
  147. package/dist/src/core/shaders/webgl/LinearGradient.js.map +1 -0
  148. package/dist/src/core/shaders/webgl/RadialGradient.d.ts +3 -0
  149. package/dist/src/core/shaders/webgl/RadialGradient.js +73 -0
  150. package/dist/src/core/shaders/webgl/RadialGradient.js.map +1 -0
  151. package/dist/src/core/shaders/webgl/Rounded.d.ts +7 -0
  152. package/dist/src/core/shaders/webgl/Rounded.js +86 -0
  153. package/dist/src/core/shaders/webgl/Rounded.js.map +1 -0
  154. package/dist/src/core/shaders/webgl/RoundedWithBorder.d.ts +3 -0
  155. package/dist/src/core/shaders/webgl/RoundedWithBorder.js +129 -0
  156. package/dist/src/core/shaders/webgl/RoundedWithBorder.js.map +1 -0
  157. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.d.ts +3 -0
  158. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js +149 -0
  159. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js.map +1 -0
  160. package/dist/src/core/shaders/webgl/RoundedWithShadow.d.ts +3 -0
  161. package/dist/src/core/shaders/webgl/RoundedWithShadow.js +84 -0
  162. package/dist/src/core/shaders/webgl/RoundedWithShadow.js.map +1 -0
  163. package/dist/src/core/shaders/webgl/SdfShader.d.ts +32 -0
  164. package/dist/src/core/shaders/webgl/SdfShader.js +116 -0
  165. package/dist/src/core/shaders/webgl/SdfShader.js.map +1 -0
  166. package/dist/src/core/shaders/webgl/Shadow.d.ts +3 -0
  167. package/dist/src/core/shaders/webgl/Shadow.js +110 -0
  168. package/dist/src/core/shaders/webgl/Shadow.js.map +1 -0
  169. package/dist/src/core/temp.js +77 -0
  170. package/dist/src/core/temp.js.map +1 -0
  171. package/dist/src/core/textures/Texture.d.ts +4 -2
  172. package/dist/src/core/textures/Texture.js +18 -6
  173. package/dist/src/core/textures/Texture.js.map +1 -1
  174. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  175. package/exports/canvas.ts +39 -39
  176. package/exports/index.ts +89 -89
  177. package/exports/inspector.ts +24 -24
  178. package/exports/utils.ts +44 -44
  179. package/exports/webgl.ts +38 -38
  180. package/package.json +1 -2
  181. package/scripts/please-use-pnpm.js +13 -13
  182. package/src/common/CommonTypes.ts +146 -146
  183. package/src/common/EventEmitter.ts +77 -77
  184. package/src/common/IAnimationController.ts +92 -92
  185. package/src/common/IEventEmitter.ts +28 -28
  186. package/src/core/CoreNode.test.ts +202 -202
  187. package/src/core/CoreNode.ts +2455 -2455
  188. package/src/core/CoreShaderManager.ts +292 -292
  189. package/src/core/CoreTextNode.ts +455 -455
  190. package/src/core/CoreTextureManager.ts +604 -597
  191. package/src/core/Stage.ts +743 -743
  192. package/src/core/TextureMemoryManager.ts +395 -395
  193. package/src/core/animations/AnimationManager.ts +38 -38
  194. package/src/core/animations/CoreAnimation.ts +340 -340
  195. package/src/core/animations/CoreAnimationController.ts +157 -157
  196. package/src/core/lib/ContextSpy.ts +41 -41
  197. package/src/core/lib/ImageWorker.ts +280 -280
  198. package/src/core/lib/Matrix3d.ts +244 -244
  199. package/src/core/lib/RenderCoords.ts +86 -86
  200. package/src/core/lib/WebGlContextWrapper.ts +1332 -1332
  201. package/src/core/lib/textureCompression.ts +152 -152
  202. package/src/core/lib/textureSvg.ts +78 -78
  203. package/src/core/lib/utils.ts +384 -384
  204. package/src/core/lib/validateImageBitmap.ts +76 -76
  205. package/src/core/platform.ts +63 -63
  206. package/src/core/renderers/CoreContextTexture.ts +43 -43
  207. package/src/core/renderers/CoreRenderOp.ts +22 -22
  208. package/src/core/renderers/CoreRenderer.ts +115 -115
  209. package/src/core/renderers/CoreShader.ts +41 -41
  210. package/src/core/renderers/canvas/CanvasCoreRenderer.ts +375 -375
  211. package/src/core/renderers/canvas/CanvasCoreTexture.ts +153 -153
  212. package/src/core/renderers/canvas/internal/C2DShaderUtils.ts +231 -231
  213. package/src/core/renderers/canvas/internal/ColorUtils.ts +69 -69
  214. package/src/core/renderers/canvas/shaders/UnsupportedShader.ts +48 -48
  215. package/src/core/renderers/webgl/WebGlCoreCtxRenderTexture.ts +86 -86
  216. package/src/core/renderers/webgl/WebGlCoreCtxSubTexture.ts +50 -50
  217. package/src/core/renderers/webgl/WebGlCoreCtxTexture.ts +301 -301
  218. package/src/core/renderers/webgl/WebGlCoreRenderOp.ts +125 -125
  219. package/src/core/renderers/webgl/WebGlCoreRenderer.ts +815 -815
  220. package/src/core/renderers/webgl/WebGlCoreShader.ts +362 -362
  221. package/src/core/renderers/webgl/internal/BufferCollection.ts +54 -54
  222. package/src/core/renderers/webgl/internal/RendererUtils.ts +155 -155
  223. package/src/core/renderers/webgl/internal/ShaderUtils.ts +143 -143
  224. package/src/core/renderers/webgl/internal/WebGlUtils.ts +35 -35
  225. package/src/core/renderers/webgl/shaders/DefaultShader.ts +93 -93
  226. package/src/core/renderers/webgl/shaders/DefaultShaderBatched.ts +132 -132
  227. package/src/core/renderers/webgl/shaders/DynamicShader.ts +580 -580
  228. package/src/core/renderers/webgl/shaders/RoundedRectangle.ts +167 -167
  229. package/src/core/renderers/webgl/shaders/SdfShader.ts +204 -204
  230. package/src/core/renderers/webgl/shaders/effects/BorderBottomEffect.ts +101 -101
  231. package/src/core/renderers/webgl/shaders/effects/BorderEffect.ts +87 -87
  232. package/src/core/renderers/webgl/shaders/effects/BorderLeftEffect.ts +101 -101
  233. package/src/core/renderers/webgl/shaders/effects/BorderRightEffect.ts +101 -101
  234. package/src/core/renderers/webgl/shaders/effects/BorderTopEffect.ts +101 -101
  235. package/src/core/renderers/webgl/shaders/effects/EffectUtils.ts +159 -159
  236. package/src/core/renderers/webgl/shaders/effects/FadeOutEffect.ts +127 -127
  237. package/src/core/renderers/webgl/shaders/effects/GlitchEffect.ts +148 -148
  238. package/src/core/renderers/webgl/shaders/effects/GrayscaleEffect.ts +67 -67
  239. package/src/core/renderers/webgl/shaders/effects/HolePunchEffect.ts +157 -157
  240. package/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.ts +171 -171
  241. package/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.ts +168 -168
  242. package/src/core/renderers/webgl/shaders/effects/RadialProgressEffect.ts +187 -187
  243. package/src/core/renderers/webgl/shaders/effects/RadiusEffect.ts +110 -110
  244. package/src/core/renderers/webgl/shaders/effects/ShaderEffect.ts +196 -196
  245. package/src/core/text-rendering/TextRenderingUtils.ts +36 -36
  246. package/src/core/text-rendering/TextTextureRendererUtils.ts +263 -263
  247. package/src/core/text-rendering/TrFontManager.ts +183 -183
  248. package/src/core/text-rendering/font-face-types/SdfTrFontFace/SdfTrFontFace.ts +176 -176
  249. package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/FontShaper.ts +139 -139
  250. package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/SdfFontShaper.test.ts +173 -173
  251. package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/SdfFontShaper.ts +171 -171
  252. package/src/core/text-rendering/font-face-types/TrFontFace.ts +187 -187
  253. package/src/core/text-rendering/font-face-types/WebTrFontFace.ts +94 -94
  254. package/src/core/text-rendering/font-face-types/utils.ts +39 -39
  255. package/src/core/text-rendering/renderers/CanvasTextRenderer.ts +509 -509
  256. package/src/core/text-rendering/renderers/LightningTextTextureRenderer.ts +808 -808
  257. package/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.ts +853 -853
  258. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/PeekableGenerator.test.ts +48 -48
  259. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/PeekableGenerator.ts +66 -66
  260. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/SpecialCodepoints.ts +52 -52
  261. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/constants.ts +32 -32
  262. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getStartConditions.ts +117 -117
  263. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getUnicodeCodepoints.test.ts +133 -133
  264. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getUnicodeCodepoints.ts +38 -38
  265. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText.ts +408 -408
  266. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/measureText.test.ts +49 -49
  267. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/measureText.ts +52 -52
  268. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/setRenderWindow.test.ts +205 -205
  269. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/setRenderWindow.ts +93 -93
  270. package/src/core/text-rendering/renderers/SdfTextRenderer/internal/util.ts +40 -40
  271. package/src/core/text-rendering/renderers/TextRenderer.ts +557 -557
  272. package/src/core/textures/ColorTexture.ts +102 -102
  273. package/src/core/textures/ImageTexture.ts +399 -399
  274. package/src/core/textures/NoiseTexture.ts +104 -104
  275. package/src/core/textures/RenderTexture.ts +85 -85
  276. package/src/core/textures/SubTexture.ts +205 -205
  277. package/src/core/textures/Texture.ts +353 -337
  278. package/src/core/utils.ts +227 -227
  279. package/src/env.d.ts +7 -7
  280. package/src/main-api/DynamicShaderController.ts +104 -104
  281. package/src/main-api/INode.ts +101 -101
  282. package/src/main-api/Inspector.ts +522 -522
  283. package/src/main-api/Renderer.ts +751 -751
  284. package/src/main-api/ShaderController.ts +80 -80
  285. package/src/main-api/utils.ts +45 -45
  286. package/src/utils.ts +248 -248
  287. package/dist/exports/core-api.d.ts +0 -74
  288. package/dist/exports/core-api.js +0 -96
  289. package/dist/exports/core-api.js.map +0 -1
  290. package/dist/exports/main-api.d.ts +0 -30
  291. package/dist/exports/main-api.js +0 -45
  292. package/dist/exports/main-api.js.map +0 -1
  293. package/dist/src/core/CoreExtension.d.ts +0 -12
  294. package/dist/src/core/CoreExtension.js.map +0 -1
  295. package/dist/src/main-api/ICoreDriver.d.ts +0 -24
  296. package/dist/src/main-api/ICoreDriver.js.map +0 -1
  297. package/dist/src/main-api/RendererMain.d.ts +0 -378
  298. package/dist/src/main-api/RendererMain.js +0 -367
  299. package/dist/src/main-api/RendererMain.js.map +0 -1
  300. package/dist/src/main-api/texture-usage-trackers/FinalizationRegistryTextureUsageTracker.d.ts +0 -9
  301. package/dist/src/main-api/texture-usage-trackers/FinalizationRegistryTextureUsageTracker.js +0 -38
  302. package/dist/src/main-api/texture-usage-trackers/FinalizationRegistryTextureUsageTracker.js.map +0 -1
  303. package/dist/src/main-api/texture-usage-trackers/ManualCountTextureUsageTracker.d.ts +0 -56
  304. package/dist/src/main-api/texture-usage-trackers/ManualCountTextureUsageTracker.js +0 -101
  305. package/dist/src/main-api/texture-usage-trackers/ManualCountTextureUsageTracker.js.map +0 -1
  306. package/dist/src/main-api/texture-usage-trackers/TextureUsageTracker.d.ts +0 -32
  307. package/dist/src/main-api/texture-usage-trackers/TextureUsageTracker.js.map +0 -1
  308. package/dist/src/render-drivers/main/MainCoreDriver.d.ts +0 -21
  309. package/dist/src/render-drivers/main/MainCoreDriver.js +0 -115
  310. package/dist/src/render-drivers/main/MainCoreDriver.js.map +0 -1
  311. package/dist/src/render-drivers/main/MainOnlyNode.d.ts +0 -101
  312. package/dist/src/render-drivers/main/MainOnlyNode.js +0 -425
  313. package/dist/src/render-drivers/main/MainOnlyNode.js.map +0 -1
  314. package/dist/src/render-drivers/main/MainOnlyTextNode.d.ts +0 -47
  315. package/dist/src/render-drivers/main/MainOnlyTextNode.js +0 -204
  316. package/dist/src/render-drivers/main/MainOnlyTextNode.js.map +0 -1
  317. package/dist/src/render-drivers/threadx/NodeStruct.d.ts +0 -93
  318. package/dist/src/render-drivers/threadx/NodeStruct.js +0 -290
  319. package/dist/src/render-drivers/threadx/NodeStruct.js.map +0 -1
  320. package/dist/src/render-drivers/threadx/SharedNode.d.ts +0 -40
  321. package/dist/src/render-drivers/threadx/SharedNode.js +0 -61
  322. package/dist/src/render-drivers/threadx/SharedNode.js.map +0 -1
  323. package/dist/src/render-drivers/threadx/TextNodeStruct.d.ts +0 -44
  324. package/dist/src/render-drivers/threadx/TextNodeStruct.js +0 -203
  325. package/dist/src/render-drivers/threadx/TextNodeStruct.js.map +0 -1
  326. package/dist/src/render-drivers/threadx/ThreadXCoreDriver.d.ts +0 -25
  327. package/dist/src/render-drivers/threadx/ThreadXCoreDriver.js +0 -232
  328. package/dist/src/render-drivers/threadx/ThreadXCoreDriver.js.map +0 -1
  329. package/dist/src/render-drivers/threadx/ThreadXMainAnimationController.d.ts +0 -24
  330. package/dist/src/render-drivers/threadx/ThreadXMainAnimationController.js +0 -113
  331. package/dist/src/render-drivers/threadx/ThreadXMainAnimationController.js.map +0 -1
  332. package/dist/src/render-drivers/threadx/ThreadXMainNode.d.ts +0 -46
  333. package/dist/src/render-drivers/threadx/ThreadXMainNode.js +0 -160
  334. package/dist/src/render-drivers/threadx/ThreadXMainNode.js.map +0 -1
  335. package/dist/src/render-drivers/threadx/ThreadXMainTextNode.d.ts +0 -28
  336. package/dist/src/render-drivers/threadx/ThreadXMainTextNode.js +0 -55
  337. package/dist/src/render-drivers/threadx/ThreadXMainTextNode.js.map +0 -1
  338. package/dist/src/render-drivers/threadx/ThreadXRendererMessage.d.ts +0 -70
  339. package/dist/src/render-drivers/threadx/ThreadXRendererMessage.js +0 -32
  340. package/dist/src/render-drivers/threadx/ThreadXRendererMessage.js.map +0 -1
  341. package/dist/src/render-drivers/threadx/worker/ThreadXRendererNode.d.ts +0 -19
  342. package/dist/src/render-drivers/threadx/worker/ThreadXRendererNode.js +0 -184
  343. package/dist/src/render-drivers/threadx/worker/ThreadXRendererNode.js.map +0 -1
  344. package/dist/src/render-drivers/threadx/worker/ThreadXRendererTextNode.d.ts +0 -27
  345. package/dist/src/render-drivers/threadx/worker/ThreadXRendererTextNode.js +0 -109
  346. package/dist/src/render-drivers/threadx/worker/ThreadXRendererTextNode.js.map +0 -1
  347. package/dist/src/render-drivers/threadx/worker/renderer.js +0 -147
  348. package/dist/src/render-drivers/threadx/worker/renderer.js.map +0 -1
  349. package/dist/src/render-drivers/utils.d.ts +0 -12
  350. package/dist/src/render-drivers/utils.js +0 -74
  351. package/dist/src/render-drivers/utils.js.map +0 -1
  352. package/dist/tsconfig.tsbuildinfo +0 -1
  353. /package/dist/src/{render-drivers/threadx/worker/renderer.d.ts → core/temp.d.ts} +0 -0
@@ -0,0 +1,222 @@
1
+ import type { CoreNode } from '../../CoreNode.js';
2
+ import type { WebGlContextWrapper } from '../../lib/WebGlContextWrapper.js';
3
+ import type { Stage } from '../../Stage.js';
4
+ import type { QuadOptions } from '../CoreRenderer.js';
5
+ import { CoreShaderNode, type CoreShaderType } from '../CoreShaderNode.js';
6
+ import type { UniformCollection, Vec2, Vec3, Vec4 } from './internal/ShaderUtils.js';
7
+ import type { WebGlRenderer } from './WebGlRenderer.js';
8
+ import type { WebGlRenderOp } from './WebGlRenderOp.js';
9
+ import type { WebGlShaderProgram } from './WebGlShaderProgram.js';
10
+ export type ShaderSource<T> = string | ((renderer: WebGlRenderer, props: T) => string);
11
+ /**
12
+ * This is the WebGL specific ShaderType @mixes CoreShaderType
13
+ */
14
+ export type WebGlShaderType<T extends object = Record<string, unknown>> = CoreShaderType<T> & {
15
+ /**
16
+ * fragment shader source for WebGl or WebGl2
17
+ */
18
+ fragment: ShaderSource<T>;
19
+ /**
20
+ * vertex shader source for WebGl or WebGl2
21
+ */
22
+ vertex?: ShaderSource<T>;
23
+ /**
24
+ * This function is called when one of the props is changed, here you can update the uniforms you use in the fragment / vertex shader.
25
+ * @param node WebGlContextWrapper with utilities to update uniforms, and other actions.
26
+ */
27
+ update?: (this: WebGlShaderNode<T>, node: CoreNode) => void;
28
+ /**
29
+ * only used for SDF shader, will be removed in the future.
30
+ *
31
+ * @warning don't use this in your shader type
32
+ */
33
+ onSdfBind?: (this: WebGlContextWrapper, props: T) => void;
34
+ /**
35
+ * This function is used to check if the shader can be reused based on quad info
36
+ * @param props
37
+ */
38
+ canBatch?: (incomingQuad: QuadOptions, currentRenderOp: WebGlRenderOp) => boolean;
39
+ /**
40
+ * extensions required for specific shader?
41
+ */
42
+ webgl1Extensions?: string[];
43
+ webgl2Extensions?: string[];
44
+ supportsIndexedTextures?: boolean;
45
+ };
46
+ export declare class WebGlShaderNode<Props extends object = Record<string, unknown>> extends CoreShaderNode<Props> {
47
+ readonly program: WebGlShaderProgram;
48
+ private updater;
49
+ private valueKey;
50
+ uniforms: UniformCollection;
51
+ constructor(shaderKey: string, config: WebGlShaderType<Props>, program: WebGlShaderProgram, stage: Stage, props?: Props);
52
+ /**
53
+ * Sets the value of a RGBA variable
54
+ * @param location
55
+ * @param value
56
+ */
57
+ uniformRGBA(location: string, value: number): void;
58
+ /**
59
+ * Sets the value of a single float uniform variable.
60
+ *
61
+ * @param location - The location of the uniform variable.
62
+ * @param v0 - The value to set.
63
+ */
64
+ uniform1f(location: string, value: number): void;
65
+ /**
66
+ * Sets the value of a float array uniform variable.
67
+ *
68
+ * @param location - The location of the uniform variable.
69
+ * @param value - The array of values to set.
70
+ */
71
+ uniform1fv(location: string, value: Float32Array): void;
72
+ /**
73
+ * Sets the value of a single integer uniform variable.
74
+ *
75
+ * @param location - The location of the uniform variable.
76
+ * @param v0 - The value to set.
77
+ */
78
+ uniform1i(location: string, value: number): void;
79
+ /**
80
+ * Sets the value of an integer array uniform variable.
81
+ *
82
+ * @param location - The location of the uniform variable.
83
+ * @param value - The array of values to set.
84
+ */
85
+ uniform1iv(location: string, value: Int32Array): void;
86
+ /**
87
+ * Sets the value of a vec2 uniform variable.
88
+ *
89
+ * @param location - The location of the uniform variable.
90
+ * @param v0 - The first component of the vector.
91
+ * @param v1 - The second component of the vector.
92
+ */
93
+ uniform2f(location: string, v0: number, v1: number): void;
94
+ /**
95
+ * Sets the value of a vec2 array uniform variable.
96
+ *
97
+ * @param location - The location of the uniform variable.
98
+ * @param value - The array of vec2 values to set as FloatArray.
99
+ */
100
+ uniform2fv(location: string, value: Float32Array): void;
101
+ /**
102
+ * Sets the value of a vec2 array uniform variable.
103
+ *
104
+ * @param location - The location of the uniform variable.
105
+ * @param value - The array of vec2 values to set.
106
+ */
107
+ uniform2fa(location: string, value: Vec2): void;
108
+ /**
109
+ * Sets the value of a ivec2 uniform variable.
110
+ *
111
+ * @param location - The location of the uniform variable.
112
+ * @param v0 - The first component of the vector.
113
+ * @param v1 - The second component of the vector.
114
+ */
115
+ uniform2i(location: string, v0: number, v1: number): void;
116
+ /**
117
+ * Sets the value of an ivec2 array uniform variable.
118
+ *
119
+ * @param location - The location of the uniform variable.
120
+ * @param value - The array of ivec2 values to set.
121
+ */
122
+ uniform2iv(location: string, value: Int32Array): void;
123
+ /**
124
+ * Sets the value of a vec3 uniform variable.
125
+ *
126
+ * @param location - The location of the uniform variable.
127
+ * @param v0 - The first component of the vector.
128
+ * @param v1 - The second component of the vector.
129
+ * @param v2 - The third component of the vector.
130
+ */
131
+ uniform3f(location: string, v0: number, v1: number, v2: number): void;
132
+ /**
133
+ * Sets the value of a vec3 uniform variable.
134
+ *
135
+ * @param location - The location of the uniform variable.
136
+ * @param
137
+ */
138
+ uniform3fa(location: string, value: Vec3): void;
139
+ /**
140
+ * Sets the value of a vec3 array uniform variable.
141
+ *
142
+ * @param location - The location of the uniform variable.
143
+ * @param value - The array of vec3 values to set.
144
+ */
145
+ uniform3fv(location: string, value: Float32Array): void;
146
+ /**
147
+ * Sets the value of a ivec3 uniform variable.
148
+ *
149
+ * @param location - The location of the uniform variable.
150
+ * @param v0 - The first component of the vector.
151
+ * @param v1 - The second component of the vector.
152
+ * @param v2 - The third component of the vector.
153
+ */
154
+ uniform3i(location: string, v0: number, v1: number, v2: number): void;
155
+ /**
156
+ * Sets the value of an ivec3 array uniform variable.
157
+ *
158
+ * @param location - The location of the uniform variable.
159
+ * @param value - The array of ivec3 values to set.
160
+ */
161
+ uniform3iv(location: string, value: Int32Array): void;
162
+ /**
163
+ * Sets the value of a vec4 uniform variable.
164
+ *
165
+ * @param location - The location of the uniform variable.
166
+ * @param v0 - The first component of the vector.
167
+ * @param v1 - The second component of the vector.
168
+ * @param v2 - The third component of the vector.
169
+ * @param v3 - The fourth component of the vector.
170
+ */
171
+ uniform4f(location: string, v0: number, v1: number, v2: number, v3: number): void;
172
+ /**
173
+ * Sets an array of numbers
174
+ * @param location The location of the uniform variable.
175
+ * @param value
176
+ */
177
+ uniform4fa(location: string, value: Vec4): void;
178
+ /**
179
+ * Sets the value of a vec4 array uniform variable.
180
+ *
181
+ * @param location - The location of the uniform variable.
182
+ * @param value - The array of vec4 values to set.
183
+ */
184
+ uniform4fv(location: string, value: Float32Array): void;
185
+ /**
186
+ * Sets the value of a ivec4 uniform variable.
187
+ *
188
+ * @param location - The location of the uniform variable.
189
+ * @param v0 - The first component of the vector.
190
+ * @param v1 - The second component of the vector.
191
+ * @param v2 - The third component of the vector.
192
+ * @param v3 - The fourth component of the vector.
193
+ */
194
+ uniform4i(location: string, v0: number, v1: number, v2: number, v3: number): void;
195
+ /**
196
+ * Sets the value of an ivec4 array uniform variable.
197
+ *
198
+ * @param location - The location of the uniform variable.
199
+ * @param value - The array of ivec4 values to set.
200
+ */
201
+ uniform4iv(location: string, value: Int32Array): void;
202
+ /**
203
+ * Sets the value of a mat2 uniform variable.
204
+ *
205
+ * @param location - The location of the uniform variable.
206
+ * @param transpose - Whether to transpose the matrix.
207
+ * @param value - The array of mat2 values to set.
208
+ */
209
+ uniformMatrix2fv(location: string, value: Float32Array): void;
210
+ /**
211
+ * Sets the value of a mat2 uniform variable.
212
+ * @param location - The location of the uniform variable.
213
+ * @param value - The array of mat2 values to set.
214
+ */
215
+ uniformMatrix3fv(location: string, value: Float32Array): void;
216
+ /**
217
+ * Sets the value of a mat4 uniform variable.
218
+ * @param location - The location of the uniform variable.
219
+ * @param value - The array of mat4 values to set.
220
+ */
221
+ uniformMatrix4fv(location: string, value: Float32Array): void;
222
+ }
@@ -0,0 +1,334 @@
1
+ import { getNormalizedRgbaComponents } from '../../lib/utils.js';
2
+ import { CoreShaderNode } from '../CoreShaderNode.js';
3
+ export class WebGlShaderNode extends CoreShaderNode {
4
+ program;
5
+ updater = undefined;
6
+ valueKey = '';
7
+ uniforms = {
8
+ single: {},
9
+ vec2: {},
10
+ vec3: {},
11
+ vec4: {},
12
+ };
13
+ constructor(shaderKey, config, program, stage, props) {
14
+ super(shaderKey, config, stage, props);
15
+ this.program = program;
16
+ if (config.update !== undefined) {
17
+ this.updater = config.update;
18
+ this.update = () => {
19
+ if (this.props === undefined) {
20
+ this.updater(this.node, this.props);
21
+ return;
22
+ }
23
+ const prevKey = this.valueKey;
24
+ this.valueKey = '';
25
+ for (const key in this.resolvedProps) {
26
+ this.valueKey += `${key}:${this.resolvedProps[key]};`;
27
+ }
28
+ if (prevKey === this.valueKey) {
29
+ return;
30
+ }
31
+ if (prevKey.length > 0) {
32
+ this.stage.shManager.mutateShaderValueUsage(prevKey, -1);
33
+ }
34
+ const values = this.stage.shManager.getShaderValues(this.valueKey);
35
+ if (values !== undefined) {
36
+ this.uniforms = values;
37
+ return;
38
+ }
39
+ //create empty uniform collection when calculating new values
40
+ this.uniforms = {
41
+ single: {},
42
+ vec2: {},
43
+ vec3: {},
44
+ vec4: {},
45
+ };
46
+ this.updater(this.node);
47
+ this.stage.shManager.setShaderValues(this.valueKey, this.uniforms);
48
+ };
49
+ }
50
+ }
51
+ /**
52
+ * Sets the value of a RGBA variable
53
+ * @param location
54
+ * @param value
55
+ */
56
+ uniformRGBA(location, value) {
57
+ this.uniform4fv(location, new Float32Array(getNormalizedRgbaComponents(value)));
58
+ }
59
+ /**
60
+ * Sets the value of a single float uniform variable.
61
+ *
62
+ * @param location - The location of the uniform variable.
63
+ * @param v0 - The value to set.
64
+ */
65
+ uniform1f(location, value) {
66
+ this.uniforms.single[location] = {
67
+ method: 'uniform1f',
68
+ value,
69
+ };
70
+ }
71
+ /**
72
+ * Sets the value of a float array uniform variable.
73
+ *
74
+ * @param location - The location of the uniform variable.
75
+ * @param value - The array of values to set.
76
+ */
77
+ uniform1fv(location, value) {
78
+ this.uniforms.single[location] = {
79
+ method: 'uniform1fv',
80
+ value,
81
+ };
82
+ }
83
+ /**
84
+ * Sets the value of a single integer uniform variable.
85
+ *
86
+ * @param location - The location of the uniform variable.
87
+ * @param v0 - The value to set.
88
+ */
89
+ uniform1i(location, value) {
90
+ this.uniforms.single[location] = {
91
+ method: 'uniform1i',
92
+ value,
93
+ };
94
+ }
95
+ /**
96
+ * Sets the value of an integer array uniform variable.
97
+ *
98
+ * @param location - The location of the uniform variable.
99
+ * @param value - The array of values to set.
100
+ */
101
+ uniform1iv(location, value) {
102
+ this.uniforms.single[location] = {
103
+ method: 'uniform1iv',
104
+ value,
105
+ };
106
+ }
107
+ /**
108
+ * Sets the value of a vec2 uniform variable.
109
+ *
110
+ * @param location - The location of the uniform variable.
111
+ * @param v0 - The first component of the vector.
112
+ * @param v1 - The second component of the vector.
113
+ */
114
+ uniform2f(location, v0, v1) {
115
+ this.uniforms.vec2[location] = {
116
+ method: 'uniform2f',
117
+ value: [v0, v1],
118
+ };
119
+ }
120
+ /**
121
+ * Sets the value of a vec2 array uniform variable.
122
+ *
123
+ * @param location - The location of the uniform variable.
124
+ * @param value - The array of vec2 values to set as FloatArray.
125
+ */
126
+ uniform2fv(location, value) {
127
+ this.uniforms.single[location] = {
128
+ method: 'uniform2fv',
129
+ value,
130
+ };
131
+ }
132
+ /**
133
+ * Sets the value of a vec2 array uniform variable.
134
+ *
135
+ * @param location - The location of the uniform variable.
136
+ * @param value - The array of vec2 values to set.
137
+ */
138
+ uniform2fa(location, value) {
139
+ this.uniforms.vec2[location] = {
140
+ method: 'uniform2f',
141
+ value,
142
+ };
143
+ }
144
+ /**
145
+ * Sets the value of a ivec2 uniform variable.
146
+ *
147
+ * @param location - The location of the uniform variable.
148
+ * @param v0 - The first component of the vector.
149
+ * @param v1 - The second component of the vector.
150
+ */
151
+ uniform2i(location, v0, v1) {
152
+ this.uniforms.vec2[location] = {
153
+ method: 'uniform2i',
154
+ value: [v0, v1],
155
+ };
156
+ }
157
+ /**
158
+ * Sets the value of an ivec2 array uniform variable.
159
+ *
160
+ * @param location - The location of the uniform variable.
161
+ * @param value - The array of ivec2 values to set.
162
+ */
163
+ uniform2iv(location, value) {
164
+ this.uniforms.single[location] = {
165
+ method: 'uniform2iv',
166
+ value,
167
+ };
168
+ }
169
+ /**
170
+ * Sets the value of a vec3 uniform variable.
171
+ *
172
+ * @param location - The location of the uniform variable.
173
+ * @param v0 - The first component of the vector.
174
+ * @param v1 - The second component of the vector.
175
+ * @param v2 - The third component of the vector.
176
+ */
177
+ uniform3f(location, v0, v1, v2) {
178
+ this.uniforms.vec3[location] = {
179
+ method: 'uniform3f',
180
+ value: [v0, v1, v2],
181
+ };
182
+ }
183
+ /**
184
+ * Sets the value of a vec3 uniform variable.
185
+ *
186
+ * @param location - The location of the uniform variable.
187
+ * @param
188
+ */
189
+ uniform3fa(location, value) {
190
+ this.uniforms.vec3[location] = {
191
+ method: 'uniform3f',
192
+ value,
193
+ };
194
+ }
195
+ /**
196
+ * Sets the value of a vec3 array uniform variable.
197
+ *
198
+ * @param location - The location of the uniform variable.
199
+ * @param value - The array of vec3 values to set.
200
+ */
201
+ uniform3fv(location, value) {
202
+ this.uniforms.single[location] = {
203
+ method: 'uniform3fv',
204
+ value,
205
+ };
206
+ }
207
+ /**
208
+ * Sets the value of a ivec3 uniform variable.
209
+ *
210
+ * @param location - The location of the uniform variable.
211
+ * @param v0 - The first component of the vector.
212
+ * @param v1 - The second component of the vector.
213
+ * @param v2 - The third component of the vector.
214
+ */
215
+ uniform3i(location, v0, v1, v2) {
216
+ this.uniforms.vec3[location] = {
217
+ method: 'uniform3i',
218
+ value: [v0, v1, v2],
219
+ };
220
+ }
221
+ /**
222
+ * Sets the value of an ivec3 array uniform variable.
223
+ *
224
+ * @param location - The location of the uniform variable.
225
+ * @param value - The array of ivec3 values to set.
226
+ */
227
+ uniform3iv(location, value) {
228
+ this.uniforms.single[location] = {
229
+ method: 'uniform3iv',
230
+ value,
231
+ };
232
+ }
233
+ /**
234
+ * Sets the value of a vec4 uniform variable.
235
+ *
236
+ * @param location - The location of the uniform variable.
237
+ * @param v0 - The first component of the vector.
238
+ * @param v1 - The second component of the vector.
239
+ * @param v2 - The third component of the vector.
240
+ * @param v3 - The fourth component of the vector.
241
+ */
242
+ uniform4f(location, v0, v1, v2, v3) {
243
+ this.uniforms.vec4[location] = {
244
+ method: 'uniform4f',
245
+ value: [v0, v1, v2, v3],
246
+ };
247
+ }
248
+ /**
249
+ * Sets an array of numbers
250
+ * @param location The location of the uniform variable.
251
+ * @param value
252
+ */
253
+ uniform4fa(location, value) {
254
+ this.uniforms.vec4[location] = {
255
+ method: 'uniform4f',
256
+ value,
257
+ };
258
+ }
259
+ /**
260
+ * Sets the value of a vec4 array uniform variable.
261
+ *
262
+ * @param location - The location of the uniform variable.
263
+ * @param value - The array of vec4 values to set.
264
+ */
265
+ uniform4fv(location, value) {
266
+ this.uniforms.single[location] = {
267
+ method: 'uniform4fv',
268
+ value,
269
+ };
270
+ }
271
+ /**
272
+ * Sets the value of a ivec4 uniform variable.
273
+ *
274
+ * @param location - The location of the uniform variable.
275
+ * @param v0 - The first component of the vector.
276
+ * @param v1 - The second component of the vector.
277
+ * @param v2 - The third component of the vector.
278
+ * @param v3 - The fourth component of the vector.
279
+ */
280
+ uniform4i(location, v0, v1, v2, v3) {
281
+ this.uniforms.vec4[location] = {
282
+ method: 'uniform4i',
283
+ value: [v0, v1, v2, v3],
284
+ };
285
+ }
286
+ /**
287
+ * Sets the value of an ivec4 array uniform variable.
288
+ *
289
+ * @param location - The location of the uniform variable.
290
+ * @param value - The array of ivec4 values to set.
291
+ */
292
+ uniform4iv(location, value) {
293
+ this.uniforms.single[location] = {
294
+ method: 'uniform4iv',
295
+ value,
296
+ };
297
+ }
298
+ /**
299
+ * Sets the value of a mat2 uniform variable.
300
+ *
301
+ * @param location - The location of the uniform variable.
302
+ * @param transpose - Whether to transpose the matrix.
303
+ * @param value - The array of mat2 values to set.
304
+ */
305
+ uniformMatrix2fv(location, value) {
306
+ this.uniforms.single[location] = {
307
+ method: 'uniformMatrix2fv',
308
+ value,
309
+ };
310
+ }
311
+ /**
312
+ * Sets the value of a mat2 uniform variable.
313
+ * @param location - The location of the uniform variable.
314
+ * @param value - The array of mat2 values to set.
315
+ */
316
+ uniformMatrix3fv(location, value) {
317
+ this.uniforms.single[location] = {
318
+ method: 'uniformMatrix3fv',
319
+ value,
320
+ };
321
+ }
322
+ /**
323
+ * Sets the value of a mat4 uniform variable.
324
+ * @param location - The location of the uniform variable.
325
+ * @param value - The array of mat4 values to set.
326
+ */
327
+ uniformMatrix4fv(location, value) {
328
+ this.uniforms.single[location] = {
329
+ method: 'uniformMatrix4fv',
330
+ value,
331
+ };
332
+ }
333
+ }
334
+ //# sourceMappingURL=WebGlShaderNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlShaderNode.js","sourceRoot":"","sources":["../../../../../src/core/renderers/webgl/WebGlShaderNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAIjE,OAAO,EAAE,cAAc,EAAuB,MAAM,sBAAsB,CAAC;AAwD3E,MAAM,OAAO,eAEX,SAAQ,cAAqB;IACpB,OAAO,CAAqB;IAC7B,OAAO,GACb,SAAS,CAAC;IACJ,QAAQ,GAAW,EAAE,CAAC;IAC9B,QAAQ,GAAsB;QAC5B,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,EAAE;QAC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CACF"}
@@ -0,0 +1,35 @@
1
+ import type { WebGlContextWrapper } from '../../lib/WebGlContextWrapper.js';
2
+ import type { QuadOptions } from '../CoreRenderer.js';
3
+ import type { CoreShaderProgram } from '../CoreShaderProgram.js';
4
+ import type { WebGlCtxTexture } from './WebGlCtxTexture.js';
5
+ import type { WebGlRenderOp } from './WebGlRenderOp.js';
6
+ import type { WebGlRenderer } from './WebGlRenderer.js';
7
+ import type { WebGlShaderType } from './WebGlShaderNode.js';
8
+ import type { BufferCollection } from './internal/BufferCollection.js';
9
+ export declare class WebGlShaderProgram implements CoreShaderProgram {
10
+ protected boundBufferCollection: BufferCollection | null;
11
+ protected program: WebGLProgram;
12
+ /**
13
+ * Vertex Array Object
14
+ *
15
+ * @remarks
16
+ * Used by WebGL2 Only
17
+ */
18
+ protected vao: WebGLVertexArrayObject | undefined;
19
+ protected renderer: WebGlRenderer;
20
+ protected glw: WebGlContextWrapper;
21
+ protected attributeLocations: Record<string, number>;
22
+ protected lifecycle: Pick<WebGlShaderType, 'update' | 'canBatch'>;
23
+ protected useSystemAlpha: boolean;
24
+ protected useSystemDimensions: boolean;
25
+ supportsIndexedTextures: boolean;
26
+ constructor(renderer: WebGlRenderer, config: WebGlShaderType, resolvedProps: Record<string, any>);
27
+ disableAttribute(location: number): void;
28
+ disableAttributes(): void;
29
+ reuseRenderOp(incomingQuad: QuadOptions, currentRenderOp: WebGlRenderOp): boolean;
30
+ bindRenderOp(renderOp: WebGlRenderOp): void;
31
+ bindBufferCollection(buffer: BufferCollection): void;
32
+ bindTextures(textures: WebGlCtxTexture[]): void;
33
+ attach(): void;
34
+ detach(): void;
35
+ }