@babylonjs/lite-gl 1.23.0 → 1.24.1

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 (94) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +103 -6
  3. package/blend.d.ts +1 -1
  4. package/blend.js +1 -1
  5. package/blend.js.map +1 -1
  6. package/context.d.ts +52 -4
  7. package/context.js +108 -11
  8. package/context.js.map +1 -1
  9. package/depth-stencil.d.ts +4 -16
  10. package/depth-stencil.js +10 -11
  11. package/depth-stencil.js.map +1 -1
  12. package/dynamic-texture.d.ts +6 -3
  13. package/dynamic-texture.js +16 -4
  14. package/dynamic-texture.js.map +1 -1
  15. package/effect-renderer.d.ts +1 -11
  16. package/effect-renderer.js.map +1 -1
  17. package/effect.d.ts +16 -29
  18. package/effect.js +52 -19
  19. package/effect.js.map +1 -1
  20. package/family.d.ts +474 -0
  21. package/family.js +14 -0
  22. package/family.js.map +1 -0
  23. package/framebuffer-validation.d.ts +20 -0
  24. package/framebuffer-validation.js +37 -0
  25. package/framebuffer-validation.js.map +1 -0
  26. package/html-texture.d.ts +2 -2
  27. package/html-texture.js.map +1 -1
  28. package/index.d.ts +10 -7
  29. package/index.js +5 -4
  30. package/index.js.map +1 -1
  31. package/mesh.d.ts +72 -15
  32. package/mesh.js +221 -64
  33. package/mesh.js.map +1 -1
  34. package/native/command-stream.d.ts +1 -0
  35. package/native/command-stream.js +135 -0
  36. package/native/command-stream.js.map +1 -0
  37. package/native/context.d.ts +26 -0
  38. package/native/context.js +89 -0
  39. package/native/context.js.map +1 -0
  40. package/native/effect.d.ts +44 -0
  41. package/native/effect.js +276 -0
  42. package/native/effect.js.map +1 -0
  43. package/native/family.d.ts +75 -0
  44. package/native/family.js +2 -0
  45. package/native/family.js.map +1 -0
  46. package/native/identity.d.ts +11 -0
  47. package/native/identity.js +2 -0
  48. package/native/identity.js.map +1 -0
  49. package/native/index.d.ts +25 -0
  50. package/native/index.js +7 -0
  51. package/native/index.js.map +1 -0
  52. package/native/mesh.d.ts +53 -0
  53. package/native/mesh.js +137 -0
  54. package/native/mesh.js.map +1 -0
  55. package/native/render-target.d.ts +35 -0
  56. package/native/render-target.js +159 -0
  57. package/native/render-target.js.map +1 -0
  58. package/native/runtime.d.ts +1 -0
  59. package/native/runtime.js +12 -0
  60. package/native/runtime.js.map +1 -0
  61. package/native/state.d.ts +19 -0
  62. package/native/state.js +104 -0
  63. package/native/state.js.map +1 -0
  64. package/native/texture.d.ts +37 -0
  65. package/native/texture.js +86 -0
  66. package/native/texture.js.map +1 -0
  67. package/package.json +11 -3
  68. package/render-target.d.ts +18 -9
  69. package/render-target.js +84 -31
  70. package/render-target.js.map +1 -1
  71. package/scissor.d.ts +3 -3
  72. package/scissor.js +2 -2
  73. package/scissor.js.map +1 -1
  74. package/sprites.d.ts +5 -3
  75. package/sprites.js +24 -23
  76. package/sprites.js.map +1 -1
  77. package/state.d.ts +26 -13
  78. package/state.js +15 -15
  79. package/state.js.map +1 -1
  80. package/text/_gpu/text-instances.js +1 -1
  81. package/text/_gpu/text-instances.js.map +1 -1
  82. package/text/text-renderer.js.map +1 -1
  83. package/texture-3d.d.ts +2 -1
  84. package/texture-3d.js +7 -2
  85. package/texture-3d.js.map +1 -1
  86. package/texture-source.d.ts +4 -2
  87. package/texture-source.js +3 -2
  88. package/texture-source.js.map +1 -1
  89. package/texture.d.ts +18 -8
  90. package/texture.js +61 -35
  91. package/texture.js.map +1 -1
  92. package/web-family.d.ts +88 -0
  93. package/web-family.js +2 -0
  94. package/web-family.js.map +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"html-texture.js","sourceRoot":"","sources":["../src/html-texture.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,GAIjB,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;0CAW0C;AAC1C,MAAM,UAAU,wBAAwB,CAAC,MAAuB,EAAE,O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AAuB,EAAQ,EAAE;QAC3D,qBAAqB,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC,CAAC;IAEF,MAAM,GAAG,GAAc;QACnB,MAAM;QACN,MAAM,EAAE,EAAE,CAAC,UAAU;QACrB,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,MAAM;QACf,qBAAqB,EAAE,oBAAoB;QAC3C,SAAS,EAAE,IAAI;KAClB,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,CAAC;IACf,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;;;;;;iFAWiF;AACjF,MAAM,UAAU,wBAAwB,CAAC,GAAc,EAAE,OAAgC;IACrF,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IAC3B,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QACtD,OAAO;IACX,CAAC;IACD,GAAG,CAAC,QAAQ,GAAG,OAAO,EAAE,OAAO,CAAC;IAChC,GAAG,CAAC,iBAAiB,GAAG,OAAO,EAAE,gBAAgB,CAAC;IAClD,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC","sourcesContent":["/**\n * HTML element textures.\n *\n * Part of the public API via the `@babylonjs/lite-gl` barrel. The package is\n * `sideEffects: false`, so consumers that don't need it (everything except\n * NeonBrush's `InputGlow`) tree-shake it out.\n */\nimport type { GLEngineContext } from \"./context.js\";\nimport {\n bindTextureForUpload,\n setTexImageSourceSize,\n setBoundTextureParams,\n setUnpackState,\n type GLTexture,\n type GLTextureOptions,\n type GLTextureUpdateOptions,\n} from \"./texture.js\";\n\n/** Create a texture backed by an `<canvas>` / `<img>` / `<video>` element.\n * The initial upload is performed immediately; call `updateHtmlElementTexture`\n * to re-upload after the source has changed.\n *\n * @param engine - The engine to create GL resources on.\n * @param element - The source element.\n * @param options - The shared {@link GLTextureOptions} (including `invertY`\n * and `premultiplyAlpha`), applied on creation, on every\n * `updateHtmlElementTexture` that omits them and on `webglcontextrestored`.\n * For Babylon-style presets spread `getSamplingModeFilters(...)`; for mipmaps\n * call `generateTextureMipMaps` once and every later update rebuilds the chain.\n * @returns The new {@link GLTexture}. */\nexport function createHtmlElementTexture(engine: GLEngineContext, element: HTMLCanvasElement | HTMLImageElement | HTMLVideoElement, options?: GLTextureOptions): GLTexture {\n const gl = engine.gl;\n const handle = gl.createTexture();\n if (handle === null) {\n throw new Error(\"lite-gl: gl.createTexture returned null\");\n }\n const opts = options ?? {};\n const minFilter = opts.minFilter ?? gl.LINEAR;\n const magFilter = opts.magFilter ?? gl.LINEAR;\n const wrapS = opts.wrapS ?? gl.CLAMP_TO_EDGE;\n const wrapT = opts.wrapT ?? gl.CLAMP_TO_EDGE;\n const invertY = opts.invertY ?? false;\n const premultiplyAlpha = opts.premultiplyAlpha ?? false;\n\n const upload = (target: GLEngineContext): void => {\n const g = target.gl;\n setUnpackState(target, tex._invertY ?? invertY, tex._premultiplyAlpha ?? premultiplyAlpha);\n bindTextureForUpload(target, tex.handle);\n g.texImage2D(g.TEXTURE_2D, 0, g.RGBA8, g.RGBA, g.UNSIGNED_BYTE, element);\n setTexImageSourceSize(tex, element);\n };\n\n const initializeParameters = (target: GLEngineContext): void => {\n setBoundTextureParams(target.gl, minFilter, magFilter, wrapS, wrapT);\n };\n\n const tex: GLTexture = {\n handle,\n target: gl.TEXTURE_2D,\n width: 1,\n height: 1,\n isReady: true,\n _engine: engine,\n _disposed: false,\n _refCount: 1,\n _upload: upload,\n _initializeParameters: initializeParameters,\n _wasReady: true,\n };\n upload(engine);\n initializeParameters(engine);\n engine._textures.add(tex);\n return tex;\n}\n\n/** Re-upload the texture from its source element — the counterpart of\n * Babylon's `HtmlElementTexture.update(invertY)`. Only valid for textures\n * created by {@link createHtmlElementTexture}. No-op when the context is\n * lost/disposed or the texture is disposed.\n *\n * `invertY` is always the raw `UNPACK_FLIP_Y_WEBGL` value. Babylon flips\n * video elements with `!invertY`, so port `videoTexture.update(invertY)` as\n * `{ invertY: !invertY }` (canvas / image calls map directly).\n *\n * @param tex - A texture created by {@link createHtmlElementTexture}.\n * @param options - Per-update `invertY` / `premultiplyAlpha`; each defaults to\n * the texture's creation value. Retained for `webglcontextrestored` replay. */\nexport function updateHtmlElementTexture(tex: GLTexture, options?: GLTextureUpdateOptions): void {\n const engine = tex._engine;\n if (engine._isLost || engine._disposed || tex._disposed) {\n return;\n }\n tex._invertY = options?.invertY;\n tex._premultiplyAlpha = options?.premultiplyAlpha;\n tex._upload(engine);\n}\n"]}
1
+ {"version":3,"file":"html-texture.js","sourceRoot":"","sources":["../src/html-texture.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,GAIjB,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;0CAW0C;AAC1C,MAAM,UAAU,wBAAwB,CAAC,MAAuB,EAAE,OAAgE,EAAE,OAA0B;IAC1J,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;IACrB,MAAM,MAAM,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC;IAClC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC/D,CAAC;IACD,MAAM,IAAI,GAAG,OAAO,IAAI,EAAE,CAAC;IAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,MAAM,CAAC;IAC9C,MAAM,SAAS,GAAG,IAAI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AAqB,EAAE,oBAAoB;QAC3C,SAAS,EAAE,IAAI;KAClB,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,CAAC;IACf,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;;;;;;iFAWiF;AACjF,MAAM,UAAU,wBAAwB,CAAC,GAAc,EAAE,OAAgC;IACrF,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IAC3B,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QACtD,OAAO;IACX,CAAC;IACD,GAAG,CAAC,QAAQ,GAAG,OAAO,EAAE,OAAO,CAAC;IAChC,GAAG,CAAC,iBAAiB,GAAG,OAAO,EAAE,gBAAgB,CAAC;IAClD,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC","sourcesContent":["/**\n * HTML element textures.\n *\n * Part of the public API via the `@babylonjs/lite-gl` barrel. The package is\n * `sideEffects: false`, so consumers that don't sample HTML elements\n * tree-shake it out.\n */\nimport type { GLEngineContext } from \"./context.js\";\nimport {\n bindTextureForUpload,\n setTexImageSourceSize,\n setBoundTextureParams,\n setUnpackState,\n type GLTexture,\n type GLTextureOptions,\n type GLTextureUpdateOptions,\n} from \"./texture.js\";\n\n/** Create a texture backed by an `<canvas>` / `<img>` / `<video>` element.\n * The initial upload is performed immediately; call `updateHtmlElementTexture`\n * to re-upload after the source has changed.\n *\n * @param engine - The engine to create GL resources on.\n * @param element - The source element.\n * @param options - The shared {@link GLTextureOptions} (including `invertY`\n * and `premultiplyAlpha`), applied on creation, on every\n * `updateHtmlElementTexture` that omits them and on `webglcontextrestored`.\n * For Babylon-style presets spread `getSamplingModeFilters(...)`; for mipmaps\n * call `generateTextureMipMaps` once and every later update rebuilds the chain.\n * @returns The new {@link GLTexture}. */\nexport function createHtmlElementTexture(engine: GLEngineContext, element: HTMLCanvasElement | HTMLImageElement | HTMLVideoElement, options?: GLTextureOptions): GLTexture {\n const gl = engine.gl;\n const handle = gl.createTexture();\n if (handle === null) {\n throw new Error(\"lite-gl: gl.createTexture returned null\");\n }\n const opts = options ?? {};\n const minFilter = opts.minFilter ?? gl.LINEAR;\n const magFilter = opts.magFilter ?? gl.LINEAR;\n const wrapS = opts.wrapS ?? gl.CLAMP_TO_EDGE;\n const wrapT = opts.wrapT ?? gl.CLAMP_TO_EDGE;\n const invertY = opts.invertY ?? false;\n const premultiplyAlpha = opts.premultiplyAlpha ?? false;\n\n const upload = (target: GLEngineContext): void => {\n const g = target.gl;\n setUnpackState(target, tex._invertY ?? invertY, tex._premultiplyAlpha ?? premultiplyAlpha);\n bindTextureForUpload(target, tex.handle);\n g.texImage2D(g.TEXTURE_2D, 0, g.RGBA8, g.RGBA, g.UNSIGNED_BYTE, element);\n setTexImageSourceSize(tex, element);\n };\n\n const initializeParameters = (target: GLEngineContext): void => {\n setBoundTextureParams(target.gl, minFilter, magFilter, wrapS, wrapT);\n };\n\n const tex: GLTexture = {\n handle,\n target: gl.TEXTURE_2D,\n width: 1,\n height: 1,\n isReady: true,\n _engine: engine,\n _disposed: false,\n _refCount: 1,\n _upload: upload,\n _initializeParameters: initializeParameters,\n _wasReady: true,\n };\n upload(engine);\n initializeParameters(engine);\n engine._textures.add(tex);\n return tex;\n}\n\n/** Re-upload the texture from its source element — the counterpart of\n * Babylon's `HtmlElementTexture.update(invertY)`. Only valid for textures\n * created by {@link createHtmlElementTexture}. No-op when the context is\n * lost/disposed or the texture is disposed.\n *\n * `invertY` is always the raw `UNPACK_FLIP_Y_WEBGL` value. Babylon flips\n * video elements with `!invertY`, so port `videoTexture.update(invertY)` as\n * `{ invertY: !invertY }` (canvas / image calls map directly).\n *\n * @param tex - A texture created by {@link createHtmlElementTexture}.\n * @param options - Per-update `invertY` / `premultiplyAlpha`; each defaults to\n * the texture's creation value. Retained for `webglcontextrestored` replay. */\nexport function updateHtmlElementTexture(tex: GLTexture, options?: GLTextureUpdateOptions): void {\n const engine = tex._engine;\n if (engine._isLost || engine._disposed || tex._disposed) {\n return;\n }\n tex._invertY = options?.invertY;\n tex._premultiplyAlpha = options?.premultiplyAlpha;\n tex._upload(engine);\n}\n"]}
package/index.d.ts CHANGED
@@ -1,15 +1,18 @@
1
- export { createGLEngine, disposeGLEngine, resizeGLEngine, setGLEngineSize, wipeGLStateCache, getRenderWidth, getRenderHeight, getHardwareScalingLevel, setHardwareScalingLevel, getRenderingCanvas, onContextLost, offContextLost, onContextRestored, offContextRestored, } from "./context.js";
1
+ export type { GLEffectOptions, GLViewport, GLClearOptions } from "./family.js";
2
+ export type { WebGLFamily, WebGLHostOps } from "./web-family.js";
3
+ export { createGLEngine, createHostOwnedGLEngine, disposeGLEngine, resizeGLEngine, setGLEngineSize, wipeGLStateCache, getRenderWidth, getRenderHeight, getTextureCount, getCurrentRenderTarget, getHardwareScalingLevel, setHardwareScalingLevel, getRenderingCanvas, onContextLost, offContextLost, onContextRestored, offContextRestored, } from "./context.js";
2
4
  export type { GLEngineOptions, GLEngineCaps, GLEngineContext } from "./context.js";
5
+ export { setFramebufferValidation } from "./framebuffer-validation.js";
3
6
  export { getAlphaToCoverage, getCurrentSampleCount, setAlphaToCoverage } from "./alpha-to-coverage.js";
4
7
  export { runRenderLoop, stopRenderLoop, beginFrame, endFrame } from "./render-loop.js";
5
8
  export { captureGPUFrameTime, getGPUFrameTimeCounter } from "./gpu-frame-time.js";
6
9
  export type { GLPerfCounter } from "./gpu-frame-time.js";
7
- export { createEffect, useEffect, isEffectReady, getEffectCompilationError, executeWhenCompiled, disposeEffect, setEffectFloat, setEffectFloat2, setEffectFloat3, setEffectFloat4, setEffectColor3, setEffectColor4, setEffectVector2, setEffectDirectColor4, setEffectInt, setEffectTexture, setEffectMatrix, setEffectMatrix3x3, setEffectFloatArray, setEffectFloatArray4, setEffectIntArray, } from "./effect.js";
8
- export type { GLEffectOptions, GLEffect } from "./effect.js";
10
+ export { createEffect, useEffect, isEffectReady, getEffectCompilationError, executeWhenCompiled, disposeEffect, setEffectFloat, setEffectFloat2, setEffectFloat3, setEffectFloat4, setEffectColor3, setEffectColor4, setEffectVector2, setEffectDirectColor4, setEffectInt, setEffectTexture, setEffectMatrix, setEffectMatrix3x3, setEffectFloatArray, setEffectFloatArray2, setEffectFloatArray3, setEffectFloatArray4, setEffectIntArray, } from "./effect.js";
11
+ export type { GLEffect } from "./effect.js";
9
12
  export { waitForEffect } from "./effect-ready.js";
10
13
  export type { GLEffectWaitOptions } from "./effect-ready.js";
11
14
  export { createEffectWrapper, applyEffectWrapper, drawEffect, setViewport, disposeEffectWrapper } from "./effect-renderer.js";
12
- export type { GLEffectWrapperOptions, GLEffectWrapper, GLViewport } from "./effect-renderer.js";
15
+ export type { GLEffectWrapperOptions, GLEffectWrapper } from "./effect-renderer.js";
13
16
  export { createRawTexture, createFloatTexture, generateTextureMipMaps, loadTexture2D, bindTexture, unbindTexture, disposeTexture, updateRawTexture, updateTextureSamplingMode, updateTextureSamplingPreset, updateTextureWrapMode, createTextureFromHandle, getSamplingModeFilters, isTextureReady, GLSamplingMode, } from "./texture.js";
14
17
  export type { GLTextureOptions, GLTextureUpdateOptions, GLRawTextureOptions, GLFloatTextureOptions, GLTexture, GLSamplingFilters } from "./texture.js";
15
18
  export { createTextureFromSource } from "./texture-source.js";
@@ -17,14 +20,14 @@ export type { GLTextureSourceOptions } from "./texture-source.js";
17
20
  export { createTexture3DFromPixels, bindTexture3D, unbindTexture3D, setEffectTexture3D, generateTexture3DMipMaps, updateTexture3DSamplingMode, updateTexture3DWrapMode, disposeTexture3D, } from "./texture-3d.js";
18
21
  export type { GLPixelsTexture3DOptions, GLTexture3D } from "./texture-3d.js";
19
22
  export { createDynamicTexture, updateDynamicTexture, clearDynamicTextureSource } from "./dynamic-texture.js";
20
- export { createRenderTarget, createFloatRenderTarget, bindRenderTarget, restoreDefaultFramebuffer, generateRenderTargetMipMaps, resizeRenderTarget, readRenderTargetPixels, readRenderTargetPixelsToBuffer, disposeRenderTarget, } from "./render-target.js";
23
+ export { createRenderTarget, createFloatRenderTarget, bindRenderTarget, restoreDefaultFramebuffer, presentRenderTarget, generateRenderTargetMipMaps, resizeRenderTarget, readRenderTargetPixels, readRenderTargetPixelsToBuffer, disposeRenderTarget, } from "./render-target.js";
21
24
  export type { GLRenderTarget, GLRenderTargetOptions, GLFloatRenderTargetOptions, GLReadPixelsRegionOptions, GLReadPixelsOptions, GLReadPixelsToBufferOptions, } from "./render-target.js";
22
- export { createVertexBuffer, updateVertexBuffer, createIndexBuffer, disposeBuffer, bindIndexBuffer, bindAttributes, unbindInstanceAttributes, drawIndexed, createMeshVao, bindMeshVao, drawMesh, disposeMeshVao, } from "./mesh.js";
25
+ export { createVertexBuffer, updateVertexBuffer, createIndexBuffer, disposeBuffer, bindIndexBuffer, bindAttributes, bindAttributesCached, disableAttributeByIndex, unbindAllAttributes, unbindInstanceAttributes, drawIndexed, createMeshVao, bindMeshVao, drawMesh, disposeMeshVao, } from "./mesh.js";
23
26
  export type { GLVertexBuffer, GLIndexBuffer, GLAttributeDescriptor, GLMeshVertexBuffer, GLMeshVao } from "./mesh.js";
24
27
  export { GLBlendMode, GLBlendEquation, setBlendMode, setBlendState, disableBlend } from "./blend.js";
25
28
  export type { GLBlendState } from "./blend.js";
26
29
  export { setDepthState, setCullState, setStencilState, setStencilOpSeparate, setColorMask, clearEngine, generateRenderTargetStencil } from "./depth-stencil.js";
27
- export type { GLDepthState, GLStencilState, GLStencilOpState, GLClearOptions } from "./depth-stencil.js";
30
+ export type { GLDepthState, GLStencilState, GLStencilOpState } from "./depth-stencil.js";
28
31
  export { setScissor, disableScissor } from "./scissor.js";
29
32
  export { createSpriteRenderer, renderSprites, setSpriteRendererTexture, disposeSpriteRenderer } from "./sprites.js";
30
33
  export type { GLSprite, GLSpriteColor, GLSpriteRendererOptions, GLSpriteRenderer } from "./sprites.js";
package/index.js CHANGED
@@ -11,7 +11,8 @@
11
11
  // so a consumer that imports only the symbols it needs tree-shakes everything
12
12
  // else (sprites, html-texture, …) away.
13
13
  // ─── Engine / context ────────────────────────────────────────────────
14
- export { createGLEngine, disposeGLEngine, resizeGLEngine, setGLEngineSize, wipeGLStateCache, getRenderWidth, getRenderHeight, getHardwareScalingLevel, setHardwareScalingLevel, getRenderingCanvas, onContextLost, offContextLost, onContextRestored, offContextRestored, } from "./context.js";
14
+ export { createGLEngine, createHostOwnedGLEngine, disposeGLEngine, resizeGLEngine, setGLEngineSize, wipeGLStateCache, getRenderWidth, getRenderHeight, getTextureCount, getCurrentRenderTarget, getHardwareScalingLevel, setHardwareScalingLevel, getRenderingCanvas, onContextLost, offContextLost, onContextRestored, offContextRestored, } from "./context.js";
15
+ export { setFramebufferValidation } from "./framebuffer-validation.js";
15
16
  // ─── Alpha-to-coverage (optional) ───────────────────────────────────
16
17
  export { getAlphaToCoverage, getCurrentSampleCount, setAlphaToCoverage } from "./alpha-to-coverage.js";
17
18
  // ─── Render loop ─────────────────────────────────────────────────────
@@ -19,7 +20,7 @@ export { runRenderLoop, stopRenderLoop, beginFrame, endFrame } from "./render-lo
19
20
  // ─── GPU frame timing (optional) ────────────────────────────────────
20
21
  export { captureGPUFrameTime, getGPUFrameTimeCounter } from "./gpu-frame-time.js";
21
22
  // ─── Effects ─────────────────────────────────────────────────────────
22
- export { createEffect, useEffect, isEffectReady, getEffectCompilationError, executeWhenCompiled, disposeEffect, setEffectFloat, setEffectFloat2, setEffectFloat3, setEffectFloat4, setEffectColor3, setEffectColor4, setEffectVector2, setEffectDirectColor4, setEffectInt, setEffectTexture, setEffectMatrix, setEffectMatrix3x3, setEffectFloatArray, setEffectFloatArray4, setEffectIntArray, } from "./effect.js";
23
+ export { createEffect, useEffect, isEffectReady, getEffectCompilationError, executeWhenCompiled, disposeEffect, setEffectFloat, setEffectFloat2, setEffectFloat3, setEffectFloat4, setEffectColor3, setEffectColor4, setEffectVector2, setEffectDirectColor4, setEffectInt, setEffectTexture, setEffectMatrix, setEffectMatrix3x3, setEffectFloatArray, setEffectFloatArray2, setEffectFloatArray3, setEffectFloatArray4, setEffectIntArray, } from "./effect.js";
23
24
  export { waitForEffect } from "./effect-ready.js";
24
25
  // ─── Effect renderer (fullscreen quad) ───────────────────────────────
25
26
  export { createEffectWrapper, applyEffectWrapper, drawEffect, setViewport, disposeEffectWrapper } from "./effect-renderer.js";
@@ -32,9 +33,9 @@ export { createTexture3DFromPixels, bindTexture3D, unbindTexture3D, setEffectTex
32
33
  // ─── Dynamic textures ────────────────────────────────────────────────
33
34
  export { createDynamicTexture, updateDynamicTexture, clearDynamicTextureSource } from "./dynamic-texture.js";
34
35
  // ─── Render targets ──────────────────────────────────────────────────
35
- export { createRenderTarget, createFloatRenderTarget, bindRenderTarget, restoreDefaultFramebuffer, generateRenderTargetMipMaps, resizeRenderTarget, readRenderTargetPixels, readRenderTargetPixelsToBuffer, disposeRenderTarget, } from "./render-target.js";
36
+ export { createRenderTarget, createFloatRenderTarget, bindRenderTarget, restoreDefaultFramebuffer, presentRenderTarget, generateRenderTargetMipMaps, resizeRenderTarget, readRenderTargetPixels, readRenderTargetPixelsToBuffer, disposeRenderTarget, } from "./render-target.js";
36
37
  // ─── Meshes / buffers / instancing ───────────────────────────────────
37
- export { createVertexBuffer, updateVertexBuffer, createIndexBuffer, disposeBuffer, bindIndexBuffer, bindAttributes, unbindInstanceAttributes, drawIndexed, createMeshVao, bindMeshVao, drawMesh, disposeMeshVao, } from "./mesh.js";
38
+ export { createVertexBuffer, updateVertexBuffer, createIndexBuffer, disposeBuffer, bindIndexBuffer, bindAttributes, bindAttributesCached, disableAttributeByIndex, unbindAllAttributes, unbindInstanceAttributes, drawIndexed, createMeshVao, bindMeshVao, drawMesh, disposeMeshVao, } from "./mesh.js";
38
39
  // ─── Blend modes ─────────────────────────────────────────────────────
39
40
  // GLBlendMode / GLBlendEquation are const + same-name type; one value
40
41
  // re-export carries both.
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,gFAAgF;AAChF,EAAE;AACF,iFAAiF;AACjF,4EAA4E;AAC5E,2EAA2E;AAC3E,yEAAyE;AACzE,+DAA+D;AAC/D,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,wCAAwC;AAExC,wEAAwE;AACxE,OAAO,EACH,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,cAAc,CAAC;AAGtB,uEAAuE;AACvE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEvG,wEAAwE;AACxE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvF,uEAAuE;AACvE,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGlF,wEAAwE;AACxE,OAAO,EACH,YAAY,EACZ,SAAS,EACT,aAAa,EACb,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,GACpB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,wEAAwE;AACxE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,o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A2B,EAAE,MAAM,oBAAoB,CAAC;AAGhK,wEAAwE;AACxE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE1D,wEAAwE;AACxE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGpH,wEAAwE;AACxE,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAIvF,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGnF,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEtG,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtF,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAEnH,OAAO,EACH,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC","sourcesContent":["// @babylonjs/lite-gl — Public API\n// Function-based, tree-shakeable WebGL2 micro-engine. Import only what you use.\n//\n// Convention (mirrors @babylonjs/lite): the public API is re-exported EXPLICITLY\n// by name — never `export *`. This keeps the public surface intentional and\n// reviewable, lets `export type` mark type-only re-exports (required under\n// `isolatedModules`), and keeps internal helpers (e.g. `bindTextureRaw`,\n// `bindTextureForUpload`) out of consumers' bundles + `.d.ts`.\n//\n// The package is `sideEffects: false` and no module has top-level side effects,\n// so a consumer that imports only the symbols it needs tree-shakes everything\n// else (sprites, html-texture, …) away.\n\n// ─── Engine / context ────────────────────────────────────────────────\nexport {\n createGLEngine,\n disposeGLEngine,\n resizeGLEngine,\n setGLEngineSize,\n wipeGLStateCache,\n getRenderWidth,\n getRenderHeight,\n getHardwareScalingLevel,\n setHardwareScalingLevel,\n getRenderingCanvas,\n onContextLost,\n offContextLost,\n onContextRestored,\n offContextRestored,\n} from \"./context.js\";\nexport type { GLEngineOptions, GLEngineCaps, GLEngineContext } from \"./context.js\";\n\n// ─── Alpha-to-coverage (optional) ───────────────────────────────────\nexport { getAlphaToCoverage, getCurrentSampleCount, setAlphaToCoverage } from \"./alpha-to-coverage.js\";\n\n// ─── Render loop ─────────────────────────────────────────────────────\nexport { runRenderLoop, stopRenderLoop, beginFrame, endFrame } from \"./render-loop.js\";\n\n// ─── GPU frame timing (optional) ────────────────────────────────────\nexport { captureGPUFrameTime, getGPUFrameTimeCounter } from \"./gpu-frame-time.js\";\nexport type { GLPerfCounter } from \"./gpu-frame-time.js\";\n\n// ─── Effects ─────────────────────────────────────────────────────────\nexport {\n createEffect,\n useEffect,\n isEffectReady,\n getEffectCompilationError,\n executeWhenCompiled,\n disposeEffect,\n setEffectFloat,\n setEffectFloat2,\n setEffectFloat3,\n setEffectFloat4,\n setEffectColor3,\n setEffectColor4,\n setEffectVector2,\n setEffectDirectColor4,\n setEffectInt,\n setEffectTexture,\n setEffectMatrix,\n setEffectMatrix3x3,\n setEffectFloatArray,\n setEffectFloatArray4,\n setEffectIntArray,\n} from \"./effect.js\";\nexport type { GLEffectOptions, GLEffect } from \"./effect.js\";\nexport { waitForEffect } from \"./effect-ready.js\";\nexport type { GLEffectWaitOptions } from \"./effect-ready.js\";\n\n// ─── Effect renderer (fullscreen quad) ───────────────────────────────\nexport { createEffectWrapper, applyEffectWrapper, drawEffect, setViewport, disposeEffectWrapper } from \"./effect-renderer.js\";\nexport type { GLEffectWrapperOptions, GLEffectWrapper, GLViewport } from \"./effect-renderer.js\";\n\n// ─── Textures ────────────────────────────────────────────────────────\nexport {\n createRawTexture,\n createFloatTexture,\n generateTextureMipMaps,\n loadTexture2D,\n bindTexture,\n unbindTexture,\n disposeTexture,\n updateRawTexture,\n updateTextureSamplingMode,\n updateTextureSamplingPreset,\n updateTextureWrapMode,\n createTextureFromHandle,\n getSamplingModeFilters,\n isTextureReady,\n // GLSamplingMode is a const + same-name type; one value re-export carries both.\n GLSamplingMode,\n} from \"./texture.js\";\nexport type { GLTextureOptions, GLTextureUpdateOptions, GLRawTextureOptions, GLFloatTextureOptions, GLTexture, GLSamplingFilters } from \"./texture.js\";\nexport { createTextureFromSource } from \"./texture-source.js\";\nexport type { GLTextureSourceOptions } from \"./texture-source.js\";\nexport {\n createTexture3DFromPixels,\n bindTexture3D,\n unbindTexture3D,\n setEffectTexture3D,\n generateTexture3DMipMaps,\n updateTexture3DSamplingMode,\n updateTexture3DWrapMode,\n disposeTexture3D,\n} from \"./texture-3d.js\";\nexport type { GLPixelsTexture3DOptions, GLTexture3D } from \"./texture-3d.js\";\n\n// ─── Dynamic textures ────────────────────────────────────────────────\nexport { createDynamicTexture, updateDynamicTexture, clearDynamicTextureSource } from \"./dynamic-texture.js\";\n\n// ─── Render targets ──────────────────────────────────────────────────\nexport {\n createRenderTarget,\n createFloatRenderTarget,\n bindRenderTarget,\n restoreDefaultFramebuffer,\n generateRenderTargetMipMaps,\n resizeRenderTarget,\n readRenderTargetPixels,\n readRenderTargetPixelsToBuffer,\n disposeRenderTarget,\n} from \"./render-target.js\";\nexport type {\n GLRenderTarget,\n GLRenderTargetOptions,\n GLFloatRenderTargetOptions,\n GLReadPixelsRegionOptions,\n GLReadPixelsOptions,\n GLReadPixelsToBufferOptions,\n} from \"./render-target.js\";\n\n// ─── Meshes / buffers / instancing ───────────────────────────────────\nexport {\n createVertexBuffer,\n updateVertexBuffer,\n createIndexBuffer,\n disposeBuffer,\n bindIndexBuffer,\n bindAttributes,\n unbindInstanceAttributes,\n drawIndexed,\n createMeshVao,\n bindMeshVao,\n drawMesh,\n disposeMeshVao,\n} from \"./mesh.js\";\nexport type { GLVertexBuffer, GLIndexBuffer, GLAttributeDescriptor, GLMeshVertexBuffer, GLMeshVao } from \"./mesh.js\";\n\n// ─── Blend modes ─────────────────────────────────────────────────────\n// GLBlendMode / GLBlendEquation are const + same-name type; one value\n// re-export carries both.\nexport { GLBlendMode, GLBlendEquation, setBlendMode, setBlendState, disableBlend } from \"./blend.js\";\nexport type { GLBlendState } from \"./blend.js\";\n\n// ─── Depth / stencil / color-mask / clear ────────────────────────────\nexport { setDepthState, setCullState, setStencilState, setStencilOpSeparate, setColorMask, clearEngine, generateRenderTargetStencil } from \"./depth-stencil.js\";\nexport type { GLDepthState, GLStencilState, GLStencilOpState, GLClearOptions } from \"./depth-stencil.js\";\n\n// ─── Scissor ─────────────────────────────────────────────────────────\nexport { setScissor, disableScissor } from \"./scissor.js\";\n\n// ─── Sprites ─────────────────────────────────────────────────────────\nexport { createSpriteRenderer, renderSprites, setSpriteRendererTexture, disposeSpriteRenderer } from \"./sprites.js\";\nexport type { GLSprite, GLSpriteColor, GLSpriteRendererOptions, GLSpriteRenderer } from \"./sprites.js\";\n\n// ─── HTML-element textures ───────────────────────────────────────────\nexport { createHtmlElementTexture, updateHtmlElementTexture } from \"./html-texture.js\";\n\n// ─── Text (analytic Slug coverage) ───────────────────────────────────\nexport type { GLFont } from \"./text/font.js\";\nexport { loadFont, createFontFromBuffer } from \"./text/font.js\";\nexport { extractGlyphCurves, cubicToQuadratics } from \"./text/glyph-extraction.js\";\nexport type { GLTextLayoutOptions } from \"./text/layout.js\";\nexport type { GLGlyphStorage, GLCurveSetId, GLQuadCurve, GLGlyphBounds, GLGlyphCurves } from \"./text/glyph-storage.js\";\nexport { createGlyphStorage, updateGlyphStorage, disposeGlyphStorage } from \"./text/glyph-storage.js\";\nexport type { GLTextData, GLPlacedGlyph, GLGlyphRun, GLTextDataUpdate } from \"./text/text-data.js\";\nexport { createTextData, updateTextData, disposeTextData } from \"./text/text-data.js\";\nexport type { GLDefaultTextData } from \"./text/default-text-data.js\";\nexport { createDefaultTextData, updateDefaultTextData, disposeDefaultTextData } from \"./text/default-text-data.js\";\nexport type { GLTextLayer, GLTextLayerOptions, GLTextRenderer, GLTextRendererOptions } from \"./text/text-renderer.js\";\nexport {\n createTextLayer,\n setTextLayerPosition,\n createTextRenderer,\n renderText,\n isTextRendererReady,\n addTextRendererLayer,\n removeTextRendererLayer,\n registerTextRenderer,\n unregisterTextRenderer,\n disposeTextRenderer,\n} from \"./text/text-renderer.js\";\nexport { setFontWeightOffset } from \"./text/set-font-weight-offset.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,gFAAgF;AAChF,EAAE;AACF,iFAAiF;AACjF,4EAA4E;AAC5E,2EAA2E;AAC3E,yEAAyE;AACzE,+DAA+D;AAC/D,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,wCAAwC;AASxC,wEAAwE;AACxE,OAAO,EACH,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,uEAAuE;AACvE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEvG,wEAAwE;AACxE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvF,uEAAuE;AACvE,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGlF,wEAAwE;AAC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ACpB,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC","sourcesContent":["// @babylonjs/lite-gl — Public API\n// Function-based, tree-shakeable WebGL2 micro-engine. Import only what you use.\n//\n// Convention (mirrors @babylonjs/lite): the public API is re-exported EXPLICITLY\n// by name — never `export *`. This keeps the public surface intentional and\n// reviewable, lets `export type` mark type-only re-exports (required under\n// `isolatedModules`), and keeps internal helpers (e.g. `bindTextureRaw`,\n// `bindTextureForUpload`) out of consumers' bundles + `.d.ts`.\n//\n// The package is `sideEffects: false` and no module has top-level side effects,\n// so a consumer that imports only the symbols it needs tree-shakes everything\n// else (sprites, html-texture, …) away.\n\n// ─── Backend-neutral contract ────────────────────────────────────────\n// The generic contract (`GLFamily`, `GLOps`, `GLKit`) is published at\n// `@babylonjs/lite-gl/family`; this entry adds the WebGL2 mapping and keeps the\n// shared descriptors importable alongside the operations that take them.\nexport type { GLEffectOptions, GLViewport, GLClearOptions } from \"./family.js\";\nexport type { WebGLFamily, WebGLHostOps } from \"./web-family.js\";\n\n// ─── Engine / context ────────────────────────────────────────────────\nexport {\n createGLEngine,\n createHostOwnedGLEngine,\n disposeGLEngine,\n resizeGLEngine,\n setGLEngineSize,\n wipeGLStateCache,\n getRenderWidth,\n getRenderHeight,\n getTextureCount,\n getCurrentRenderTarget,\n getHardwareScalingLevel,\n setHardwareScalingLevel,\n getRenderingCanvas,\n onContextLost,\n offContextLost,\n onContextRestored,\n offContextRestored,\n} from \"./context.js\";\nexport type { GLEngineOptions, GLEngineCaps, GLEngineContext } from \"./context.js\";\nexport { setFramebufferValidation } from \"./framebuffer-validation.js\";\n\n// ─── Alpha-to-coverage (optional) ───────────────────────────────────\nexport { getAlphaToCoverage, getCurrentSampleCount, setAlphaToCoverage } from \"./alpha-to-coverage.js\";\n\n// ─── Render loop ─────────────────────────────────────────────────────\nexport { runRenderLoop, stopRenderLoop, beginFrame, endFrame } from \"./render-loop.js\";\n\n// ─── GPU frame timing (optional) ────────────────────────────────────\nexport { captureGPUFrameTime, getGPUFrameTimeCounter } from \"./gpu-frame-time.js\";\nexport type { GLPerfCounter } from \"./gpu-frame-time.js\";\n\n// ─── Effects ─────────────────────────────────────────────────────────\nexport {\n createEffect,\n useEffect,\n isEffectReady,\n getEffectCompilationError,\n executeWhenCompiled,\n disposeEffect,\n setEffectFloat,\n setEffectFloat2,\n setEffectFloat3,\n setEffectFloat4,\n setEffectColor3,\n setEffectColor4,\n setEffectVector2,\n setEffectDirectColor4,\n setEffectInt,\n setEffectTexture,\n setEffectMatrix,\n setEffectMatrix3x3,\n setEffectFloatArray,\n setEffectFloatArray2,\n setEffectFloatArray3,\n setEffectFloatArray4,\n setEffectIntArray,\n} from \"./effect.js\";\nexport type { GLEffect } from \"./effect.js\";\nexport { waitForEffect } from \"./effect-ready.js\";\nexport type { GLEffectWaitOptions } from \"./effect-ready.js\";\n\n// ─── Effect renderer (fullscreen quad) ───────────────────────────────\nexport { createEffectWrapper, applyEffectWrapper, drawEffect, setViewport, disposeEffectWrapper } from \"./effect-renderer.js\";\nexport type { GLEffectWrapperOptions, GLEffectWrapper } from \"./effect-renderer.js\";\n\n// ─── Textures ────────────────────────────────────────────────────────\nexport {\n createRawTexture,\n createFloatTexture,\n generateTextureMipMaps,\n loadTexture2D,\n bindTexture,\n unbindTexture,\n disposeTexture,\n updateRawTexture,\n updateTextureSamplingMode,\n updateTextureSamplingPreset,\n updateTextureWrapMode,\n createTextureFromHandle,\n getSamplingModeFilters,\n isTextureReady,\n // GLSamplingMode is a const + same-name type; one value re-export carries both.\n GLSamplingMode,\n} from \"./texture.js\";\nexport type { GLTextureOptions, GLTextureUpdateOptions, GLRawTextureOptions, GLFloatTextureOptions, GLTexture, GLSamplingFilters } from \"./texture.js\";\nexport { createTextureFromSource } from \"./texture-source.js\";\nexport type { GLTextureSourceOptions } from \"./texture-source.js\";\nexport {\n createTexture3DFromPixels,\n bindTexture3D,\n unbindTexture3D,\n setEffectTexture3D,\n generateTexture3DMipMaps,\n updateTexture3DSamplingMode,\n updateTexture3DWrapMode,\n disposeTexture3D,\n} from \"./texture-3d.js\";\nexport type { GLPixelsTexture3DOptions, GLTexture3D } from \"./texture-3d.js\";\n\n// ─── Dynamic textures ────────────────────────────────────────────────\nexport { createDynamicTexture, updateDynamicTexture, clearDynamicTextureSource } from \"./dynamic-texture.js\";\n\n// ─── Render targets ──────────────────────────────────────────────────\nexport {\n createRenderTarget,\n createFloatRenderTarget,\n bindRenderTarget,\n restoreDefaultFramebuffer,\n presentRenderTarget,\n generateRenderTargetMipMaps,\n resizeRenderTarget,\n readRenderTargetPixels,\n readRenderTargetPixelsToBuffer,\n disposeRenderTarget,\n} from \"./render-target.js\";\nexport type {\n GLRenderTarget,\n GLRenderTargetOptions,\n GLFloatRenderTargetOptions,\n GLReadPixelsRegionOptions,\n GLReadPixelsOptions,\n GLReadPixelsToBufferOptions,\n} from \"./render-target.js\";\n\n// ─── Meshes / buffers / instancing ───────────────────────────────────\nexport {\n createVertexBuffer,\n updateVertexBuffer,\n createIndexBuffer,\n disposeBuffer,\n bindIndexBuffer,\n bindAttributes,\n bindAttributesCached,\n disableAttributeByIndex,\n unbindAllAttributes,\n unbindInstanceAttributes,\n drawIndexed,\n createMeshVao,\n bindMeshVao,\n drawMesh,\n disposeMeshVao,\n} from \"./mesh.js\";\nexport type { GLVertexBuffer, GLIndexBuffer, GLAttributeDescriptor, GLMeshVertexBuffer, GLMeshVao } from \"./mesh.js\";\n\n// ─── Blend modes ─────────────────────────────────────────────────────\n// GLBlendMode / GLBlendEquation are const + same-name type; one value\n// re-export carries both.\nexport { GLBlendMode, GLBlendEquation, setBlendMode, setBlendState, disableBlend } from \"./blend.js\";\nexport type { GLBlendState } from \"./blend.js\";\n\n// ─── Depth / stencil / color-mask / clear ────────────────────────────\nexport { setDepthState, setCullState, setStencilState, setStencilOpSeparate, setColorMask, clearEngine, generateRenderTargetStencil } from \"./depth-stencil.js\";\nexport type { GLDepthState, GLStencilState, GLStencilOpState } from \"./depth-stencil.js\";\n\n// ─── Scissor ─────────────────────────────────────────────────────────\nexport { setScissor, disableScissor } from \"./scissor.js\";\n\n// ─── Sprites ─────────────────────────────────────────────────────────\nexport { createSpriteRenderer, renderSprites, setSpriteRendererTexture, disposeSpriteRenderer } from \"./sprites.js\";\nexport type { GLSprite, GLSpriteColor, GLSpriteRendererOptions, GLSpriteRenderer } from \"./sprites.js\";\n\n// ─── HTML-element textures ───────────────────────────────────────────\nexport { createHtmlElementTexture, updateHtmlElementTexture } from \"./html-texture.js\";\n\n// ─── Text (analytic Slug coverage) ───────────────────────────────────\nexport type { GLFont } from \"./text/font.js\";\nexport { loadFont, createFontFromBuffer } from \"./text/font.js\";\nexport { extractGlyphCurves, cubicToQuadratics } from \"./text/glyph-extraction.js\";\nexport type { GLTextLayoutOptions } from \"./text/layout.js\";\nexport type { GLGlyphStorage, GLCurveSetId, GLQuadCurve, GLGlyphBounds, GLGlyphCurves } from \"./text/glyph-storage.js\";\nexport { createGlyphStorage, updateGlyphStorage, disposeGlyphStorage } from \"./text/glyph-storage.js\";\nexport type { GLTextData, GLPlacedGlyph, GLGlyphRun, GLTextDataUpdate } from \"./text/text-data.js\";\nexport { createTextData, updateTextData, disposeTextData } from \"./text/text-data.js\";\nexport type { GLDefaultTextData } from \"./text/default-text-data.js\";\nexport { createDefaultTextData, updateDefaultTextData, disposeDefaultTextData } from \"./text/default-text-data.js\";\nexport type { GLTextLayer, GLTextLayerOptions, GLTextRenderer, GLTextRendererOptions } from \"./text/text-renderer.js\";\nexport {\n createTextLayer,\n setTextLayerPosition,\n createTextRenderer,\n renderText,\n isTextRendererReady,\n addTextRendererLayer,\n removeTextRendererLayer,\n registerTextRenderer,\n unregisterTextRenderer,\n disposeTextRenderer,\n} from \"./text/text-renderer.js\";\nexport { setFontWeightOffset } from \"./text/set-font-weight-offset.js\";\n"]}
package/mesh.d.ts CHANGED
@@ -9,14 +9,14 @@
9
9
  * `createIndexBuffer` / `_releaseBuffer` / `bindIndexBuffer` /
10
10
  * `bindInstancesBuffer` / `unbindInstanceAttributes` / `drawElementsType`. The
11
11
  * attribute binder reproduces Babylon's instancing semantics EXACTLY, including
12
- * the `computeStride = false → stride 0` "sliding window" used by ShapeBuilder's
12
+ * the `computeStride = false → stride 0` "sliding window" used by distance-field
13
13
  * tape buffers (consecutive instances read overlapping vec4 windows) and the
14
14
  * `divisor === undefined → 1` default.
15
15
  *
16
16
  * The mesh path runs on the DEFAULT (null) VAO — every buffer/attribute op binds
17
17
  * `gl.bindVertexArray(null)` first, so it never corrupts the quad / sprite VAOs.
18
- * Vertex and index buffers retain their CPU data and re-upload automatically on
19
- * `webglcontextrestored`.
18
+ * Unless the engine is host-owned (`createHostOwnedGLEngine`), vertex/index buffers retain their CPU
19
+ * data and re-upload automatically on `webglcontextrestored`.
20
20
  */
21
21
  import type { GLEngineContext } from "./context.js";
22
22
  import { type GLEffect } from "./effect.js";
@@ -68,7 +68,7 @@ export interface GLAttributeDescriptor {
68
68
  * Create a GPU vertex buffer from interleaved float data.
69
69
  *
70
70
  * @param engine - The engine.
71
- * @param data - The vertex data. Retained by reference for context-restore — do
71
+ * @param data - The vertex data. Retained by reference unless the engine opts out of context restoration — do
72
72
  * not mutate it in place; use {@link updateVertexBuffer} to change contents.
73
73
  * @param dynamic - Hint that the buffer will be updated frequently
74
74
  * (`DYNAMIC_DRAW`). Default `false` (`STATIC_DRAW`).
@@ -78,7 +78,7 @@ export declare function createVertexBuffer(engine: GLEngineContext, data: Float3
78
78
  /**
79
79
  * Upload new contents into (part of) a vertex buffer via `bufferSubData`. A
80
80
  * full-buffer update from offset 0 also refreshes the retained CPU data used
81
- * for context-restore.
81
+ * for context-restore unless the engine opts out. Neither mode copies the input.
82
82
  *
83
83
  * @param vb - The vertex buffer to update.
84
84
  * @param data - The new float data.
@@ -91,12 +91,13 @@ export declare function updateVertexBuffer(vb: GLVertexBuffer, data: Float32Arra
91
91
  * VAO element bindings.
92
92
  *
93
93
  * @param engine - The engine.
94
- * @param data - The index data. Retained by reference for context-restore.
94
+ * @param data - The index data. Retained by reference unless the engine opts out of context restoration.
95
95
  * @returns The new {@link GLIndexBuffer}.
96
96
  */
97
97
  export declare function createIndexBuffer(engine: GLEngineContext, data: Uint16Array | Uint32Array): GLIndexBuffer;
98
98
  /** Dispose a vertex or index buffer (delete the GL buffer + unregister). Clears
99
- * the array/element-buffer cache slot if it pointed at this buffer. Idempotent. */
99
+ * the array/element-buffer cache slot if it pointed at this buffer and releases
100
+ * retained upload/restore references in both recovery modes. Idempotent. */
100
101
  export declare function disposeBuffer(buffer: GLVertexBuffer | GLIndexBuffer): void;
101
102
  /**
102
103
  * Bind an index buffer as the current element-array buffer (on the default
@@ -108,18 +109,22 @@ export declare function bindIndexBuffer(ib: GLIndexBuffer): void;
108
109
  /**
109
110
  * Configure vertex attributes from `vb`, reproducing Babylon's
110
111
  * `bindInstancesBuffer` exactly. For each descriptor: resolves the location
111
- * (explicit `index` or via the effect), enables the attribute array, issues
112
- * `vertexAttribPointer`, and sets the vertex divisor (`undefined → 1`). Each
113
- * instanced location (divisor ≠ 0) is tracked once so {@link unbindInstanceAttributes}
112
+ * (explicit `index` or via the effect), enables the attribute array (cached),
113
+ * issues `vertexAttribPointer`, and sets the vertex divisor (`undefined → 1`).
114
+ * Each instanced location (divisor ≠ 0) is tracked once so {@link unbindInstanceAttributes}
114
115
  * can reset its divisor afterwards; per-vertex locations already have divisor 0 and are
115
116
  * not tracked, so callers that never instance can rebind every frame without growth.
116
117
  *
117
118
  * `computeStride` controls the GL stride passed to `vertexAttribPointer`:
118
119
  * - `false` (default) → stride `0`: each attribute is independently tightly
119
120
  * packed. Combined with overlapping `offset`s this yields the "sliding window"
120
- * ShapeBuilder uses for distance-field tape buffers.
121
+ * used by distance-field tape buffers.
121
122
  * - `true` → stride = Σ(`size`·4 bytes): interleaved per-vertex/per-instance.
122
123
  *
124
+ * Every call re-issues `vertexAttribPointer`. Callers that rebind an equivalent
125
+ * layout every draw (e.g. a 2D shape renderer) should use {@link bindAttributesCached},
126
+ * which elides unchanged pointers; the two can be mixed freely.
127
+ *
123
128
  * Runs on the default (null) VAO — never corrupts the quad / sprite VAOs.
124
129
  * No-op on a lost/disposed context or before the effect is ready.
125
130
  *
@@ -129,11 +134,59 @@ export declare function bindIndexBuffer(ib: GLIndexBuffer): void;
129
134
  * @param computeStride - See above. Default `false`.
130
135
  */
131
136
  export declare function bindAttributes(vb: GLVertexBuffer, descriptors: readonly GLAttributeDescriptor[], effect: GLEffect, computeStride?: boolean): void;
137
+ /**
138
+ * {@link bindAttributes} with a default-VAO attribute cache: `vertexAttribPointer`
139
+ * is issued only when a location's (buffer handle, size, type, normalized,
140
+ * stride, offset) tuple changes, and `vertexAttribDivisor` only when its divisor
141
+ * changes, so rebinding an equivalent layout every draw (e.g. per-shape binds in a
142
+ * 2D shape renderer) issues no attribute calls. Divisors are tracked through
143
+ * `instanceLocations`, so {@link unbindInstanceAttributes} needs no cache code.
144
+ * Semantics, parameters and no-op conditions are
145
+ * otherwise identical to {@link bindAttributes}.
146
+ *
147
+ * The cache (4 numbers per `MAX_VERTEX_ATTRIBS` location) is allocated once on
148
+ * the first effective call; later binds allocate nothing. Disabling an
149
+ * attribute, {@link bindAttributes}, cache wipes/resets and context loss
150
+ * invalidate the affected tuples, and a recreated buffer handle never matches
151
+ * a stale one. Named VAOs keep independent state.
152
+ *
153
+ * @param vb - The buffer supplying the attribute data.
154
+ * @param descriptors - The attribute layout.
155
+ * @param effect - The effect whose attribute locations resolve unnamed indices.
156
+ * @param computeStride - See {@link bindAttributes}. Default `false`.
157
+ */
158
+ export declare function bindAttributesCached(vb: GLVertexBuffer, descriptors: readonly GLAttributeDescriptor[], effect: GLEffect, computeStride?: boolean): void;
159
+ /**
160
+ * Disable an enabled attribute on the default VAO, eliding redundant calls.
161
+ * Leaves its divisor unchanged, like ThinEngine's `disableAttributeByIndex`;
162
+ * use {@link unbindInstanceAttributes} for divisor cleanup. Named VAOs are
163
+ * untouched. No-op on a lost/disposed engine. The enable cache is cleared on
164
+ * context loss or cache reset, so subsequent binds replay their enables. After
165
+ * a plain `wipeGLStateCache`, a location lite-gl has not confirmed
166
+ * disabled is treated as unknown (the host may have enabled it) and is disabled.
167
+ *
168
+ * @param engine - The engine.
169
+ * @param location - The attribute location to disable.
170
+ */
171
+ export declare function disableAttributeByIndex(engine: GLEngineContext, location: number): void;
172
+ /**
173
+ * Disable all enabled default-VAO attributes in ascending location order.
174
+ * Cached across frames and allocation-free; named VAOs and instance divisors
175
+ * are unchanged (ThinEngine's `unbindAllAttributes` semantics). No-op on a
176
+ * lost/disposed engine. Context loss/cache reset clears the enable cache;
177
+ * subsequent {@link bindAttributes} calls replay their enables. The first call
178
+ * after a plain `wipeGLStateCache` disables every location up to
179
+ * `MAX_VERTEX_ATTRIBS` once, since the host may have enabled any of them.
180
+ *
181
+ * @param engine - The engine.
182
+ */
183
+ export declare function unbindAllAttributes(engine: GLEngineContext): void;
132
184
  /**
133
185
  * Reset the vertex divisor of every attribute touched by {@link bindAttributes}
134
- * back to 0 — the lite-gl equivalent of Babylon's `unbindInstanceAttributes`.
186
+ * or {@link bindAttributesCached} back to 0 — the lite-gl equivalent of Babylon's `unbindInstanceAttributes`.
135
187
  * Call after an instanced draw so a following non-instanced draw is not skewed.
136
- * No-op on a lost/disposed context.
188
+ * The divisors are reset on the default VAO (selected if a named VAO is bound),
189
+ * where these binders set them. No-op on a lost/disposed context.
137
190
  *
138
191
  * @param engine - The engine.
139
192
  */
@@ -164,7 +217,8 @@ export interface GLMeshVertexBuffer {
164
217
  /** A recorded Vertex Array Object capturing a static mesh's attribute layout +
165
218
  * index binding. Bind + draw it with {@link drawMesh} each frame — the GPU
166
219
  * replays the entire attribute setup from one `bindVertexArray`. Re-recorded
167
- * automatically on `webglcontextrestored`. */
220
+ * automatically on `webglcontextrestored` unless the engine is host-owned
221
+ * (`createHostOwnedGLEngine`). */
168
222
  export interface GLMeshVao {
169
223
  /** The live `WebGLVertexArrayObject`. Swapped on `webglcontextrestored`. */
170
224
  handle: WebGLVertexArrayObject;
@@ -198,8 +252,11 @@ export declare function bindMeshVao(vao: GLMeshVao): void;
198
252
  *
199
253
  * @param vao - The mesh VAO to draw.
200
254
  * @param instanceCount - Instance count for instanced draws. Default 0 (non-instanced).
255
+ * @param indexStart - First index in the retained mesh.
256
+ * @param indexCount - Number of indices; defaults to the indices from `indexStart` to the end of the mesh.
257
+ * @throws RangeError when the range is not whole indices within the mesh.
201
258
  */
202
- export declare function drawMesh(vao: GLMeshVao, instanceCount?: number): void;
259
+ export declare function drawMesh(vao: GLMeshVao, instanceCount?: number, indexStart?: number, indexCount?: number): void;
203
260
  /** Dispose a {@link GLMeshVao}: delete the VAO and unregister its restore hook.
204
261
  * Does NOT dispose the vertex/index buffers (the caller owns those). Idempotent. */
205
262
  export declare function disposeMeshVao(vao: GLMeshVao): void;