@solidtv/renderer 1.0.0

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 (424) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +7 -0
  3. package/README.md +137 -0
  4. package/dist/exports/canvas-shaders.d.ts +10 -0
  5. package/dist/exports/canvas-shaders.js +11 -0
  6. package/dist/exports/canvas-shaders.js.map +1 -0
  7. package/dist/exports/canvas.d.ts +26 -0
  8. package/dist/exports/canvas.js +27 -0
  9. package/dist/exports/canvas.js.map +1 -0
  10. package/dist/exports/index.d.ts +50 -0
  11. package/dist/exports/index.js +40 -0
  12. package/dist/exports/index.js.map +1 -0
  13. package/dist/exports/inspector.d.ts +4 -0
  14. package/dist/exports/inspector.js +5 -0
  15. package/dist/exports/inspector.js.map +1 -0
  16. package/dist/exports/utils.d.ts +27 -0
  17. package/dist/exports/utils.js +28 -0
  18. package/dist/exports/utils.js.map +1 -0
  19. package/dist/exports/webgl-shaders.d.ts +11 -0
  20. package/dist/exports/webgl-shaders.js +12 -0
  21. package/dist/exports/webgl-shaders.js.map +1 -0
  22. package/dist/exports/webgl.d.ts +28 -0
  23. package/dist/exports/webgl.js +29 -0
  24. package/dist/exports/webgl.js.map +1 -0
  25. package/dist/src/common/CommonTypes.d.ts +110 -0
  26. package/dist/src/common/CommonTypes.js +2 -0
  27. package/dist/src/common/CommonTypes.js.map +1 -0
  28. package/dist/src/common/EventEmitter.d.ts +12 -0
  29. package/dist/src/common/EventEmitter.js +48 -0
  30. package/dist/src/common/EventEmitter.js.map +1 -0
  31. package/dist/src/common/IAnimationController.d.ts +58 -0
  32. package/dist/src/common/IAnimationController.js +2 -0
  33. package/dist/src/common/IAnimationController.js.map +1 -0
  34. package/dist/src/common/IEventEmitter.d.ts +8 -0
  35. package/dist/src/common/IEventEmitter.js +2 -0
  36. package/dist/src/common/IEventEmitter.js.map +1 -0
  37. package/dist/src/core/Autosizer.d.ts +35 -0
  38. package/dist/src/core/Autosizer.js +178 -0
  39. package/dist/src/core/Autosizer.js.map +1 -0
  40. package/dist/src/core/CoreNode.d.ts +908 -0
  41. package/dist/src/core/CoreNode.js +1837 -0
  42. package/dist/src/core/CoreNode.js.map +1 -0
  43. package/dist/src/core/CoreShaderManager.d.ts +38 -0
  44. package/dist/src/core/CoreShaderManager.js +123 -0
  45. package/dist/src/core/CoreShaderManager.js.map +1 -0
  46. package/dist/src/core/CoreTextNode.d.ts +91 -0
  47. package/dist/src/core/CoreTextNode.js +440 -0
  48. package/dist/src/core/CoreTextNode.js.map +1 -0
  49. package/dist/src/core/CoreTextureManager.d.ts +264 -0
  50. package/dist/src/core/CoreTextureManager.js +318 -0
  51. package/dist/src/core/CoreTextureManager.js.map +1 -0
  52. package/dist/src/core/Stage.d.ts +238 -0
  53. package/dist/src/core/Stage.js +804 -0
  54. package/dist/src/core/Stage.js.map +1 -0
  55. package/dist/src/core/TextureError.d.ts +11 -0
  56. package/dist/src/core/TextureError.js +37 -0
  57. package/dist/src/core/TextureError.js.map +1 -0
  58. package/dist/src/core/TextureMemoryManager.d.ts +150 -0
  59. package/dist/src/core/TextureMemoryManager.js +239 -0
  60. package/dist/src/core/TextureMemoryManager.js.map +1 -0
  61. package/dist/src/core/animations/AnimationManager.d.ts +33 -0
  62. package/dist/src/core/animations/AnimationManager.js +137 -0
  63. package/dist/src/core/animations/AnimationManager.js.map +1 -0
  64. package/dist/src/core/animations/CoreAnimation.d.ts +12 -0
  65. package/dist/src/core/animations/CoreAnimation.js +107 -0
  66. package/dist/src/core/animations/CoreAnimation.js.map +1 -0
  67. package/dist/src/core/lib/ContextSpy.d.ts +12 -0
  68. package/dist/src/core/lib/ContextSpy.js +20 -0
  69. package/dist/src/core/lib/ContextSpy.js.map +1 -0
  70. package/dist/src/core/lib/ImageWorker.d.ts +16 -0
  71. package/dist/src/core/lib/ImageWorker.js +202 -0
  72. package/dist/src/core/lib/ImageWorker.js.map +1 -0
  73. package/dist/src/core/lib/Matrix3d.d.ts +74 -0
  74. package/dist/src/core/lib/Matrix3d.js +218 -0
  75. package/dist/src/core/lib/Matrix3d.js.map +1 -0
  76. package/dist/src/core/lib/RenderCoords.d.ts +12 -0
  77. package/dist/src/core/lib/RenderCoords.js +35 -0
  78. package/dist/src/core/lib/RenderCoords.js.map +1 -0
  79. package/dist/src/core/lib/WebGlContextWrapper.d.ts +782 -0
  80. package/dist/src/core/lib/WebGlContextWrapper.js +1143 -0
  81. package/dist/src/core/lib/WebGlContextWrapper.js.map +1 -0
  82. package/dist/src/core/lib/collectionUtils.d.ts +5 -0
  83. package/dist/src/core/lib/collectionUtils.js +82 -0
  84. package/dist/src/core/lib/collectionUtils.js.map +1 -0
  85. package/dist/src/core/lib/colorCache.d.ts +1 -0
  86. package/dist/src/core/lib/colorCache.js +19 -0
  87. package/dist/src/core/lib/colorCache.js.map +1 -0
  88. package/dist/src/core/lib/colorParser.d.ts +21 -0
  89. package/dist/src/core/lib/colorParser.js +54 -0
  90. package/dist/src/core/lib/colorParser.js.map +1 -0
  91. package/dist/src/core/lib/textureCompression.d.ts +28 -0
  92. package/dist/src/core/lib/textureCompression.js +363 -0
  93. package/dist/src/core/lib/textureCompression.js.map +1 -0
  94. package/dist/src/core/lib/textureSvg.d.ts +16 -0
  95. package/dist/src/core/lib/textureSvg.js +45 -0
  96. package/dist/src/core/lib/textureSvg.js.map +1 -0
  97. package/dist/src/core/lib/utils.d.ts +66 -0
  98. package/dist/src/core/lib/utils.js +268 -0
  99. package/dist/src/core/lib/utils.js.map +1 -0
  100. package/dist/src/core/lib/validateImageBitmap.d.ts +7 -0
  101. package/dist/src/core/lib/validateImageBitmap.js +68 -0
  102. package/dist/src/core/lib/validateImageBitmap.js.map +1 -0
  103. package/dist/src/core/platforms/Platform.d.ts +42 -0
  104. package/dist/src/core/platforms/Platform.js +4 -0
  105. package/dist/src/core/platforms/Platform.js.map +1 -0
  106. package/dist/src/core/platforms/web/WebPlatform.d.ts +10 -0
  107. package/dist/src/core/platforms/web/WebPlatform.js +90 -0
  108. package/dist/src/core/platforms/web/WebPlatform.js.map +1 -0
  109. package/dist/src/core/renderers/CoreContextTexture.d.ts +13 -0
  110. package/dist/src/core/renderers/CoreContextTexture.js +16 -0
  111. package/dist/src/core/renderers/CoreContextTexture.js.map +1 -0
  112. package/dist/src/core/renderers/CoreRenderOp.d.ts +3 -0
  113. package/dist/src/core/renderers/CoreRenderOp.js +3 -0
  114. package/dist/src/core/renderers/CoreRenderOp.js.map +1 -0
  115. package/dist/src/core/renderers/CoreRenderer.d.ts +81 -0
  116. package/dist/src/core/renderers/CoreRenderer.js +14 -0
  117. package/dist/src/core/renderers/CoreRenderer.js.map +1 -0
  118. package/dist/src/core/renderers/CoreShaderNode.d.ts +69 -0
  119. package/dist/src/core/renderers/CoreShaderNode.js +130 -0
  120. package/dist/src/core/renderers/CoreShaderNode.js.map +1 -0
  121. package/dist/src/core/renderers/CoreShaderProgram.d.ts +4 -0
  122. package/dist/src/core/renderers/CoreShaderProgram.js +2 -0
  123. package/dist/src/core/renderers/CoreShaderProgram.js.map +1 -0
  124. package/dist/src/core/renderers/canvas/CanvasRenderer.d.ts +36 -0
  125. package/dist/src/core/renderers/canvas/CanvasRenderer.js +221 -0
  126. package/dist/src/core/renderers/canvas/CanvasRenderer.js.map +1 -0
  127. package/dist/src/core/renderers/canvas/CanvasShaderNode.d.ts +21 -0
  128. package/dist/src/core/renderers/canvas/CanvasShaderNode.js +42 -0
  129. package/dist/src/core/renderers/canvas/CanvasShaderNode.js.map +1 -0
  130. package/dist/src/core/renderers/canvas/CanvasTexture.d.ts +17 -0
  131. package/dist/src/core/renderers/canvas/CanvasTexture.js +110 -0
  132. package/dist/src/core/renderers/canvas/CanvasTexture.js.map +1 -0
  133. package/dist/src/core/renderers/webgl/SdfRenderOp.d.ts +41 -0
  134. package/dist/src/core/renderers/webgl/SdfRenderOp.js +88 -0
  135. package/dist/src/core/renderers/webgl/SdfRenderOp.js.map +1 -0
  136. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.d.ts +14 -0
  137. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js +45 -0
  138. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js.map +1 -0
  139. package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.d.ts +22 -0
  140. package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.js +49 -0
  141. package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.js.map +1 -0
  142. package/dist/src/core/renderers/webgl/WebGlCtxTexture.d.ts +67 -0
  143. package/dist/src/core/renderers/webgl/WebGlCtxTexture.js +259 -0
  144. package/dist/src/core/renderers/webgl/WebGlCtxTexture.js.map +1 -0
  145. package/dist/src/core/renderers/webgl/WebGlRenderer.d.ts +221 -0
  146. package/dist/src/core/renderers/webgl/WebGlRenderer.js +1015 -0
  147. package/dist/src/core/renderers/webgl/WebGlRenderer.js.map +1 -0
  148. package/dist/src/core/renderers/webgl/WebGlShaderNode.d.ts +213 -0
  149. package/dist/src/core/renderers/webgl/WebGlShaderNode.js +331 -0
  150. package/dist/src/core/renderers/webgl/WebGlShaderNode.js.map +1 -0
  151. package/dist/src/core/renderers/webgl/WebGlShaderProgram.d.ts +37 -0
  152. package/dist/src/core/renderers/webgl/WebGlShaderProgram.js +240 -0
  153. package/dist/src/core/renderers/webgl/WebGlShaderProgram.js.map +1 -0
  154. package/dist/src/core/renderers/webgl/internal/BufferCollection.d.ts +28 -0
  155. package/dist/src/core/renderers/webgl/internal/BufferCollection.js +39 -0
  156. package/dist/src/core/renderers/webgl/internal/BufferCollection.js.map +1 -0
  157. package/dist/src/core/renderers/webgl/internal/RendererUtils.d.ts +55 -0
  158. package/dist/src/core/renderers/webgl/internal/RendererUtils.js +88 -0
  159. package/dist/src/core/renderers/webgl/internal/RendererUtils.js.map +1 -0
  160. package/dist/src/core/renderers/webgl/internal/ShaderUtils.d.ts +74 -0
  161. package/dist/src/core/renderers/webgl/internal/ShaderUtils.js +83 -0
  162. package/dist/src/core/renderers/webgl/internal/ShaderUtils.js.map +1 -0
  163. package/dist/src/core/renderers/webgl/internal/WebGlUtils.d.ts +10 -0
  164. package/dist/src/core/renderers/webgl/internal/WebGlUtils.js +13 -0
  165. package/dist/src/core/renderers/webgl/internal/WebGlUtils.js.map +1 -0
  166. package/dist/src/core/shaders/canvas/Border.d.ts +15 -0
  167. package/dist/src/core/shaders/canvas/Border.js +83 -0
  168. package/dist/src/core/shaders/canvas/Border.js.map +1 -0
  169. package/dist/src/core/shaders/canvas/HolePunch.d.ts +7 -0
  170. package/dist/src/core/shaders/canvas/HolePunch.js +22 -0
  171. package/dist/src/core/shaders/canvas/HolePunch.js.map +1 -0
  172. package/dist/src/core/shaders/canvas/LinearGradient.d.ts +10 -0
  173. package/dist/src/core/shaders/canvas/LinearGradient.js +32 -0
  174. package/dist/src/core/shaders/canvas/LinearGradient.js.map +1 -0
  175. package/dist/src/core/shaders/canvas/RadialGradient.d.ts +11 -0
  176. package/dist/src/core/shaders/canvas/RadialGradient.js +54 -0
  177. package/dist/src/core/shaders/canvas/RadialGradient.js.map +1 -0
  178. package/dist/src/core/shaders/canvas/Rounded.d.ts +7 -0
  179. package/dist/src/core/shaders/canvas/Rounded.js +17 -0
  180. package/dist/src/core/shaders/canvas/Rounded.js.map +1 -0
  181. package/dist/src/core/shaders/canvas/RoundedWithBorder.d.ts +10 -0
  182. package/dist/src/core/shaders/canvas/RoundedWithBorder.js +57 -0
  183. package/dist/src/core/shaders/canvas/RoundedWithBorder.js.map +1 -0
  184. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.d.ts +7 -0
  185. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js +61 -0
  186. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js.map +1 -0
  187. package/dist/src/core/shaders/canvas/RoundedWithShadow.d.ts +7 -0
  188. package/dist/src/core/shaders/canvas/RoundedWithShadow.js +26 -0
  189. package/dist/src/core/shaders/canvas/RoundedWithShadow.js.map +1 -0
  190. package/dist/src/core/shaders/canvas/Shadow.d.ts +8 -0
  191. package/dist/src/core/shaders/canvas/Shadow.js +15 -0
  192. package/dist/src/core/shaders/canvas/Shadow.js.map +1 -0
  193. package/dist/src/core/shaders/canvas/utils/render.d.ts +5 -0
  194. package/dist/src/core/shaders/canvas/utils/render.js +81 -0
  195. package/dist/src/core/shaders/canvas/utils/render.js.map +1 -0
  196. package/dist/src/core/shaders/templates/BorderTemplate.d.ts +47 -0
  197. package/dist/src/core/shaders/templates/BorderTemplate.js +77 -0
  198. package/dist/src/core/shaders/templates/BorderTemplate.js.map +1 -0
  199. package/dist/src/core/shaders/templates/HolePunchTemplate.d.ts +46 -0
  200. package/dist/src/core/shaders/templates/HolePunchTemplate.js +19 -0
  201. package/dist/src/core/shaders/templates/HolePunchTemplate.js.map +1 -0
  202. package/dist/src/core/shaders/templates/LinearGradientTemplate.d.ts +23 -0
  203. package/dist/src/core/shaders/templates/LinearGradientTemplate.js +31 -0
  204. package/dist/src/core/shaders/templates/LinearGradientTemplate.js.map +1 -0
  205. package/dist/src/core/shaders/templates/RadialGradientTemplate.d.ts +33 -0
  206. package/dist/src/core/shaders/templates/RadialGradientTemplate.js +33 -0
  207. package/dist/src/core/shaders/templates/RadialGradientTemplate.js.map +1 -0
  208. package/dist/src/core/shaders/templates/RoundedTemplate.d.ts +29 -0
  209. package/dist/src/core/shaders/templates/RoundedTemplate.js +51 -0
  210. package/dist/src/core/shaders/templates/RoundedTemplate.js.map +1 -0
  211. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.d.ts +7 -0
  212. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js +8 -0
  213. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js.map +1 -0
  214. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.d.ts +8 -0
  215. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js +9 -0
  216. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js.map +1 -0
  217. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.d.ts +6 -0
  218. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js +7 -0
  219. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js.map +1 -0
  220. package/dist/src/core/shaders/templates/ShadowTemplate.d.ts +34 -0
  221. package/dist/src/core/shaders/templates/ShadowTemplate.js +50 -0
  222. package/dist/src/core/shaders/templates/ShadowTemplate.js.map +1 -0
  223. package/dist/src/core/shaders/utils.d.ts +5 -0
  224. package/dist/src/core/shaders/utils.js +25 -0
  225. package/dist/src/core/shaders/utils.js.map +1 -0
  226. package/dist/src/core/shaders/webgl/Border.d.ts +3 -0
  227. package/dist/src/core/shaders/webgl/Border.js +153 -0
  228. package/dist/src/core/shaders/webgl/Border.js.map +1 -0
  229. package/dist/src/core/shaders/webgl/Default.d.ts +2 -0
  230. package/dist/src/core/shaders/webgl/Default.js +51 -0
  231. package/dist/src/core/shaders/webgl/Default.js.map +1 -0
  232. package/dist/src/core/shaders/webgl/HolePunch.d.ts +3 -0
  233. package/dist/src/core/shaders/webgl/HolePunch.js +49 -0
  234. package/dist/src/core/shaders/webgl/HolePunch.js.map +1 -0
  235. package/dist/src/core/shaders/webgl/LinearGradient.d.ts +3 -0
  236. package/dist/src/core/shaders/webgl/LinearGradient.js +114 -0
  237. package/dist/src/core/shaders/webgl/LinearGradient.js.map +1 -0
  238. package/dist/src/core/shaders/webgl/RadialGradient.d.ts +3 -0
  239. package/dist/src/core/shaders/webgl/RadialGradient.js +81 -0
  240. package/dist/src/core/shaders/webgl/RadialGradient.js.map +1 -0
  241. package/dist/src/core/shaders/webgl/Rounded.d.ts +7 -0
  242. package/dist/src/core/shaders/webgl/Rounded.js +88 -0
  243. package/dist/src/core/shaders/webgl/Rounded.js.map +1 -0
  244. package/dist/src/core/shaders/webgl/RoundedWithBorder.d.ts +3 -0
  245. package/dist/src/core/shaders/webgl/RoundedWithBorder.js +202 -0
  246. package/dist/src/core/shaders/webgl/RoundedWithBorder.js.map +1 -0
  247. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.d.ts +3 -0
  248. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js +223 -0
  249. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js.map +1 -0
  250. package/dist/src/core/shaders/webgl/RoundedWithShadow.d.ts +3 -0
  251. package/dist/src/core/shaders/webgl/RoundedWithShadow.js +123 -0
  252. package/dist/src/core/shaders/webgl/RoundedWithShadow.js.map +1 -0
  253. package/dist/src/core/shaders/webgl/SdfShader.d.ts +13 -0
  254. package/dist/src/core/shaders/webgl/SdfShader.js +72 -0
  255. package/dist/src/core/shaders/webgl/SdfShader.js.map +1 -0
  256. package/dist/src/core/shaders/webgl/Shadow.d.ts +3 -0
  257. package/dist/src/core/shaders/webgl/Shadow.js +115 -0
  258. package/dist/src/core/shaders/webgl/Shadow.js.map +1 -0
  259. package/dist/src/core/text-rendering/CanvasFontHandler.d.ts +59 -0
  260. package/dist/src/core/text-rendering/CanvasFontHandler.js +206 -0
  261. package/dist/src/core/text-rendering/CanvasFontHandler.js.map +1 -0
  262. package/dist/src/core/text-rendering/CanvasTextRenderer.d.ts +17 -0
  263. package/dist/src/core/text-rendering/CanvasTextRenderer.js +139 -0
  264. package/dist/src/core/text-rendering/CanvasTextRenderer.js.map +1 -0
  265. package/dist/src/core/text-rendering/SdfFontHandler.d.ts +167 -0
  266. package/dist/src/core/text-rendering/SdfFontHandler.js +371 -0
  267. package/dist/src/core/text-rendering/SdfFontHandler.js.map +1 -0
  268. package/dist/src/core/text-rendering/SdfTextRenderer.d.ts +17 -0
  269. package/dist/src/core/text-rendering/SdfTextRenderer.js +249 -0
  270. package/dist/src/core/text-rendering/SdfTextRenderer.js.map +1 -0
  271. package/dist/src/core/text-rendering/TextLayoutEngine.d.ts +18 -0
  272. package/dist/src/core/text-rendering/TextLayoutEngine.js +380 -0
  273. package/dist/src/core/text-rendering/TextLayoutEngine.js.map +1 -0
  274. package/dist/src/core/text-rendering/TextRenderer.d.ts +406 -0
  275. package/dist/src/core/text-rendering/TextRenderer.js +2 -0
  276. package/dist/src/core/text-rendering/TextRenderer.js.map +1 -0
  277. package/dist/src/core/text-rendering/Utils.d.ts +30 -0
  278. package/dist/src/core/text-rendering/Utils.js +66 -0
  279. package/dist/src/core/text-rendering/Utils.js.map +1 -0
  280. package/dist/src/core/textures/ColorTexture.d.ts +36 -0
  281. package/dist/src/core/textures/ColorTexture.js +57 -0
  282. package/dist/src/core/textures/ColorTexture.js.map +1 -0
  283. package/dist/src/core/textures/ImageTexture.d.ts +131 -0
  284. package/dist/src/core/textures/ImageTexture.js +211 -0
  285. package/dist/src/core/textures/ImageTexture.js.map +1 -0
  286. package/dist/src/core/textures/NoiseTexture.d.ts +43 -0
  287. package/dist/src/core/textures/NoiseTexture.js +50 -0
  288. package/dist/src/core/textures/NoiseTexture.js.map +1 -0
  289. package/dist/src/core/textures/RenderTexture.d.ts +29 -0
  290. package/dist/src/core/textures/RenderTexture.js +36 -0
  291. package/dist/src/core/textures/RenderTexture.js.map +1 -0
  292. package/dist/src/core/textures/SubTexture.d.ts +61 -0
  293. package/dist/src/core/textures/SubTexture.js +99 -0
  294. package/dist/src/core/textures/SubTexture.js.map +1 -0
  295. package/dist/src/core/textures/Texture.d.ts +275 -0
  296. package/dist/src/core/textures/Texture.js +326 -0
  297. package/dist/src/core/textures/Texture.js.map +1 -0
  298. package/dist/src/core/utils.d.ts +23 -0
  299. package/dist/src/core/utils.js +155 -0
  300. package/dist/src/core/utils.js.map +1 -0
  301. package/dist/src/main-api/INode.d.ts +65 -0
  302. package/dist/src/main-api/INode.js +2 -0
  303. package/dist/src/main-api/INode.js.map +1 -0
  304. package/dist/src/main-api/Inspector.d.ts +154 -0
  305. package/dist/src/main-api/Inspector.js +844 -0
  306. package/dist/src/main-api/Inspector.js.map +1 -0
  307. package/dist/src/main-api/Renderer.d.ts +629 -0
  308. package/dist/src/main-api/Renderer.js +471 -0
  309. package/dist/src/main-api/Renderer.js.map +1 -0
  310. package/dist/src/main-api/utils.d.ts +2 -0
  311. package/dist/src/main-api/utils.js +34 -0
  312. package/dist/src/main-api/utils.js.map +1 -0
  313. package/dist/src/utils.d.ts +123 -0
  314. package/dist/src/utils.js +234 -0
  315. package/dist/src/utils.js.map +1 -0
  316. package/dist/tsconfig.dist.tsbuildinfo +1 -0
  317. package/exports/canvas-shaders.ts +11 -0
  318. package/exports/canvas.ts +27 -0
  319. package/exports/index.ts +69 -0
  320. package/exports/inspector.ts +5 -0
  321. package/exports/utils.ts +32 -0
  322. package/exports/webgl-shaders.ts +12 -0
  323. package/exports/webgl.ts +33 -0
  324. package/package.json +99 -0
  325. package/src/common/CommonTypes.ts +145 -0
  326. package/src/common/EventEmitter.ts +58 -0
  327. package/src/common/IAnimationController.ts +65 -0
  328. package/src/common/IEventEmitter.ts +11 -0
  329. package/src/core/Autosizer.ts +205 -0
  330. package/src/core/CoreNode.test.ts +535 -0
  331. package/src/core/CoreNode.ts +2883 -0
  332. package/src/core/CoreShaderManager.ts +170 -0
  333. package/src/core/CoreTextNode.ts +573 -0
  334. package/src/core/CoreTextureManager.ts +552 -0
  335. package/src/core/Stage.ts +1037 -0
  336. package/src/core/TextureError.ts +46 -0
  337. package/src/core/TextureMemoryManager.ts +378 -0
  338. package/src/core/animations/AnimationManager.ts +178 -0
  339. package/src/core/animations/CoreAnimation.ts +138 -0
  340. package/src/core/lib/ContextSpy.ts +22 -0
  341. package/src/core/lib/ImageWorker.ts +292 -0
  342. package/src/core/lib/Matrix3d.ts +231 -0
  343. package/src/core/lib/RenderCoords.ts +55 -0
  344. package/src/core/lib/WebGlContextWrapper.ts +1448 -0
  345. package/src/core/lib/collectionUtils.ts +99 -0
  346. package/src/core/lib/colorCache.ts +20 -0
  347. package/src/core/lib/colorParser.ts +66 -0
  348. package/src/core/lib/textureCompression.ts +492 -0
  349. package/src/core/lib/textureSvg.ts +59 -0
  350. package/src/core/lib/utils.ts +400 -0
  351. package/src/core/lib/validateImageBitmap.ts +87 -0
  352. package/src/core/platforms/Platform.ts +64 -0
  353. package/src/core/platforms/web/WebPlatform.ts +132 -0
  354. package/src/core/renderers/CoreContextTexture.ts +25 -0
  355. package/src/core/renderers/CoreRenderOp.ts +3 -0
  356. package/src/core/renderers/CoreRenderer.ts +101 -0
  357. package/src/core/renderers/CoreShaderNode.ts +202 -0
  358. package/src/core/renderers/CoreShaderProgram.ts +4 -0
  359. package/src/core/renderers/canvas/CanvasRenderer.ts +274 -0
  360. package/src/core/renderers/canvas/CanvasShaderNode.ts +79 -0
  361. package/src/core/renderers/canvas/CanvasTexture.ts +141 -0
  362. package/src/core/renderers/webgl/SdfRenderOp.ts +103 -0
  363. package/src/core/renderers/webgl/WebGlCtxRenderTexture.ts +70 -0
  364. package/src/core/renderers/webgl/WebGlCtxSubTexture.ts +76 -0
  365. package/src/core/renderers/webgl/WebGlCtxTexture.ts +332 -0
  366. package/src/core/renderers/webgl/WebGlRenderer.ts +1323 -0
  367. package/src/core/renderers/webgl/WebGlShaderNode.ts +423 -0
  368. package/src/core/renderers/webgl/WebGlShaderProgram.ts +346 -0
  369. package/src/core/renderers/webgl/internal/BufferCollection.ts +46 -0
  370. package/src/core/renderers/webgl/internal/RendererUtils.ts +136 -0
  371. package/src/core/renderers/webgl/internal/ShaderUtils.ts +262 -0
  372. package/src/core/renderers/webgl/internal/WebGlUtils.ts +16 -0
  373. package/src/core/shaders/canvas/Border.ts +119 -0
  374. package/src/core/shaders/canvas/HolePunch.ts +38 -0
  375. package/src/core/shaders/canvas/LinearGradient.ts +54 -0
  376. package/src/core/shaders/canvas/RadialGradient.ts +82 -0
  377. package/src/core/shaders/canvas/Rounded.ts +38 -0
  378. package/src/core/shaders/canvas/RoundedWithBorder.ts +105 -0
  379. package/src/core/shaders/canvas/RoundedWithBorderAndShadow.ts +118 -0
  380. package/src/core/shaders/canvas/RoundedWithShadow.ts +56 -0
  381. package/src/core/shaders/canvas/Shadow.ts +35 -0
  382. package/src/core/shaders/canvas/utils/render.ts +143 -0
  383. package/src/core/shaders/templates/BorderTemplate.ts +128 -0
  384. package/src/core/shaders/templates/HolePunchTemplate.ts +65 -0
  385. package/src/core/shaders/templates/LinearGradientTemplate.ts +54 -0
  386. package/src/core/shaders/templates/RadialGradientTemplate.ts +66 -0
  387. package/src/core/shaders/templates/RoundedTemplate.ts +81 -0
  388. package/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.ts +21 -0
  389. package/src/core/shaders/templates/RoundedWithBorderTemplate.ts +23 -0
  390. package/src/core/shaders/templates/RoundedWithShadowTemplate.ts +18 -0
  391. package/src/core/shaders/templates/ShadowTemplate.ts +89 -0
  392. package/src/core/shaders/utils.ts +30 -0
  393. package/src/core/shaders/webgl/Border.ts +158 -0
  394. package/src/core/shaders/webgl/Default.ts +52 -0
  395. package/src/core/shaders/webgl/HolePunch.ts +58 -0
  396. package/src/core/shaders/webgl/LinearGradient.ts +119 -0
  397. package/src/core/shaders/webgl/RadialGradient.ts +91 -0
  398. package/src/core/shaders/webgl/Rounded.ts +97 -0
  399. package/src/core/shaders/webgl/RoundedWithBorder.ts +212 -0
  400. package/src/core/shaders/webgl/RoundedWithBorderAndShadow.ts +235 -0
  401. package/src/core/shaders/webgl/RoundedWithShadow.ts +132 -0
  402. package/src/core/shaders/webgl/SdfShader.ts +73 -0
  403. package/src/core/shaders/webgl/Shadow.ts +119 -0
  404. package/src/core/text-rendering/CanvasFontHandler.ts +285 -0
  405. package/src/core/text-rendering/CanvasTextRenderer.ts +236 -0
  406. package/src/core/text-rendering/SdfFontHandler.ts +566 -0
  407. package/src/core/text-rendering/SdfTextRenderer.ts +352 -0
  408. package/src/core/text-rendering/TextLayoutEngine.ts +672 -0
  409. package/src/core/text-rendering/TextRenderer.ts +449 -0
  410. package/src/core/text-rendering/Utils.ts +80 -0
  411. package/src/core/text-rendering/tests/TextLayoutEngine.test.ts +434 -0
  412. package/src/core/textures/ColorTexture.ts +85 -0
  413. package/src/core/textures/ImageTexture.ts +394 -0
  414. package/src/core/textures/NoiseTexture.ts +87 -0
  415. package/src/core/textures/RenderTexture.ts +68 -0
  416. package/src/core/textures/SubTexture.ts +165 -0
  417. package/src/core/textures/Texture.ts +505 -0
  418. package/src/core/utils.ts +210 -0
  419. package/src/env.d.ts +7 -0
  420. package/src/main-api/INode.ts +92 -0
  421. package/src/main-api/Inspector.ts +1267 -0
  422. package/src/main-api/Renderer.ts +1011 -0
  423. package/src/main-api/utils.ts +45 -0
  424. package/src/utils.ts +302 -0
@@ -0,0 +1,782 @@
1
+ import type { Vec2, Vec3, Vec4 } from '../renderers/webgl/internal/ShaderUtils.js';
2
+ /**
3
+ * Optimized WebGL Context Wrapper
4
+ *
5
+ * @remarks
6
+ * This class contains the subset of the WebGLRenderingContext & WebGL2RenderingContext
7
+ * API that is used by the renderer. Select high volume WebGL methods include
8
+ * caching optimizations to avoid making WebGL calls if the state is already set
9
+ * to the desired value.
10
+ *
11
+ * While most methods contained are direct passthroughs to the WebGL context,
12
+ * some methods combine multiple WebGL calls into one for convenience, modify
13
+ * arguments to be more convenient, or are replaced by more specific methods.
14
+ *
15
+ * Not all methods are optimized. Only methods that are called frequently
16
+ * and/or have a high cost are optimized.
17
+ *
18
+ * A subset of GLenum constants are also exposed as properties on this class
19
+ * for convenience.
20
+ */
21
+ export declare class WebGlContextWrapper {
22
+ private gl;
23
+ private activeTextureUnit;
24
+ private texture2dUnits;
25
+ private texture2dParams;
26
+ private scissorEnabled;
27
+ private scissorX;
28
+ private scissorY;
29
+ private scissorWidth;
30
+ private scissorHeight;
31
+ private blendEnabled;
32
+ private blendSrcRgb;
33
+ private blendDstRgb;
34
+ private blendSrcAlpha;
35
+ private blendDstAlpha;
36
+ private boundArrayBuffer;
37
+ private boundElementArrayBuffer;
38
+ private curProgram;
39
+ private curUniformLocations;
40
+ readonly canvas: any;
41
+ readonly MAX_RENDERBUFFER_SIZE: any;
42
+ readonly MAX_TEXTURE_SIZE: any;
43
+ readonly MAX_VIEWPORT_DIMS: any;
44
+ readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: any;
45
+ readonly MAX_TEXTURE_IMAGE_UNITS: any;
46
+ readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: any;
47
+ readonly MAX_VERTEX_ATTRIBS: any;
48
+ readonly MAX_VARYING_VECTORS: any;
49
+ readonly MAX_VERTEX_UNIFORM_VECTORS: any;
50
+ readonly MAX_FRAGMENT_UNIFORM_VECTORS: any;
51
+ readonly TEXTURE_MAG_FILTER: any;
52
+ readonly TEXTURE_MIN_FILTER: any;
53
+ readonly TEXTURE_WRAP_S: any;
54
+ readonly TEXTURE_WRAP_T: any;
55
+ readonly LINEAR: any;
56
+ readonly LINEAR_MIPMAP_LINEAR: any;
57
+ readonly CLAMP_TO_EDGE: any;
58
+ readonly RGB: any;
59
+ readonly RGBA: any;
60
+ readonly UNSIGNED_BYTE: any;
61
+ readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: any;
62
+ readonly UNPACK_FLIP_Y_WEBGL: any;
63
+ readonly FLOAT: any;
64
+ readonly TRIANGLES: any;
65
+ readonly UNSIGNED_SHORT: any;
66
+ readonly ONE: any;
67
+ readonly ONE_MINUS_SRC_ALPHA: any;
68
+ readonly VERTEX_SHADER: any;
69
+ readonly FRAGMENT_SHADER: any;
70
+ readonly STATIC_DRAW: any;
71
+ readonly COMPILE_STATUS: any;
72
+ readonly LINK_STATUS: any;
73
+ readonly DYNAMIC_DRAW: any;
74
+ readonly COLOR_ATTACHMENT0: any;
75
+ readonly INVALID_ENUM: number;
76
+ readonly INVALID_OPERATION: number;
77
+ constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
78
+ /**
79
+ * Returns true if the WebGL context is WebGL2
80
+ *
81
+ * @returns
82
+ */
83
+ isWebGl2(): boolean;
84
+ /**
85
+ * ```
86
+ * gl.activeTexture(textureUnit + gl.TEXTURE0);
87
+ * ```
88
+ *
89
+ * @remarks
90
+ * **WebGL Difference**: `textureUnit` is based from 0, not `gl.TEXTURE0`.
91
+ *
92
+ * @param textureUnit
93
+ */
94
+ activeTexture(textureUnit: number): void;
95
+ /**
96
+ * ```
97
+ * gl.bindTexture(gl.TEXTURE_2D, texture);
98
+ * ```
99
+ * @remarks
100
+ * **WebGL Difference**: Bind target is always `gl.TEXTURE_2D`
101
+ *
102
+ * @param texture
103
+ */
104
+ bindTexture(texture: WebGLTexture | null): void;
105
+ private _getActiveTexture;
106
+ /**
107
+ * ```
108
+ * gl.texParameteri(gl.TEXTURE_2D, pname, param);
109
+ * ```
110
+ * @remarks
111
+ * **WebGL Difference**: Bind target is always `gl.TEXTURE_2D`
112
+ *
113
+ * @param pname
114
+ * @param param
115
+ * @returns
116
+ */
117
+ texParameteri(pname: number, param: number): void;
118
+ /**
119
+ * ```
120
+ * gl.texImage2D(
121
+ * gl.TEXTURE_2D,
122
+ * level,
123
+ * internalFormat,
124
+ * width,
125
+ * height,
126
+ * border,
127
+ * format,
128
+ * type,
129
+ * pixels,
130
+ * );
131
+ * ```
132
+ * @remarks
133
+ * **WebGL Difference**: Bind target is always `gl.TEXTURE_2D`
134
+ *
135
+ * @param level
136
+ * @param internalFormat
137
+ * @param width
138
+ * @param height
139
+ * @param border
140
+ * @param format
141
+ * @param type
142
+ * @param pixels
143
+ */
144
+ texImage2D(level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView | null): void;
145
+ texImage2D(level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource | Uint8Array): void;
146
+ /**
147
+ * ```
148
+ * gl.compressedTexImage2D(gl.TEXTURE_2D, level, internalFormat, width, height, border, data);
149
+ * ```
150
+ *
151
+ * @remarks
152
+ * **WebGL Difference**: Bind target is always `gl.TEXTURE_2D`
153
+ */
154
+ compressedTexImage2D(level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, data?: ArrayBufferView): void;
155
+ /**
156
+ * ```
157
+ * gl.pixelStorei(pname, param);
158
+ * ```
159
+ *
160
+ * @param pname
161
+ * @param param
162
+ */
163
+ pixelStorei(pname: GLenum, param: GLint | GLboolean): void;
164
+ /**
165
+ * ```
166
+ * gl.generateMipmap(gl.TEXTURE_2D);
167
+ * ```
168
+ *
169
+ * @remarks
170
+ * **WebGL Difference**: Bind target is always `gl.TEXTURE_2D`
171
+ */
172
+ generateMipmap(): void;
173
+ /**
174
+ * ```
175
+ * gl.createTexture();
176
+ * ```
177
+ *
178
+ * @returns
179
+ */
180
+ createTexture(): WebGLTexture;
181
+ /**
182
+ * ```
183
+ * gl.deleteTexture(texture);
184
+ * ```
185
+ *
186
+ * @param texture
187
+ */
188
+ deleteTexture(texture: WebGLTexture | null): void;
189
+ /**
190
+ * ```
191
+ * gl.deleteFramebuffer(framebuffer);
192
+ *
193
+ * @param framebuffer
194
+ */
195
+ deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void;
196
+ /**
197
+ * ```
198
+ * gl.viewport(x, y, width, height);
199
+ * ```
200
+ */
201
+ viewport(x: GLint, y: GLint, width: GLsizei, height: GLsizei): void;
202
+ /**
203
+ * ```
204
+ * gl.clearColor(red, green, blue, alpha);
205
+ * ```
206
+ *
207
+ * @param red
208
+ * @param green
209
+ * @param blue
210
+ * @param alpha
211
+ */
212
+ clearColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf): void;
213
+ /**
214
+ * ```
215
+ * gl["enable"|"disable"](gl.SCISSOR_TEST);
216
+ * ```
217
+ * @param enable
218
+ */
219
+ setScissorTest(enable: boolean): void;
220
+ /**
221
+ * ```
222
+ * gl.scissor(x, y, width, height);
223
+ * ```
224
+ *
225
+ * @param x
226
+ * @param y
227
+ * @param width
228
+ * @param height
229
+ */
230
+ scissor(x: GLint, y: GLint, width: GLsizei, height: GLsizei): void;
231
+ /**
232
+ * ```
233
+ * gl["enable"|"disable"](gl.BLEND);
234
+ * ```
235
+ *
236
+ * @param blend
237
+ * @returns
238
+ */
239
+ setBlend(blend: boolean): void;
240
+ /**
241
+ * ```
242
+ * gl.blendFunc(src, dst);
243
+ * ```
244
+ *
245
+ * @param src
246
+ * @param dst
247
+ */
248
+ blendFunc(src: GLenum, dst: GLenum): void;
249
+ /**
250
+ * ```
251
+ * gl.createBuffer();
252
+ * ```
253
+ *
254
+ * @returns
255
+ */
256
+ createBuffer(): WebGLBuffer;
257
+ /**
258
+ * ```
259
+ * gl.createFramebuffer();
260
+ * ```
261
+ * @returns
262
+ */
263
+ createFramebuffer(): WebGLFramebuffer;
264
+ /**
265
+ * ```
266
+ * gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
267
+ * ```
268
+ *
269
+ * @param framebuffer
270
+ */
271
+ bindFramebuffer(framebuffer: WebGLFramebuffer | null): void;
272
+ /**
273
+ * ```
274
+ * gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
275
+ * ```
276
+ * @remarks
277
+ * **WebGL Difference**: Bind target is always `gl.FRAMEBUFFER` and textarget is always `gl.TEXTURE_2D`
278
+ */
279
+ framebufferTexture2D(attachment: GLenum, texture: WebGLTexture | null, level: GLint): void;
280
+ /**
281
+ * ```
282
+ * gl.clear(gl.COLOR_BUFFER_BIT);
283
+ * ```
284
+ *
285
+ * @remarks
286
+ * **WebGL Difference**: Clear mask is always `gl.COLOR_BUFFER_BIT`
287
+ */
288
+ clear(): void;
289
+ /**
290
+ * ```
291
+ * gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
292
+ * gl.bufferData(gl.ARRAY_BUFFER, data, usage);
293
+ * ```
294
+ *
295
+ * @remarks
296
+ * **WebGL Combo**: `gl.bindBuffer` and `gl.bufferData` are combined into one function.
297
+ *
298
+ * @param buffer
299
+ * @param data
300
+ * @param usage
301
+ */
302
+ arrayBufferData(buffer: WebGLBuffer | null, data: ArrayBufferView, usage: GLenum): void;
303
+ /**
304
+ * ```
305
+ * gl.bindBuffer(gl.ARRAY_BUFFER, buffer); // if needed
306
+ * gl.bufferSubData(gl.ARRAY_BUFFER, dstByteOffset, data);
307
+ * ```
308
+ *
309
+ * @remarks
310
+ * **WebGL Combo**: `gl.bindBuffer` is only called when the buffer changes.
311
+ * Used to surgically update a subset of the GPU buffer without reallocating it.
312
+ *
313
+ * @param buffer
314
+ * @param dstByteOffset - Byte offset into the GPU buffer where `data` will be written
315
+ * @param data
316
+ */
317
+ arrayBufferSubData(buffer: WebGLBuffer | null, dstByteOffset: number, data: ArrayBufferView): void;
318
+ /**
319
+ * ```
320
+ * gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffer);
321
+ * gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, data, usage);
322
+ * ```
323
+ * @remarks
324
+ * **WebGL Combo**: `gl.bindBuffer` and `gl.bufferData` are combined into one function.
325
+ *
326
+ * @param buffer
327
+ * @param data
328
+ * @param usage
329
+ */
330
+ elementArrayBufferData(buffer: WebGLBuffer | null, data: ArrayBufferView, usage: GLenum): void;
331
+ /**
332
+ * ```
333
+ * gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
334
+ * gl.vertexAttribPointer(index, size, type, normalized, stride, offset);
335
+ * ```
336
+ *
337
+ * @remarks
338
+ * **WebGL Combo**: `gl.bindBuffer` and `gl.vertexAttribPointer` are combined into one function.
339
+ *
340
+ * @param buffer
341
+ * @param index
342
+ * @param size
343
+ * @param type
344
+ * @param normalized
345
+ * @param stride
346
+ * @param offset
347
+ */
348
+ vertexAttribPointer(buffer: WebGLBuffer, index: GLuint, size: GLint, type: GLenum, normalized: GLboolean, stride: GLsizei, offset: GLintptr): void;
349
+ /**
350
+ * Returns object with Attribute names as key and numbers as location values
351
+ *
352
+ * @param program
353
+ * @returns object with numbers
354
+ */
355
+ getUniformLocations(program: WebGLProgram): Record<string, WebGLUniformLocation>;
356
+ /**
357
+ * Returns object with Attribute names as key and numbers as location values
358
+ * @param program
359
+ * @returns object with numbers
360
+ */
361
+ getAttributeLocations(program: WebGLProgram): string[];
362
+ /**
363
+ * ```
364
+ * gl.useProgram(program);
365
+ * ```
366
+ *
367
+ * @param program
368
+ * @returns
369
+ */
370
+ useProgram(program: WebGLProgram | null, uniformLocations: Record<string, WebGLUniformLocation>): void;
371
+ /**
372
+ * Sets the value of a single float uniform variable.
373
+ *
374
+ * @param location - The location of the uniform variable.
375
+ * @param v0 - The value to set.
376
+ */
377
+ uniform1f(location: string, v0: number): void;
378
+ /**
379
+ * Sets the value of a float array uniform variable.
380
+ *
381
+ * @param location - The location of the uniform variable.
382
+ * @param value - The array of values to set.
383
+ */
384
+ uniform1fv(location: string, value: Float32Array): void;
385
+ /**
386
+ * Sets the value of a single integer uniform variable.
387
+ *
388
+ * @param location - The location of the uniform variable.
389
+ * @param v0 - The value to set.
390
+ */
391
+ uniform1i(location: string, v0: number): void;
392
+ /**
393
+ * Sets the value of an integer array uniform variable.
394
+ *
395
+ * @param location - The location of the uniform variable.
396
+ * @param value - The array of values to set.
397
+ */
398
+ uniform1iv(location: string, value: Int32Array): void;
399
+ /**
400
+ * Sets the value of a vec2 uniform variable.
401
+ *
402
+ * @param location - The location of the uniform variable.
403
+ * @param v0 - The first component of the vector.
404
+ * @param v1 - The second component of the vector.
405
+ */
406
+ uniform2f(location: string, v0: number, v1: number): void;
407
+ /**
408
+ * Sets the value of a vec3 uniform variable.
409
+ *
410
+ * @param location - The location of the uniform variable.
411
+ * @param v - array of 4 numbers.
412
+ */
413
+ uniform2fa(location: string, value: Vec2): void;
414
+ /**
415
+ * Sets the value of a vec2 array uniform variable.
416
+ *
417
+ * @param location - The location of the uniform variable.
418
+ * @param value - The array of vec2 values to set.
419
+ */
420
+ uniform2fv(location: string, value: Float32Array): void;
421
+ /**
422
+ * Sets the value of a ivec2 uniform variable.
423
+ *
424
+ * @param location - The location of the uniform variable.
425
+ * @param v0 - The first component of the vector.
426
+ * @param v1 - The second component of the vector.
427
+ */
428
+ uniform2i(location: string, v0: number, v1: number): void;
429
+ /**
430
+ * Sets the value of an ivec2 array uniform variable.
431
+ *
432
+ * @param location - The location of the uniform variable.
433
+ * @param value - The array of ivec2 values to set.
434
+ */
435
+ uniform2iv(location: string, value: Int32Array): void;
436
+ /**
437
+ * Sets the value of a vec3 uniform variable.
438
+ *
439
+ * @param location - The location of the uniform variable.
440
+ * @param v0 - The first component of the vector.
441
+ * @param v1 - The second component of the vector.
442
+ * @param v2 - The third component of the vector.
443
+ */
444
+ uniform3f(location: string, v0: number, v1: number, v2: number): void;
445
+ /**
446
+ * Sets the value of a vec3 uniform variable.
447
+ *
448
+ * @param location - The location of the uniform variable.
449
+ * @param v - array of 4 numbers.
450
+ */
451
+ uniform3fa(location: string, value: Vec3): void;
452
+ /**
453
+ * Sets the value of a vec3 array uniform variable.
454
+ *
455
+ * @param location - The location of the uniform variable.
456
+ * @param value - The array of vec3 values to set.
457
+ */
458
+ uniform3fv(location: string, value: Float32Array): void;
459
+ /**
460
+ * Sets the value of a ivec3 uniform variable.
461
+ *
462
+ * @param location - The location of the uniform variable.
463
+ * @param v0 - The first component of the vector.
464
+ * @param v1 - The second component of the vector.
465
+ * @param v2 - The third component of the vector.
466
+ */
467
+ uniform3i(location: string, v0: number, v1: number, v2: number): void;
468
+ /**
469
+ * Sets the value of an ivec3 array uniform variable.
470
+ *
471
+ * @param location - The location of the uniform variable.
472
+ * @param value - The array of ivec3 values to set.
473
+ */
474
+ uniform3iv(location: string, value: Int32Array): void;
475
+ /**
476
+ * Sets the value of a vec4 uniform variable.
477
+ *
478
+ * @param location - The location of the uniform variable.
479
+ * @param v0 - The first component of the vector.
480
+ * @param v1 - The second component of the vector.
481
+ * @param v2 - The third component of the vector.
482
+ * @param v3 - The fourth component of the vector.
483
+ */
484
+ uniform4f(location: string, v0: number, v1: number, v2: number, v3: number): void;
485
+ /**
486
+ * Sets the value of a vec4 uniform variable.
487
+ *
488
+ * @param location - The location of the uniform variable.
489
+ * @param v - array of 4 numbers.
490
+ */
491
+ uniform4fa(location: string, value: Vec4): void;
492
+ /**
493
+ * Sets the value of a vec4 array uniform variable.
494
+ *
495
+ * @param location - The location of the uniform variable.
496
+ * @param value - The array of vec4 values to set.
497
+ */
498
+ uniform4fv(location: string, value: Float32Array): void;
499
+ /**
500
+ * Sets the value of a ivec4 uniform variable.
501
+ *
502
+ * @param location - The location of the uniform variable.
503
+ * @param v0 - The first component of the vector.
504
+ * @param v1 - The second component of the vector.
505
+ * @param v2 - The third component of the vector.
506
+ * @param v3 - The fourth component of the vector.
507
+ */
508
+ uniform4i(location: string, v0: number, v1: number, v2: number, v3: number): void;
509
+ /**
510
+ * Sets the value of an ivec4 array uniform variable.
511
+ *
512
+ * @param location - The location of the uniform variable.
513
+ * @param value - The array of ivec4 values to set.
514
+ */
515
+ uniform4iv(location: string, value: Int32Array): void;
516
+ /**
517
+ * Sets the value of a mat2 uniform variable.
518
+ *
519
+ * @param location - The location of the uniform variable.
520
+ * @param transpose - Whether to transpose the matrix.
521
+ * @param value - The array of mat2 values to set.
522
+ */
523
+ uniformMatrix2fv(location: string, value: Float32Array): void;
524
+ /**
525
+ * Sets the value of a mat2 uniform variable.
526
+ * @param location - The location of the uniform variable.
527
+ * @param value - The array of mat2 values to set.
528
+ */
529
+ uniformMatrix3fv(location: string, value: Float32Array): void;
530
+ /**
531
+ * Sets the value of a mat4 uniform variable.
532
+ * @param location - The location of the uniform variable.
533
+ * @param value - The array of mat4 values to set.
534
+ */
535
+ uniformMatrix4fv(location: string, value: Float32Array): void;
536
+ /**
537
+ * ```
538
+ * gl.getParameter(pname);
539
+ * ```
540
+ *
541
+ * @param pname
542
+ * @returns
543
+ */
544
+ getParameter(pname: GLenum): any;
545
+ /**
546
+ * ```
547
+ * gl.drawElements(mode, count, type, offset);
548
+ * ```
549
+ *
550
+ * @param mode
551
+ * @param count
552
+ * @param type
553
+ * @param offset
554
+ */
555
+ drawElements(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr): void;
556
+ /**
557
+ * ```
558
+ * gl.drawArrays(mode, first, count);
559
+ * ```
560
+ *
561
+ * @param mode
562
+ * @param first
563
+ * @param count
564
+ */
565
+ drawArrays(mode: GLenum, first: GLint, count: GLsizei): void;
566
+ /**
567
+ * ```
568
+ * gl.drawArrays(mode, first, count);
569
+ * ```
570
+ *
571
+ * @param name
572
+ * @returns
573
+ */
574
+ getExtension(name: string): any;
575
+ /**
576
+ * ```
577
+ * gl.getError(type);
578
+ * ```
579
+ *
580
+ * @returns
581
+ */
582
+ getError(): number;
583
+ /**
584
+ * ```
585
+ * gl.createVertexArray();
586
+ * ```
587
+ *
588
+ * @returns
589
+ */
590
+ createVertexArray(): WebGLVertexArrayObject | undefined;
591
+ /**
592
+ * ```
593
+ * gl.bindVertexArray(vertexArray);
594
+ * ```
595
+ *
596
+ * @param vertexArray
597
+ */
598
+ bindVertexArray(vertexArray: WebGLVertexArrayObject | null): void;
599
+ /**
600
+ * ```
601
+ * gl.getAttribLocation(program, name);
602
+ * ```
603
+ *
604
+ * @param program
605
+ * @param name
606
+ * @returns
607
+ */
608
+ getAttribLocation(program: WebGLProgram, name: string): number;
609
+ /**
610
+ * ```
611
+ * gl.getUniformLocation(program, name);
612
+ * ```
613
+ *
614
+ * @param program
615
+ * @param name
616
+ * @returns
617
+ */
618
+ getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation | null;
619
+ /**
620
+ * ```
621
+ * gl.enableVertexAttribArray(index);
622
+ * ```
623
+ *
624
+ * @param index
625
+ */
626
+ enableVertexAttribArray(index: number): void;
627
+ /**
628
+ * ```
629
+ * gl.disableVertexAttribArray(index);
630
+ * ```
631
+ *
632
+ * @param index
633
+ */
634
+ disableVertexAttribArray(index: number): void;
635
+ /**
636
+ * ```
637
+ * gl.createShader(type);
638
+ * ```
639
+ *
640
+ * @param type
641
+ * @returns
642
+ */
643
+ createShader(type: number): WebGLShader | null;
644
+ /**
645
+ * ```
646
+ * gl.compileShader(shader);
647
+ * ```
648
+ *
649
+ * @param shader
650
+ * @returns
651
+ */
652
+ compileShader(shader: WebGLShader): void;
653
+ /**
654
+ * ```
655
+ * gl.attachShader(program, shader);
656
+ * ```
657
+ *
658
+ * @param program
659
+ * @param shader
660
+ */
661
+ attachShader(program: WebGLProgram, shader: WebGLShader): void;
662
+ /**
663
+ * ```
664
+ * gl.linkProgram(program);
665
+ * ```
666
+ *
667
+ * @param program
668
+ */
669
+ linkProgram(program: WebGLProgram): void;
670
+ /**
671
+ * ```
672
+ * gl.deleteProgram(shader);
673
+ * ```
674
+ *
675
+ * @param shader
676
+ */
677
+ deleteProgram(shader: WebGLProgram): void;
678
+ /**
679
+ * ```
680
+ * gl.getShaderParameter(shader, pname);
681
+ * ```
682
+ *
683
+ * @param shader
684
+ * @param pname
685
+ */
686
+ getShaderParameter(shader: WebGLShader, pname: GLenum): any;
687
+ /**
688
+ * ```
689
+ * gl.getShaderInfoLog(shader);
690
+ * ```
691
+ *
692
+ * @param shader
693
+ */
694
+ getShaderInfoLog(shader: WebGLShader): string | null;
695
+ /**
696
+ * ```
697
+ * gl.createProgram();
698
+ * ```
699
+ *
700
+ * @returns
701
+ */
702
+ createProgram(): WebGLProgram;
703
+ /**
704
+ * ```
705
+ * gl.getProgramParameter(program, pname);
706
+ * ```
707
+ *
708
+ * @param program
709
+ * @param pname
710
+ * @returns
711
+ */
712
+ getProgramParameter(program: WebGLProgram, pname: GLenum): any;
713
+ /**
714
+ * ```
715
+ * gl.getProgramInfoLog(program);
716
+ * ```
717
+ *
718
+ * @param program
719
+ * @returns
720
+ */
721
+ getProgramInfoLog(program: WebGLProgram): string | null;
722
+ /**
723
+ * ```
724
+ * gl.shaderSource(shader, source);
725
+ * ```
726
+ *
727
+ * @param shader
728
+ * @param source
729
+ */
730
+ shaderSource(shader: WebGLShader, source: string): void;
731
+ /**
732
+ * ```
733
+ * gl.deleteShader(shader);
734
+ * ```
735
+ *
736
+ * @param shader
737
+ */
738
+ deleteShader(shader: WebGLShader): void;
739
+ /**
740
+ * ```
741
+ * gl.deleteBuffer(buffer);
742
+ * ```
743
+ *
744
+ * @param buffer - The buffer to delete
745
+ */
746
+ deleteBuffer(buffer: WebGLBuffer): void;
747
+ /**
748
+ * ```
749
+ * gl.deleteVertexArray(vertexArray);
750
+ * ```
751
+ *
752
+ * @param vertexArray - The vertex array object to delete
753
+ */
754
+ deleteVertexArray(vertexArray: WebGLVertexArrayObject): void;
755
+ /**
756
+ * Check for WebGL errors and return error information
757
+ * @param operation Description of the operation for error reporting
758
+ * @returns Object with error information or null if no error
759
+ */
760
+ checkError(operation: string): {
761
+ error: number;
762
+ errorName: string;
763
+ message: string;
764
+ } | null;
765
+ }
766
+ type IsUniformMethod<MethodName, MethodType> = MethodName extends `uniform${string}` ? MethodType extends (location: WebGLUniformLocation | null, ...args: any[]) => void ? true : false : false;
767
+ export type UniformMethodMap = {
768
+ [Key in keyof WebGLRenderingContext as IsUniformMethod<Key, WebGLRenderingContext[Key]> extends true ? Key : never]: WebGLRenderingContext[Key] extends (location: WebGLUniformLocation | null, ...args: infer T) => void ? T : never;
769
+ };
770
+ /**
771
+ * Compare two arrays for equality.
772
+ *
773
+ * @remarks
774
+ * This function will not try to compare nested arrays or Float32Arrays and
775
+ * instead will always return false when they are encountered.
776
+ *
777
+ * @param a
778
+ * @param b
779
+ * @returns
780
+ */
781
+ export declare function compareArrays<T>(a: T[], b: T[]): boolean;
782
+ export {};