@luma.gl/engine 10.0.0-alpha.5 → 10.0.0-alpha.7
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.
- package/README.md +39 -2
- package/dist/arrow/arrow-geometry.cjs +350 -0
- package/dist/arrow/arrow-geometry.d.ts +44 -0
- package/dist/arrow/arrow-geometry.d.ts.map +1 -0
- package/dist/arrow/arrow-geometry.js +337 -0
- package/dist/arrow/arrow-geometry.js.map +1 -0
- package/dist/arrow/arrow-mesh-types.cjs +15 -0
- package/dist/arrow/arrow-mesh-types.d.ts +35 -0
- package/dist/arrow/arrow-mesh-types.d.ts.map +1 -0
- package/dist/arrow/arrow-mesh-types.js +5 -0
- package/dist/arrow/arrow-mesh-types.js.map +1 -0
- package/dist/arrow/arrow-picking.cjs +139 -0
- package/dist/arrow/arrow-picking.d.ts +66 -0
- package/dist/arrow/arrow-picking.d.ts.map +1 -0
- package/dist/arrow/arrow-picking.js +108 -0
- package/dist/arrow/arrow-picking.js.map +1 -0
- package/dist/arrow/index.cjs +222 -0
- package/dist/arrow/index.cjs.map +6 -0
- package/dist/arrow/index.d.ts +22 -0
- package/dist/arrow/index.d.ts.map +1 -0
- package/dist/arrow/index.js +24 -0
- package/dist/arrow/index.js.map +1 -0
- package/dist/arrow/renderers/arrow-renderer-utils.cjs +128 -0
- package/dist/arrow/renderers/arrow-renderer-utils.d.ts +72 -0
- package/dist/arrow/renderers/arrow-renderer-utils.d.ts.map +1 -0
- package/dist/arrow/renderers/arrow-renderer-utils.js +103 -0
- package/dist/arrow/renderers/arrow-renderer-utils.js.map +1 -0
- package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.cjs +839 -0
- package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.d.ts +92 -0
- package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.d.ts.map +1 -0
- package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.js +842 -0
- package/dist/arrow/renderers/path/conversion/arrow-path-gpu-vectors.js.map +1 -0
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.cjs +228 -0
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.d.ts +17 -0
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.d.ts.map +1 -0
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.js +219 -0
- package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.js.map +1 -0
- package/dist/arrow/renderers/path/renderers/arrow-path-renderer.cjs +98 -0
- package/dist/arrow/renderers/path/renderers/arrow-path-renderer.d.ts +48 -0
- package/dist/arrow/renderers/path/renderers/arrow-path-renderer.d.ts.map +1 -0
- package/dist/arrow/renderers/path/renderers/arrow-path-renderer.js +64 -0
- package/dist/arrow/renderers/path/renderers/arrow-path-renderer.js.map +1 -0
- package/dist/arrow/renderers/path/source/arrow-path-source-mapping.cjs +98 -0
- package/dist/arrow/renderers/path/source/arrow-path-source-mapping.d.ts +41 -0
- package/dist/arrow/renderers/path/source/arrow-path-source-mapping.d.ts.map +1 -0
- package/dist/arrow/renderers/path/source/arrow-path-source-mapping.js +80 -0
- package/dist/arrow/renderers/path/source/arrow-path-source-mapping.js.map +1 -0
- package/dist/arrow/renderers/path/transforms/close-arrow-paths.cjs +557 -0
- package/dist/arrow/renderers/path/transforms/close-arrow-paths.d.ts +34 -0
- package/dist/arrow/renderers/path/transforms/close-arrow-paths.d.ts.map +1 -0
- package/dist/arrow/renderers/path/transforms/close-arrow-paths.js +550 -0
- package/dist/arrow/renderers/path/transforms/close-arrow-paths.js.map +1 -0
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.cjs +254 -0
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.d.ts +20 -0
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.d.ts.map +1 -0
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.js +228 -0
- package/dist/arrow/renderers/path/transforms/gpu-path-float64-deltas.js.map +1 -0
- package/dist/arrow/renderers/path/transforms/path-view-origins.cjs +74 -0
- package/dist/arrow/renderers/path/transforms/path-view-origins.d.ts +16 -0
- package/dist/arrow/renderers/path/transforms/path-view-origins.d.ts.map +1 -0
- package/dist/arrow/renderers/path/transforms/path-view-origins.js +64 -0
- package/dist/arrow/renderers/path/transforms/path-view-origins.js.map +1 -0
- package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.cjs +182 -0
- package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.d.ts +36 -0
- package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.d.ts.map +1 -0
- package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.js +159 -0
- package/dist/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.js.map +1 -0
- package/dist/arrow/renderers/polygon/renderers/arrow-polygon-renderer.cjs +379 -0
- package/dist/arrow/renderers/polygon/renderers/arrow-polygon-renderer.d.ts +128 -0
- package/dist/arrow/renderers/polygon/renderers/arrow-polygon-renderer.d.ts.map +1 -0
- package/dist/arrow/renderers/polygon/renderers/arrow-polygon-renderer.js +354 -0
- package/dist/arrow/renderers/polygon/renderers/arrow-polygon-renderer.js.map +1 -0
- package/dist/arrow/renderers/polygon/source/arrow-polygon-source-mapping.cjs +74 -0
- package/dist/arrow/renderers/polygon/source/arrow-polygon-source-mapping.d.ts +25 -0
- package/dist/arrow/renderers/polygon/source/arrow-polygon-source-mapping.d.ts.map +1 -0
- package/dist/arrow/renderers/polygon/source/arrow-polygon-source-mapping.js +53 -0
- package/dist/arrow/renderers/polygon/source/arrow-polygon-source-mapping.js.map +1 -0
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.cjs +275 -0
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.d.ts +67 -0
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.d.ts.map +1 -0
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.js +304 -0
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.js.map +1 -0
- package/dist/arrow/renderers/text/conversion/arrow-text.cjs +579 -0
- package/dist/arrow/renderers/text/conversion/arrow-text.d.ts +124 -0
- package/dist/arrow/renderers/text/conversion/arrow-text.d.ts.map +1 -0
- package/dist/arrow/renderers/text/conversion/arrow-text.js +596 -0
- package/dist/arrow/renderers/text/conversion/arrow-text.js.map +1 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.cjs +119 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.d.ts +96 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.d.ts.map +1 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.js +129 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.js.map +1 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-dictionary.cjs +47 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-dictionary.d.ts +27 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-dictionary.d.ts.map +1 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-dictionary.js +39 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-dictionary.js.map +1 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-storage.cjs +63 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-storage.d.ts +28 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-storage.d.ts.map +1 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-storage.js +61 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-to-storage.js.map +1 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.cjs +2133 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.d.ts +295 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.d.ts.map +1 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.js +2228 -0
- package/dist/arrow/renderers/text/conversion/convert-arrow-text-vectors.js.map +1 -0
- package/dist/arrow/renderers/text/conversion/index.cjs +102 -0
- package/dist/arrow/renderers/text/conversion/index.d.ts +7 -0
- package/dist/arrow/renderers/text/conversion/index.d.ts.map +1 -0
- package/dist/arrow/renderers/text/conversion/index.js +10 -0
- package/dist/arrow/renderers/text/conversion/index.js.map +1 -0
- package/dist/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.cjs +205 -0
- package/dist/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.d.ts +37 -0
- package/dist/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.d.ts.map +1 -0
- package/dist/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.js +196 -0
- package/dist/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.js.map +1 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-picking.cjs +149 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-picking.d.ts +14 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-picking.d.ts.map +1 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-picking.js +117 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-picking.js.map +1 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.cjs +987 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.d.ts +196 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.d.ts.map +1 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.js +1042 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.js.map +1 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-shaders.cjs +996 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-shaders.d.ts +129 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-shaders.d.ts.map +1 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-shaders.js +944 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-shaders.js.map +1 -0
- package/dist/arrow/renderers/text/source/arrow-text-source-mapping.cjs +92 -0
- package/dist/arrow/renderers/text/source/arrow-text-source-mapping.d.ts +55 -0
- package/dist/arrow/renderers/text/source/arrow-text-source-mapping.d.ts.map +1 -0
- package/dist/arrow/renderers/text/source/arrow-text-source-mapping.js +72 -0
- package/dist/arrow/renderers/text/source/arrow-text-source-mapping.js.map +1 -0
- package/dist/arrow/renderers/text/source/index.cjs +27 -0
- package/dist/arrow/renderers/text/source/index.d.ts +2 -0
- package/dist/arrow/renderers/text/source/index.d.ts.map +1 -0
- package/dist/arrow/renderers/text/source/index.js +5 -0
- package/dist/arrow/renderers/text/source/index.js.map +1 -0
- package/dist/compute/buffer-transform.cjs +2 -2
- package/dist/compute/buffer-transform.js +1 -1
- package/dist/compute/buffer-transform.js.map +1 -1
- package/dist/compute/computation.cjs +13 -8
- package/dist/compute/computation.d.ts +5 -5
- package/dist/compute/computation.d.ts.map +1 -1
- package/dist/compute/computation.js +13 -6
- package/dist/compute/computation.js.map +1 -1
- package/dist/compute/texture-transform.cjs +2 -2
- package/dist/compute/texture-transform.d.ts +2 -2
- package/dist/compute/texture-transform.d.ts.map +1 -1
- package/dist/compute/texture-transform.js +1 -1
- package/dist/compute/texture-transform.js.map +1 -1
- package/dist/dist.dev.js +36501 -146
- package/dist/dist.min.js +148 -32
- package/dist/effects/index.cjs +211 -0
- package/dist/effects/index.cjs.map +6 -0
- package/dist/effects/index.d.ts +78 -0
- package/dist/effects/index.d.ts.map +1 -0
- package/dist/effects/index.js +47 -0
- package/dist/effects/index.js.map +1 -0
- package/dist/effects/passes/postprocessing/fxaa/fxaa.cjs +935 -0
- package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts +16 -0
- package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/fxaa/fxaa.js +972 -0
- package/dist/effects/passes/postprocessing/fxaa/fxaa.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.cjs +87 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +43 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +67 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.cjs +106 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.d.ts +43 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.js +86 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.cjs +112 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +46 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.js +95 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.cjs +81 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.d.ts +33 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.js +59 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/persistence.cjs +69 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/persistence.d.ts +19 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/persistence.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/persistence.js +49 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/persistence.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.cjs +91 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.d.ts +30 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.js +70 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.cjs +96 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.d.ts +44 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.js +71 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.cjs +80 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.d.ts +30 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.js +55 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.cjs +80 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.d.ts +45 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.js +58 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.cjs +1055 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts +1313 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.js +1009 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.cjs +163 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts +15 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.js +142 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.cjs +578 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.d.ts +112 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.js +549 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom.cjs +131 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom.d.ts +49 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom.js +109 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/gaussianblur.cjs +199 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/gaussianblur.d.ts +49 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/gaussianblur.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/gaussianblur.js +177 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/gaussianblur.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/tiltshift.cjs +152 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/tiltshift.d.ts +81 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/tiltshift.js +162 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/tiltshift.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/triangleblur.cjs +132 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/triangleblur.d.ts +58 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/triangleblur.js +112 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/triangleblur.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/zoomblur.cjs +114 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/zoomblur.d.ts +44 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/zoomblur.js +90 -0
- package/dist/effects/passes/postprocessing/image-blur-filters/zoomblur.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/colorhalftone.cjs +124 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +53 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/colorhalftone.js +105 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/colorhalftone.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/dotscreen.cjs +98 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/dotscreen.d.ts +51 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/dotscreen.js +77 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/dotscreen.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/edgework.cjs +227 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/edgework.d.ts +56 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/edgework.js +206 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/edgework.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/hexagonalpixelate.cjs +148 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +44 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/hexagonalpixelate.js +127 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/hexagonalpixelate.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/ink.cjs +113 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/ink.d.ts +41 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/ink.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/ink.js +93 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/ink.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/magnify.cjs +107 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/magnify.d.ts +46 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/magnify.js +84 -0
- package/dist/effects/passes/postprocessing/image-fun-filters/magnify.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/bulgepinch.cjs +123 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +51 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/bulgepinch.js +101 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/bulgepinch.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/swirl.cjs +118 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/swirl.d.ts +52 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/swirl.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/swirl.js +95 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/swirl.js.map +1 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/warp.cjs +63 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/warp.d.ts +9 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/warp.d.ts.map +1 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/warp.js +37 -0
- package/dist/effects/passes/postprocessing/image-warp-filters/warp.js.map +1 -0
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.cjs +214 -0
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts +109 -0
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.js +197 -0
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.js.map +1 -0
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.cjs +716 -0
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts +366 -0
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js +683 -0
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js.map +1 -0
- package/dist/effects/passes/screen-space/copy-pass.cjs +36 -0
- package/dist/effects/passes/screen-space/copy-pass.d.ts +8 -0
- package/dist/effects/passes/screen-space/copy-pass.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/copy-pass.js +12 -0
- package/dist/effects/passes/screen-space/copy-pass.js.map +1 -0
- package/dist/effects/passes/screen-space/depth-aware-blur.cjs +109 -0
- package/dist/effects/passes/screen-space/depth-aware-blur.d.ts +156 -0
- package/dist/effects/passes/screen-space/depth-aware-blur.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/depth-aware-blur.js +83 -0
- package/dist/effects/passes/screen-space/depth-aware-blur.js.map +1 -0
- package/dist/effects/passes/screen-space/dof.cjs +250 -0
- package/dist/effects/passes/screen-space/dof.d.ts +271 -0
- package/dist/effects/passes/screen-space/dof.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/dof.js +239 -0
- package/dist/effects/passes/screen-space/dof.js.map +1 -0
- package/dist/effects/passes/screen-space/gtao.cjs +543 -0
- package/dist/effects/passes/screen-space/gtao.d.ts +222 -0
- package/dist/effects/passes/screen-space/gtao.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/gtao.js +507 -0
- package/dist/effects/passes/screen-space/gtao.js.map +1 -0
- package/dist/effects/passes/screen-space/hdr-auto-exposure.cjs +318 -0
- package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts +149 -0
- package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/hdr-auto-exposure.js +285 -0
- package/dist/effects/passes/screen-space/hdr-auto-exposure.js.map +1 -0
- package/dist/effects/passes/screen-space/height-fog.cjs +144 -0
- package/dist/effects/passes/screen-space/height-fog.d.ts +80 -0
- package/dist/effects/passes/screen-space/height-fog.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/height-fog.js +117 -0
- package/dist/effects/passes/screen-space/height-fog.js.map +1 -0
- package/dist/effects/passes/screen-space/motion-blur.cjs +80 -0
- package/dist/effects/passes/screen-space/motion-blur.d.ts +45 -0
- package/dist/effects/passes/screen-space/motion-blur.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/motion-blur.js +54 -0
- package/dist/effects/passes/screen-space/motion-blur.js.map +1 -0
- package/dist/effects/passes/screen-space/outlines.cjs +106 -0
- package/dist/effects/passes/screen-space/outlines.d.ts +62 -0
- package/dist/effects/passes/screen-space/outlines.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/outlines.js +80 -0
- package/dist/effects/passes/screen-space/outlines.js.map +1 -0
- package/dist/effects/passes/screen-space/screen-space-global-illumination.cjs +549 -0
- package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts +243 -0
- package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/screen-space-global-illumination.js +513 -0
- package/dist/effects/passes/screen-space/screen-space-global-illumination.js.map +1 -0
- package/dist/effects/passes/screen-space/screen-space-reflections.cjs +678 -0
- package/dist/effects/passes/screen-space/screen-space-reflections.d.ts +304 -0
- package/dist/effects/passes/screen-space/screen-space-reflections.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/screen-space-reflections.js +646 -0
- package/dist/effects/passes/screen-space/screen-space-reflections.js.map +1 -0
- package/dist/effects/passes/screen-space/screen-space-shader-helpers.cjs +111 -0
- package/dist/effects/passes/screen-space/screen-space-shader-helpers.d.ts +5 -0
- package/dist/effects/passes/screen-space/screen-space-shader-helpers.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/screen-space-shader-helpers.js +84 -0
- package/dist/effects/passes/screen-space/screen-space-shader-helpers.js.map +1 -0
- package/dist/effects/passes/screen-space/selection-outline.cjs +86 -0
- package/dist/effects/passes/screen-space/selection-outline.d.ts +30 -0
- package/dist/effects/passes/screen-space/selection-outline.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/selection-outline.js +59 -0
- package/dist/effects/passes/screen-space/selection-outline.js.map +1 -0
- package/dist/effects/passes/screen-space/ssao.cjs +172 -0
- package/dist/effects/passes/screen-space/ssao.d.ts +98 -0
- package/dist/effects/passes/screen-space/ssao.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/ssao.js +142 -0
- package/dist/effects/passes/screen-space/ssao.js.map +1 -0
- package/dist/effects/passes/screen-space/ssr-camera-temporal.cjs +173 -0
- package/dist/effects/passes/screen-space/ssr-camera-temporal.d.ts +112 -0
- package/dist/effects/passes/screen-space/ssr-camera-temporal.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/ssr-camera-temporal.js +141 -0
- package/dist/effects/passes/screen-space/ssr-camera-temporal.js.map +1 -0
- package/dist/effects/passes/screen-space/temporal-antialiasing.cjs +137 -0
- package/dist/effects/passes/screen-space/temporal-antialiasing.d.ts +68 -0
- package/dist/effects/passes/screen-space/temporal-antialiasing.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/temporal-antialiasing.js +107 -0
- package/dist/effects/passes/screen-space/temporal-antialiasing.js.map +1 -0
- package/dist/effects/passes/screen-space/volumetric-fog.cjs +109 -0
- package/dist/effects/passes/screen-space/volumetric-fog.d.ts +68 -0
- package/dist/effects/passes/screen-space/volumetric-fog.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/volumetric-fog.js +83 -0
- package/dist/effects/passes/screen-space/volumetric-fog.js.map +1 -0
- package/dist/experimental/materials/emissive-material.cjs +1 -1
- package/dist/experimental/materials/emissive-material.d.ts +2 -2
- package/dist/experimental/materials/emissive-material.d.ts.map +1 -1
- package/dist/experimental/materials/emissive-material.js +1 -1
- package/dist/experimental/materials/emissive-material.js.map +1 -1
- package/dist/experimental/materials/glass-material.cjs +1 -1
- package/dist/experimental/materials/glass-material.d.ts +2 -2
- package/dist/experimental/materials/glass-material.d.ts.map +1 -1
- package/dist/experimental/materials/glass-material.js +1 -1
- package/dist/experimental/materials/glass-material.js.map +1 -1
- package/dist/experimental/materials/glass-transmission.cjs +1 -1
- package/dist/experimental/materials/glass-transmission.d.ts +2 -2
- package/dist/experimental/materials/glass-transmission.d.ts.map +1 -1
- package/dist/experimental/materials/glass-transmission.js +1 -1
- package/dist/experimental/materials/glass-transmission.js.map +1 -1
- package/dist/experimental/materials/index.cjs.map +1 -1
- package/dist/experimental/materials/optical-caustics.cjs +1 -1
- package/dist/experimental/materials/optical-caustics.d.ts +2 -2
- package/dist/experimental/materials/optical-caustics.d.ts.map +1 -1
- package/dist/experimental/materials/optical-caustics.js +1 -1
- package/dist/experimental/materials/optical-caustics.js.map +1 -1
- package/dist/experimental/materials/optical-point-lights.cjs +1 -1
- package/dist/experimental/materials/optical-point-lights.d.ts +2 -2
- package/dist/experimental/materials/optical-point-lights.d.ts.map +1 -1
- package/dist/experimental/materials/optical-point-lights.js +1 -1
- package/dist/experimental/materials/optical-point-lights.js.map +1 -1
- package/dist/experimental/materials/reflective-material.cjs +1 -1
- package/dist/experimental/materials/reflective-material.d.ts +2 -2
- package/dist/experimental/materials/reflective-material.d.ts.map +1 -1
- package/dist/experimental/materials/reflective-material.js +1 -1
- package/dist/experimental/materials/reflective-material.js.map +1 -1
- package/dist/geometry/gpu-geometry.cjs +1 -1
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +1 -1
- package/dist/geometry/gpu-geometry.js.map +1 -1
- package/dist/gltf/gltf/animations/animations.cjs +15 -0
- package/dist/gltf/gltf/animations/animations.d.ts +97 -0
- package/dist/gltf/gltf/animations/animations.d.ts.map +1 -0
- package/dist/gltf/gltf/animations/animations.js +5 -0
- package/dist/gltf/gltf/animations/animations.js.map +1 -0
- package/dist/gltf/gltf/create-gltf-model.cjs +792 -0
- package/dist/gltf/gltf/create-gltf-model.d.ts +65 -0
- package/dist/gltf/gltf/create-gltf-model.d.ts.map +1 -0
- package/dist/gltf/gltf/create-gltf-model.js +785 -0
- package/dist/gltf/gltf/create-gltf-model.js.map +1 -0
- package/dist/gltf/gltf/create-scenegraph-from-gltf.cjs +207 -0
- package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts +66 -0
- package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts.map +1 -0
- package/dist/gltf/gltf/create-scenegraph-from-gltf.js +186 -0
- package/dist/gltf/gltf/create-scenegraph-from-gltf.js.map +1 -0
- package/dist/gltf/gltf/gltf-animated-crowd.cjs +966 -0
- package/dist/gltf/gltf/gltf-animated-crowd.d.ts +253 -0
- package/dist/gltf/gltf/gltf-animated-crowd.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-animated-crowd.js +1002 -0
- package/dist/gltf/gltf/gltf-animated-crowd.js.map +1 -0
- package/dist/gltf/gltf/gltf-animator.cjs +159 -0
- package/dist/gltf/gltf/gltf-animator.d.ts +69 -0
- package/dist/gltf/gltf/gltf-animator.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-animator.js +141 -0
- package/dist/gltf/gltf/gltf-animator.js.map +1 -0
- package/dist/gltf/gltf/gltf-area-lights.cjs +57 -0
- package/dist/gltf/gltf/gltf-area-lights.d.ts +10 -0
- package/dist/gltf/gltf/gltf-area-lights.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-area-lights.js +35 -0
- package/dist/gltf/gltf/gltf-area-lights.js.map +1 -0
- package/dist/gltf/gltf/gltf-audio.cjs +90 -0
- package/dist/gltf/gltf/gltf-audio.d.ts +87 -0
- package/dist/gltf/gltf/gltf-audio.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-audio.js +68 -0
- package/dist/gltf/gltf/gltf-audio.js.map +1 -0
- package/dist/gltf/gltf/gltf-billboard.cjs +46 -0
- package/dist/gltf/gltf/gltf-billboard.d.ts +14 -0
- package/dist/gltf/gltf/gltf-billboard.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-billboard.js +29 -0
- package/dist/gltf/gltf/gltf-billboard.js.map +1 -0
- package/dist/gltf/gltf/gltf-extension-support.cjs +380 -0
- package/dist/gltf/gltf/gltf-extension-support.d.ts +33 -0
- package/dist/gltf/gltf/gltf-extension-support.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-extension-support.js +360 -0
- package/dist/gltf/gltf/gltf-extension-support.js.map +1 -0
- package/dist/gltf/gltf/gltf-gpu-animation.cjs +66 -0
- package/dist/gltf/gltf/gltf-gpu-animation.d.ts +28 -0
- package/dist/gltf/gltf/gltf-gpu-animation.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-gpu-animation.js +42 -0
- package/dist/gltf/gltf/gltf-gpu-animation.js.map +1 -0
- package/dist/gltf/gltf/gltf-instancing.cjs +106 -0
- package/dist/gltf/gltf/gltf-instancing.d.ts +23 -0
- package/dist/gltf/gltf/gltf-instancing.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-instancing.js +89 -0
- package/dist/gltf/gltf/gltf-instancing.js.map +1 -0
- package/dist/gltf/gltf/gltf-lightmap.cjs +100 -0
- package/dist/gltf/gltf/gltf-lightmap.d.ts +44 -0
- package/dist/gltf/gltf/gltf-lightmap.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-lightmap.js +79 -0
- package/dist/gltf/gltf/gltf-lightmap.js.map +1 -0
- package/dist/gltf/gltf/gltf-lod.cjs +271 -0
- package/dist/gltf/gltf/gltf-lod.d.ts +36 -0
- package/dist/gltf/gltf/gltf-lod.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-lod.js +269 -0
- package/dist/gltf/gltf/gltf-lod.js.map +1 -0
- package/dist/gltf/gltf/gltf-material-variants.cjs +49 -0
- package/dist/gltf/gltf/gltf-material-variants.d.ts +5 -0
- package/dist/gltf/gltf/gltf-material-variants.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-material-variants.js +27 -0
- package/dist/gltf/gltf/gltf-material-variants.js.map +1 -0
- package/dist/gltf/gltf/gltf-materials-scatter.cjs +53 -0
- package/dist/gltf/gltf/gltf-materials-scatter.d.ts +15 -0
- package/dist/gltf/gltf/gltf-materials-scatter.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-materials-scatter.js +34 -0
- package/dist/gltf/gltf/gltf-materials-scatter.js.map +1 -0
- package/dist/gltf/gltf/gltf-skin.cjs +115 -0
- package/dist/gltf/gltf/gltf-skin.d.ts +19 -0
- package/dist/gltf/gltf/gltf-skin.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-skin.js +92 -0
- package/dist/gltf/gltf/gltf-skin.js.map +1 -0
- package/dist/gltf/gltf/morph-targets.cjs +27 -0
- package/dist/gltf/gltf/morph-targets.d.ts +3 -0
- package/dist/gltf/gltf/morph-targets.d.ts.map +1 -0
- package/dist/gltf/gltf/morph-targets.js +5 -0
- package/dist/gltf/gltf/morph-targets.js.map +1 -0
- package/dist/gltf/index.cjs +112 -0
- package/dist/gltf/index.cjs.map +6 -0
- package/dist/gltf/index.d.ts +28 -0
- package/dist/gltf/index.d.ts.map +1 -0
- package/dist/gltf/index.js +27 -0
- package/dist/gltf/index.js.map +1 -0
- package/dist/gltf/parsers/gltf-accessor-utils.cjs +79 -0
- package/dist/gltf/parsers/gltf-accessor-utils.d.ts +13 -0
- package/dist/gltf/parsers/gltf-accessor-utils.d.ts.map +1 -0
- package/dist/gltf/parsers/gltf-accessor-utils.js +60 -0
- package/dist/gltf/parsers/gltf-accessor-utils.js.map +1 -0
- package/dist/gltf/parsers/parse-gltf-animations.cjs +479 -0
- package/dist/gltf/parsers/parse-gltf-animations.d.ts +5 -0
- package/dist/gltf/parsers/parse-gltf-animations.d.ts.map +1 -0
- package/dist/gltf/parsers/parse-gltf-animations.js +558 -0
- package/dist/gltf/parsers/parse-gltf-animations.js.map +1 -0
- package/dist/gltf/parsers/parse-gltf-joints.cjs +146 -0
- package/dist/gltf/parsers/parse-gltf-joints.d.ts +20 -0
- package/dist/gltf/parsers/parse-gltf-joints.d.ts.map +1 -0
- package/dist/gltf/parsers/parse-gltf-joints.js +129 -0
- package/dist/gltf/parsers/parse-gltf-joints.js.map +1 -0
- package/dist/gltf/parsers/parse-gltf-lights.cjs +171 -0
- package/dist/gltf/parsers/parse-gltf-lights.d.ts +17 -0
- package/dist/gltf/parsers/parse-gltf-lights.d.ts.map +1 -0
- package/dist/gltf/parsers/parse-gltf-lights.js +187 -0
- package/dist/gltf/parsers/parse-gltf-lights.js.map +1 -0
- package/dist/gltf/parsers/parse-gltf-physics-pointer.cjs +35 -0
- package/dist/gltf/parsers/parse-gltf-physics-pointer.d.ts +3 -0
- package/dist/gltf/parsers/parse-gltf-physics-pointer.d.ts.map +1 -0
- package/dist/gltf/parsers/parse-gltf-physics-pointer.js +21 -0
- package/dist/gltf/parsers/parse-gltf-physics-pointer.js.map +1 -0
- package/dist/gltf/parsers/parse-gltf.cjs +405 -0
- package/dist/gltf/parsers/parse-gltf.d.ts +45 -0
- package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -0
- package/dist/gltf/parsers/parse-gltf.js +405 -0
- package/dist/gltf/parsers/parse-gltf.js.map +1 -0
- package/dist/gltf/parsers/parse-pbr-material.cjs +821 -0
- package/dist/gltf/parsers/parse-pbr-material.d.ts +179 -0
- package/dist/gltf/parsers/parse-pbr-material.d.ts.map +1 -0
- package/dist/gltf/parsers/parse-pbr-material.js +1045 -0
- package/dist/gltf/parsers/parse-pbr-material.js.map +1 -0
- package/dist/gltf/parsers/post-process-gltf.cjs +560 -0
- package/dist/gltf/parsers/post-process-gltf.d.ts +8 -0
- package/dist/gltf/parsers/post-process-gltf.d.ts.map +1 -0
- package/dist/gltf/parsers/post-process-gltf.js +581 -0
- package/dist/gltf/parsers/post-process-gltf.js.map +1 -0
- package/dist/gltf/pbr/pbr-environment.cjs +96 -0
- package/dist/gltf/pbr/pbr-environment.d.ts +25 -0
- package/dist/gltf/pbr/pbr-environment.d.ts.map +1 -0
- package/dist/gltf/pbr/pbr-environment.js +75 -0
- package/dist/gltf/pbr/pbr-environment.js.map +1 -0
- package/dist/gltf/pbr/pbr-material.cjs +15 -0
- package/dist/gltf/pbr/pbr-material.d.ts +23 -0
- package/dist/gltf/pbr/pbr-material.d.ts.map +1 -0
- package/dist/gltf/pbr/pbr-material.js +5 -0
- package/dist/gltf/pbr/pbr-material.js.map +1 -0
- package/dist/gltf/pbr/texture-transform.cjs +130 -0
- package/dist/gltf/pbr/texture-transform.d.ts +21 -0
- package/dist/gltf/pbr/texture-transform.d.ts.map +1 -0
- package/dist/gltf/pbr/texture-transform.js +109 -0
- package/dist/gltf/pbr/texture-transform.js.map +1 -0
- package/dist/gltf/physics/export-state.cjs +194 -0
- package/dist/gltf/physics/export-state.d.ts +9 -0
- package/dist/gltf/physics/export-state.d.ts.map +1 -0
- package/dist/gltf/physics/export-state.js +203 -0
- package/dist/gltf/physics/export-state.js.map +1 -0
- package/dist/gltf/physics/index.cjs +103 -0
- package/dist/gltf/physics/index.cjs.map +6 -0
- package/dist/gltf/physics/index.d.ts +17 -0
- package/dist/gltf/physics/index.d.ts.map +1 -0
- package/dist/gltf/physics/index.js +68 -0
- package/dist/gltf/physics/index.js.map +1 -0
- package/dist/gltf/physics/mesh-box-shape.cjs +66 -0
- package/dist/gltf/physics/mesh-box-shape.d.ts +6 -0
- package/dist/gltf/physics/mesh-box-shape.d.ts.map +1 -0
- package/dist/gltf/physics/mesh-box-shape.js +46 -0
- package/dist/gltf/physics/mesh-box-shape.js.map +1 -0
- package/dist/gltf/physics/mesh-snapshot.cjs +192 -0
- package/dist/gltf/physics/mesh-snapshot.d.ts +19 -0
- package/dist/gltf/physics/mesh-snapshot.d.ts.map +1 -0
- package/dist/gltf/physics/mesh-snapshot.js +190 -0
- package/dist/gltf/physics/mesh-snapshot.js.map +1 -0
- package/dist/gltf/physics/node-collision-geometry.cjs +101 -0
- package/dist/gltf/physics/node-collision-geometry.d.ts +9 -0
- package/dist/gltf/physics/node-collision-geometry.d.ts.map +1 -0
- package/dist/gltf/physics/node-collision-geometry.js +85 -0
- package/dist/gltf/physics/node-collision-geometry.js.map +1 -0
- package/dist/gltf/physics/parse-gltf-physics.cjs +700 -0
- package/dist/gltf/physics/parse-gltf-physics.d.ts +8 -0
- package/dist/gltf/physics/parse-gltf-physics.d.ts.map +1 -0
- package/dist/gltf/physics/parse-gltf-physics.js +780 -0
- package/dist/gltf/physics/parse-gltf-physics.js.map +1 -0
- package/dist/gltf/physics/parse-physics-joints.cjs +71 -0
- package/dist/gltf/physics/parse-physics-joints.d.ts +5 -0
- package/dist/gltf/physics/parse-physics-joints.d.ts.map +1 -0
- package/dist/gltf/physics/parse-physics-joints.js +56 -0
- package/dist/gltf/physics/parse-physics-joints.js.map +1 -0
- package/dist/gltf/physics/physics-transforms.cjs +33 -0
- package/dist/gltf/physics/physics-transforms.d.ts +3 -0
- package/dist/gltf/physics/physics-transforms.d.ts.map +1 -0
- package/dist/gltf/physics/physics-transforms.js +5 -0
- package/dist/gltf/physics/physics-transforms.js.map +1 -0
- package/dist/gltf/physics/physics-types.cjs +15 -0
- package/dist/gltf/physics/physics-types.d.ts +126 -0
- package/dist/gltf/physics/physics-types.d.ts.map +1 -0
- package/dist/gltf/physics/physics-types.js +5 -0
- package/dist/gltf/physics/physics-types.js.map +1 -0
- package/dist/gltf/physics/property-bindings.cjs +137 -0
- package/dist/gltf/physics/property-bindings.d.ts +6 -0
- package/dist/gltf/physics/property-bindings.d.ts.map +1 -0
- package/dist/gltf/physics/property-bindings.js +149 -0
- package/dist/gltf/physics/property-bindings.js.map +1 -0
- package/dist/gltf/physics/scene-bindings.cjs +59 -0
- package/dist/gltf/physics/scene-bindings.d.ts +10 -0
- package/dist/gltf/physics/scene-bindings.d.ts.map +1 -0
- package/dist/gltf/physics/scene-bindings.js +38 -0
- package/dist/gltf/physics/scene-bindings.js.map +1 -0
- package/dist/gltf/physics/snapshot-scene.cjs +43 -0
- package/dist/gltf/physics/snapshot-scene.d.ts +8 -0
- package/dist/gltf/physics/snapshot-scene.d.ts.map +1 -0
- package/dist/gltf/physics/snapshot-scene.js +22 -0
- package/dist/gltf/physics/snapshot-scene.js.map +1 -0
- package/dist/gltf/types/gltf-json-schema.cjs +15 -0
- package/dist/gltf/types/gltf-json-schema.d.ts +830 -0
- package/dist/gltf/types/gltf-json-schema.d.ts.map +1 -0
- package/dist/gltf/types/gltf-json-schema.js +4 -0
- package/dist/gltf/types/gltf-json-schema.js.map +1 -0
- package/dist/gltf/types/gltf-postprocessed-schema.cjs +15 -0
- package/dist/gltf/types/gltf-postprocessed-schema.d.ts +657 -0
- package/dist/gltf/types/gltf-postprocessed-schema.d.ts.map +1 -0
- package/dist/gltf/types/gltf-postprocessed-schema.js +4 -0
- package/dist/gltf/types/gltf-postprocessed-schema.js.map +1 -0
- package/dist/gltf/types/gltf-shape-schema.cjs +15 -0
- package/dist/gltf/types/gltf-shape-schema.d.ts +49 -0
- package/dist/gltf/types/gltf-shape-schema.d.ts.map +1 -0
- package/dist/gltf/types/gltf-shape-schema.js +6 -0
- package/dist/gltf/types/gltf-shape-schema.js.map +1 -0
- package/dist/gltf/types/gltf-types.cjs +15 -0
- package/dist/gltf/types/gltf-types.d.ts +79 -0
- package/dist/gltf/types/gltf-types.d.ts.map +1 -0
- package/dist/gltf/types/gltf-types.js +5 -0
- package/dist/gltf/types/gltf-types.js.map +1 -0
- package/dist/gltf/webgl-to-webgpu/convert-webgl-sampler.cjs +131 -0
- package/dist/gltf/webgl-to-webgpu/convert-webgl-sampler.d.ts +20 -0
- package/dist/gltf/webgl-to-webgpu/convert-webgl-sampler.d.ts.map +1 -0
- package/dist/gltf/webgl-to-webgpu/convert-webgl-sampler.js +111 -0
- package/dist/gltf/webgl-to-webgpu/convert-webgl-sampler.js.map +1 -0
- package/dist/gltf/webgl-to-webgpu/convert-webgl-topology.cjs +68 -0
- package/dist/gltf/webgl-to-webgpu/convert-webgl-topology.d.ts +19 -0
- package/dist/gltf/webgl-to-webgpu/convert-webgl-topology.d.ts.map +1 -0
- package/dist/gltf/webgl-to-webgpu/convert-webgl-topology.js +54 -0
- package/dist/gltf/webgl-to-webgpu/convert-webgl-topology.js.map +1 -0
- package/dist/gltf/webgl-to-webgpu/gltf-webgl-constants.cjs +54 -0
- package/dist/gltf/webgl-to-webgpu/gltf-webgl-constants.d.ts +28 -0
- package/dist/gltf/webgl-to-webgpu/gltf-webgl-constants.d.ts.map +1 -0
- package/dist/gltf/webgl-to-webgpu/gltf-webgl-constants.js +35 -0
- package/dist/gltf/webgl-to-webgpu/gltf-webgl-constants.js.map +1 -0
- package/dist/graph/models/index.cjs.map +2 -2
- package/dist/graph/models/path/path-attribute-model.cjs +2 -2
- package/dist/graph/models/path/path-attribute-model.d.ts +2 -2
- package/dist/graph/models/path/path-attribute-model.js +2 -2
- package/dist/graph/models/path/path-storage-model.cjs +1 -1
- package/dist/graph/models/path/path-storage-model.d.ts +1 -1
- package/dist/graph/models/path/path-storage-model.js +1 -1
- package/dist/graph/models/path/path-trips-storage-model.d.ts +2 -2
- package/dist/graph/models/polygon/polygon-attribute-model.cjs +2 -2
- package/dist/graph/models/polygon/polygon-attribute-model.js +2 -2
- package/dist/graph/models/polygon/polygon-shaders.d.ts +2 -2
- package/dist/graph/models/polygon/polygon-shaders.d.ts.map +1 -1
- package/dist/graph/models/polygon/polygon-storage-model.cjs +2 -2
- package/dist/graph/models/polygon/polygon-storage-model.js +2 -2
- package/dist/graph/tables/gpu-table-model.cjs +1 -1
- package/dist/graph/tables/gpu-table-model.js +1 -1
- package/dist/graph/tables/gpu-table-transform.cjs +2 -2
- package/dist/graph/tables/gpu-table-transform.d.ts +1 -1
- package/dist/graph/tables/gpu-table-transform.js +2 -2
- package/dist/graph/tables/index.cjs.map +2 -2
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lighting/ltc-data.cjs +32800 -0
- package/dist/lighting/ltc-data.d.ts +3 -0
- package/dist/lighting/ltc-data.d.ts.map +1 -0
- package/dist/lighting/ltc-data.js +3278 -0
- package/dist/lighting/ltc-data.js.map +1 -0
- package/dist/lighting/ltc-textures.cjs +48 -0
- package/dist/lighting/ltc-textures.d.ts +10 -0
- package/dist/lighting/ltc-textures.d.ts.map +1 -0
- package/dist/lighting/ltc-textures.js +27 -0
- package/dist/lighting/ltc-textures.js.map +1 -0
- package/dist/material/material-factory.d.ts +1 -1
- package/dist/material/material-factory.d.ts.map +1 -1
- package/dist/material/material.d.ts +1 -1
- package/dist/material/material.d.ts.map +1 -1
- package/dist/model/gpu-vector-model.cjs +109 -82
- package/dist/model/gpu-vector-model.d.ts +6 -6
- package/dist/model/gpu-vector-model.d.ts.map +1 -1
- package/dist/model/gpu-vector-model.js +139 -103
- package/dist/model/gpu-vector-model.js.map +1 -1
- package/dist/model/split-uniforms-and-bindings.d.ts +1 -1
- package/dist/model/split-uniforms-and-bindings.d.ts.map +1 -1
- package/dist/models/light-model-utils.d.ts +1 -1
- package/dist/models/light-model-utils.d.ts.map +1 -1
- package/dist/models/light-model-utils.js.map +1 -1
- package/dist/modules/picking/color-picking.d.ts +1 -1
- package/dist/modules/picking/index-color-picking.d.ts +1 -1
- package/dist/modules/picking/index-picking.d.ts +1 -1
- package/dist/modules/picking/legacy-color-picking.cjs +2 -2
- package/dist/modules/picking/legacy-color-picking.d.ts +3 -3
- package/dist/modules/picking/legacy-color-picking.d.ts.map +1 -1
- package/dist/modules/picking/legacy-color-picking.js +2 -2
- package/dist/modules/picking/legacy-color-picking.js.map +1 -1
- package/dist/modules/picking/legacy-picking-manager.d.ts +1 -1
- package/dist/modules/picking/legacy-picking-manager.d.ts.map +1 -1
- package/dist/modules/picking/picking-uniforms.d.ts +1 -1
- package/dist/modules/picking/picking.d.ts +1 -1
- package/dist/passes/get-fragment-shader.d.ts +1 -1
- package/dist/passes/get-fragment-shader.d.ts.map +1 -1
- package/dist/passes/shader-pass-renderer.cjs +2 -2
- package/dist/passes/shader-pass-renderer.d.ts +1 -1
- package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
- package/dist/passes/shader-pass-renderer.js +1 -1
- package/dist/passes/shader-pass-renderer.js.map +1 -1
- package/dist/scenegraph/controllers/area-light-controller.d.ts +1 -1
- package/dist/scenegraph/controllers/area-light-controller.d.ts.map +1 -1
- package/dist/shader-inputs.cjs +3 -3
- package/dist/shader-inputs.d.ts +1 -1
- package/dist/shader-inputs.d.ts.map +1 -1
- package/dist/shader-inputs.js +1 -1
- package/dist/shader-inputs.js.map +1 -1
- package/dist/splats/gpu-paged-splat-renderer.cjs +1155 -0
- package/dist/splats/gpu-paged-splat-renderer.d.ts +184 -0
- package/dist/splats/gpu-paged-splat-renderer.d.ts.map +1 -0
- package/dist/splats/gpu-paged-splat-renderer.js +1186 -0
- package/dist/splats/gpu-paged-splat-renderer.js.map +1 -0
- package/dist/splats/gpu-paged-splat-shaders.cjs +283 -0
- package/dist/splats/gpu-paged-splat-shaders.d.ts +64 -0
- package/dist/splats/gpu-paged-splat-shaders.d.ts.map +1 -0
- package/dist/splats/gpu-paged-splat-shaders.js +263 -0
- package/dist/splats/gpu-paged-splat-shaders.js.map +1 -0
- package/dist/splats/gpu-splat-graph-interaction.cjs +503 -0
- package/dist/splats/gpu-splat-graph-interaction.d.ts +111 -0
- package/dist/splats/gpu-splat-graph-interaction.d.ts.map +1 -0
- package/dist/splats/gpu-splat-graph-interaction.js +507 -0
- package/dist/splats/gpu-splat-graph-interaction.js.map +1 -0
- package/dist/splats/gpu-splat-graph-renderer.cjs +827 -0
- package/dist/splats/gpu-splat-graph-renderer.d.ts +144 -0
- package/dist/splats/gpu-splat-graph-renderer.d.ts.map +1 -0
- package/dist/splats/gpu-splat-graph-renderer.js +847 -0
- package/dist/splats/gpu-splat-graph-renderer.js.map +1 -0
- package/dist/splats/gpu-splat-graph-shaders.cjs +546 -0
- package/dist/splats/gpu-splat-graph-shaders.d.ts +70 -0
- package/dist/splats/gpu-splat-graph-shaders.d.ts.map +1 -0
- package/dist/splats/gpu-splat-graph-shaders.js +508 -0
- package/dist/splats/gpu-splat-graph-shaders.js.map +1 -0
- package/dist/splats/index.cjs +135 -0
- package/dist/splats/index.cjs.map +6 -0
- package/dist/splats/index.d.ts +16 -0
- package/dist/splats/index.d.ts.map +1 -0
- package/dist/splats/index.js +19 -0
- package/dist/splats/index.js.map +1 -0
- package/dist/splats/splat-covariance.cjs +150 -0
- package/dist/splats/splat-covariance.d.ts +34 -0
- package/dist/splats/splat-covariance.d.ts.map +1 -0
- package/dist/splats/splat-covariance.js +129 -0
- package/dist/splats/splat-covariance.js.map +1 -0
- package/dist/splats/splat-data.cjs +264 -0
- package/dist/splats/splat-data.d.ts +131 -0
- package/dist/splats/splat-data.d.ts.map +1 -0
- package/dist/splats/splat-data.js +254 -0
- package/dist/splats/splat-data.js.map +1 -0
- package/dist/splats/splat-filter.cjs +49 -0
- package/dist/splats/splat-filter.d.ts +17 -0
- package/dist/splats/splat-filter.d.ts.map +1 -0
- package/dist/splats/splat-filter.js +30 -0
- package/dist/splats/splat-filter.js.map +1 -0
- package/dist/splats/splat-gltf.cjs +216 -0
- package/dist/splats/splat-gltf.d.ts +83 -0
- package/dist/splats/splat-gltf.d.ts.map +1 -0
- package/dist/splats/splat-gltf.js +229 -0
- package/dist/splats/splat-gltf.js.map +1 -0
- package/dist/splats/splat-hierarchy.cjs +410 -0
- package/dist/splats/splat-hierarchy.d.ts +192 -0
- package/dist/splats/splat-hierarchy.d.ts.map +1 -0
- package/dist/splats/splat-hierarchy.js +412 -0
- package/dist/splats/splat-hierarchy.js.map +1 -0
- package/dist/splats/splat-picking.cjs +448 -0
- package/dist/splats/splat-picking.d.ts +93 -0
- package/dist/splats/splat-picking.d.ts.map +1 -0
- package/dist/splats/splat-picking.js +442 -0
- package/dist/splats/splat-picking.js.map +1 -0
- package/dist/splats/splat-rad-hierarchy.cjs +2033 -0
- package/dist/splats/splat-rad-hierarchy.d.ts +356 -0
- package/dist/splats/splat-rad-hierarchy.d.ts.map +1 -0
- package/dist/splats/splat-rad-hierarchy.js +2187 -0
- package/dist/splats/splat-rad-hierarchy.js.map +1 -0
- package/dist/splats/splat-renderer.cjs +979 -0
- package/dist/splats/splat-renderer.d.ts +226 -0
- package/dist/splats/splat-renderer.d.ts.map +1 -0
- package/dist/splats/splat-renderer.js +1003 -0
- package/dist/splats/splat-renderer.js.map +1 -0
- package/dist/splats/splat-residency.cjs +443 -0
- package/dist/splats/splat-residency.d.ts +199 -0
- package/dist/splats/splat-residency.d.ts.map +1 -0
- package/dist/splats/splat-residency.js +442 -0
- package/dist/splats/splat-residency.js.map +1 -0
- package/dist/splats/splat-shaders.cjs +468 -0
- package/dist/splats/splat-shaders.d.ts +103 -0
- package/dist/splats/splat-shaders.d.ts.map +1 -0
- package/dist/splats/splat-shaders.js +431 -0
- package/dist/splats/splat-shaders.js.map +1 -0
- package/dist/splats/splat-sort.cjs +146 -0
- package/dist/splats/splat-sort.d.ts +30 -0
- package/dist/splats/splat-sort.d.ts.map +1 -0
- package/dist/splats/splat-sort.js +129 -0
- package/dist/splats/splat-sort.js.map +1 -0
- package/dist/splats/splat-spherical-harmonics.cjs +79 -0
- package/dist/splats/splat-spherical-harmonics.d.ts +14 -0
- package/dist/splats/splat-spherical-harmonics.d.ts.map +1 -0
- package/dist/splats/splat-spherical-harmonics.js +62 -0
- package/dist/splats/splat-spherical-harmonics.js.map +1 -0
- package/dist/text/experimental.cjs +169 -0
- package/dist/text/experimental.cjs.map +6 -0
- package/dist/text/experimental.d.ts +2 -0
- package/dist/text/experimental.d.ts.map +1 -0
- package/dist/text/experimental.js +5 -0
- package/dist/text/experimental.js.map +1 -0
- package/dist/text/fonts/atlas/browser-font-atlas.cjs +215 -0
- package/dist/text/fonts/atlas/browser-font-atlas.d.ts +55 -0
- package/dist/text/fonts/atlas/browser-font-atlas.d.ts.map +1 -0
- package/dist/text/fonts/atlas/browser-font-atlas.js +194 -0
- package/dist/text/fonts/atlas/browser-font-atlas.js.map +1 -0
- package/dist/text/fonts/atlas/font-atlas.cjs +15 -0
- package/dist/text/fonts/atlas/font-atlas.d.ts +48 -0
- package/dist/text/fonts/atlas/font-atlas.d.ts.map +1 -0
- package/dist/text/fonts/atlas/font-atlas.js +5 -0
- package/dist/text/fonts/atlas/font-atlas.js.map +1 -0
- package/dist/text/fonts/atlas/lru-cache.cjs +55 -0
- package/dist/text/fonts/atlas/lru-cache.d.ts +9 -0
- package/dist/text/fonts/atlas/lru-cache.d.ts.map +1 -0
- package/dist/text/fonts/atlas/lru-cache.js +34 -0
- package/dist/text/fonts/atlas/lru-cache.js.map +1 -0
- package/dist/text/fonts/atlas/text-glyph-walker.cjs +90 -0
- package/dist/text/fonts/atlas/text-glyph-walker.d.ts +39 -0
- package/dist/text/fonts/atlas/text-glyph-walker.d.ts.map +1 -0
- package/dist/text/fonts/atlas/text-glyph-walker.js +76 -0
- package/dist/text/fonts/atlas/text-glyph-walker.js.map +1 -0
- package/dist/text/fonts/atlas/text-metrics.cjs +35 -0
- package/dist/text/fonts/atlas/text-metrics.d.ts +25 -0
- package/dist/text/fonts/atlas/text-metrics.d.ts.map +1 -0
- package/dist/text/fonts/atlas/text-metrics.js +14 -0
- package/dist/text/fonts/atlas/text-metrics.js.map +1 -0
- package/dist/text/fonts/atlas/text-utils.cjs +96 -0
- package/dist/text/fonts/atlas/text-utils.d.ts +60 -0
- package/dist/text/fonts/atlas/text-utils.d.ts.map +1 -0
- package/dist/text/fonts/atlas/text-utils.js +72 -0
- package/dist/text/fonts/atlas/text-utils.js.map +1 -0
- package/dist/text/fonts/build-bitmap-font-atlas.cjs +36 -0
- package/dist/text/fonts/build-bitmap-font-atlas.d.ts +12 -0
- package/dist/text/fonts/build-bitmap-font-atlas.d.ts.map +1 -0
- package/dist/text/fonts/build-bitmap-font-atlas.js +20 -0
- package/dist/text/fonts/build-bitmap-font-atlas.js.map +1 -0
- package/dist/text/fonts/build-glyph-font-atlas.cjs +79 -0
- package/dist/text/fonts/build-glyph-font-atlas.d.ts +14 -0
- package/dist/text/fonts/build-glyph-font-atlas.d.ts.map +1 -0
- package/dist/text/fonts/build-glyph-font-atlas.js +67 -0
- package/dist/text/fonts/build-glyph-font-atlas.js.map +1 -0
- package/dist/text/fonts/build-msdf-font-atlas.cjs +148 -0
- package/dist/text/fonts/build-msdf-font-atlas.d.ts +92 -0
- package/dist/text/fonts/build-msdf-font-atlas.d.ts.map +1 -0
- package/dist/text/fonts/build-msdf-font-atlas.js +137 -0
- package/dist/text/fonts/build-msdf-font-atlas.js.map +1 -0
- package/dist/text/fonts/build-sdf-font-atlas.cjs +89 -0
- package/dist/text/fonts/build-sdf-font-atlas.d.ts +19 -0
- package/dist/text/fonts/build-sdf-font-atlas.d.ts.map +1 -0
- package/dist/text/fonts/build-sdf-font-atlas.js +65 -0
- package/dist/text/fonts/build-sdf-font-atlas.js.map +1 -0
- package/dist/text/fonts/glyph-pbf.cjs +155 -0
- package/dist/text/fonts/glyph-pbf.d.ts +38 -0
- package/dist/text/fonts/glyph-pbf.d.ts.map +1 -0
- package/dist/text/fonts/glyph-pbf.js +146 -0
- package/dist/text/fonts/glyph-pbf.js.map +1 -0
- package/dist/text/fonts/glyph-range-loader.cjs +121 -0
- package/dist/text/fonts/glyph-range-loader.d.ts +38 -0
- package/dist/text/fonts/glyph-range-loader.d.ts.map +1 -0
- package/dist/text/fonts/glyph-range-loader.js +116 -0
- package/dist/text/fonts/glyph-range-loader.js.map +1 -0
- package/dist/text/fonts/helvetiker.cjs +1307 -0
- package/dist/text/fonts/helvetiker.d.ts +4 -0
- package/dist/text/fonts/helvetiker.d.ts.map +1 -0
- package/dist/text/fonts/helvetiker.js +1288 -0
- package/dist/text/fonts/helvetiker.js.map +1 -0
- package/dist/text/fonts/index.cjs +72 -0
- package/dist/text/fonts/index.cjs.map +6 -0
- package/dist/text/fonts/index.d.ts +13 -0
- package/dist/text/fonts/index.d.ts.map +1 -0
- package/dist/text/fonts/index.js +14 -0
- package/dist/text/fonts/index.js.map +1 -0
- package/dist/text/fonts/typeface-font-data.cjs +15 -0
- package/dist/text/fonts/typeface-font-data.d.ts +38 -0
- package/dist/text/fonts/typeface-font-data.d.ts.map +1 -0
- package/dist/text/fonts/typeface-font-data.js +6 -0
- package/dist/text/fonts/typeface-font-data.js.map +1 -0
- package/dist/text/index.cjs +59 -0
- package/dist/text/index.cjs.map +6 -0
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.d.ts.map +1 -0
- package/dist/text/index.js +5 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/text-2d/dictionary-text-renderer.cjs +160 -0
- package/dist/text/text-2d/dictionary-text-renderer.d.ts +50 -0
- package/dist/text/text-2d/dictionary-text-renderer.d.ts.map +1 -0
- package/dist/text/text-2d/dictionary-text-renderer.js +145 -0
- package/dist/text/text-2d/dictionary-text-renderer.js.map +1 -0
- package/dist/text/text-2d/experimental.cjs +182 -0
- package/dist/text/text-2d/experimental.d.ts +17 -0
- package/dist/text/text-2d/experimental.d.ts.map +1 -0
- package/dist/text/text-2d/experimental.js +19 -0
- package/dist/text/text-2d/experimental.js.map +1 -0
- package/dist/text/text-2d/gpu-text-data.cjs +112 -0
- package/dist/text/text-2d/gpu-text-data.d.ts +108 -0
- package/dist/text/text-2d/gpu-text-data.d.ts.map +1 -0
- package/dist/text/text-2d/gpu-text-data.js +92 -0
- package/dist/text/text-2d/gpu-text-data.js.map +1 -0
- package/dist/text/text-2d/gpu-text-resources.cjs +55 -0
- package/dist/text/text-2d/gpu-text-resources.d.ts +30 -0
- package/dist/text/text-2d/gpu-text-resources.d.ts.map +1 -0
- package/dist/text/text-2d/gpu-text-resources.js +40 -0
- package/dist/text/text-2d/gpu-text-resources.js.map +1 -0
- package/dist/text/text-2d/index.cjs +69 -0
- package/dist/text/text-2d/index.d.ts +15 -0
- package/dist/text/text-2d/index.d.ts.map +1 -0
- package/dist/text/text-2d/index.js +15 -0
- package/dist/text/text-2d/index.js.map +1 -0
- package/dist/text/text-2d/model-utils/gpu-text-expansion.cjs +859 -0
- package/dist/text/text-2d/model-utils/gpu-text-expansion.d.ts +196 -0
- package/dist/text/text-2d/model-utils/gpu-text-expansion.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/gpu-text-expansion.js +843 -0
- package/dist/text/text-2d/model-utils/gpu-text-expansion.js.map +1 -0
- package/dist/text/text-2d/model-utils/gpu-text-types.cjs +15 -0
- package/dist/text/text-2d/model-utils/gpu-text-types.d.ts +114 -0
- package/dist/text/text-2d/model-utils/gpu-text-types.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/gpu-text-types.js +5 -0
- package/dist/text/text-2d/model-utils/gpu-text-types.js.map +1 -0
- package/dist/text/text-2d/model-utils/gpu-utf8-map.cjs +134 -0
- package/dist/text/text-2d/model-utils/gpu-utf8-map.d.ts +39 -0
- package/dist/text/text-2d/model-utils/gpu-utf8-map.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/gpu-utf8-map.js +118 -0
- package/dist/text/text-2d/model-utils/gpu-utf8-map.js.map +1 -0
- package/dist/text/text-2d/model-utils/text-fragment-shaders.cjs +97 -0
- package/dist/text/text-2d/model-utils/text-fragment-shaders.d.ts +23 -0
- package/dist/text/text-2d/model-utils/text-fragment-shaders.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/text-fragment-shaders.js +81 -0
- package/dist/text/text-2d/model-utils/text-fragment-shaders.js.map +1 -0
- package/dist/text/text-2d/model-utils/text-fragment-uniforms.cjs +50 -0
- package/dist/text/text-2d/model-utils/text-fragment-uniforms.d.ts +13 -0
- package/dist/text/text-2d/model-utils/text-fragment-uniforms.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/text-fragment-uniforms.js +25 -0
- package/dist/text/text-2d/model-utils/text-fragment-uniforms.js.map +1 -0
- package/dist/text/text-2d/model-utils/text-layout.cjs +300 -0
- package/dist/text/text-2d/model-utils/text-layout.d.ts +61 -0
- package/dist/text/text-2d/model-utils/text-layout.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/text-layout.js +282 -0
- package/dist/text/text-2d/model-utils/text-layout.js.map +1 -0
- package/dist/text/text-2d/model-utils/text-model-props.cjs +184 -0
- package/dist/text/text-2d/model-utils/text-model-props.d.ts +206 -0
- package/dist/text/text-2d/model-utils/text-model-props.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/text-model-props.js +158 -0
- package/dist/text/text-2d/model-utils/text-model-props.js.map +1 -0
- package/dist/text/text-2d/model-utils/text-shaders.cjs +692 -0
- package/dist/text/text-2d/model-utils/text-shaders.d.ts +26 -0
- package/dist/text/text-2d/model-utils/text-shaders.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/text-shaders.js +618 -0
- package/dist/text/text-2d/model-utils/text-shaders.js.map +1 -0
- package/dist/text/text-2d/model-utils/text-storage-model-draw.cjs +53 -0
- package/dist/text/text-2d/model-utils/text-storage-model-draw.d.ts +16 -0
- package/dist/text/text-2d/model-utils/text-storage-model-draw.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/text-storage-model-draw.js +45 -0
- package/dist/text/text-2d/model-utils/text-storage-model-draw.js.map +1 -0
- package/dist/text/text-2d/model-utils/text-storage-model-utils.cjs +56 -0
- package/dist/text/text-2d/model-utils/text-storage-model-utils.d.ts +25 -0
- package/dist/text/text-2d/model-utils/text-storage-model-utils.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/text-storage-model-utils.js +39 -0
- package/dist/text/text-2d/model-utils/text-storage-model-utils.js.map +1 -0
- package/dist/text/text-2d/model-utils/text-storage-state.cjs +68 -0
- package/dist/text/text-2d/model-utils/text-storage-state.d.ts +153 -0
- package/dist/text/text-2d/model-utils/text-storage-state.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/text-storage-state.js +38 -0
- package/dist/text/text-2d/model-utils/text-storage-state.js.map +1 -0
- package/dist/text/text-2d/models/text-attribute-model.cjs +79 -0
- package/dist/text/text-2d/models/text-attribute-model.d.ts +111 -0
- package/dist/text/text-2d/models/text-attribute-model.d.ts.map +1 -0
- package/dist/text/text-2d/models/text-attribute-model.js +68 -0
- package/dist/text/text-2d/models/text-attribute-model.js.map +1 -0
- package/dist/text/text-2d/models/text-dictionary-model.cjs +115 -0
- package/dist/text/text-2d/models/text-dictionary-model.d.ts +95 -0
- package/dist/text/text-2d/models/text-dictionary-model.d.ts.map +1 -0
- package/dist/text/text-2d/models/text-dictionary-model.js +100 -0
- package/dist/text/text-2d/models/text-dictionary-model.js.map +1 -0
- package/dist/text/text-2d/models/text-storage-model.cjs +165 -0
- package/dist/text/text-2d/models/text-storage-model.d.ts +94 -0
- package/dist/text/text-2d/models/text-storage-model.d.ts.map +1 -0
- package/dist/text/text-2d/models/text-storage-model.js +162 -0
- package/dist/text/text-2d/models/text-storage-model.js.map +1 -0
- package/dist/text/text-2d/text-renderer.cjs +181 -0
- package/dist/text/text-2d/text-renderer.d.ts +56 -0
- package/dist/text/text-2d/text-renderer.d.ts.map +1 -0
- package/dist/text/text-2d/text-renderer.js +164 -0
- package/dist/text/text-2d/text-renderer.js.map +1 -0
- package/dist/text/text-3d/extrude.cjs +380 -0
- package/dist/text/text-3d/extrude.d.ts +34 -0
- package/dist/text/text-3d/extrude.d.ts.map +1 -0
- package/dist/text/text-3d/extrude.js +390 -0
- package/dist/text/text-3d/extrude.js.map +1 -0
- package/dist/text/text-3d/font.cjs +184 -0
- package/dist/text/text-3d/font.d.ts +32 -0
- package/dist/text/text-3d/font.d.ts.map +1 -0
- package/dist/text/text-3d/font.js +174 -0
- package/dist/text/text-3d/font.js.map +1 -0
- package/dist/text/text-3d/glyph-atlas.cjs +190 -0
- package/dist/text/text-3d/glyph-atlas.d.ts +97 -0
- package/dist/text/text-3d/glyph-atlas.d.ts.map +1 -0
- package/dist/text/text-3d/glyph-atlas.js +178 -0
- package/dist/text/text-3d/glyph-atlas.js.map +1 -0
- package/dist/text/text-3d/index.cjs +48 -0
- package/dist/text/text-3d/index.cjs.map +6 -0
- package/dist/text/text-3d/index.d.ts +7 -0
- package/dist/text/text-3d/index.d.ts.map +1 -0
- package/dist/text/text-3d/index.js +12 -0
- package/dist/text/text-3d/index.js.map +1 -0
- package/dist/text/text-3d/paths/curve-path.cjs +50 -0
- package/dist/text/text-3d/paths/curve-path.d.ts +11 -0
- package/dist/text/text-3d/paths/curve-path.d.ts.map +1 -0
- package/dist/text/text-3d/paths/curve-path.js +31 -0
- package/dist/text/text-3d/paths/curve-path.js.map +1 -0
- package/dist/text/text-3d/paths/curves.cjs +151 -0
- package/dist/text/text-3d/paths/curves.d.ts +60 -0
- package/dist/text/text-3d/paths/curves.d.ts.map +1 -0
- package/dist/text/text-3d/paths/curves.js +132 -0
- package/dist/text/text-3d/paths/curves.js.map +1 -0
- package/dist/text/text-3d/paths/path.cjs +106 -0
- package/dist/text/text-3d/paths/path.d.ts +36 -0
- package/dist/text/text-3d/paths/path.d.ts.map +1 -0
- package/dist/text/text-3d/paths/path.js +86 -0
- package/dist/text/text-3d/paths/path.js.map +1 -0
- package/dist/text/text-3d/paths/shape-path.cjs +150 -0
- package/dist/text/text-3d/paths/shape-path.d.ts +22 -0
- package/dist/text/text-3d/paths/shape-path.d.ts.map +1 -0
- package/dist/text/text-3d/paths/shape-path.js +137 -0
- package/dist/text/text-3d/paths/shape-path.js.map +1 -0
- package/dist/text/text-3d/paths/shape-utils.cjs +78 -0
- package/dist/text/text-3d/paths/shape-utils.d.ts +11 -0
- package/dist/text/text-3d/paths/shape-utils.d.ts.map +1 -0
- package/dist/text/text-3d/paths/shape-utils.js +63 -0
- package/dist/text/text-3d/paths/shape-utils.js.map +1 -0
- package/dist/text/text-3d/text-geometry.cjs +69 -0
- package/dist/text/text-3d/text-geometry.d.ts +20 -0
- package/dist/text/text-3d/text-geometry.d.ts.map +1 -0
- package/dist/text/text-3d/text-geometry.js +53 -0
- package/dist/text/text-3d/text-geometry.js.map +1 -0
- package/dist/utils/deep-equal.cjs +3 -1
- package/dist/utils/deep-equal.d.ts +1 -1
- package/dist/utils/deep-equal.d.ts.map +1 -1
- package/dist/utils/deep-equal.js +3 -1
- package/dist/utils/deep-equal.js.map +1 -1
- package/dist/utils/get-platform-info.cjs +9 -3
- package/dist/utils/get-platform-info.d.ts +1 -1
- package/dist/utils/get-platform-info.d.ts.map +1 -1
- package/dist/utils/get-platform-info.js +1 -1
- package/dist/utils/get-platform-info.js.map +1 -1
- package/dist/utils/shader-module-utils.cjs +3 -3
- package/dist/utils/shader-module-utils.d.ts +1 -1
- package/dist/utils/shader-module-utils.d.ts.map +1 -1
- package/dist/utils/shader-module-utils.js +1 -1
- package/dist/utils/shader-module-utils.js.map +1 -1
- package/package.json +59 -8
- package/src/arrow/arrow-geometry.ts +491 -0
- package/src/arrow/arrow-mesh-types.ts +41 -0
- package/src/arrow/arrow-picking.ts +217 -0
- package/src/arrow/index.ts +247 -0
- package/src/arrow/renderers/arrow-renderer-utils.ts +205 -0
- package/src/arrow/renderers/path/conversion/arrow-path-gpu-vectors.ts +1349 -0
- package/src/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.ts +321 -0
- package/src/arrow/renderers/path/renderers/arrow-path-renderer.ts +159 -0
- package/src/arrow/renderers/path/source/arrow-path-source-mapping.ts +175 -0
- package/src/arrow/renderers/path/transforms/close-arrow-paths.ts +778 -0
- package/src/arrow/renderers/path/transforms/gpu-path-float64-deltas.ts +304 -0
- package/src/arrow/renderers/path/transforms/path-view-origins.ts +92 -0
- package/src/arrow/renderers/polygon/conversion/arrow-polygon-gpu-vectors.ts +265 -0
- package/src/arrow/renderers/polygon/renderers/arrow-polygon-renderer.ts +592 -0
- package/src/arrow/renderers/polygon/source/arrow-polygon-source-mapping.ts +116 -0
- package/src/arrow/renderers/splats/conversion/make-gpu-splat-data-from-arrow.ts +486 -0
- package/src/arrow/renderers/text/conversion/arrow-text.ts +930 -0
- package/src/arrow/renderers/text/conversion/convert-arrow-text-to-attribute.ts +224 -0
- package/src/arrow/renderers/text/conversion/convert-arrow-text-to-dictionary.ts +65 -0
- package/src/arrow/renderers/text/conversion/convert-arrow-text-to-storage.ts +98 -0
- package/src/arrow/renderers/text/conversion/convert-arrow-text-vectors.ts +3569 -0
- package/src/arrow/renderers/text/conversion/index.ts +83 -0
- package/src/arrow/renderers/text/conversion/make-gpu-text-data-from-arrow.ts +275 -0
- package/src/arrow/renderers/text/renderers/arrow-text-picking.ts +166 -0
- package/src/arrow/renderers/text/renderers/arrow-text-renderer.ts +1605 -0
- package/src/arrow/renderers/text/renderers/arrow-text-shaders.ts +1001 -0
- package/src/arrow/renderers/text/source/arrow-text-source-mapping.ts +221 -0
- package/src/arrow/renderers/text/source/index.ts +15 -0
- package/src/compute/buffer-transform.ts +1 -1
- package/src/compute/computation.ts +20 -11
- package/src/compute/texture-transform.ts +3 -3
- package/src/effects/README.md +165 -0
- package/src/effects/index.ts +210 -0
- package/src/effects/passes/postprocessing/fxaa/fxaa.ts +982 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +80 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/denoise.ts +109 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/huesaturation.ts +114 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/noise.ts +75 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/persistence.ts +53 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/sepia.ts +81 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/tone-mapping.ts +89 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/vibrance.ts +69 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/vignette.ts +77 -0
- package/src/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.ts +1160 -0
- package/src/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.ts +165 -0
- package/src/effects/passes/postprocessing/image-blur-filters/bloom-lens-effects.ts +646 -0
- package/src/effects/passes/postprocessing/image-blur-filters/bloom.ts +129 -0
- package/src/effects/passes/postprocessing/image-blur-filters/gaussianblur.ts +196 -0
- package/src/effects/passes/postprocessing/image-blur-filters/tiltshift.ts +188 -0
- package/src/effects/passes/postprocessing/image-blur-filters/triangleblur.ts +133 -0
- package/src/effects/passes/postprocessing/image-blur-filters/zoomblur.ts +108 -0
- package/src/effects/passes/postprocessing/image-fun-filters/colorhalftone.ts +128 -0
- package/src/effects/passes/postprocessing/image-fun-filters/dotscreen.ts +99 -0
- package/src/effects/passes/postprocessing/image-fun-filters/edgework.ts +226 -0
- package/src/effects/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +147 -0
- package/src/effects/passes/postprocessing/image-fun-filters/ink.ts +115 -0
- package/src/effects/passes/postprocessing/image-fun-filters/magnify.ts +108 -0
- package/src/effects/passes/postprocessing/image-warp-filters/bulgepinch.ts +119 -0
- package/src/effects/passes/postprocessing/image-warp-filters/swirl.ts +115 -0
- package/src/effects/passes/postprocessing/image-warp-filters/warp.ts +46 -0
- package/src/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.ts +235 -0
- package/src/effects/passes/screen-space/clustered-volumetric-lighting.ts +784 -0
- package/src/effects/passes/screen-space/copy-pass.ts +14 -0
- package/src/effects/passes/screen-space/depth-aware-blur.ts +102 -0
- package/src/effects/passes/screen-space/dof.ts +285 -0
- package/src/effects/passes/screen-space/gtao.ts +575 -0
- package/src/effects/passes/screen-space/hdr-auto-exposure.ts +348 -0
- package/src/effects/passes/screen-space/height-fog.ts +144 -0
- package/src/effects/passes/screen-space/motion-blur.ts +61 -0
- package/src/effects/passes/screen-space/outlines.ts +97 -0
- package/src/effects/passes/screen-space/screen-space-global-illumination.ts +590 -0
- package/src/effects/passes/screen-space/screen-space-reflections.ts +754 -0
- package/src/effects/passes/screen-space/screen-space-shader-helpers.ts +85 -0
- package/src/effects/passes/screen-space/selection-outline.ts +68 -0
- package/src/effects/passes/screen-space/ssao.ts +167 -0
- package/src/effects/passes/screen-space/ssr-camera-temporal.ts +172 -0
- package/src/effects/passes/screen-space/temporal-antialiasing.ts +120 -0
- package/src/effects/passes/screen-space/volumetric-fog.ts +102 -0
- package/src/experimental/materials/emissive-material.ts +2 -2
- package/src/experimental/materials/glass-material.ts +2 -2
- package/src/experimental/materials/glass-transmission.ts +2 -2
- package/src/experimental/materials/optical-caustics.ts +2 -2
- package/src/experimental/materials/optical-lighting.ts +1 -1
- package/src/experimental/materials/optical-point-lights.ts +2 -2
- package/src/experimental/materials/reflective-material.ts +2 -2
- package/src/experimental/textures/rgba-decoder.ts +1 -1
- package/src/geometry/gpu-geometry.ts +1 -4
- package/src/gltf/README.md +48 -0
- package/src/gltf/gltf/animations/animations.ts +160 -0
- package/src/gltf/gltf/create-gltf-model.ts +957 -0
- package/src/gltf/gltf/create-scenegraph-from-gltf.ts +282 -0
- package/src/gltf/gltf/gltf-animated-crowd.ts +1338 -0
- package/src/gltf/gltf/gltf-animator.ts +259 -0
- package/src/gltf/gltf/gltf-area-lights.ts +55 -0
- package/src/gltf/gltf/gltf-audio.ts +145 -0
- package/src/gltf/gltf/gltf-billboard.ts +49 -0
- package/src/gltf/gltf/gltf-extension-support.ts +483 -0
- package/src/gltf/gltf/gltf-gpu-animation.ts +80 -0
- package/src/gltf/gltf/gltf-instancing.ts +130 -0
- package/src/gltf/gltf/gltf-lightmap.ts +136 -0
- package/src/gltf/gltf/gltf-lod.ts +373 -0
- package/src/gltf/gltf/gltf-material-variants.ts +42 -0
- package/src/gltf/gltf/gltf-materials-scatter.ts +55 -0
- package/src/gltf/gltf/gltf-skin.ts +127 -0
- package/src/gltf/gltf/morph-targets.ts +9 -0
- package/src/gltf/index.ts +189 -0
- package/src/gltf/parsers/gltf-accessor-utils.ts +85 -0
- package/src/gltf/parsers/parse-gltf-animations.ts +813 -0
- package/src/gltf/parsers/parse-gltf-joints.ts +145 -0
- package/src/gltf/parsers/parse-gltf-lights.ts +276 -0
- package/src/gltf/parsers/parse-gltf-physics-pointer.ts +32 -0
- package/src/gltf/parsers/parse-gltf.ts +655 -0
- package/src/gltf/parsers/parse-pbr-material.ts +1664 -0
- package/src/gltf/parsers/post-process-gltf.ts +756 -0
- package/src/gltf/pbr/pbr-environment.ts +130 -0
- package/src/gltf/pbr/pbr-material.ts +32 -0
- package/src/gltf/pbr/texture-transform.ts +261 -0
- package/src/gltf/physics/README.md +164 -0
- package/src/gltf/physics/export-state.ts +224 -0
- package/src/gltf/physics/index.ts +100 -0
- package/src/gltf/physics/mesh-box-shape.ts +44 -0
- package/src/gltf/physics/mesh-snapshot.ts +230 -0
- package/src/gltf/physics/node-collision-geometry.ts +98 -0
- package/src/gltf/physics/parse-gltf-physics.ts +918 -0
- package/src/gltf/physics/parse-physics-joints.ts +69 -0
- package/src/gltf/physics/physics-transforms.ts +11 -0
- package/src/gltf/physics/physics-types.ts +126 -0
- package/src/gltf/physics/property-bindings.ts +168 -0
- package/src/gltf/physics/scene-bindings.ts +46 -0
- package/src/gltf/physics/snapshot-scene.ts +31 -0
- package/src/gltf/types/gltf-json-schema.ts +930 -0
- package/src/gltf/types/gltf-postprocessed-schema.ts +788 -0
- package/src/gltf/types/gltf-shape-schema.ts +48 -0
- package/src/gltf/types/gltf-types.ts +102 -0
- package/src/gltf/webgl-to-webgpu/convert-webgl-sampler.ts +151 -0
- package/src/gltf/webgl-to-webgpu/convert-webgl-topology.ts +81 -0
- package/src/gltf/webgl-to-webgpu/gltf-webgl-constants.ts +36 -0
- package/src/graph/models/path/path-attribute-model.ts +3 -3
- package/src/graph/models/path/path-storage-model.ts +2 -2
- package/src/graph/models/path/path-trips-storage-model.ts +2 -2
- package/src/graph/models/polygon/polygon-attribute-model.ts +2 -2
- package/src/graph/models/polygon/polygon-shaders.ts +1 -1
- package/src/graph/models/polygon/polygon-storage-model.ts +2 -2
- package/src/graph/tables/gpu-table-model.ts +1 -1
- package/src/graph/tables/gpu-table-transform.ts +3 -3
- package/src/index.ts +2 -0
- package/src/lighting/LTC-LICENSE.txt +31 -0
- package/src/lighting/ltc-data.ts +3277 -0
- package/src/lighting/ltc-textures.ts +30 -0
- package/src/material/material-factory.ts +1 -1
- package/src/material/material.ts +1 -1
- package/src/model/gpu-vector-model.ts +160 -138
- package/src/model/split-uniforms-and-bindings.ts +1 -1
- package/src/models/billboard-texture-model.ts +1 -1
- package/src/models/billboard-texture-module.ts +1 -1
- package/src/models/light-model-utils.ts +1 -7
- package/src/modules/picking/color-picking.ts +1 -1
- package/src/modules/picking/index-color-picking.ts +1 -1
- package/src/modules/picking/index-picking.ts +1 -1
- package/src/modules/picking/legacy-color-picking.ts +2 -2
- package/src/modules/picking/legacy-picking-manager.ts +1 -1
- package/src/modules/picking/picking-uniforms.ts +1 -1
- package/src/modules/picking/picking.ts +1 -1
- package/src/passes/get-fragment-shader.ts +1 -1
- package/src/passes/shader-pass-renderer.ts +2 -2
- package/src/passes/texture-transform-module.ts +1 -1
- package/src/scenegraph/controllers/area-light-controller.ts +1 -1
- package/src/scenegraph/published-transforms.ts +1 -1
- package/src/shader-inputs.ts +1 -1
- package/src/splats/README.md +43 -0
- package/src/splats/gpu-paged-splat-renderer.ts +1637 -0
- package/src/splats/gpu-paged-splat-shaders.ts +397 -0
- package/src/splats/gpu-splat-graph-interaction.ts +600 -0
- package/src/splats/gpu-splat-graph-renderer.ts +1150 -0
- package/src/splats/gpu-splat-graph-shaders.ts +520 -0
- package/src/splats/index.ts +136 -0
- package/src/splats/splat-covariance.ts +199 -0
- package/src/splats/splat-data.ts +433 -0
- package/src/splats/splat-filter.ts +59 -0
- package/src/splats/splat-gltf.ts +388 -0
- package/src/splats/splat-hierarchy.ts +670 -0
- package/src/splats/splat-picking.ts +616 -0
- package/src/splats/splat-rad-hierarchy.ts +2927 -0
- package/src/splats/splat-renderer.ts +1281 -0
- package/src/splats/splat-residency.ts +673 -0
- package/src/splats/splat-shaders.ts +476 -0
- package/src/splats/splat-sort.ts +173 -0
- package/src/splats/splat-spherical-harmonics.ts +99 -0
- package/src/text/README.md +127 -0
- package/src/text/experimental.ts +126 -0
- package/src/text/fonts/atlas/browser-font-atlas.ts +289 -0
- package/src/text/fonts/atlas/font-atlas.ts +55 -0
- package/src/text/fonts/atlas/lru-cache.ts +37 -0
- package/src/text/fonts/atlas/text-glyph-walker.ts +124 -0
- package/src/text/fonts/atlas/text-metrics.ts +40 -0
- package/src/text/fonts/atlas/text-utils.ts +146 -0
- package/src/text/fonts/build-bitmap-font-atlas.ts +29 -0
- package/src/text/fonts/build-glyph-font-atlas.ts +74 -0
- package/src/text/fonts/build-msdf-font-atlas.ts +229 -0
- package/src/text/fonts/build-sdf-font-atlas.ts +100 -0
- package/src/text/fonts/glyph-pbf.ts +164 -0
- package/src/text/fonts/glyph-range-loader.ts +143 -0
- package/src/text/fonts/helvetiker.ts +1291 -0
- package/src/text/fonts/index.ts +58 -0
- package/src/text/fonts/typeface-font-data.ts +43 -0
- package/src/text/index.ts +44 -0
- package/src/text/text-2d/dictionary-text-renderer.ts +193 -0
- package/src/text/text-2d/experimental.ts +153 -0
- package/src/text/text-2d/gpu-text-data.ts +198 -0
- package/src/text/text-2d/gpu-text-resources.ts +54 -0
- package/src/text/text-2d/index.ts +49 -0
- package/src/text/text-2d/model-utils/gpu-text-expansion.ts +1187 -0
- package/src/text/text-2d/model-utils/gpu-text-types.ts +121 -0
- package/src/text/text-2d/model-utils/gpu-utf8-map.ts +150 -0
- package/src/text/text-2d/model-utils/text-fragment-shaders.ts +119 -0
- package/src/text/text-2d/model-utils/text-fragment-uniforms.ts +46 -0
- package/src/text/text-2d/model-utils/text-layout.ts +463 -0
- package/src/text/text-2d/model-utils/text-model-props.ts +242 -0
- package/src/text/text-2d/model-utils/text-shaders.ts +640 -0
- package/src/text/text-2d/model-utils/text-storage-model-draw.ts +64 -0
- package/src/text/text-2d/model-utils/text-storage-model-utils.ts +68 -0
- package/src/text/text-2d/model-utils/text-storage-state.ts +216 -0
- package/src/text/text-2d/models/text-attribute-model.ts +147 -0
- package/src/text/text-2d/models/text-dictionary-model.ts +187 -0
- package/src/text/text-2d/models/text-storage-model.ts +254 -0
- package/src/text/text-2d/text-renderer.ts +199 -0
- package/src/text/text-3d/extrude.ts +518 -0
- package/src/text/text-3d/font.ts +244 -0
- package/src/text/text-3d/glyph-atlas.ts +330 -0
- package/src/text/text-3d/index.ts +28 -0
- package/src/text/text-3d/paths/curve-path.ts +34 -0
- package/src/text/text-3d/paths/curves.ts +167 -0
- package/src/text/text-3d/paths/path.ts +114 -0
- package/src/text/text-3d/paths/shape-path.ts +180 -0
- package/src/text/text-3d/paths/shape-utils.ts +78 -0
- package/src/text/text-3d/text-geometry.ts +72 -0
- package/src/utils/deep-equal.ts +4 -2
- package/src/utils/get-platform-info.ts +1 -1
- package/src/utils/shader-module-utils.ts +1 -1
|
@@ -0,0 +1,2228 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { Buffer } from '@luma.gl/core';
|
|
5
|
+
import { planGeneratedBufferBatches } from '@luma.gl/graph/gpu-tables';
|
|
6
|
+
import { expandArrowVector } from '@luma.gl/graph/arrow';
|
|
7
|
+
import { getArrowVectorBufferSource, makeArrowFixedSizeListVector } from '@luma.gl/graph/arrow';
|
|
8
|
+
import { makeGPUTableFromArrowTable } from '@luma.gl/graph/arrow';
|
|
9
|
+
import { makeGPUVectorFromArrow } from '@luma.gl/graph/arrow';
|
|
10
|
+
import { getRequiredArrowGPUVectorDataType } from '@luma.gl/graph/_internal/arrow';
|
|
11
|
+
import { isNumericArrowType } from '@luma.gl/graph/arrow';
|
|
12
|
+
import { DynamicBuffer, DynamicTexture } from '@luma.gl/core/dynamic';
|
|
13
|
+
import { DataType, Field, FixedSizeList, Float32, Int16, Schema, Table, Uint16, Uint32, Uint8, Utf8, Vector, makeData, makeVector, util } from 'apache-arrow';
|
|
14
|
+
import { buildTextGpuGlyphDefinitions, createTextDefaultFragmentShaderUniforms, createGpuExpandedCompactInput, createGpuExpandedGeneratedState, createGpuUtf8ExpandedInput, createGpuUtf8ExpandedInputFromBuffers, DEFAULT_TEXT_FS, DEFAULT_TEXT_SHADER_LAYOUT, DEFAULT_TEXT_VS, DEFAULT_CLIPPED_TEXT_SHADER_LAYOUT, DEFAULT_CLIPPED_TEXT_VS, dispatchGpuExpandedTextCompute, dispatchGpuUtf8ExpandedTextCompute, GPU_TEXT_EXPANSION_STORAGE_BUFFER_COUNT, GPU_UTF8_TEXT_EXPANSION_STORAGE_BUFFER_COUNT, ROW_INDEXED_COMPACT_GLYPH_VERTEX_BYTE_STRIDE, createTextStorageGlyphLookup, createTextStorageGlyphMetrics, createTextStorageGlyphPages, createTextStorageGlyphKernings, supportsGpuTextExpansion, supportsGpuUtf8TextExpansion, assertTextStorageGPUVectorInputs } from '@luma.gl/engine/text-experimental';
|
|
15
|
+
import { buildArrowGlyphLayout, buildGpuTextDictionaryCompressedStream, buildGpuExpandedTextStream, buildGpuUtf8TextInput, isArrowUtf8DictionaryType, isArrowUtf8DictionaryVector, isArrowUtf8TextVector, isArrowUtf8Vector } from "./arrow-text.js";
|
|
16
|
+
const GLYPH_OFFSETS_COLUMN = 'glyphOffsets';
|
|
17
|
+
const GLYPH_FRAMES_COLUMN = 'glyphFrames';
|
|
18
|
+
const GLYPH_PAGES_COLUMN = 'glyphPages';
|
|
19
|
+
const GLYPH_CLIP_RECTS_COLUMN = 'glyphClipRects';
|
|
20
|
+
const ROW_INDICES_COLUMN = 'rowIndices';
|
|
21
|
+
const EXPANDED_GLYPH_VERTEX_DATA = 'expandedGlyphVertexData';
|
|
22
|
+
const COMPACT_GLYPH_VERTEX_BYTE_STRIDE = Uint32Array.BYTES_PER_ELEMENT * 2;
|
|
23
|
+
const EXPANDED_GLYPH_VERTEX_BYTE_STRIDE = Uint32Array.BYTES_PER_ELEMENT * 5;
|
|
24
|
+
const CLIPPED_EXPANDED_GLYPH_VERTEX_BYTE_STRIDE = EXPANDED_GLYPH_VERTEX_BYTE_STRIDE + Float32Array.BYTES_PER_ELEMENT * 4;
|
|
25
|
+
const DEFAULT_TEXT_STORAGE_COLOR = [0, 0, 0, 255];
|
|
26
|
+
const DEFAULT_TEXT_STORAGE_ANGLE = 0;
|
|
27
|
+
const DEFAULT_TEXT_STORAGE_SIZE = 32;
|
|
28
|
+
const DEFAULT_TEXT_STORAGE_PIXEL_OFFSET = [0, 0];
|
|
29
|
+
const DEFAULT_TEXT_STORAGE_ANCHOR = 0;
|
|
30
|
+
const DEFAULT_STORAGE_ALIGNMENT_BASELINE = 0;
|
|
31
|
+
const BITMAP_TEXT_SDF_THRESHOLD = -1;
|
|
32
|
+
const INVALID_DICTIONARY_INDEX = 0xffffffff;
|
|
33
|
+
const STORAGE_RENDER_CONFIG_BYTE_LENGTH = Uint32Array.BYTES_PER_ELEMENT * 4;
|
|
34
|
+
const TEXT_DICTIONARY_RENDER_CONFIG_BYTE_LENGTH = Uint32Array.BYTES_PER_ELEMENT * 4;
|
|
35
|
+
/** Build an Arrow glyph table without creating a Model. */
|
|
36
|
+
export function buildArrowTextGlyphTable(props) {
|
|
37
|
+
if (props.labelTable.numRows !== props.texts.length) {
|
|
38
|
+
throw new Error('ArrowTextModel requires labelTable rows to match UTF-8 text rows');
|
|
39
|
+
}
|
|
40
|
+
assertClipRects(props.clipRects, props.texts.length);
|
|
41
|
+
assertColumnAvailable(props.labelTable, GLYPH_OFFSETS_COLUMN);
|
|
42
|
+
assertColumnAvailable(props.labelTable, GLYPH_FRAMES_COLUMN);
|
|
43
|
+
assertColumnAvailable(props.labelTable, GLYPH_PAGES_COLUMN);
|
|
44
|
+
assertColumnAvailable(props.labelTable, GLYPH_CLIP_RECTS_COLUMN);
|
|
45
|
+
assertColumnAvailable(props.labelTable, ROW_INDICES_COLUMN);
|
|
46
|
+
const glyphAttributeBuildStartTime = getNow();
|
|
47
|
+
const glyphLayout = buildArrowGlyphLayout({
|
|
48
|
+
texts: props.texts,
|
|
49
|
+
fontAtlas: props.fontAtlas,
|
|
50
|
+
lineHeight: props.lineHeight,
|
|
51
|
+
characterSet: props.characterSet
|
|
52
|
+
});
|
|
53
|
+
const fields = [];
|
|
54
|
+
const columns = {};
|
|
55
|
+
const glyphRowIndices = makeGlyphRowIndices(glyphLayout.startIndices);
|
|
56
|
+
for (const field of props.labelTable.schema.fields) {
|
|
57
|
+
const vector = props.labelTable.getChild(field.name);
|
|
58
|
+
if (!vector) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (field.name === 'colors' && isArrowTextCharacterColorType(vector.type)) {
|
|
62
|
+
fields.push(new Field(field.name, vector.type.children[0].type, field.nullable, field.metadata));
|
|
63
|
+
columns[field.name] = expandArrowTextCharacterColorRows(vector, glyphLayout.startIndices, props.color);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (!isInstanceCompatibleArrowType(vector.type)) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
fields.push(field);
|
|
70
|
+
columns[field.name] = expandArrowVector(vector, glyphRowIndices, getArrowTextExpansionNullValue(field.name, props));
|
|
71
|
+
}
|
|
72
|
+
fields.push(makeFixedSizeListField(GLYPH_OFFSETS_COLUMN, new Int16(), 2));
|
|
73
|
+
fields.push(makeFixedSizeListField(GLYPH_FRAMES_COLUMN, new Uint16(), 4));
|
|
74
|
+
fields.push(new Field(GLYPH_PAGES_COLUMN, new Uint16(), false));
|
|
75
|
+
if (props.clipRects) {
|
|
76
|
+
fields.push(makeFixedSizeListField(GLYPH_CLIP_RECTS_COLUMN, new Int16(), 4));
|
|
77
|
+
}
|
|
78
|
+
fields.push(new Field(ROW_INDICES_COLUMN, new Uint32(), false));
|
|
79
|
+
columns[GLYPH_OFFSETS_COLUMN] = makeArrowFixedSizeListVector(new Int16(), 2, glyphLayout.glyphOffsets);
|
|
80
|
+
columns[GLYPH_FRAMES_COLUMN] = makeArrowFixedSizeListVector(new Uint16(), 4, glyphLayout.glyphFrames);
|
|
81
|
+
columns[GLYPH_PAGES_COLUMN] = makeNumericArrowVector(new Uint16(), glyphLayout.glyphPages);
|
|
82
|
+
if (props.clipRects) {
|
|
83
|
+
columns[GLYPH_CLIP_RECTS_COLUMN] = expandArrowVector(props.clipRects, glyphRowIndices);
|
|
84
|
+
}
|
|
85
|
+
columns[ROW_INDICES_COLUMN] = makeNumericArrowVector(new Uint32(), makeGlyphRowIndices(glyphLayout.startIndices, props.rowIndexBase));
|
|
86
|
+
const attributeByteLength = getGeneratedAttributeByteLength(columns);
|
|
87
|
+
const glyphAttributeBuildTimeMs = getNow() - glyphAttributeBuildStartTime;
|
|
88
|
+
return {
|
|
89
|
+
table: new Table(new Schema(fields, props.labelTable.schema.metadata), columns),
|
|
90
|
+
glyphLayout,
|
|
91
|
+
characterSet: props.characterSet,
|
|
92
|
+
attributeByteLength,
|
|
93
|
+
glyphAttributeBuildTimeMs
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function resolveArrowTextInputs(props) {
|
|
97
|
+
if (!props.sourceVectors) {
|
|
98
|
+
throw new Error('ArrowTextModel requires explicit sourceVectors for CPU glyph expansion');
|
|
99
|
+
}
|
|
100
|
+
assertArrowTextVectorTypes(props);
|
|
101
|
+
assertArrowTextVectorRowAlignment(props);
|
|
102
|
+
assertArrowTextSourceVectorAlignment(props);
|
|
103
|
+
const { sourceVectors } = props;
|
|
104
|
+
const columns = {
|
|
105
|
+
positions: sourceVectors.positions
|
|
106
|
+
};
|
|
107
|
+
if (sourceVectors.colors) {
|
|
108
|
+
columns['colors'] = sourceVectors.colors;
|
|
109
|
+
}
|
|
110
|
+
if (sourceVectors.angles) {
|
|
111
|
+
columns['angles'] = sourceVectors.angles;
|
|
112
|
+
}
|
|
113
|
+
if (sourceVectors.sizes) {
|
|
114
|
+
columns['sizes'] = sourceVectors.sizes;
|
|
115
|
+
}
|
|
116
|
+
if (sourceVectors.pixelOffsets) {
|
|
117
|
+
columns['pixelOffsets'] = sourceVectors.pixelOffsets;
|
|
118
|
+
}
|
|
119
|
+
const labelTable = new Table(columns);
|
|
120
|
+
return {
|
|
121
|
+
labelTable,
|
|
122
|
+
texts: sourceVectors.texts,
|
|
123
|
+
clipRects: sourceVectors.clipRects
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/** Resolves one aligned Arrow source-vector batch for attribute glyph expansion. */
|
|
127
|
+
export function resolveArrowTextBatchInputs(props, batchIndex) {
|
|
128
|
+
const { sourceVectors } = props;
|
|
129
|
+
const columns = {
|
|
130
|
+
positions: getArrowTextSourceBatch(sourceVectors.positions, 'positions', batchIndex)
|
|
131
|
+
};
|
|
132
|
+
appendArrowTextBatchSourceColumn(columns, 'colors', sourceVectors.colors, batchIndex);
|
|
133
|
+
appendArrowTextBatchSourceColumn(columns, 'angles', sourceVectors.angles, batchIndex);
|
|
134
|
+
appendArrowTextBatchSourceColumn(columns, 'sizes', sourceVectors.sizes, batchIndex);
|
|
135
|
+
appendArrowTextBatchSourceColumn(columns, 'pixelOffsets', sourceVectors.pixelOffsets, batchIndex);
|
|
136
|
+
return {
|
|
137
|
+
labelTable: new Table(columns),
|
|
138
|
+
texts: getArrowTextSourceBatch(sourceVectors.texts, 'texts', batchIndex),
|
|
139
|
+
clipRects: sourceVectors.clipRects
|
|
140
|
+
? getArrowTextSourceBatch(sourceVectors.clipRects, 'clipRects', batchIndex)
|
|
141
|
+
: undefined
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function appendArrowTextBatchSourceColumn(columns, columnName, vector, batchIndex) {
|
|
145
|
+
if (!vector) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
columns[columnName] = getArrowTextSourceBatch(vector, columnName, batchIndex);
|
|
149
|
+
}
|
|
150
|
+
function getArrowTextSourceBatch(vector, vectorName, batchIndex) {
|
|
151
|
+
const data = vector.data[batchIndex];
|
|
152
|
+
if (!data) {
|
|
153
|
+
throw new Error(`Arrow text ${vectorName} source is missing batch ${batchIndex}`);
|
|
154
|
+
}
|
|
155
|
+
return new Vector([data]);
|
|
156
|
+
}
|
|
157
|
+
function getArrowGPUVectorDataType(vector) {
|
|
158
|
+
return getRequiredArrowGPUVectorDataType(vector);
|
|
159
|
+
}
|
|
160
|
+
function isArrowUtf8TextGPUVector(vector) {
|
|
161
|
+
const type = getArrowGPUVectorDataType(vector);
|
|
162
|
+
return type instanceof Utf8 || isArrowUtf8DictionaryType(type);
|
|
163
|
+
}
|
|
164
|
+
function isArrowUtf8DictionaryGPUVector(vector) {
|
|
165
|
+
return isArrowUtf8DictionaryType(getArrowGPUVectorDataType(vector));
|
|
166
|
+
}
|
|
167
|
+
/** Validates the GPUVector Arrow types accepted by attribute text conversion. */
|
|
168
|
+
export function assertArrowTextVectorTypes(props) {
|
|
169
|
+
const textType = getArrowGPUVectorDataType(props.texts);
|
|
170
|
+
const positionType = getArrowGPUVectorDataType(props.positions);
|
|
171
|
+
const colorType = props.colors ? getArrowGPUVectorDataType(props.colors) : undefined;
|
|
172
|
+
const angleType = props.angles ? getArrowGPUVectorDataType(props.angles) : undefined;
|
|
173
|
+
const sizeType = props.sizes ? getArrowGPUVectorDataType(props.sizes) : undefined;
|
|
174
|
+
const pixelOffsetType = props.pixelOffsets
|
|
175
|
+
? getArrowGPUVectorDataType(props.pixelOffsets)
|
|
176
|
+
: undefined;
|
|
177
|
+
if (!isArrowUtf8TextGPUVector(props.texts)) {
|
|
178
|
+
throw new Error('ArrowTextModel texts must be GPUVector');
|
|
179
|
+
}
|
|
180
|
+
if (!isArrowUtf8TextVector(props.sourceVectors.texts)) {
|
|
181
|
+
throw new Error('ArrowTextModel sourceVectors.texts must be Utf8 or Dictionary<Utf8>');
|
|
182
|
+
}
|
|
183
|
+
if (!util.compareTypes(props.sourceVectors.texts.type, textType)) {
|
|
184
|
+
throw new Error('ArrowTextModel sourceVectors.texts type must match GPU texts type');
|
|
185
|
+
}
|
|
186
|
+
if (!DataType.isFixedSizeList(positionType) ||
|
|
187
|
+
positionType.listSize !== 2 ||
|
|
188
|
+
!(positionType.children[0]?.type instanceof Float32)) {
|
|
189
|
+
throw new Error('ArrowTextModel positions must be GPUVector');
|
|
190
|
+
}
|
|
191
|
+
if (colorType && !isArrowTextColorType(colorType)) {
|
|
192
|
+
throw new Error('ArrowTextModel colors must be GPUVector or GPUVector<List<FixedSizeList<Uint8>[4]>>');
|
|
193
|
+
}
|
|
194
|
+
if (angleType && !(angleType instanceof Float32)) {
|
|
195
|
+
throw new Error('ArrowTextModel angles must be GPUVector');
|
|
196
|
+
}
|
|
197
|
+
if (sizeType && !(sizeType instanceof Float32)) {
|
|
198
|
+
throw new Error('ArrowTextModel sizes must be GPUVector');
|
|
199
|
+
}
|
|
200
|
+
if (pixelOffsetType &&
|
|
201
|
+
(!DataType.isFixedSizeList(pixelOffsetType) ||
|
|
202
|
+
pixelOffsetType.listSize !== 2 ||
|
|
203
|
+
!(pixelOffsetType.children[0]?.type instanceof Float32))) {
|
|
204
|
+
throw new Error('ArrowTextModel pixelOffsets must be GPUVector');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function assertArrowTextVectorRowAlignment(props) {
|
|
208
|
+
const rowInputs = [
|
|
209
|
+
['positions', props.positions],
|
|
210
|
+
['texts', props.texts],
|
|
211
|
+
['colors', props.colors],
|
|
212
|
+
['angles', props.angles],
|
|
213
|
+
['sizes', props.sizes],
|
|
214
|
+
['pixelOffsets', props.pixelOffsets],
|
|
215
|
+
['clipRects', props.clipRects]
|
|
216
|
+
];
|
|
217
|
+
const suppliedInputs = rowInputs.filter(([, vector]) => vector !== undefined);
|
|
218
|
+
const [referenceName, referenceVector] = suppliedInputs[0];
|
|
219
|
+
for (const [name, vector] of suppliedInputs.slice(1)) {
|
|
220
|
+
if (vector.length !== referenceVector.length) {
|
|
221
|
+
throw new Error(`ArrowTextModel ${name} rows must match ${referenceName} rows (${vector.length} !== ${referenceVector.length})`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/** Validates that all attribute text GPUVectors preserve matching batch boundaries. */
|
|
226
|
+
export function assertArrowTextVectorBatchAlignment(props) {
|
|
227
|
+
assertArrowTextVectorRowAlignment(props);
|
|
228
|
+
const rowInputs = getArrowTextRowInputs(props);
|
|
229
|
+
const [referenceName, referenceVector] = rowInputs[0];
|
|
230
|
+
for (const [name, vector] of rowInputs.slice(1)) {
|
|
231
|
+
if (vector.data.length !== referenceVector.data.length) {
|
|
232
|
+
throw new Error(`ArrowTextModel ${name} batch count must match ${referenceName} batch count`);
|
|
233
|
+
}
|
|
234
|
+
for (let batchIndex = 0; batchIndex < vector.data.length; batchIndex++) {
|
|
235
|
+
if (vector.data[batchIndex].length !== referenceVector.data[batchIndex].length) {
|
|
236
|
+
throw new Error(`ArrowTextModel ${name} batch ${batchIndex} rows must match ${referenceName}`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function assertArrowTextSourceVectorAlignment(props) {
|
|
242
|
+
const sourceInputs = [
|
|
243
|
+
['positions', props.positions, props.sourceVectors.positions],
|
|
244
|
+
['texts', props.texts, props.sourceVectors.texts],
|
|
245
|
+
['colors', props.colors, props.sourceVectors.colors],
|
|
246
|
+
['angles', props.angles, props.sourceVectors.angles],
|
|
247
|
+
['sizes', props.sizes, props.sourceVectors.sizes],
|
|
248
|
+
['pixelOffsets', props.pixelOffsets, props.sourceVectors.pixelOffsets],
|
|
249
|
+
['clipRects', props.clipRects, props.sourceVectors.clipRects]
|
|
250
|
+
];
|
|
251
|
+
for (const [name, gpuVector, sourceVector] of sourceInputs) {
|
|
252
|
+
if (gpuVector && !sourceVector) {
|
|
253
|
+
throw new Error(`ArrowTextModel ${name} GPU rows require matching sourceVectors rows`);
|
|
254
|
+
}
|
|
255
|
+
if (!gpuVector && sourceVector) {
|
|
256
|
+
throw new Error(`ArrowTextModel sourceVectors.${name} requires matching GPU rows`);
|
|
257
|
+
}
|
|
258
|
+
if (!gpuVector || !sourceVector) {
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
assertSourceVectorMatchesGPUVector('ArrowTextModel', name, gpuVector, sourceVector);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function getArrowTextRowInputs(props) {
|
|
265
|
+
return [
|
|
266
|
+
['positions', props.positions],
|
|
267
|
+
['texts', props.texts],
|
|
268
|
+
['colors', props.colors],
|
|
269
|
+
['angles', props.angles],
|
|
270
|
+
['sizes', props.sizes],
|
|
271
|
+
['pixelOffsets', props.pixelOffsets],
|
|
272
|
+
['clipRects', props.clipRects]
|
|
273
|
+
].filter(([, vector]) => vector !== undefined);
|
|
274
|
+
}
|
|
275
|
+
function assertSourceVectorMatchesGPUVector(ownerName, vectorName, gpuVector, sourceVector) {
|
|
276
|
+
if (sourceVector.length !== gpuVector.length) {
|
|
277
|
+
throw new Error(`${ownerName} sourceVectors.${vectorName} rows must match GPU rows (${sourceVector.length} !== ${gpuVector.length})`);
|
|
278
|
+
}
|
|
279
|
+
if (sourceVector.data.length !== gpuVector.data.length) {
|
|
280
|
+
throw new Error(`${ownerName} sourceVectors.${vectorName} batch count must match GPU batches`);
|
|
281
|
+
}
|
|
282
|
+
for (let batchIndex = 0; batchIndex < sourceVector.data.length; batchIndex++) {
|
|
283
|
+
if (sourceVector.data[batchIndex].length !== gpuVector.data[batchIndex].length) {
|
|
284
|
+
throw new Error(`${ownerName} sourceVectors.${vectorName} batch ${batchIndex} rows must match GPU rows`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function resolveArrowTextStorageInputs(props) {
|
|
289
|
+
if (!props.sourceVectors) {
|
|
290
|
+
throw new Error('ArrowTextStorageModel requires explicit sourceVectors for CPU glyph expansion');
|
|
291
|
+
}
|
|
292
|
+
assertStorageVectorTypes(props);
|
|
293
|
+
assertTextStorageVectorBatchAlignment(props);
|
|
294
|
+
assertStorageSourceVectorAlignment(props);
|
|
295
|
+
const { sourceVectors } = props;
|
|
296
|
+
const batches = [];
|
|
297
|
+
let batchRowIndexBase = props.rowIndexBase ?? 0;
|
|
298
|
+
for (let batchIndex = 0; batchIndex < props.texts.data.length; batchIndex++) {
|
|
299
|
+
const textData = props.texts.data[batchIndex];
|
|
300
|
+
const positionsData = props.positions.data[batchIndex];
|
|
301
|
+
batches.push({
|
|
302
|
+
batchRowIndexBase,
|
|
303
|
+
rowStorageIndexBase: getGpuDataRowStorageIndexBase(positionsData, 'positions', batchIndex),
|
|
304
|
+
texts: getArrowTextSourceBatch(sourceVectors.texts, 'texts', batchIndex),
|
|
305
|
+
clipRects: sourceVectors.clipRects
|
|
306
|
+
? getArrowTextSourceBatch(sourceVectors.clipRects, 'clipRects', batchIndex)
|
|
307
|
+
: undefined,
|
|
308
|
+
positionsBuffer: positionsData.buffer,
|
|
309
|
+
colorsBuffer: props.colors?.data[batchIndex].buffer,
|
|
310
|
+
anglesBuffer: props.angles?.data[batchIndex].buffer,
|
|
311
|
+
sizesBuffer: props.sizes?.data[batchIndex].buffer,
|
|
312
|
+
pixelOffsetsBuffer: props.pixelOffsets?.data[batchIndex].buffer,
|
|
313
|
+
textAnchorsBuffer: props.textAnchors?.data[batchIndex].buffer,
|
|
314
|
+
alignmentBaselinesBuffer: props.alignmentBaselines?.data[batchIndex].buffer
|
|
315
|
+
});
|
|
316
|
+
batchRowIndexBase += textData.length;
|
|
317
|
+
}
|
|
318
|
+
return { texts: sourceVectors.texts, batches };
|
|
319
|
+
}
|
|
320
|
+
function resolveArrowTextDictionaryStorageInputs(props) {
|
|
321
|
+
if (!props.sourceVectors) {
|
|
322
|
+
throw new Error('ArrowTextDictionaryStorageModel requires explicit sourceVectors for compressed dictionary glyph layout');
|
|
323
|
+
}
|
|
324
|
+
assertTextDictionaryStorageVectorTypes(props);
|
|
325
|
+
assertTextStorageVectorBatchAlignment(props, 'ArrowTextDictionaryStorageModel');
|
|
326
|
+
assertTextDictionaryStorageSourceVectorAlignment(props);
|
|
327
|
+
const { sourceVectors } = props;
|
|
328
|
+
const batches = [];
|
|
329
|
+
let batchRowIndexBase = props.rowIndexBase ?? 0;
|
|
330
|
+
for (let batchIndex = 0; batchIndex < props.texts.data.length; batchIndex++) {
|
|
331
|
+
const textData = props.texts.data[batchIndex];
|
|
332
|
+
const positionsData = props.positions.data[batchIndex];
|
|
333
|
+
batches.push({
|
|
334
|
+
batchRowIndexBase,
|
|
335
|
+
rowStorageIndexBase: getGpuDataRowStorageIndexBase(positionsData, 'positions', batchIndex),
|
|
336
|
+
texts: getArrowTextSourceBatch(sourceVectors.texts, 'texts', batchIndex),
|
|
337
|
+
clipRects: sourceVectors.clipRects
|
|
338
|
+
? getArrowTextSourceBatch(sourceVectors.clipRects, 'clipRects', batchIndex)
|
|
339
|
+
: undefined,
|
|
340
|
+
positionsBuffer: positionsData.buffer,
|
|
341
|
+
colorsBuffer: props.colors?.data[batchIndex].buffer,
|
|
342
|
+
anglesBuffer: props.angles?.data[batchIndex].buffer,
|
|
343
|
+
sizesBuffer: props.sizes?.data[batchIndex].buffer,
|
|
344
|
+
pixelOffsetsBuffer: props.pixelOffsets?.data[batchIndex].buffer,
|
|
345
|
+
textAnchorsBuffer: props.textAnchors?.data[batchIndex].buffer,
|
|
346
|
+
alignmentBaselinesBuffer: props.alignmentBaselines?.data[batchIndex].buffer
|
|
347
|
+
});
|
|
348
|
+
batchRowIndexBase += textData.length;
|
|
349
|
+
}
|
|
350
|
+
return { texts: sourceVectors.texts, batches };
|
|
351
|
+
}
|
|
352
|
+
function resolveGPUVectorTextStorageInputs(device, props) {
|
|
353
|
+
assertGPUVectorTextStorageInputTypes(props);
|
|
354
|
+
assertTextStorageVectorBatchAlignment(props, 'TextStorageModel');
|
|
355
|
+
const preparedTextBatches = props.textBatches ?? createGPUVectorTextStorageBatchesFromTexts(device, props);
|
|
356
|
+
if (preparedTextBatches.length !== props.texts.data.length) {
|
|
357
|
+
throw new Error('TextStorageModel textBatches must match texts GPUVector batch count');
|
|
358
|
+
}
|
|
359
|
+
const batches = [];
|
|
360
|
+
let batchRowIndexBase = props.rowIndexBase ?? 0;
|
|
361
|
+
for (let batchIndex = 0; batchIndex < props.texts.data.length; batchIndex++) {
|
|
362
|
+
const textData = props.texts.data[batchIndex];
|
|
363
|
+
const positionsData = props.positions.data[batchIndex];
|
|
364
|
+
const textBatch = preparedTextBatches[batchIndex];
|
|
365
|
+
if (!textBatch) {
|
|
366
|
+
throw new Error(`TextStorageModel textBatches is missing batch ${batchIndex}`);
|
|
367
|
+
}
|
|
368
|
+
if (textBatch.rowCount !== textData.length) {
|
|
369
|
+
throw new Error('TextStorageModel textBatches rows must match texts GPU rows');
|
|
370
|
+
}
|
|
371
|
+
batches.push({
|
|
372
|
+
...textBatch,
|
|
373
|
+
batchRowIndexBase,
|
|
374
|
+
rowStorageIndexBase: getGpuDataRowStorageIndexBase(positionsData, 'positions', batchIndex),
|
|
375
|
+
positionsBuffer: positionsData.buffer,
|
|
376
|
+
colorsBuffer: props.colors?.data[batchIndex].buffer,
|
|
377
|
+
anglesBuffer: props.angles?.data[batchIndex].buffer,
|
|
378
|
+
sizesBuffer: props.sizes?.data[batchIndex].buffer,
|
|
379
|
+
pixelOffsetsBuffer: props.pixelOffsets?.data[batchIndex].buffer,
|
|
380
|
+
textAnchorsBuffer: props.textAnchors?.data[batchIndex].buffer,
|
|
381
|
+
alignmentBaselinesBuffer: props.alignmentBaselines?.data[batchIndex].buffer,
|
|
382
|
+
clipRectsBuffer: props.clipRects
|
|
383
|
+
? getGPUVectorTextStorageClipRectsBuffer(props.clipRects, batchIndex)
|
|
384
|
+
: undefined
|
|
385
|
+
});
|
|
386
|
+
batchRowIndexBase += textData.length;
|
|
387
|
+
}
|
|
388
|
+
return { batches };
|
|
389
|
+
}
|
|
390
|
+
function assertStorageVectorTypes(props) {
|
|
391
|
+
const textType = getArrowGPUVectorDataType(props.texts);
|
|
392
|
+
const positionType = getArrowGPUVectorDataType(props.positions);
|
|
393
|
+
const colorType = props.colors ? getArrowGPUVectorDataType(props.colors) : undefined;
|
|
394
|
+
const angleType = props.angles ? getArrowGPUVectorDataType(props.angles) : undefined;
|
|
395
|
+
const sizeType = props.sizes ? getArrowGPUVectorDataType(props.sizes) : undefined;
|
|
396
|
+
const pixelOffsetType = props.pixelOffsets
|
|
397
|
+
? getArrowGPUVectorDataType(props.pixelOffsets)
|
|
398
|
+
: undefined;
|
|
399
|
+
const textAnchorType = props.textAnchors
|
|
400
|
+
? getArrowGPUVectorDataType(props.textAnchors)
|
|
401
|
+
: undefined;
|
|
402
|
+
const alignmentBaselineType = props.alignmentBaselines
|
|
403
|
+
? getArrowGPUVectorDataType(props.alignmentBaselines)
|
|
404
|
+
: undefined;
|
|
405
|
+
if (!isArrowUtf8TextGPUVector(props.texts)) {
|
|
406
|
+
throw new Error('ArrowTextStorageModel texts must be GPUVector');
|
|
407
|
+
}
|
|
408
|
+
if (!isArrowUtf8TextVector(props.sourceVectors.texts)) {
|
|
409
|
+
throw new Error('ArrowTextStorageModel sourceVectors.texts must be Utf8 or Dictionary<Utf8>');
|
|
410
|
+
}
|
|
411
|
+
if (!util.compareTypes(props.sourceVectors.texts.type, textType)) {
|
|
412
|
+
throw new Error('ArrowTextStorageModel sourceVectors.texts type must match GPU texts type');
|
|
413
|
+
}
|
|
414
|
+
if (!DataType.isFixedSizeList(positionType) ||
|
|
415
|
+
positionType.listSize !== 2 ||
|
|
416
|
+
!(positionType.children[0]?.type instanceof Float32)) {
|
|
417
|
+
throw new Error('ArrowTextStorageModel positions must be GPUVector');
|
|
418
|
+
}
|
|
419
|
+
if (colorType &&
|
|
420
|
+
(!DataType.isFixedSizeList(colorType) ||
|
|
421
|
+
colorType.listSize !== 4 ||
|
|
422
|
+
!(colorType.children[0]?.type instanceof Uint8))) {
|
|
423
|
+
throw new Error('ArrowTextStorageModel colors must be GPUVector');
|
|
424
|
+
}
|
|
425
|
+
if (angleType && !(angleType instanceof Float32)) {
|
|
426
|
+
throw new Error('ArrowTextStorageModel angles must be GPUVector');
|
|
427
|
+
}
|
|
428
|
+
if (sizeType && !(sizeType instanceof Float32)) {
|
|
429
|
+
throw new Error('ArrowTextStorageModel sizes must be GPUVector');
|
|
430
|
+
}
|
|
431
|
+
if (pixelOffsetType &&
|
|
432
|
+
(!DataType.isFixedSizeList(pixelOffsetType) ||
|
|
433
|
+
pixelOffsetType.listSize !== 2 ||
|
|
434
|
+
!(pixelOffsetType.children[0]?.type instanceof Float32))) {
|
|
435
|
+
throw new Error('ArrowTextStorageModel pixelOffsets must be GPUVector');
|
|
436
|
+
}
|
|
437
|
+
if (textAnchorType && !(textAnchorType instanceof Uint8)) {
|
|
438
|
+
throw new Error('ArrowTextStorageModel textAnchors must be GPUVector');
|
|
439
|
+
}
|
|
440
|
+
if (alignmentBaselineType && !(alignmentBaselineType instanceof Uint8)) {
|
|
441
|
+
throw new Error('ArrowTextStorageModel alignmentBaselines must be GPUVector');
|
|
442
|
+
}
|
|
443
|
+
const clipRects = props.sourceVectors.clipRects;
|
|
444
|
+
assertClipRects(clipRects, props.texts.length);
|
|
445
|
+
}
|
|
446
|
+
function assertGPUVectorTextStorageInputTypes(props) {
|
|
447
|
+
assertTextStorageGPUVectorInputs(props);
|
|
448
|
+
}
|
|
449
|
+
function createGPUVectorTextStorageBatchesFromTexts(device, props) {
|
|
450
|
+
return props.texts.data.map((data, batchIndex) => {
|
|
451
|
+
if (data.byteOffset !== 0 || data.byteStride !== 1) {
|
|
452
|
+
throw new Error('TextStorageModel GPUVector UTF-8 batches must be zero-offset byte buffers');
|
|
453
|
+
}
|
|
454
|
+
const { valueOffsets, nullBitmap, valueByteLength } = data;
|
|
455
|
+
if (!valueOffsets || valueByteLength === undefined) {
|
|
456
|
+
throw new Error('TextStorageModel GPUVector UTF-8 batches require row offset metadata');
|
|
457
|
+
}
|
|
458
|
+
const rowByteRanges = new Uint32Array(data.length * 2);
|
|
459
|
+
const startIndices = new Array(data.length + 1);
|
|
460
|
+
startIndices[0] = 0;
|
|
461
|
+
for (let rowIndex = 0; rowIndex < data.length; rowIndex++) {
|
|
462
|
+
const isValid = isGPUVectorTextStorageRowValid(nullBitmap, rowIndex);
|
|
463
|
+
const startIndex = isValid ? (valueOffsets[rowIndex] ?? 0) : 0;
|
|
464
|
+
const endIndex = isValid ? (valueOffsets[rowIndex + 1] ?? startIndex) : startIndex;
|
|
465
|
+
rowByteRanges[rowIndex * 2] = startIndex;
|
|
466
|
+
rowByteRanges[rowIndex * 2 + 1] = endIndex;
|
|
467
|
+
startIndices[rowIndex + 1] = Math.max(startIndices[rowIndex] ?? 0, endIndex);
|
|
468
|
+
}
|
|
469
|
+
const rowByteRangesBuffer = device.createBuffer({
|
|
470
|
+
id: `${props.id || 'text-storage-model'}-utf8-row-byte-ranges-${batchIndex}`,
|
|
471
|
+
usage: Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
472
|
+
data: rowByteRanges.byteLength > 0 ? rowByteRanges : new Uint32Array(2)
|
|
473
|
+
});
|
|
474
|
+
return {
|
|
475
|
+
rowCount: data.length,
|
|
476
|
+
startIndices,
|
|
477
|
+
rowByteRanges,
|
|
478
|
+
rowByteRangesBuffer,
|
|
479
|
+
utf8BytesBuffer: data.buffer,
|
|
480
|
+
byteLength: valueByteLength,
|
|
481
|
+
inputByteLength: rowByteRanges.byteLength + valueByteLength,
|
|
482
|
+
ownsRowByteRangesBuffer: true
|
|
483
|
+
};
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
function isGPUVectorTextStorageRowValid(nullBitmap, rowIndex) {
|
|
487
|
+
if (!nullBitmap) {
|
|
488
|
+
return true;
|
|
489
|
+
}
|
|
490
|
+
return (nullBitmap[rowIndex >> 3] & (1 << (rowIndex & 7))) !== 0;
|
|
491
|
+
}
|
|
492
|
+
function getGPUVectorTextStorageClipRectsBuffer(clipRects, batchIndex) {
|
|
493
|
+
const clipRectsData = clipRects.data[batchIndex];
|
|
494
|
+
if (!clipRectsData) {
|
|
495
|
+
throw new Error(`TextStorageModel clipRects is missing batch ${batchIndex}`);
|
|
496
|
+
}
|
|
497
|
+
if (clipRectsData.byteOffset !== 0 ||
|
|
498
|
+
clipRectsData.byteStride !== Float32Array.BYTES_PER_ELEMENT * 4) {
|
|
499
|
+
throw new Error('TextStorageModel GPUVector clipRects batches must be zero-offset packed Float32x4 buffers');
|
|
500
|
+
}
|
|
501
|
+
return clipRectsData.buffer;
|
|
502
|
+
}
|
|
503
|
+
function assertTextStorageVectorBatchAlignment(props, ownerName = 'ArrowTextStorageModel') {
|
|
504
|
+
const rowInputs = [
|
|
505
|
+
['positions', props.positions],
|
|
506
|
+
['texts', props.texts],
|
|
507
|
+
['colors', props.colors],
|
|
508
|
+
['angles', props.angles],
|
|
509
|
+
['sizes', props.sizes],
|
|
510
|
+
['pixelOffsets', props.pixelOffsets],
|
|
511
|
+
['textAnchors', props.textAnchors],
|
|
512
|
+
['alignmentBaselines', props.alignmentBaselines],
|
|
513
|
+
['clipRects', props.clipRects]
|
|
514
|
+
];
|
|
515
|
+
const suppliedInputs = rowInputs.filter(([, vector]) => vector !== undefined);
|
|
516
|
+
const [referenceName, referenceVector] = suppliedInputs[0];
|
|
517
|
+
for (const [name, vector] of suppliedInputs.slice(1)) {
|
|
518
|
+
if (vector.length !== referenceVector.length) {
|
|
519
|
+
throw new Error(`${ownerName} ${name} rows must match ${referenceName} rows (${vector.length} !== ${referenceVector.length})`);
|
|
520
|
+
}
|
|
521
|
+
if (vector.data.length !== referenceVector.data.length) {
|
|
522
|
+
throw new Error(`${ownerName} ${name} batch count must match ${referenceName} batch count`);
|
|
523
|
+
}
|
|
524
|
+
for (let batchIndex = 0; batchIndex < vector.data.length; batchIndex++) {
|
|
525
|
+
if (vector.data[batchIndex].length !== referenceVector.data[batchIndex].length) {
|
|
526
|
+
throw new Error(`${ownerName} ${name} batch ${batchIndex} rows must match ${referenceName}`);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
function assertStorageSourceVectorAlignment(props) {
|
|
532
|
+
assertSourceVectorMatchesGPUVector('ArrowTextStorageModel', 'texts', props.texts, props.sourceVectors.texts);
|
|
533
|
+
if (props.clipRects && !props.sourceVectors.clipRects) {
|
|
534
|
+
throw new Error('ArrowTextStorageModel clipRects GPU rows require matching sourceVectors rows');
|
|
535
|
+
}
|
|
536
|
+
if (!props.clipRects && props.sourceVectors.clipRects) {
|
|
537
|
+
throw new Error('ArrowTextStorageModel sourceVectors.clipRects requires matching GPU clipRects rows');
|
|
538
|
+
}
|
|
539
|
+
if (props.clipRects && props.sourceVectors.clipRects) {
|
|
540
|
+
assertSourceVectorMatchesGPUVector('ArrowTextStorageModel', 'clipRects', props.clipRects, props.sourceVectors.clipRects);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
function assertTextDictionaryStorageVectorTypes(props) {
|
|
544
|
+
const textType = getArrowGPUVectorDataType(props.texts);
|
|
545
|
+
const positionType = getArrowGPUVectorDataType(props.positions);
|
|
546
|
+
const colorType = props.colors ? getArrowGPUVectorDataType(props.colors) : undefined;
|
|
547
|
+
const angleType = props.angles ? getArrowGPUVectorDataType(props.angles) : undefined;
|
|
548
|
+
const sizeType = props.sizes ? getArrowGPUVectorDataType(props.sizes) : undefined;
|
|
549
|
+
const pixelOffsetType = props.pixelOffsets
|
|
550
|
+
? getArrowGPUVectorDataType(props.pixelOffsets)
|
|
551
|
+
: undefined;
|
|
552
|
+
const textAnchorType = props.textAnchors
|
|
553
|
+
? getArrowGPUVectorDataType(props.textAnchors)
|
|
554
|
+
: undefined;
|
|
555
|
+
const alignmentBaselineType = props.alignmentBaselines
|
|
556
|
+
? getArrowGPUVectorDataType(props.alignmentBaselines)
|
|
557
|
+
: undefined;
|
|
558
|
+
if (!isArrowUtf8DictionaryGPUVector(props.texts)) {
|
|
559
|
+
throw new Error('ArrowTextDictionaryStorageModel texts must be GPUVector');
|
|
560
|
+
}
|
|
561
|
+
if (!isArrowUtf8DictionaryVector(props.sourceVectors.texts)) {
|
|
562
|
+
throw new Error('ArrowTextDictionaryStorageModel sourceVectors.texts must be Dictionary<Utf8>');
|
|
563
|
+
}
|
|
564
|
+
if (!util.compareTypes(props.sourceVectors.texts.type, textType)) {
|
|
565
|
+
throw new Error('ArrowTextDictionaryStorageModel sourceVectors.texts type must match GPU texts type');
|
|
566
|
+
}
|
|
567
|
+
if (!DataType.isFixedSizeList(positionType) ||
|
|
568
|
+
positionType.listSize !== 2 ||
|
|
569
|
+
!(positionType.children[0]?.type instanceof Float32)) {
|
|
570
|
+
throw new Error('ArrowTextDictionaryStorageModel positions must be GPUVector');
|
|
571
|
+
}
|
|
572
|
+
if (colorType &&
|
|
573
|
+
(!DataType.isFixedSizeList(colorType) ||
|
|
574
|
+
colorType.listSize !== 4 ||
|
|
575
|
+
!(colorType.children[0]?.type instanceof Uint8))) {
|
|
576
|
+
throw new Error('ArrowTextDictionaryStorageModel colors must be GPUVector');
|
|
577
|
+
}
|
|
578
|
+
if (angleType && !(angleType instanceof Float32)) {
|
|
579
|
+
throw new Error('ArrowTextDictionaryStorageModel angles must be GPUVector');
|
|
580
|
+
}
|
|
581
|
+
if (sizeType && !(sizeType instanceof Float32)) {
|
|
582
|
+
throw new Error('ArrowTextDictionaryStorageModel sizes must be GPUVector');
|
|
583
|
+
}
|
|
584
|
+
if (pixelOffsetType &&
|
|
585
|
+
(!DataType.isFixedSizeList(pixelOffsetType) ||
|
|
586
|
+
pixelOffsetType.listSize !== 2 ||
|
|
587
|
+
!(pixelOffsetType.children[0]?.type instanceof Float32))) {
|
|
588
|
+
throw new Error('ArrowTextDictionaryStorageModel pixelOffsets must be GPUVector');
|
|
589
|
+
}
|
|
590
|
+
if (textAnchorType && !(textAnchorType instanceof Uint8)) {
|
|
591
|
+
throw new Error('ArrowTextDictionaryStorageModel textAnchors must be GPUVector');
|
|
592
|
+
}
|
|
593
|
+
if (alignmentBaselineType && !(alignmentBaselineType instanceof Uint8)) {
|
|
594
|
+
throw new Error('ArrowTextDictionaryStorageModel alignmentBaselines must be GPUVector');
|
|
595
|
+
}
|
|
596
|
+
const clipRects = props.sourceVectors.clipRects;
|
|
597
|
+
assertClipRects(clipRects, props.texts.length);
|
|
598
|
+
}
|
|
599
|
+
function assertTextDictionaryStorageSourceVectorAlignment(props) {
|
|
600
|
+
assertSourceVectorMatchesGPUVector('ArrowTextDictionaryStorageModel', 'texts', props.texts, props.sourceVectors.texts);
|
|
601
|
+
if (props.clipRects && !props.sourceVectors.clipRects) {
|
|
602
|
+
throw new Error('ArrowTextDictionaryStorageModel clipRects GPU rows require matching sourceVectors rows');
|
|
603
|
+
}
|
|
604
|
+
if (!props.clipRects && props.sourceVectors.clipRects) {
|
|
605
|
+
throw new Error('ArrowTextDictionaryStorageModel sourceVectors.clipRects requires matching GPU clipRects rows');
|
|
606
|
+
}
|
|
607
|
+
if (props.clipRects && props.sourceVectors.clipRects) {
|
|
608
|
+
assertSourceVectorMatchesGPUVector('ArrowTextDictionaryStorageModel', 'clipRects', props.clipRects, props.sourceVectors.clipRects);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
function getGpuDataRowStorageIndexBase(data, vectorName, batchIndex) {
|
|
612
|
+
if (!Number.isFinite(data.byteStride) || data.byteStride <= 0) {
|
|
613
|
+
throw new Error(`ArrowTextStorageModel ${vectorName} batch ${batchIndex} has invalid byte stride`);
|
|
614
|
+
}
|
|
615
|
+
const rowStorageIndexBase = data.byteOffset / data.byteStride;
|
|
616
|
+
if (!Number.isInteger(rowStorageIndexBase)) {
|
|
617
|
+
throw new Error(`ArrowTextStorageModel ${vectorName} batch ${batchIndex} byte offset is not row aligned`);
|
|
618
|
+
}
|
|
619
|
+
return rowStorageIndexBase;
|
|
620
|
+
}
|
|
621
|
+
/** Builds reusable attribute text state for GPU/state-only model construction. */
|
|
622
|
+
export function createArrowTextAttributeState(device, props) {
|
|
623
|
+
return {
|
|
624
|
+
...makeArrowTextModelProps(device, props),
|
|
625
|
+
textProps: props
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
function makeArrowTextModelProps(device, props) {
|
|
629
|
+
const textInputs = resolveArrowTextInputs(props);
|
|
630
|
+
const mappingState = resolveCharacterMapping(props);
|
|
631
|
+
const defaultFragmentShaderUniforms = createTextDefaultFragmentShaderUniforms(props.uniforms, mappingState.fontRenderSettings);
|
|
632
|
+
const glyphTable = buildArrowTextGlyphTable({
|
|
633
|
+
labelTable: textInputs.labelTable,
|
|
634
|
+
texts: textInputs.texts,
|
|
635
|
+
clipRects: textInputs.clipRects,
|
|
636
|
+
fontAtlas: mappingState.fontAtlas,
|
|
637
|
+
lineHeight: mappingState.lineHeight,
|
|
638
|
+
characterSet: mappingState.characterSet,
|
|
639
|
+
rowIndexBase: props.rowIndexBase,
|
|
640
|
+
color: props.color,
|
|
641
|
+
angle: props.angle,
|
|
642
|
+
size: props.size
|
|
643
|
+
});
|
|
644
|
+
const shaderLayout = resolveArrowTextShaderLayout(props);
|
|
645
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
646
|
+
device,
|
|
647
|
+
recordOffsets: glyphTable.glyphLayout.startIndices,
|
|
648
|
+
recordByteStride: textInputs.clipRects
|
|
649
|
+
? CLIPPED_EXPANDED_GLYPH_VERTEX_BYTE_STRIDE
|
|
650
|
+
: EXPANDED_GLYPH_VERTEX_BYTE_STRIDE,
|
|
651
|
+
resourceLabel: 'ArrowTextModel expanded glyph vertex data'
|
|
652
|
+
});
|
|
653
|
+
const expandedGlyphVertexStates = generatedBufferBatches.map(generatedBufferBatch => createExpandedGlyphVertexData(device, props, {
|
|
654
|
+
glyphTable,
|
|
655
|
+
shaderLayout,
|
|
656
|
+
generatedBufferBatch,
|
|
657
|
+
rowIndexBase: 0
|
|
658
|
+
}));
|
|
659
|
+
const firstExpandedGlyphVertexState = expandedGlyphVertexStates[0];
|
|
660
|
+
if (!firstExpandedGlyphVertexState) {
|
|
661
|
+
throw new Error('ArrowTextModel requires at least one generated glyph render batch');
|
|
662
|
+
}
|
|
663
|
+
const renderBatches = generatedBufferBatches.map((generatedBufferBatch, batchIndex) => ({
|
|
664
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
665
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
666
|
+
glyphCount: generatedBufferBatch.recordCount,
|
|
667
|
+
expandedGlyphVertexData: expandedGlyphVertexStates[batchIndex].buffer
|
|
668
|
+
}));
|
|
669
|
+
const expandedGlyphVertexState = firstExpandedGlyphVertexState;
|
|
670
|
+
const { atlasTexture, ownsAtlasTexture } = getTextAtlasTexture(device, props, mappingState.fontAtlas);
|
|
671
|
+
const modelProps = {
|
|
672
|
+
...props,
|
|
673
|
+
vs: props.vs ?? (textInputs.clipRects ? DEFAULT_CLIPPED_TEXT_VS : DEFAULT_TEXT_VS),
|
|
674
|
+
fs: props.fs ?? DEFAULT_TEXT_FS,
|
|
675
|
+
uniforms: defaultFragmentShaderUniforms,
|
|
676
|
+
shaderLayout,
|
|
677
|
+
bindings: {
|
|
678
|
+
...(props.bindings || {}),
|
|
679
|
+
fontAtlasTexture: atlasTexture
|
|
680
|
+
},
|
|
681
|
+
attributes: {
|
|
682
|
+
...(props.attributes || {}),
|
|
683
|
+
[EXPANDED_GLYPH_VERTEX_DATA]: expandedGlyphVertexState.buffer
|
|
684
|
+
},
|
|
685
|
+
bufferLayout: [...(props.bufferLayout || []), expandedGlyphVertexState.bufferLayout],
|
|
686
|
+
vertexCount: props.vertexCount ?? 6,
|
|
687
|
+
instanceCount: glyphTable.glyphLayout.glyphCount,
|
|
688
|
+
table: makeGPUTableFromArrowTable(device, createArrowTextRenderTable(glyphTable.table, generatedBufferBatches), { shaderLayout }),
|
|
689
|
+
tableCount: 'none'
|
|
690
|
+
};
|
|
691
|
+
let destroyed = false;
|
|
692
|
+
return {
|
|
693
|
+
modelProps,
|
|
694
|
+
glyphLayout: glyphTable.glyphLayout,
|
|
695
|
+
glyphTable,
|
|
696
|
+
expandedGlyphVertexData: expandedGlyphVertexState.buffer,
|
|
697
|
+
renderBatches,
|
|
698
|
+
atlasTexture,
|
|
699
|
+
glyphAttributeBuildTimeMs: glyphTable.glyphAttributeBuildTimeMs,
|
|
700
|
+
glyphAttributeByteLength: glyphTable.attributeByteLength,
|
|
701
|
+
fontRenderSettings: mappingState.fontRenderSettings,
|
|
702
|
+
defaultFragmentShaderUniforms,
|
|
703
|
+
mappingState,
|
|
704
|
+
destroy: () => {
|
|
705
|
+
if (destroyed) {
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
destroyed = true;
|
|
709
|
+
if (ownsAtlasTexture) {
|
|
710
|
+
atlasTexture.destroy();
|
|
711
|
+
}
|
|
712
|
+
for (const renderBatch of renderBatches) {
|
|
713
|
+
renderBatch.expandedGlyphVertexData.destroy();
|
|
714
|
+
}
|
|
715
|
+
modelProps.table?.destroy();
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
/** Resolves the attribute text shader layout, selecting the clipped layout when needed. */
|
|
720
|
+
export function resolveArrowTextShaderLayout(props) {
|
|
721
|
+
return (props.shaderLayout ??
|
|
722
|
+
(props.clipRects ? DEFAULT_CLIPPED_TEXT_SHADER_LAYOUT : DEFAULT_TEXT_SHADER_LAYOUT));
|
|
723
|
+
}
|
|
724
|
+
/** Builds the glyph render table and splits it to match generated buffer batches when needed. */
|
|
725
|
+
export function createArrowTextRenderTable(glyphTable, generatedBufferBatches) {
|
|
726
|
+
const generatedGlyphColumnNames = new Set([
|
|
727
|
+
GLYPH_OFFSETS_COLUMN,
|
|
728
|
+
GLYPH_FRAMES_COLUMN,
|
|
729
|
+
GLYPH_PAGES_COLUMN,
|
|
730
|
+
GLYPH_CLIP_RECTS_COLUMN,
|
|
731
|
+
ROW_INDICES_COLUMN
|
|
732
|
+
]);
|
|
733
|
+
const fields = [];
|
|
734
|
+
const columns = {};
|
|
735
|
+
for (const field of glyphTable.schema.fields) {
|
|
736
|
+
if (generatedGlyphColumnNames.has(field.name)) {
|
|
737
|
+
continue;
|
|
738
|
+
}
|
|
739
|
+
const vector = glyphTable.getChild(field.name);
|
|
740
|
+
if (!vector) {
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
fields.push(field);
|
|
744
|
+
columns[field.name] = vector;
|
|
745
|
+
}
|
|
746
|
+
const renderTable = new Table(new Schema(fields, new Map(glyphTable.schema.metadata)), columns);
|
|
747
|
+
if (!generatedBufferBatches || generatedBufferBatches.length <= 1) {
|
|
748
|
+
return renderTable;
|
|
749
|
+
}
|
|
750
|
+
const recordBatches = generatedBufferBatches.flatMap(batch => renderTable.slice(batch.recordStart, batch.recordEnd).batches);
|
|
751
|
+
return new Table(renderTable.schema, recordBatches);
|
|
752
|
+
}
|
|
753
|
+
/** Creates the interleaved expanded glyph vertex buffer consumed by the attribute model. */
|
|
754
|
+
export function createExpandedGlyphVertexData(device, props, { glyphTable, shaderLayout, generatedBufferBatch, rowIndexBase = 0 }) {
|
|
755
|
+
const { glyphLayout } = glyphTable;
|
|
756
|
+
const glyphClipRects = glyphTable.table.getChild(GLYPH_CLIP_RECTS_COLUMN);
|
|
757
|
+
const glyphClipRectValues = glyphClipRects
|
|
758
|
+
? getArrowVectorBufferSource(glyphClipRects)
|
|
759
|
+
: undefined;
|
|
760
|
+
const byteStride = glyphClipRectValues
|
|
761
|
+
? CLIPPED_EXPANDED_GLYPH_VERTEX_BYTE_STRIDE
|
|
762
|
+
: EXPANDED_GLYPH_VERTEX_BYTE_STRIDE;
|
|
763
|
+
const byteLength = generatedBufferBatch.byteLength;
|
|
764
|
+
const arrayBuffer = new ArrayBuffer(Math.max(byteLength, byteStride));
|
|
765
|
+
const int16Values = new Int16Array(arrayBuffer);
|
|
766
|
+
const uint16Values = new Uint16Array(arrayBuffer);
|
|
767
|
+
const uint32Values = new Uint32Array(arrayBuffer);
|
|
768
|
+
const float32Values = new Float32Array(arrayBuffer);
|
|
769
|
+
const rowIndices = makeGlyphRowIndices(glyphLayout.startIndices, rowIndexBase);
|
|
770
|
+
for (let glyphIndex = generatedBufferBatch.recordStart; glyphIndex < generatedBufferBatch.recordEnd; glyphIndex++) {
|
|
771
|
+
const batchGlyphIndex = glyphIndex - generatedBufferBatch.recordStart;
|
|
772
|
+
const recordInt16Index = (batchGlyphIndex * byteStride) / Int16Array.BYTES_PER_ELEMENT;
|
|
773
|
+
const recordUint32Index = (batchGlyphIndex * byteStride) / Uint32Array.BYTES_PER_ELEMENT;
|
|
774
|
+
const recordFloat32Index = (batchGlyphIndex * byteStride) / Float32Array.BYTES_PER_ELEMENT;
|
|
775
|
+
const glyphOffsetIndex = glyphIndex * 2;
|
|
776
|
+
const glyphFrameIndex = glyphIndex * 4;
|
|
777
|
+
int16Values[recordInt16Index] = glyphLayout.glyphOffsets[glyphOffsetIndex];
|
|
778
|
+
int16Values[recordInt16Index + 1] = glyphLayout.glyphOffsets[glyphOffsetIndex + 1];
|
|
779
|
+
uint16Values[recordInt16Index + 2] = glyphLayout.glyphFrames[glyphFrameIndex];
|
|
780
|
+
uint16Values[recordInt16Index + 3] = glyphLayout.glyphFrames[glyphFrameIndex + 1];
|
|
781
|
+
uint16Values[recordInt16Index + 4] = glyphLayout.glyphFrames[glyphFrameIndex + 2];
|
|
782
|
+
uint16Values[recordInt16Index + 5] = glyphLayout.glyphFrames[glyphFrameIndex + 3];
|
|
783
|
+
uint16Values[recordInt16Index + 6] = glyphLayout.glyphPages[glyphIndex];
|
|
784
|
+
uint32Values[recordUint32Index + 4] = rowIndices[glyphIndex];
|
|
785
|
+
if (glyphClipRectValues) {
|
|
786
|
+
const glyphClipRectIndex = glyphIndex * 4;
|
|
787
|
+
float32Values[recordFloat32Index + 5] = glyphClipRectValues[glyphClipRectIndex];
|
|
788
|
+
float32Values[recordFloat32Index + 6] = glyphClipRectValues[glyphClipRectIndex + 1];
|
|
789
|
+
float32Values[recordFloat32Index + 7] = glyphClipRectValues[glyphClipRectIndex + 2];
|
|
790
|
+
float32Values[recordFloat32Index + 8] = glyphClipRectValues[glyphClipRectIndex + 3];
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
const shaderAttributeNames = new Set(shaderLayout.attributes.map(attribute => attribute.name));
|
|
794
|
+
const attributes = [];
|
|
795
|
+
if (shaderAttributeNames.has(GLYPH_OFFSETS_COLUMN)) {
|
|
796
|
+
attributes.push({ attribute: GLYPH_OFFSETS_COLUMN, format: 'sint16x2', byteOffset: 0 });
|
|
797
|
+
}
|
|
798
|
+
if (shaderAttributeNames.has(GLYPH_FRAMES_COLUMN)) {
|
|
799
|
+
attributes.push({
|
|
800
|
+
attribute: GLYPH_FRAMES_COLUMN,
|
|
801
|
+
format: 'uint16x4',
|
|
802
|
+
byteOffset: Int16Array.BYTES_PER_ELEMENT * 2
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
if (shaderAttributeNames.has(GLYPH_PAGES_COLUMN)) {
|
|
806
|
+
attributes.push({
|
|
807
|
+
attribute: GLYPH_PAGES_COLUMN,
|
|
808
|
+
format: 'uint16',
|
|
809
|
+
byteOffset: Int16Array.BYTES_PER_ELEMENT * 6
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
if (shaderAttributeNames.has(ROW_INDICES_COLUMN)) {
|
|
813
|
+
attributes.push({
|
|
814
|
+
attribute: ROW_INDICES_COLUMN,
|
|
815
|
+
format: 'uint32',
|
|
816
|
+
byteOffset: Int16Array.BYTES_PER_ELEMENT * 8
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
if (glyphClipRectValues && shaderAttributeNames.has(GLYPH_CLIP_RECTS_COLUMN)) {
|
|
820
|
+
attributes.push({
|
|
821
|
+
attribute: GLYPH_CLIP_RECTS_COLUMN,
|
|
822
|
+
format: 'float32x4',
|
|
823
|
+
byteOffset: EXPANDED_GLYPH_VERTEX_BYTE_STRIDE
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
return {
|
|
827
|
+
buffer: device.createBuffer({
|
|
828
|
+
id: `${props.id || 'arrow-text-model'}-expanded-glyph-vertex-data-` +
|
|
829
|
+
`${generatedBufferBatch.rowStart}`,
|
|
830
|
+
usage: Buffer.VERTEX | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
831
|
+
data: new Uint8Array(arrayBuffer)
|
|
832
|
+
}),
|
|
833
|
+
bufferLayout: {
|
|
834
|
+
name: EXPANDED_GLYPH_VERTEX_DATA,
|
|
835
|
+
stepMode: 'instance',
|
|
836
|
+
byteStride,
|
|
837
|
+
attributes
|
|
838
|
+
},
|
|
839
|
+
byteLength
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
/** Builds reusable WebGPU storage text expansion and row-binding state. */
|
|
843
|
+
export function createArrowTextStorageState(device, props) {
|
|
844
|
+
if (device.type !== 'webgpu') {
|
|
845
|
+
throw new Error('createArrowTextStorageState requires a WebGPU device');
|
|
846
|
+
}
|
|
847
|
+
if (!supportsGpuTextExpansion(device)) {
|
|
848
|
+
throw new Error('createArrowTextStorageState requires at least ' +
|
|
849
|
+
`${GPU_TEXT_EXPANSION_STORAGE_BUFFER_COUNT} storage buffer bindings per shader stage`);
|
|
850
|
+
}
|
|
851
|
+
const textInputs = resolveArrowTextStorageInputs(props);
|
|
852
|
+
const mappingState = resolveCharacterMapping(props);
|
|
853
|
+
const { atlasTexture, ownsAtlasTexture } = getTextAtlasTexture(device, props, mappingState.fontAtlas);
|
|
854
|
+
const useGpuUtf8Decode = Boolean(supportsGpuUtf8TextExpansion(device) &&
|
|
855
|
+
mappingState.characterSet &&
|
|
856
|
+
isArrowUtf8Vector(textInputs.texts));
|
|
857
|
+
const hasGlyphRowIndices = props.rowIndexColumn === true;
|
|
858
|
+
const compactGlyphVertexByteStride = hasGlyphRowIndices
|
|
859
|
+
? ROW_INDEXED_COMPACT_GLYPH_VERTEX_BYTE_STRIDE
|
|
860
|
+
: COMPACT_GLYPH_VERTEX_BYTE_STRIDE;
|
|
861
|
+
let glyphStream;
|
|
862
|
+
let glyphFrames;
|
|
863
|
+
let utf8GlyphDefinitions;
|
|
864
|
+
let glyphCount = 0;
|
|
865
|
+
let glyphAttributeBuildTimeMs = 0;
|
|
866
|
+
let compactStreamByteLength = 0;
|
|
867
|
+
let generatedRenderBufferByteLength = 0;
|
|
868
|
+
let renderControlByteLength = 0;
|
|
869
|
+
let rowStorageByteLength = 0;
|
|
870
|
+
let glyphDefinitionStorageByteLength = 0;
|
|
871
|
+
let transientComputeInputByteLength = 0;
|
|
872
|
+
const ownedRowStorageResources = [];
|
|
873
|
+
const ownedGlyphResources = [];
|
|
874
|
+
const batches = [];
|
|
875
|
+
const renderBatches = [];
|
|
876
|
+
const defaultBuffers = createTextStorageDefaultBuffers(device, props);
|
|
877
|
+
ownedRowStorageResources.push(...defaultBuffers.ownedResources);
|
|
878
|
+
rowStorageByteLength += defaultBuffers.byteLength;
|
|
879
|
+
if (useGpuUtf8Decode) {
|
|
880
|
+
const glyphDefinitions = buildTextGpuGlyphDefinitions(mappingState.characterSet, {
|
|
881
|
+
fontAtlas: mappingState.fontAtlas,
|
|
882
|
+
lineHeight: mappingState.lineHeight
|
|
883
|
+
});
|
|
884
|
+
utf8GlyphDefinitions = glyphDefinitions;
|
|
885
|
+
glyphFrames = createTextStorageGlyphFrames(device, props, glyphDefinitions.glyphFrames);
|
|
886
|
+
glyphDefinitionStorageByteLength = glyphFrames.byteLength;
|
|
887
|
+
for (const [rowBindingBatchIndex, batchInput] of textInputs.batches.entries()) {
|
|
888
|
+
const rowState = createTextStorageBatchRowState(device, props, batchInput, defaultBuffers, mappingState.fontRenderSettings);
|
|
889
|
+
const utf8TextInput = buildGpuUtf8TextInput(batchInput.texts);
|
|
890
|
+
const rowGlyphStarts = createStorageRowGlyphStartsBuffer(device, props, batchInput.batchRowIndexBase, utf8TextInput.startIndices);
|
|
891
|
+
ownedGlyphResources.push(rowGlyphStarts.buffer);
|
|
892
|
+
renderControlByteLength += rowGlyphStarts.byteLength;
|
|
893
|
+
const glyphMetrics = createTextStorageGlyphMetrics(device, { id: props.id }, glyphDefinitions.glyphMetrics);
|
|
894
|
+
const glyphLookup = createTextStorageGlyphLookup(device, { id: props.id }, glyphDefinitions.glyphLookup);
|
|
895
|
+
const glyphPages = createTextStorageGlyphPages(device, { id: props.id }, glyphDefinitions.glyphPages);
|
|
896
|
+
const glyphKernings = createTextStorageGlyphKernings(device, { id: props.id }, glyphDefinitions.glyphKernings);
|
|
897
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
898
|
+
device,
|
|
899
|
+
recordOffsets: utf8TextInput.startIndices,
|
|
900
|
+
recordByteStride: compactGlyphVertexByteStride,
|
|
901
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
902
|
+
resourceLabel: 'ArrowTextStorageModel UTF-8 generated glyph vertex data'
|
|
903
|
+
});
|
|
904
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
905
|
+
const partitionedUtf8TextInput = createPartitionedGpuUtf8TextInput(utf8TextInput, generatedBufferBatch);
|
|
906
|
+
const utf8Input = createGpuUtf8ExpandedInput(device, { id: props.id }, {
|
|
907
|
+
utf8TextInput: partitionedUtf8TextInput,
|
|
908
|
+
baselineOffsetY: glyphDefinitions.baselineOffsetY,
|
|
909
|
+
glyphLookupCount: glyphDefinitions.glyphLookup.length / 2,
|
|
910
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
911
|
+
batchRowIndexBase: generatedBufferBatch.rowStart,
|
|
912
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase + generatedBufferBatch.rowStart,
|
|
913
|
+
alignment: createGpuTextAlignmentOptions(props, rowState, mappingState.lineHeight)
|
|
914
|
+
});
|
|
915
|
+
const generated = createGpuExpandedGeneratedState(device, { id: props.id }, partitionedUtf8TextInput.byteLength, hasGlyphRowIndices);
|
|
916
|
+
dispatchGpuUtf8ExpandedTextCompute(device, { id: props.id }, {
|
|
917
|
+
utf8Input,
|
|
918
|
+
glyphLookup,
|
|
919
|
+
glyphMetrics,
|
|
920
|
+
glyphPages,
|
|
921
|
+
glyphKernings,
|
|
922
|
+
generated,
|
|
923
|
+
outputSlotCount: partitionedUtf8TextInput.byteLength,
|
|
924
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
925
|
+
alignment: {
|
|
926
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
927
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(rowState.rowAlignmentBaselinesBuffer)
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
const storageRenderConfigBuffer = createStorageRenderConfigBuffer(device, props, batchInput.batchRowIndexBase, generatedBufferBatch);
|
|
931
|
+
renderBatches.push({
|
|
932
|
+
rowBindingBatchIndex,
|
|
933
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
934
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
935
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
936
|
+
glyphCount: partitionedUtf8TextInput.byteLength,
|
|
937
|
+
compactGlyphVertexData: generated.compactGlyphVertexData,
|
|
938
|
+
storageRenderConfigBuffer
|
|
939
|
+
});
|
|
940
|
+
ownedGlyphResources.push(storageRenderConfigBuffer);
|
|
941
|
+
renderControlByteLength += storageRenderConfigBuffer.byteLength;
|
|
942
|
+
generatedRenderBufferByteLength += generated.byteLength;
|
|
943
|
+
transientComputeInputByteLength += utf8Input.byteLength;
|
|
944
|
+
utf8Input.rowByteRangesBuffer.destroy();
|
|
945
|
+
utf8Input.utf8BytesBuffer.destroy();
|
|
946
|
+
utf8Input.expansionConfigBuffer.destroy();
|
|
947
|
+
}
|
|
948
|
+
batches.push({
|
|
949
|
+
...rowState,
|
|
950
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
951
|
+
rowCount: batchInput.texts.length,
|
|
952
|
+
glyphCount: utf8TextInput.byteLength,
|
|
953
|
+
rowGlyphStartsBuffer: rowGlyphStarts.buffer
|
|
954
|
+
});
|
|
955
|
+
glyphCount += utf8TextInput.byteLength;
|
|
956
|
+
glyphAttributeBuildTimeMs += utf8TextInput.textInputBuildTimeMs;
|
|
957
|
+
compactStreamByteLength += utf8TextInput.inputByteLength;
|
|
958
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
959
|
+
transientComputeInputByteLength +=
|
|
960
|
+
glyphLookup.byteLength +
|
|
961
|
+
glyphMetrics.byteLength +
|
|
962
|
+
glyphPages.byteLength +
|
|
963
|
+
glyphKernings.byteLength;
|
|
964
|
+
ownedRowStorageResources.push(...rowState.ownedResources);
|
|
965
|
+
glyphMetrics.buffer.destroy();
|
|
966
|
+
glyphLookup.buffer.destroy();
|
|
967
|
+
glyphPages.buffer.destroy();
|
|
968
|
+
glyphKernings.buffer.destroy();
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
else {
|
|
972
|
+
for (const [batchIndex, batchInput] of textInputs.batches.entries()) {
|
|
973
|
+
const rowState = createTextStorageBatchRowState(device, props, batchInput, defaultBuffers, mappingState.fontRenderSettings);
|
|
974
|
+
const batchGlyphStream = buildGpuExpandedTextStream({
|
|
975
|
+
texts: batchInput.texts,
|
|
976
|
+
fontAtlas: mappingState.fontAtlas,
|
|
977
|
+
lineHeight: mappingState.lineHeight,
|
|
978
|
+
characterSet: mappingState.characterSet
|
|
979
|
+
});
|
|
980
|
+
const rowGlyphStarts = createStorageRowGlyphStartsBuffer(device, props, batchInput.batchRowIndexBase, batchGlyphStream.startIndices);
|
|
981
|
+
ownedGlyphResources.push(rowGlyphStarts.buffer);
|
|
982
|
+
renderControlByteLength += rowGlyphStarts.byteLength;
|
|
983
|
+
glyphStream ??= batchGlyphStream;
|
|
984
|
+
glyphFrames ??= createTextStorageGlyphFrames(device, props, batchGlyphStream.glyphFrames);
|
|
985
|
+
if (batchIndex === 0) {
|
|
986
|
+
glyphDefinitionStorageByteLength = glyphFrames.byteLength;
|
|
987
|
+
}
|
|
988
|
+
const glyphMetrics = createTextStorageGlyphMetrics(device, { id: props.id }, batchGlyphStream.glyphMetrics);
|
|
989
|
+
const glyphPages = createTextStorageGlyphPages(device, { id: props.id }, batchGlyphStream.glyphPages);
|
|
990
|
+
const glyphKernings = createTextStorageGlyphKernings(device, { id: props.id }, batchGlyphStream.glyphKernings);
|
|
991
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
992
|
+
device,
|
|
993
|
+
recordOffsets: batchGlyphStream.startIndices,
|
|
994
|
+
recordByteStride: compactGlyphVertexByteStride,
|
|
995
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
996
|
+
resourceLabel: 'ArrowTextStorageModel compact generated glyph vertex data'
|
|
997
|
+
});
|
|
998
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
999
|
+
const partitionedGlyphStream = createPartitionedGpuExpandedTextStream(batchGlyphStream, generatedBufferBatch);
|
|
1000
|
+
const compactInput = createGpuExpandedCompactInput(device, { id: props.id }, partitionedGlyphStream, generatedBufferBatch.rowStart, createGpuTextAlignmentOptions(props, rowState, mappingState.lineHeight), batchInput.rowStorageIndexBase + generatedBufferBatch.rowStart);
|
|
1001
|
+
const generated = createGpuExpandedGeneratedState(device, { id: props.id }, partitionedGlyphStream.glyphCount, hasGlyphRowIndices);
|
|
1002
|
+
dispatchGpuExpandedTextCompute(device, { id: props.id }, {
|
|
1003
|
+
compactInput,
|
|
1004
|
+
glyphMetrics,
|
|
1005
|
+
glyphPages,
|
|
1006
|
+
glyphKernings,
|
|
1007
|
+
generated,
|
|
1008
|
+
glyphCount: partitionedGlyphStream.glyphCount,
|
|
1009
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
1010
|
+
alignment: {
|
|
1011
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
1012
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(rowState.rowAlignmentBaselinesBuffer),
|
|
1013
|
+
useRowTextAnchors: Boolean(props.textAnchors),
|
|
1014
|
+
useRowAlignmentBaselines: Boolean(props.alignmentBaselines)
|
|
1015
|
+
}
|
|
1016
|
+
});
|
|
1017
|
+
const storageRenderConfigBuffer = createStorageRenderConfigBuffer(device, props, batchInput.batchRowIndexBase, generatedBufferBatch);
|
|
1018
|
+
renderBatches.push({
|
|
1019
|
+
rowBindingBatchIndex: batchIndex,
|
|
1020
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
1021
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
1022
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
1023
|
+
glyphCount: partitionedGlyphStream.glyphCount,
|
|
1024
|
+
compactGlyphVertexData: generated.compactGlyphVertexData,
|
|
1025
|
+
storageRenderConfigBuffer
|
|
1026
|
+
});
|
|
1027
|
+
ownedGlyphResources.push(storageRenderConfigBuffer);
|
|
1028
|
+
renderControlByteLength += storageRenderConfigBuffer.byteLength;
|
|
1029
|
+
generatedRenderBufferByteLength += generated.byteLength;
|
|
1030
|
+
transientComputeInputByteLength += compactInput.byteLength;
|
|
1031
|
+
compactInput.glyphRangesBuffer.destroy();
|
|
1032
|
+
compactInput.glyphIdsBuffer.destroy();
|
|
1033
|
+
compactInput.expansionConfigBuffer.destroy();
|
|
1034
|
+
}
|
|
1035
|
+
batches.push({
|
|
1036
|
+
...rowState,
|
|
1037
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
1038
|
+
rowCount: batchInput.texts.length,
|
|
1039
|
+
glyphCount: batchGlyphStream.glyphCount,
|
|
1040
|
+
rowGlyphStartsBuffer: rowGlyphStarts.buffer
|
|
1041
|
+
});
|
|
1042
|
+
glyphCount += batchGlyphStream.glyphCount;
|
|
1043
|
+
glyphAttributeBuildTimeMs += batchGlyphStream.glyphStreamBuildTimeMs;
|
|
1044
|
+
compactStreamByteLength += batchGlyphStream.compactStreamByteLength;
|
|
1045
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
1046
|
+
transientComputeInputByteLength +=
|
|
1047
|
+
glyphMetrics.byteLength + glyphPages.byteLength + glyphKernings.byteLength;
|
|
1048
|
+
ownedRowStorageResources.push(...rowState.ownedResources);
|
|
1049
|
+
glyphMetrics.buffer.destroy();
|
|
1050
|
+
glyphPages.buffer.destroy();
|
|
1051
|
+
glyphKernings.buffer.destroy();
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
glyphFrames ??= createTextStorageGlyphFrames(device, props, new Float32Array(4));
|
|
1055
|
+
let destroyed = false;
|
|
1056
|
+
const storageState = {
|
|
1057
|
+
glyphStream,
|
|
1058
|
+
atlasTexture,
|
|
1059
|
+
characterSet: mappingState.characterSet,
|
|
1060
|
+
glyphCount,
|
|
1061
|
+
glyphAttributeBuildTimeMs,
|
|
1062
|
+
glyphAttributeByteLength: generatedRenderBufferByteLength + renderControlByteLength,
|
|
1063
|
+
compactStreamBuildTimeMs: glyphAttributeBuildTimeMs,
|
|
1064
|
+
compactStreamByteLength,
|
|
1065
|
+
generatedRenderBufferByteLength,
|
|
1066
|
+
renderControlByteLength,
|
|
1067
|
+
rowStorageByteLength,
|
|
1068
|
+
glyphDefinitionStorageByteLength,
|
|
1069
|
+
transientComputeInputByteLength,
|
|
1070
|
+
hasGlyphRowIndices,
|
|
1071
|
+
fontRenderSettings: mappingState.fontRenderSettings,
|
|
1072
|
+
batches,
|
|
1073
|
+
renderBatches,
|
|
1074
|
+
ownedRowBindingResources: ownedRowStorageResources,
|
|
1075
|
+
ownedGlyphResources,
|
|
1076
|
+
glyphFramesBuffer: glyphFrames.buffer,
|
|
1077
|
+
arrowAppendContext: {
|
|
1078
|
+
defaultBuffers,
|
|
1079
|
+
mappingState,
|
|
1080
|
+
useGpuUtf8Decode,
|
|
1081
|
+
utf8GlyphDefinitions
|
|
1082
|
+
},
|
|
1083
|
+
destroy: () => {
|
|
1084
|
+
if (destroyed) {
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
destroyed = true;
|
|
1088
|
+
if (ownsAtlasTexture) {
|
|
1089
|
+
atlasTexture.destroy();
|
|
1090
|
+
}
|
|
1091
|
+
destroyTextStorageResources(ownedRowStorageResources);
|
|
1092
|
+
destroyTextStorageResources(ownedGlyphResources);
|
|
1093
|
+
glyphFrames.buffer.destroy();
|
|
1094
|
+
for (const renderBatch of renderBatches) {
|
|
1095
|
+
renderBatch.compactGlyphVertexData.destroy();
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
return storageState;
|
|
1100
|
+
}
|
|
1101
|
+
/** Builds reusable WebGPU storage text state directly from GPUVector inputs. */
|
|
1102
|
+
export function createTextStorageStateFromGPUVectors(device, props) {
|
|
1103
|
+
if (device.type !== 'webgpu') {
|
|
1104
|
+
throw new Error('createTextStorageStateFromGPUVectors requires a WebGPU device');
|
|
1105
|
+
}
|
|
1106
|
+
if (!supportsGpuUtf8TextExpansion(device)) {
|
|
1107
|
+
throw new Error('createTextStorageStateFromGPUVectors requires at least ' +
|
|
1108
|
+
`${GPU_UTF8_TEXT_EXPANSION_STORAGE_BUFFER_COUNT} storage buffer bindings per shader stage`);
|
|
1109
|
+
}
|
|
1110
|
+
const textInputs = resolveGPUVectorTextStorageInputs(device, props);
|
|
1111
|
+
const mappingState = resolveGPUVectorStorageCharacterMapping(props);
|
|
1112
|
+
const characterSet = mappingState.characterSet ?? new Set(Object.keys(mappingState.fontAtlas.mapping));
|
|
1113
|
+
const { atlasTexture, ownsAtlasTexture } = getTextAtlasTexture(device, props, mappingState.fontAtlas);
|
|
1114
|
+
const glyphDefinitions = buildTextGpuGlyphDefinitions(characterSet, {
|
|
1115
|
+
fontAtlas: mappingState.fontAtlas,
|
|
1116
|
+
lineHeight: mappingState.lineHeight
|
|
1117
|
+
});
|
|
1118
|
+
const glyphFrames = createTextStorageGlyphFrames(device, props, glyphDefinitions.glyphFrames);
|
|
1119
|
+
const hasGlyphRowIndices = props.rowIndexColumn === true;
|
|
1120
|
+
const compactGlyphVertexByteStride = hasGlyphRowIndices
|
|
1121
|
+
? ROW_INDEXED_COMPACT_GLYPH_VERTEX_BYTE_STRIDE
|
|
1122
|
+
: COMPACT_GLYPH_VERTEX_BYTE_STRIDE;
|
|
1123
|
+
let glyphCount = 0;
|
|
1124
|
+
let compactStreamByteLength = 0;
|
|
1125
|
+
let generatedRenderBufferByteLength = 0;
|
|
1126
|
+
let renderControlByteLength = 0;
|
|
1127
|
+
let rowStorageByteLength = 0;
|
|
1128
|
+
let transientComputeInputByteLength = 0;
|
|
1129
|
+
const ownedRowStorageResources = [];
|
|
1130
|
+
const ownedGlyphResources = [];
|
|
1131
|
+
const batches = [];
|
|
1132
|
+
const renderBatches = [];
|
|
1133
|
+
const defaultBuffers = createTextStorageDefaultBuffers(device, props);
|
|
1134
|
+
ownedRowStorageResources.push(...defaultBuffers.ownedResources);
|
|
1135
|
+
rowStorageByteLength += defaultBuffers.byteLength;
|
|
1136
|
+
for (const [rowBindingBatchIndex, batchInput] of textInputs.batches.entries()) {
|
|
1137
|
+
const rowState = createTextStorageBatchRowState(device, props, batchInput, defaultBuffers, mappingState.fontRenderSettings);
|
|
1138
|
+
const rowGlyphStarts = createStorageRowGlyphStartsBuffer(device, props, batchInput.batchRowIndexBase, batchInput.startIndices);
|
|
1139
|
+
ownedGlyphResources.push(rowGlyphStarts.buffer);
|
|
1140
|
+
renderControlByteLength += rowGlyphStarts.byteLength;
|
|
1141
|
+
const glyphMetrics = createTextStorageGlyphMetrics(device, { id: props.id }, glyphDefinitions.glyphMetrics);
|
|
1142
|
+
const glyphPages = createTextStorageGlyphPages(device, { id: props.id }, glyphDefinitions.glyphPages);
|
|
1143
|
+
const glyphKernings = createTextStorageGlyphKernings(device, { id: props.id }, glyphDefinitions.glyphKernings);
|
|
1144
|
+
const glyphLookup = createTextStorageGlyphLookup(device, { id: props.id }, glyphDefinitions.glyphLookup);
|
|
1145
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
1146
|
+
device,
|
|
1147
|
+
recordOffsets: batchInput.startIndices,
|
|
1148
|
+
recordByteStride: compactGlyphVertexByteStride,
|
|
1149
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
1150
|
+
resourceLabel: 'TextStorageModel GPUVector UTF-8 generated glyph vertex data'
|
|
1151
|
+
});
|
|
1152
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
1153
|
+
const partitionedInput = createPartitionedGpuVectorUtf8TextInput(device, props, batchInput, generatedBufferBatch);
|
|
1154
|
+
const utf8Input = createGpuUtf8ExpandedInputFromBuffers(device, { id: props.id }, {
|
|
1155
|
+
rowByteRangesBuffer: partitionedInput.rowByteRangesBuffer,
|
|
1156
|
+
utf8BytesBuffer: getComputeTextStorageBuffer(batchInput.utf8BytesBuffer),
|
|
1157
|
+
inputByteLength: partitionedInput.inputByteLength,
|
|
1158
|
+
baselineOffsetY: glyphDefinitions.baselineOffsetY,
|
|
1159
|
+
glyphLookupCount: glyphDefinitions.glyphLookup.length / 2,
|
|
1160
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
1161
|
+
batchRowIndexBase: generatedBufferBatch.rowStart,
|
|
1162
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase + generatedBufferBatch.rowStart,
|
|
1163
|
+
outputByteBase: generatedBufferBatch.recordStart,
|
|
1164
|
+
alignment: createGpuTextAlignmentOptions(props, rowState, mappingState.lineHeight)
|
|
1165
|
+
});
|
|
1166
|
+
const generated = createGpuExpandedGeneratedState(device, { id: props.id }, generatedBufferBatch.recordCount, hasGlyphRowIndices);
|
|
1167
|
+
dispatchGpuUtf8ExpandedTextCompute(device, { id: props.id }, {
|
|
1168
|
+
utf8Input,
|
|
1169
|
+
glyphLookup,
|
|
1170
|
+
glyphMetrics,
|
|
1171
|
+
glyphPages,
|
|
1172
|
+
glyphKernings,
|
|
1173
|
+
generated,
|
|
1174
|
+
outputSlotCount: generatedBufferBatch.recordCount,
|
|
1175
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
1176
|
+
alignment: {
|
|
1177
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
1178
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(rowState.rowAlignmentBaselinesBuffer)
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
const storageRenderConfigBuffer = createStorageRenderConfigBuffer(device, props, batchInput.batchRowIndexBase, generatedBufferBatch);
|
|
1182
|
+
renderBatches.push({
|
|
1183
|
+
rowBindingBatchIndex,
|
|
1184
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
1185
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
1186
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
1187
|
+
glyphCount: generatedBufferBatch.recordCount,
|
|
1188
|
+
compactGlyphVertexData: generated.compactGlyphVertexData,
|
|
1189
|
+
storageRenderConfigBuffer
|
|
1190
|
+
});
|
|
1191
|
+
ownedGlyphResources.push(storageRenderConfigBuffer);
|
|
1192
|
+
renderControlByteLength += storageRenderConfigBuffer.byteLength;
|
|
1193
|
+
generatedRenderBufferByteLength += generated.byteLength;
|
|
1194
|
+
transientComputeInputByteLength += utf8Input.byteLength;
|
|
1195
|
+
utf8Input.expansionConfigBuffer.destroy();
|
|
1196
|
+
if (partitionedInput.ownsRowByteRangesBuffer) {
|
|
1197
|
+
partitionedInput.rowByteRangesBuffer.destroy();
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
batches.push({
|
|
1201
|
+
...rowState,
|
|
1202
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
1203
|
+
rowCount: batchInput.rowCount,
|
|
1204
|
+
glyphCount: batchInput.byteLength,
|
|
1205
|
+
rowGlyphStartsBuffer: rowGlyphStarts.buffer
|
|
1206
|
+
});
|
|
1207
|
+
glyphCount += batchInput.byteLength;
|
|
1208
|
+
compactStreamByteLength += batchInput.inputByteLength;
|
|
1209
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
1210
|
+
transientComputeInputByteLength +=
|
|
1211
|
+
glyphLookup.byteLength +
|
|
1212
|
+
glyphMetrics.byteLength +
|
|
1213
|
+
glyphPages.byteLength +
|
|
1214
|
+
glyphKernings.byteLength;
|
|
1215
|
+
ownedRowStorageResources.push(...rowState.ownedResources);
|
|
1216
|
+
glyphMetrics.buffer.destroy();
|
|
1217
|
+
glyphLookup.buffer.destroy();
|
|
1218
|
+
glyphPages.buffer.destroy();
|
|
1219
|
+
glyphKernings.buffer.destroy();
|
|
1220
|
+
if (batchInput.ownsRowByteRangesBuffer) {
|
|
1221
|
+
batchInput.rowByteRangesBuffer.destroy();
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
let destroyed = false;
|
|
1225
|
+
return {
|
|
1226
|
+
atlasTexture,
|
|
1227
|
+
characterSet,
|
|
1228
|
+
glyphCount,
|
|
1229
|
+
glyphAttributeBuildTimeMs: 0,
|
|
1230
|
+
glyphAttributeByteLength: generatedRenderBufferByteLength + renderControlByteLength,
|
|
1231
|
+
compactStreamBuildTimeMs: 0,
|
|
1232
|
+
compactStreamByteLength,
|
|
1233
|
+
generatedRenderBufferByteLength,
|
|
1234
|
+
renderControlByteLength,
|
|
1235
|
+
rowStorageByteLength,
|
|
1236
|
+
glyphDefinitionStorageByteLength: glyphFrames.byteLength,
|
|
1237
|
+
transientComputeInputByteLength,
|
|
1238
|
+
hasGlyphRowIndices,
|
|
1239
|
+
fontRenderSettings: mappingState.fontRenderSettings,
|
|
1240
|
+
glyphFramesBuffer: glyphFrames.buffer,
|
|
1241
|
+
batches,
|
|
1242
|
+
renderBatches,
|
|
1243
|
+
ownedRowBindingResources: ownedRowStorageResources,
|
|
1244
|
+
ownedGlyphResources,
|
|
1245
|
+
destroy: () => {
|
|
1246
|
+
if (destroyed) {
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
destroyed = true;
|
|
1250
|
+
if (ownsAtlasTexture) {
|
|
1251
|
+
atlasTexture.destroy();
|
|
1252
|
+
}
|
|
1253
|
+
destroyTextStorageResources(ownedRowStorageResources);
|
|
1254
|
+
destroyTextStorageResources(ownedGlyphResources);
|
|
1255
|
+
glyphFrames.buffer.destroy();
|
|
1256
|
+
for (const renderBatch of renderBatches) {
|
|
1257
|
+
renderBatch.compactGlyphVertexData.destroy();
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
/** Builds reusable WebGPU compressed dictionary text storage state. */
|
|
1263
|
+
export function createArrowTextDictionaryStorageState(device, props) {
|
|
1264
|
+
if (device.type !== 'webgpu') {
|
|
1265
|
+
throw new Error('createArrowTextDictionaryStorageState requires a WebGPU device');
|
|
1266
|
+
}
|
|
1267
|
+
const textInputs = resolveArrowTextDictionaryStorageInputs(props);
|
|
1268
|
+
const mappingState = resolveCharacterMapping(props);
|
|
1269
|
+
const { atlasTexture, ownsAtlasTexture } = getTextAtlasTexture(device, props, mappingState.fontAtlas);
|
|
1270
|
+
let glyphStream;
|
|
1271
|
+
let glyphCount = 0;
|
|
1272
|
+
let dictionaryGlyphCount = 0;
|
|
1273
|
+
let dictionaryValueCount = 0;
|
|
1274
|
+
let glyphAttributeBuildTimeMs = 0;
|
|
1275
|
+
let compactStreamByteLength = 0;
|
|
1276
|
+
let generatedRenderBufferByteLength = 0;
|
|
1277
|
+
let rowStorageByteLength = 0;
|
|
1278
|
+
let glyphDefinitionStorageByteLength = 0;
|
|
1279
|
+
const ownedRowStorageResources = [];
|
|
1280
|
+
const ownedDictionaryResources = [];
|
|
1281
|
+
const batches = [];
|
|
1282
|
+
const renderBatches = [];
|
|
1283
|
+
const defaultBuffers = createTextStorageDefaultBuffers(device, props);
|
|
1284
|
+
ownedRowStorageResources.push(...defaultBuffers.ownedResources);
|
|
1285
|
+
rowStorageByteLength += defaultBuffers.byteLength;
|
|
1286
|
+
for (const [rowBindingBatchIndex, batchInput] of textInputs.batches.entries()) {
|
|
1287
|
+
// Row/style buffers stay row-aligned and are shared with the storage text path.
|
|
1288
|
+
// The dictionary-specific buffers below only describe text content.
|
|
1289
|
+
const rowState = createTextStorageBatchRowState(device, props, batchInput, defaultBuffers, mappingState.fontRenderSettings);
|
|
1290
|
+
const batchGlyphStream = buildGpuTextDictionaryCompressedStream({
|
|
1291
|
+
texts: batchInput.texts,
|
|
1292
|
+
fontAtlas: mappingState.fontAtlas,
|
|
1293
|
+
lineHeight: mappingState.lineHeight,
|
|
1294
|
+
characterSet: mappingState.characterSet
|
|
1295
|
+
});
|
|
1296
|
+
// One record per row plus a terminal sentinel lets the shader recover the
|
|
1297
|
+
// row for an instance_index by binary-searching visible glyph starts.
|
|
1298
|
+
const rowDictionaryRecords = createTextDictionaryRowRecords(batchGlyphStream);
|
|
1299
|
+
const rowDictionaryRecordsBuffer = createTextDictionaryStorageBuffer(device, props, `row-dictionary-records-${batchInput.batchRowIndexBase}`, rowDictionaryRecords, new Uint32Array(2));
|
|
1300
|
+
// One range per unique dictionary value. Repeated rows reference these
|
|
1301
|
+
// ranges instead of storing their own glyph ids and layout offsets.
|
|
1302
|
+
const dictionaryGlyphRangesBuffer = createTextDictionaryStorageBuffer(device, props, `dictionary-glyph-ranges-${batchInput.batchRowIndexBase}`, batchGlyphStream.dictionaryGlyphRanges, new Uint32Array(2));
|
|
1303
|
+
// Shared glyph layout records for dictionary strings in this Arrow batch.
|
|
1304
|
+
// This is the main compressed payload and scales with unique dictionary text.
|
|
1305
|
+
const dictionaryGlyphRecordsBuffer = createTextDictionaryStorageBuffer(device, props, `dictionary-glyph-records-${batchInput.batchRowIndexBase}`, batchGlyphStream.dictionaryGlyphRecords, new Uint32Array(2));
|
|
1306
|
+
const glyphFrames = createTextStorageGlyphFrames(device, props, batchGlyphStream.glyphFrames);
|
|
1307
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
1308
|
+
device,
|
|
1309
|
+
recordOffsets: batchGlyphStream.startIndices,
|
|
1310
|
+
// The dictionary model does not allocate a generated vertex buffer; the
|
|
1311
|
+
// planner is used only to split draw instance counts by device limits.
|
|
1312
|
+
recordByteStride: 1,
|
|
1313
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
1314
|
+
resourceLabel: 'ArrowTextDictionaryStorageModel glyph instances'
|
|
1315
|
+
});
|
|
1316
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
1317
|
+
const dictionaryRenderConfigBuffer = createTextDictionaryRenderConfigBuffer(device, props, batchInput.batchRowIndexBase, generatedBufferBatch);
|
|
1318
|
+
renderBatches.push({
|
|
1319
|
+
rowBindingBatchIndex,
|
|
1320
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
1321
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
1322
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
1323
|
+
glyphCount: generatedBufferBatch.recordCount,
|
|
1324
|
+
dictionaryRenderConfigBuffer
|
|
1325
|
+
});
|
|
1326
|
+
ownedDictionaryResources.push(dictionaryRenderConfigBuffer);
|
|
1327
|
+
compactStreamByteLength += dictionaryRenderConfigBuffer.byteLength;
|
|
1328
|
+
}
|
|
1329
|
+
batches.push({
|
|
1330
|
+
...rowState,
|
|
1331
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
1332
|
+
rowCount: batchInput.texts.length,
|
|
1333
|
+
glyphCount: batchGlyphStream.glyphCount,
|
|
1334
|
+
rowDictionaryRecordsBuffer,
|
|
1335
|
+
dictionaryGlyphRangesBuffer,
|
|
1336
|
+
dictionaryGlyphRecordsBuffer,
|
|
1337
|
+
glyphFramesBuffer: glyphFrames.buffer,
|
|
1338
|
+
dictionaryGlyphCount: batchGlyphStream.dictionaryGlyphCount,
|
|
1339
|
+
dictionaryValueCount: batchGlyphStream.dictionaryValueCount
|
|
1340
|
+
});
|
|
1341
|
+
glyphStream ??= batchGlyphStream;
|
|
1342
|
+
glyphCount += batchGlyphStream.glyphCount;
|
|
1343
|
+
dictionaryGlyphCount += batchGlyphStream.dictionaryGlyphCount;
|
|
1344
|
+
dictionaryValueCount += batchGlyphStream.dictionaryValueCount;
|
|
1345
|
+
glyphAttributeBuildTimeMs += batchGlyphStream.glyphStreamBuildTimeMs;
|
|
1346
|
+
compactStreamByteLength +=
|
|
1347
|
+
rowDictionaryRecords.byteLength +
|
|
1348
|
+
batchGlyphStream.dictionaryGlyphRanges.byteLength +
|
|
1349
|
+
batchGlyphStream.dictionaryGlyphRecords.byteLength;
|
|
1350
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
1351
|
+
glyphDefinitionStorageByteLength += glyphFrames.byteLength;
|
|
1352
|
+
ownedRowStorageResources.push(...rowState.ownedResources);
|
|
1353
|
+
ownedDictionaryResources.push(rowDictionaryRecordsBuffer, dictionaryGlyphRangesBuffer, dictionaryGlyphRecordsBuffer, glyphFrames.buffer);
|
|
1354
|
+
}
|
|
1355
|
+
let destroyed = false;
|
|
1356
|
+
const storageState = {
|
|
1357
|
+
glyphStream,
|
|
1358
|
+
atlasTexture,
|
|
1359
|
+
characterSet: mappingState.characterSet,
|
|
1360
|
+
glyphCount,
|
|
1361
|
+
dictionaryGlyphCount,
|
|
1362
|
+
dictionaryValueCount,
|
|
1363
|
+
glyphAttributeBuildTimeMs,
|
|
1364
|
+
glyphAttributeByteLength: generatedRenderBufferByteLength,
|
|
1365
|
+
compactStreamBuildTimeMs: glyphAttributeBuildTimeMs,
|
|
1366
|
+
compactStreamByteLength,
|
|
1367
|
+
generatedRenderBufferByteLength,
|
|
1368
|
+
rowStorageByteLength,
|
|
1369
|
+
glyphDefinitionStorageByteLength,
|
|
1370
|
+
transientComputeInputByteLength: 0,
|
|
1371
|
+
fontRenderSettings: mappingState.fontRenderSettings,
|
|
1372
|
+
batches,
|
|
1373
|
+
renderBatches,
|
|
1374
|
+
ownedRowBindingResources: ownedRowStorageResources,
|
|
1375
|
+
ownedDictionaryResources,
|
|
1376
|
+
destroy: () => {
|
|
1377
|
+
if (destroyed) {
|
|
1378
|
+
return;
|
|
1379
|
+
}
|
|
1380
|
+
destroyed = true;
|
|
1381
|
+
if (ownsAtlasTexture) {
|
|
1382
|
+
atlasTexture.destroy();
|
|
1383
|
+
}
|
|
1384
|
+
destroyTextStorageResources(ownedRowStorageResources);
|
|
1385
|
+
destroyTextStorageResources(ownedDictionaryResources);
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
return storageState;
|
|
1389
|
+
}
|
|
1390
|
+
function createTextDictionaryRenderConfigBuffer(device, props, batchRowIndexBase, generatedBufferBatch) {
|
|
1391
|
+
// The render config is the only per-render-batch dictionary allocation. It
|
|
1392
|
+
// tells WGSL which visible-glyph instance range and row range this draw owns.
|
|
1393
|
+
const data = new Uint32Array(TEXT_DICTIONARY_RENDER_CONFIG_BYTE_LENGTH / Uint32Array.BYTES_PER_ELEMENT);
|
|
1394
|
+
data[0] = generatedBufferBatch.recordStart;
|
|
1395
|
+
data[1] = generatedBufferBatch.rowStart;
|
|
1396
|
+
data[2] = generatedBufferBatch.rowEnd;
|
|
1397
|
+
data[3] = 0;
|
|
1398
|
+
return new DynamicBuffer(device, {
|
|
1399
|
+
id: `${props.id || 'arrow-text-dictionary-storage-model'}-render-config-` +
|
|
1400
|
+
`${batchRowIndexBase}-${generatedBufferBatch.rowStart}`,
|
|
1401
|
+
usage: Buffer.UNIFORM | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
1402
|
+
data
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
function createStorageRenderConfigBuffer(device, props, batchRowIndexBase, generatedBufferBatch) {
|
|
1406
|
+
const data = new Uint32Array(STORAGE_RENDER_CONFIG_BYTE_LENGTH / Uint32Array.BYTES_PER_ELEMENT);
|
|
1407
|
+
data[0] = generatedBufferBatch.recordStart;
|
|
1408
|
+
data[1] = generatedBufferBatch.rowStart;
|
|
1409
|
+
data[2] = generatedBufferBatch.rowEnd;
|
|
1410
|
+
data[3] = 0;
|
|
1411
|
+
return new DynamicBuffer(device, {
|
|
1412
|
+
id: `${props.id || 'arrow-text-storage-model'}-render-config-` +
|
|
1413
|
+
`${batchRowIndexBase}-${generatedBufferBatch.rowStart}`,
|
|
1414
|
+
usage: Buffer.UNIFORM | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
1415
|
+
data
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1418
|
+
function createStorageRowGlyphStartsBuffer(device, props, batchRowIndexBase, startIndices) {
|
|
1419
|
+
const rowGlyphStarts = new Uint32Array(startIndices);
|
|
1420
|
+
return {
|
|
1421
|
+
buffer: device.createBuffer({
|
|
1422
|
+
id: `${props.id || 'arrow-text-storage-model'}-row-glyph-starts-${batchRowIndexBase}`,
|
|
1423
|
+
usage: Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
1424
|
+
data: rowGlyphStarts.byteLength > 0 ? rowGlyphStarts : new Uint32Array(1)
|
|
1425
|
+
}),
|
|
1426
|
+
byteLength: rowGlyphStarts.byteLength
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
function createTextDictionaryRowRecords(glyphStream) {
|
|
1430
|
+
const rowCount = glyphStream.rowDictionaryIndices.length;
|
|
1431
|
+
const records = new Uint32Array((rowCount + 1) * 2);
|
|
1432
|
+
// Pair each row's dictionary key with the first visible glyph occurrence for
|
|
1433
|
+
// that row. The final sentinel makes row-end lookup a single indexed read.
|
|
1434
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
1435
|
+
records[rowIndex * 2] = glyphStream.rowDictionaryIndices[rowIndex] ?? INVALID_DICTIONARY_INDEX;
|
|
1436
|
+
records[rowIndex * 2 + 1] = glyphStream.rowGlyphRanges[rowIndex * 2] ?? 0;
|
|
1437
|
+
}
|
|
1438
|
+
records[rowCount * 2] = INVALID_DICTIONARY_INDEX;
|
|
1439
|
+
records[rowCount * 2 + 1] = glyphStream.glyphCount;
|
|
1440
|
+
return records;
|
|
1441
|
+
}
|
|
1442
|
+
function getNow() {
|
|
1443
|
+
return globalThis.performance?.now() ?? Date.now();
|
|
1444
|
+
}
|
|
1445
|
+
function resolveCharacterMapping(props) {
|
|
1446
|
+
return resolveFontAtlasMapping(props.fontAtlas, props.lineHeight ?? 1);
|
|
1447
|
+
}
|
|
1448
|
+
function resolveGPUVectorStorageCharacterMapping(props) {
|
|
1449
|
+
return resolveFontAtlasMapping(props.fontAtlas, props.lineHeight ?? 1);
|
|
1450
|
+
}
|
|
1451
|
+
function resolveFontAtlasMapping(fontAtlas, lineHeightMultiplier) {
|
|
1452
|
+
return {
|
|
1453
|
+
lineHeight: lineHeightMultiplier * fontAtlas.lineHeight,
|
|
1454
|
+
characterSet: new Set(Object.keys(fontAtlas.mapping)),
|
|
1455
|
+
fontAtlas,
|
|
1456
|
+
fontRenderSettings: fontAtlas.renderSettings
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
function assertColumnAvailable(table, columnName) {
|
|
1460
|
+
if (table.getChild(columnName)) {
|
|
1461
|
+
throw new Error(`ArrowTextModel labelTable column "${columnName}" is reserved`);
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
function assertClipRects(clipRects, labelCount) {
|
|
1465
|
+
if (!clipRects) {
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
if (clipRects.length !== labelCount) {
|
|
1469
|
+
throw new Error('ArrowTextModel clipRects rows must match UTF-8 text rows');
|
|
1470
|
+
}
|
|
1471
|
+
if (!DataType.isFixedSizeList(clipRects.type) ||
|
|
1472
|
+
clipRects.type.listSize !== 4 ||
|
|
1473
|
+
!(clipRects.type.children[0]?.type instanceof Float32)) {
|
|
1474
|
+
throw new Error('ArrowTextModel clipRects must be FixedSizeList<Float32>[4]');
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
function createTextStorageDefaultBuffers(device, props) {
|
|
1478
|
+
const id = props.id || 'text-storage-model';
|
|
1479
|
+
const colorsVector = createTextStorageOwnedGpuVector(device, `${id}-default-row-colors`, makeArrowFixedSizeListVector(new Uint8(), 4, new Uint8Array(props.color ?? DEFAULT_TEXT_STORAGE_COLOR)));
|
|
1480
|
+
const anglesVector = createTextStorageOwnedGpuVector(device, `${id}-default-row-angles`, makeNumericArrowVector(new Float32(), new Float32Array([props.angle ?? DEFAULT_TEXT_STORAGE_ANGLE])));
|
|
1481
|
+
const sizesVector = createTextStorageOwnedGpuVector(device, `${id}-default-row-sizes`, makeNumericArrowVector(new Float32(), new Float32Array([props.size ?? DEFAULT_TEXT_STORAGE_SIZE])));
|
|
1482
|
+
const pixelOffsetsVector = createTextStorageOwnedGpuVector(device, `${id}-default-row-pixel-offsets`, makeArrowFixedSizeListVector(new Float32(), 2, new Float32Array(props.pixelOffset ?? DEFAULT_TEXT_STORAGE_PIXEL_OFFSET)));
|
|
1483
|
+
const textAnchorsVector = createTextStorageOwnedGpuVector(device, `${id}-default-row-text-anchors`, makeNumericArrowVector(new Uint32(), new Uint32Array([getTextAnchorEnum(props.textAnchor)])));
|
|
1484
|
+
const alignmentBaselinesVector = createTextStorageOwnedGpuVector(device, `${id}-default-row-alignment-baselines`, makeNumericArrowVector(new Uint32(), new Uint32Array([getAlignmentBaselineEnum(props.alignmentBaseline)])));
|
|
1485
|
+
const clipRectsVector = createTextStorageOwnedGpuVector(device, `${id}-default-row-clip-rects`, makeArrowFixedSizeListVector(new Float32(), 4, new Float32Array([0, 0, -1, -1])));
|
|
1486
|
+
return {
|
|
1487
|
+
colorsBuffer: getTextStorageGpuVectorBuffer(colorsVector),
|
|
1488
|
+
anglesBuffer: getTextStorageGpuVectorBuffer(anglesVector),
|
|
1489
|
+
sizesBuffer: getTextStorageGpuVectorBuffer(sizesVector),
|
|
1490
|
+
pixelOffsetsBuffer: getTextStorageGpuVectorBuffer(pixelOffsetsVector),
|
|
1491
|
+
textAnchorsBuffer: getTextStorageGpuVectorBuffer(textAnchorsVector),
|
|
1492
|
+
alignmentBaselinesBuffer: getTextStorageGpuVectorBuffer(alignmentBaselinesVector),
|
|
1493
|
+
clipRectsBuffer: getTextStorageGpuVectorBuffer(clipRectsVector),
|
|
1494
|
+
byteLength: Uint8Array.BYTES_PER_ELEMENT * 4 +
|
|
1495
|
+
Float32Array.BYTES_PER_ELEMENT +
|
|
1496
|
+
Float32Array.BYTES_PER_ELEMENT +
|
|
1497
|
+
Float32Array.BYTES_PER_ELEMENT * 2 +
|
|
1498
|
+
Uint32Array.BYTES_PER_ELEMENT +
|
|
1499
|
+
Uint32Array.BYTES_PER_ELEMENT +
|
|
1500
|
+
Float32Array.BYTES_PER_ELEMENT * 4,
|
|
1501
|
+
ownedResources: [
|
|
1502
|
+
colorsVector,
|
|
1503
|
+
anglesVector,
|
|
1504
|
+
sizesVector,
|
|
1505
|
+
pixelOffsetsVector,
|
|
1506
|
+
textAnchorsVector,
|
|
1507
|
+
alignmentBaselinesVector,
|
|
1508
|
+
clipRectsVector
|
|
1509
|
+
]
|
|
1510
|
+
};
|
|
1511
|
+
}
|
|
1512
|
+
function createTextStorageBatchRowState(device, props, batchInput, defaultBuffers, fontRenderSettings) {
|
|
1513
|
+
const packedClipRects = batchInput.clipRects
|
|
1514
|
+
? packTextStorageClipRects(batchInput.clipRects)
|
|
1515
|
+
: undefined;
|
|
1516
|
+
const rowClipRectsVector = packedClipRects
|
|
1517
|
+
? createTextStorageOwnedGpuVector(device, `${props.id || 'text-storage-model'}-row-clip-rects-${batchInput.batchRowIndexBase}`, makeArrowFixedSizeListVector(new Float32(), 4, packedClipRects.byteLength > 0 ? packedClipRects : new Float32Array(4)))
|
|
1518
|
+
: undefined;
|
|
1519
|
+
const rowClipRectsBuffer = rowClipRectsVector
|
|
1520
|
+
? getTextStorageGpuVectorBuffer(rowClipRectsVector)
|
|
1521
|
+
: batchInput.clipRectsBuffer
|
|
1522
|
+
? getComputeTextStorageBuffer(batchInput.clipRectsBuffer)
|
|
1523
|
+
: defaultBuffers.clipRectsBuffer;
|
|
1524
|
+
const styleConfigData = createTextStorageStyleConfigData(props, batchInput.batchRowIndexBase, batchInput.rowStorageIndexBase, fontRenderSettings);
|
|
1525
|
+
const styleConfigBuffer = new DynamicBuffer(device, {
|
|
1526
|
+
id: `${props.id || 'text-storage-model'}-style-config-${batchInput.batchRowIndexBase}`,
|
|
1527
|
+
usage: Buffer.UNIFORM | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
1528
|
+
data: styleConfigData
|
|
1529
|
+
});
|
|
1530
|
+
const ownedResources = [styleConfigBuffer, ...(rowClipRectsVector ? [rowClipRectsVector] : [])];
|
|
1531
|
+
return {
|
|
1532
|
+
rowPositionsBuffer: batchInput.positionsBuffer,
|
|
1533
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase,
|
|
1534
|
+
rowColorsBuffer: batchInput.colorsBuffer ?? defaultBuffers.colorsBuffer,
|
|
1535
|
+
rowAnglesBuffer: batchInput.anglesBuffer ?? defaultBuffers.anglesBuffer,
|
|
1536
|
+
rowSizesBuffer: batchInput.sizesBuffer ?? defaultBuffers.sizesBuffer,
|
|
1537
|
+
rowPixelOffsetsBuffer: batchInput.pixelOffsetsBuffer ?? defaultBuffers.pixelOffsetsBuffer,
|
|
1538
|
+
rowTextAnchorsBuffer: batchInput.textAnchorsBuffer ?? defaultBuffers.textAnchorsBuffer,
|
|
1539
|
+
rowAlignmentBaselinesBuffer: batchInput.alignmentBaselinesBuffer ?? defaultBuffers.alignmentBaselinesBuffer,
|
|
1540
|
+
rowClipRectsBuffer,
|
|
1541
|
+
styleConfigBuffer,
|
|
1542
|
+
ownedResources,
|
|
1543
|
+
ownedByteLength: styleConfigData.byteLength + (packedClipRects?.byteLength ?? 0)
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1546
|
+
function createTextStorageOwnedGpuVector(device, name, vector) {
|
|
1547
|
+
return makeGPUVectorFromArrow(device, vector, {
|
|
1548
|
+
name,
|
|
1549
|
+
id: name,
|
|
1550
|
+
usage: Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
function getTextStorageGpuVectorBuffer(vector) {
|
|
1554
|
+
const [data, ...remainingData] = vector.data;
|
|
1555
|
+
if (!data || remainingData.length > 0) {
|
|
1556
|
+
throw new Error(`Storage text vector "${vector.name}" requires exactly one GPUData chunk`);
|
|
1557
|
+
}
|
|
1558
|
+
const buffer = data.buffer;
|
|
1559
|
+
return buffer instanceof DynamicBuffer ? buffer.buffer : buffer;
|
|
1560
|
+
}
|
|
1561
|
+
function createTextDictionaryStorageBuffer(device, props, name, data, emptyData, usage = Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC) {
|
|
1562
|
+
return device.createBuffer({
|
|
1563
|
+
id: `${props.id || 'arrow-text-dictionary-storage-model'}-${name}`,
|
|
1564
|
+
usage,
|
|
1565
|
+
data: data.byteLength > 0 ? data : emptyData
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
/** Appends new source-vector batches to an owned storage text state without rebuilding old batches. */
|
|
1569
|
+
export function appendArrowTextStorageStateBatches(device, props, storageState) {
|
|
1570
|
+
const appendContext = storageState.arrowAppendContext;
|
|
1571
|
+
if (!appendContext) {
|
|
1572
|
+
throw new Error('ArrowTextStorageState requires append context');
|
|
1573
|
+
}
|
|
1574
|
+
const textInputs = resolveArrowTextStorageInputs(props);
|
|
1575
|
+
assertTextStorageAppendCompatible(storageState, textInputs.batches);
|
|
1576
|
+
if (textInputs.batches.length === storageState.batches.length) {
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
const hasGlyphRowIndices = storageState.hasGlyphRowIndices === true;
|
|
1580
|
+
const compactGlyphVertexByteStride = hasGlyphRowIndices
|
|
1581
|
+
? ROW_INDEXED_COMPACT_GLYPH_VERTEX_BYTE_STRIDE
|
|
1582
|
+
: COMPACT_GLYPH_VERTEX_BYTE_STRIDE;
|
|
1583
|
+
for (let batchIndex = storageState.batches.length; batchIndex < textInputs.batches.length; batchIndex++) {
|
|
1584
|
+
const batchInput = textInputs.batches[batchIndex];
|
|
1585
|
+
const rowState = createTextStorageBatchRowState(device, props, batchInput, appendContext.defaultBuffers, appendContext.mappingState.fontRenderSettings);
|
|
1586
|
+
const rowBindingBatchIndex = storageState.batches.length;
|
|
1587
|
+
storageState.ownedRowBindingResources.push(...rowState.ownedResources);
|
|
1588
|
+
storageState.rowStorageByteLength += rowState.ownedByteLength;
|
|
1589
|
+
if (appendContext.useGpuUtf8Decode) {
|
|
1590
|
+
const glyphDefinitions = appendContext.utf8GlyphDefinitions;
|
|
1591
|
+
if (!glyphDefinitions) {
|
|
1592
|
+
throw new Error('TextStorageState is missing UTF-8 glyph definitions');
|
|
1593
|
+
}
|
|
1594
|
+
const utf8TextInput = buildGpuUtf8TextInput(batchInput.texts);
|
|
1595
|
+
const rowGlyphStarts = createStorageRowGlyphStartsBuffer(device, props, batchInput.batchRowIndexBase, utf8TextInput.startIndices);
|
|
1596
|
+
storageState.ownedGlyphResources.push(rowGlyphStarts.buffer);
|
|
1597
|
+
storageState.renderControlByteLength += rowGlyphStarts.byteLength;
|
|
1598
|
+
const glyphMetrics = createTextStorageGlyphMetrics(device, { id: props.id }, glyphDefinitions.glyphMetrics);
|
|
1599
|
+
const glyphLookup = createTextStorageGlyphLookup(device, { id: props.id }, glyphDefinitions.glyphLookup);
|
|
1600
|
+
const glyphPages = createTextStorageGlyphPages(device, { id: props.id }, glyphDefinitions.glyphPages);
|
|
1601
|
+
const glyphKernings = createTextStorageGlyphKernings(device, { id: props.id }, glyphDefinitions.glyphKernings);
|
|
1602
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
1603
|
+
device,
|
|
1604
|
+
recordOffsets: utf8TextInput.startIndices,
|
|
1605
|
+
recordByteStride: compactGlyphVertexByteStride,
|
|
1606
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
1607
|
+
resourceLabel: 'ArrowTextStorageModel UTF-8 generated glyph vertex data'
|
|
1608
|
+
});
|
|
1609
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
1610
|
+
const partitionedUtf8TextInput = createPartitionedGpuUtf8TextInput(utf8TextInput, generatedBufferBatch);
|
|
1611
|
+
const utf8Input = createGpuUtf8ExpandedInput(device, { id: props.id }, {
|
|
1612
|
+
utf8TextInput: partitionedUtf8TextInput,
|
|
1613
|
+
baselineOffsetY: glyphDefinitions.baselineOffsetY,
|
|
1614
|
+
glyphLookupCount: glyphDefinitions.glyphLookup.length / 2,
|
|
1615
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
1616
|
+
batchRowIndexBase: generatedBufferBatch.rowStart,
|
|
1617
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase + generatedBufferBatch.rowStart,
|
|
1618
|
+
alignment: createGpuTextAlignmentOptions(props, rowState, appendContext.mappingState.lineHeight)
|
|
1619
|
+
});
|
|
1620
|
+
const generated = createGpuExpandedGeneratedState(device, { id: props.id }, partitionedUtf8TextInput.byteLength, hasGlyphRowIndices);
|
|
1621
|
+
dispatchGpuUtf8ExpandedTextCompute(device, { id: props.id }, {
|
|
1622
|
+
utf8Input,
|
|
1623
|
+
glyphLookup,
|
|
1624
|
+
glyphMetrics,
|
|
1625
|
+
glyphPages,
|
|
1626
|
+
glyphKernings,
|
|
1627
|
+
generated,
|
|
1628
|
+
outputSlotCount: partitionedUtf8TextInput.byteLength,
|
|
1629
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
1630
|
+
alignment: {
|
|
1631
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
1632
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(rowState.rowAlignmentBaselinesBuffer)
|
|
1633
|
+
}
|
|
1634
|
+
});
|
|
1635
|
+
const storageRenderConfigBuffer = createStorageRenderConfigBuffer(device, props, batchInput.batchRowIndexBase, generatedBufferBatch);
|
|
1636
|
+
storageState.renderBatches.push({
|
|
1637
|
+
rowBindingBatchIndex,
|
|
1638
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
1639
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
1640
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
1641
|
+
glyphCount: partitionedUtf8TextInput.byteLength,
|
|
1642
|
+
compactGlyphVertexData: generated.compactGlyphVertexData,
|
|
1643
|
+
storageRenderConfigBuffer
|
|
1644
|
+
});
|
|
1645
|
+
storageState.ownedGlyphResources.push(storageRenderConfigBuffer);
|
|
1646
|
+
storageState.renderControlByteLength += storageRenderConfigBuffer.byteLength;
|
|
1647
|
+
storageState.generatedRenderBufferByteLength += generated.byteLength;
|
|
1648
|
+
storageState.transientComputeInputByteLength += utf8Input.byteLength;
|
|
1649
|
+
utf8Input.rowByteRangesBuffer.destroy();
|
|
1650
|
+
utf8Input.utf8BytesBuffer.destroy();
|
|
1651
|
+
utf8Input.expansionConfigBuffer.destroy();
|
|
1652
|
+
}
|
|
1653
|
+
storageState.batches.push({
|
|
1654
|
+
...rowState,
|
|
1655
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
1656
|
+
rowCount: batchInput.texts.length,
|
|
1657
|
+
glyphCount: utf8TextInput.byteLength,
|
|
1658
|
+
rowGlyphStartsBuffer: rowGlyphStarts.buffer
|
|
1659
|
+
});
|
|
1660
|
+
storageState.glyphCount += utf8TextInput.byteLength;
|
|
1661
|
+
storageState.glyphAttributeBuildTimeMs += utf8TextInput.textInputBuildTimeMs;
|
|
1662
|
+
storageState.compactStreamBuildTimeMs = storageState.glyphAttributeBuildTimeMs;
|
|
1663
|
+
storageState.compactStreamByteLength += utf8TextInput.inputByteLength;
|
|
1664
|
+
storageState.transientComputeInputByteLength +=
|
|
1665
|
+
glyphLookup.byteLength +
|
|
1666
|
+
glyphMetrics.byteLength +
|
|
1667
|
+
glyphPages.byteLength +
|
|
1668
|
+
glyphKernings.byteLength;
|
|
1669
|
+
glyphMetrics.buffer.destroy();
|
|
1670
|
+
glyphLookup.buffer.destroy();
|
|
1671
|
+
glyphPages.buffer.destroy();
|
|
1672
|
+
glyphKernings.buffer.destroy();
|
|
1673
|
+
}
|
|
1674
|
+
else {
|
|
1675
|
+
const batchGlyphStream = buildGpuExpandedTextStream({
|
|
1676
|
+
texts: batchInput.texts,
|
|
1677
|
+
fontAtlas: appendContext.mappingState.fontAtlas,
|
|
1678
|
+
lineHeight: appendContext.mappingState.lineHeight,
|
|
1679
|
+
characterSet: appendContext.mappingState.characterSet
|
|
1680
|
+
});
|
|
1681
|
+
const rowGlyphStarts = createStorageRowGlyphStartsBuffer(device, props, batchInput.batchRowIndexBase, batchGlyphStream.startIndices);
|
|
1682
|
+
storageState.ownedGlyphResources.push(rowGlyphStarts.buffer);
|
|
1683
|
+
storageState.renderControlByteLength += rowGlyphStarts.byteLength;
|
|
1684
|
+
const glyphMetrics = createTextStorageGlyphMetrics(device, { id: props.id }, batchGlyphStream.glyphMetrics);
|
|
1685
|
+
const glyphPages = createTextStorageGlyphPages(device, { id: props.id }, batchGlyphStream.glyphPages);
|
|
1686
|
+
const glyphKernings = createTextStorageGlyphKernings(device, { id: props.id }, batchGlyphStream.glyphKernings);
|
|
1687
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
1688
|
+
device,
|
|
1689
|
+
recordOffsets: batchGlyphStream.startIndices,
|
|
1690
|
+
recordByteStride: compactGlyphVertexByteStride,
|
|
1691
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
1692
|
+
resourceLabel: 'ArrowTextStorageModel compact generated glyph vertex data'
|
|
1693
|
+
});
|
|
1694
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
1695
|
+
const partitionedGlyphStream = createPartitionedGpuExpandedTextStream(batchGlyphStream, generatedBufferBatch);
|
|
1696
|
+
const compactInput = createGpuExpandedCompactInput(device, { id: props.id }, partitionedGlyphStream, generatedBufferBatch.rowStart, createGpuTextAlignmentOptions(props, rowState, appendContext.mappingState.lineHeight), batchInput.rowStorageIndexBase + generatedBufferBatch.rowStart);
|
|
1697
|
+
const generated = createGpuExpandedGeneratedState(device, { id: props.id }, partitionedGlyphStream.glyphCount, hasGlyphRowIndices);
|
|
1698
|
+
dispatchGpuExpandedTextCompute(device, { id: props.id }, {
|
|
1699
|
+
compactInput,
|
|
1700
|
+
glyphMetrics,
|
|
1701
|
+
glyphPages,
|
|
1702
|
+
glyphKernings,
|
|
1703
|
+
generated,
|
|
1704
|
+
glyphCount: partitionedGlyphStream.glyphCount,
|
|
1705
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
1706
|
+
alignment: {
|
|
1707
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
1708
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(rowState.rowAlignmentBaselinesBuffer),
|
|
1709
|
+
useRowTextAnchors: Boolean(props.textAnchors),
|
|
1710
|
+
useRowAlignmentBaselines: Boolean(props.alignmentBaselines)
|
|
1711
|
+
}
|
|
1712
|
+
});
|
|
1713
|
+
const storageRenderConfigBuffer = createStorageRenderConfigBuffer(device, props, batchInput.batchRowIndexBase, generatedBufferBatch);
|
|
1714
|
+
storageState.renderBatches.push({
|
|
1715
|
+
rowBindingBatchIndex,
|
|
1716
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
1717
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
1718
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
1719
|
+
glyphCount: partitionedGlyphStream.glyphCount,
|
|
1720
|
+
compactGlyphVertexData: generated.compactGlyphVertexData,
|
|
1721
|
+
storageRenderConfigBuffer
|
|
1722
|
+
});
|
|
1723
|
+
storageState.ownedGlyphResources.push(storageRenderConfigBuffer);
|
|
1724
|
+
storageState.renderControlByteLength += storageRenderConfigBuffer.byteLength;
|
|
1725
|
+
storageState.generatedRenderBufferByteLength += generated.byteLength;
|
|
1726
|
+
storageState.transientComputeInputByteLength += compactInput.byteLength;
|
|
1727
|
+
compactInput.glyphRangesBuffer.destroy();
|
|
1728
|
+
compactInput.glyphIdsBuffer.destroy();
|
|
1729
|
+
compactInput.expansionConfigBuffer.destroy();
|
|
1730
|
+
}
|
|
1731
|
+
storageState.batches.push({
|
|
1732
|
+
...rowState,
|
|
1733
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
1734
|
+
rowCount: batchInput.texts.length,
|
|
1735
|
+
glyphCount: batchGlyphStream.glyphCount,
|
|
1736
|
+
rowGlyphStartsBuffer: rowGlyphStarts.buffer
|
|
1737
|
+
});
|
|
1738
|
+
storageState.glyphCount += batchGlyphStream.glyphCount;
|
|
1739
|
+
storageState.glyphAttributeBuildTimeMs += batchGlyphStream.glyphStreamBuildTimeMs;
|
|
1740
|
+
storageState.compactStreamBuildTimeMs = storageState.glyphAttributeBuildTimeMs;
|
|
1741
|
+
storageState.compactStreamByteLength += batchGlyphStream.compactStreamByteLength;
|
|
1742
|
+
storageState.transientComputeInputByteLength +=
|
|
1743
|
+
glyphMetrics.byteLength + glyphPages.byteLength + glyphKernings.byteLength;
|
|
1744
|
+
glyphMetrics.buffer.destroy();
|
|
1745
|
+
glyphPages.buffer.destroy();
|
|
1746
|
+
glyphKernings.buffer.destroy();
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
storageState.glyphAttributeByteLength =
|
|
1750
|
+
storageState.generatedRenderBufferByteLength + storageState.renderControlByteLength;
|
|
1751
|
+
}
|
|
1752
|
+
function assertTextStorageAppendCompatible(storageState, batches) {
|
|
1753
|
+
if (batches.length < storageState.batches.length) {
|
|
1754
|
+
throw new Error('ArrowTextStorageModel appended text batches cannot remove existing batches');
|
|
1755
|
+
}
|
|
1756
|
+
for (const [batchIndex, existingBatch] of storageState.batches.entries()) {
|
|
1757
|
+
const batchInput = batches[batchIndex];
|
|
1758
|
+
if (!batchInput ||
|
|
1759
|
+
batchInput.batchRowIndexBase !== existingBatch.batchRowIndexBase ||
|
|
1760
|
+
batchInput.rowStorageIndexBase !== existingBatch.rowStorageIndexBase ||
|
|
1761
|
+
batchInput.texts.length !== existingBatch.rowCount ||
|
|
1762
|
+
batchInput.positionsBuffer !== existingBatch.rowPositionsBuffer) {
|
|
1763
|
+
throw new Error('ArrowTextStorageModel appended text batches require existing row batches to stay unchanged');
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
/** Rebuilds row/style binding buffers for an existing storage text state without replacing glyph buffers. */
|
|
1768
|
+
export function refreshArrowTextStorageRowBindings(device, props, storageState) {
|
|
1769
|
+
const textInputs = resolveArrowTextStorageInputs(props);
|
|
1770
|
+
assertTextStorageRowBindingRefreshCompatible(storageState, textInputs.batches);
|
|
1771
|
+
const nextOwnedRowBindingResources = [];
|
|
1772
|
+
const defaultBuffers = createTextStorageDefaultBuffers(device, props);
|
|
1773
|
+
nextOwnedRowBindingResources.push(...defaultBuffers.ownedResources);
|
|
1774
|
+
let rowStorageByteLength = defaultBuffers.byteLength;
|
|
1775
|
+
let nextBatches = [];
|
|
1776
|
+
try {
|
|
1777
|
+
nextBatches = textInputs.batches.map((batchInput, batchIndex) => {
|
|
1778
|
+
const previousBatch = storageState.batches[batchIndex];
|
|
1779
|
+
const rowState = createTextStorageBatchRowState(device, props, batchInput, defaultBuffers, storageState.fontRenderSettings);
|
|
1780
|
+
nextOwnedRowBindingResources.push(...rowState.ownedResources);
|
|
1781
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
1782
|
+
return {
|
|
1783
|
+
...rowState,
|
|
1784
|
+
batchRowIndexBase: previousBatch.batchRowIndexBase,
|
|
1785
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase,
|
|
1786
|
+
rowCount: previousBatch.rowCount,
|
|
1787
|
+
glyphCount: previousBatch.glyphCount,
|
|
1788
|
+
rowGlyphStartsBuffer: previousBatch.rowGlyphStartsBuffer
|
|
1789
|
+
};
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
catch (error) {
|
|
1793
|
+
destroyTextStorageResources(nextOwnedRowBindingResources);
|
|
1794
|
+
throw error;
|
|
1795
|
+
}
|
|
1796
|
+
replaceOwnedTextStorageResources(storageState.ownedRowBindingResources, nextOwnedRowBindingResources);
|
|
1797
|
+
storageState.batches = nextBatches;
|
|
1798
|
+
storageState.rowStorageByteLength = rowStorageByteLength;
|
|
1799
|
+
const appendContext = getArrowTextStorageAppendContext(storageState);
|
|
1800
|
+
if (appendContext) {
|
|
1801
|
+
appendContext.defaultBuffers = defaultBuffers;
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
function assertTextStorageRowBindingRefreshCompatible(storageState, batches) {
|
|
1805
|
+
if (batches.length !== storageState.batches.length) {
|
|
1806
|
+
throw new Error('ArrowTextStorageModel row-binding updates must preserve text batch count');
|
|
1807
|
+
}
|
|
1808
|
+
for (const [batchIndex, batchInput] of batches.entries()) {
|
|
1809
|
+
const existingBatch = storageState.batches[batchIndex];
|
|
1810
|
+
if (!existingBatch ||
|
|
1811
|
+
existingBatch.batchRowIndexBase !== batchInput.batchRowIndexBase ||
|
|
1812
|
+
existingBatch.rowCount !== batchInput.texts.length) {
|
|
1813
|
+
throw new Error('ArrowTextStorageModel row-binding updates must preserve text batch rows');
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
function getArrowTextStorageAppendContext(storageState) {
|
|
1818
|
+
return isArrowTextStorageState(storageState) ? storageState.arrowAppendContext : undefined;
|
|
1819
|
+
}
|
|
1820
|
+
function isArrowTextStorageState(storageState) {
|
|
1821
|
+
return 'arrowAppendContext' in storageState;
|
|
1822
|
+
}
|
|
1823
|
+
/** Rebuilds row/style binding buffers for an existing dictionary text state without replacing glyph buffers. */
|
|
1824
|
+
export function refreshArrowTextDictionaryStorageRowBindings(device, props, storageState) {
|
|
1825
|
+
const textInputs = resolveArrowTextDictionaryStorageInputs(props);
|
|
1826
|
+
assertTextDictionaryStorageRowBindingRefreshCompatible(storageState, textInputs.batches);
|
|
1827
|
+
const nextOwnedRowBindingResources = [];
|
|
1828
|
+
const defaultBuffers = createTextStorageDefaultBuffers(device, props);
|
|
1829
|
+
nextOwnedRowBindingResources.push(...defaultBuffers.ownedResources);
|
|
1830
|
+
let rowStorageByteLength = defaultBuffers.byteLength;
|
|
1831
|
+
let nextBatches = [];
|
|
1832
|
+
try {
|
|
1833
|
+
nextBatches = textInputs.batches.map((batchInput, batchIndex) => {
|
|
1834
|
+
const previousBatch = storageState.batches[batchIndex];
|
|
1835
|
+
const rowState = createTextStorageBatchRowState(device, props, batchInput, defaultBuffers, storageState.fontRenderSettings);
|
|
1836
|
+
nextOwnedRowBindingResources.push(...rowState.ownedResources);
|
|
1837
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
1838
|
+
return {
|
|
1839
|
+
...rowState,
|
|
1840
|
+
batchRowIndexBase: previousBatch.batchRowIndexBase,
|
|
1841
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase,
|
|
1842
|
+
rowCount: previousBatch.rowCount,
|
|
1843
|
+
glyphCount: previousBatch.glyphCount,
|
|
1844
|
+
rowDictionaryRecordsBuffer: previousBatch.rowDictionaryRecordsBuffer,
|
|
1845
|
+
dictionaryGlyphRangesBuffer: previousBatch.dictionaryGlyphRangesBuffer,
|
|
1846
|
+
dictionaryGlyphRecordsBuffer: previousBatch.dictionaryGlyphRecordsBuffer,
|
|
1847
|
+
glyphFramesBuffer: previousBatch.glyphFramesBuffer,
|
|
1848
|
+
dictionaryGlyphCount: previousBatch.dictionaryGlyphCount,
|
|
1849
|
+
dictionaryValueCount: previousBatch.dictionaryValueCount
|
|
1850
|
+
};
|
|
1851
|
+
});
|
|
1852
|
+
}
|
|
1853
|
+
catch (error) {
|
|
1854
|
+
destroyTextStorageResources(nextOwnedRowBindingResources);
|
|
1855
|
+
throw error;
|
|
1856
|
+
}
|
|
1857
|
+
replaceOwnedTextStorageResources(storageState.ownedRowBindingResources, nextOwnedRowBindingResources);
|
|
1858
|
+
storageState.batches = nextBatches;
|
|
1859
|
+
storageState.rowStorageByteLength = rowStorageByteLength;
|
|
1860
|
+
}
|
|
1861
|
+
function assertTextDictionaryStorageRowBindingRefreshCompatible(storageState, batches) {
|
|
1862
|
+
if (batches.length !== storageState.batches.length) {
|
|
1863
|
+
throw new Error('ArrowTextDictionaryStorageModel row-binding updates must preserve text batch count');
|
|
1864
|
+
}
|
|
1865
|
+
for (const [batchIndex, batchInput] of batches.entries()) {
|
|
1866
|
+
const existingBatch = storageState.batches[batchIndex];
|
|
1867
|
+
if (!existingBatch ||
|
|
1868
|
+
existingBatch.batchRowIndexBase !== batchInput.batchRowIndexBase ||
|
|
1869
|
+
existingBatch.rowStorageIndexBase !== batchInput.rowStorageIndexBase ||
|
|
1870
|
+
existingBatch.rowCount !== batchInput.texts.length) {
|
|
1871
|
+
throw new Error('ArrowTextDictionaryStorageModel row-binding updates must preserve text batch rows');
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
function destroyTextStorageResources(resources) {
|
|
1876
|
+
for (const resource of resources) {
|
|
1877
|
+
resource.destroy();
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
function replaceOwnedTextStorageResources(currentResources, nextResources) {
|
|
1881
|
+
destroyTextStorageResources(currentResources);
|
|
1882
|
+
currentResources.splice(0, currentResources.length, ...nextResources);
|
|
1883
|
+
}
|
|
1884
|
+
function createTextStorageStyleConfigData(props, batchRowIndexBase, rowStorageIndexBase, fontRenderSettings) {
|
|
1885
|
+
const arrayBuffer = new ArrayBuffer(80);
|
|
1886
|
+
const floatValues = new Float32Array(arrayBuffer);
|
|
1887
|
+
const uintValues = new Uint32Array(arrayBuffer);
|
|
1888
|
+
const color = props.color ?? DEFAULT_TEXT_STORAGE_COLOR;
|
|
1889
|
+
floatValues[0] = color[0] / 255;
|
|
1890
|
+
floatValues[1] = color[1] / 255;
|
|
1891
|
+
floatValues[2] = color[2] / 255;
|
|
1892
|
+
floatValues[3] = color[3] / 255;
|
|
1893
|
+
floatValues[4] = props.angle ?? DEFAULT_TEXT_STORAGE_ANGLE;
|
|
1894
|
+
floatValues[5] = props.size ?? DEFAULT_TEXT_STORAGE_SIZE;
|
|
1895
|
+
floatValues[6] = (props.pixelOffset ?? DEFAULT_TEXT_STORAGE_PIXEL_OFFSET)[0];
|
|
1896
|
+
floatValues[7] = (props.pixelOffset ?? DEFAULT_TEXT_STORAGE_PIXEL_OFFSET)[1];
|
|
1897
|
+
uintValues[8] = props.colors ? 1 : 0;
|
|
1898
|
+
uintValues[9] = props.angles ? 1 : 0;
|
|
1899
|
+
uintValues[10] = props.sizes ? 1 : 0;
|
|
1900
|
+
uintValues[11] = props.pixelOffsets ? 1 : 0;
|
|
1901
|
+
uintValues[12] = props.clipRects ? 1 : 0;
|
|
1902
|
+
uintValues[13] = batchRowIndexBase;
|
|
1903
|
+
uintValues[14] = rowStorageIndexBase;
|
|
1904
|
+
uintValues[15] = 0;
|
|
1905
|
+
floatValues[16] =
|
|
1906
|
+
fontRenderSettings.mode === 'bitmap' ? BITMAP_TEXT_SDF_THRESHOLD : fontRenderSettings.threshold;
|
|
1907
|
+
floatValues[17] = fontRenderSettings.smoothing;
|
|
1908
|
+
uintValues[18] =
|
|
1909
|
+
fontRenderSettings.mode === 'bitmap' ? 0 : fontRenderSettings.mode === 'sdf' ? 1 : 2;
|
|
1910
|
+
floatValues[19] = fontRenderSettings.distanceRange ?? 0;
|
|
1911
|
+
return uintValues;
|
|
1912
|
+
}
|
|
1913
|
+
function createGpuTextAlignmentOptions(props, rowState, lineHeight) {
|
|
1914
|
+
return {
|
|
1915
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
1916
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(rowState.rowAlignmentBaselinesBuffer),
|
|
1917
|
+
useRowTextAnchors: Boolean(props.textAnchors),
|
|
1918
|
+
useRowAlignmentBaselines: Boolean(props.alignmentBaselines),
|
|
1919
|
+
textAnchor: getTextAnchorEnum(props.textAnchor),
|
|
1920
|
+
alignmentBaseline: getAlignmentBaselineEnum(props.alignmentBaseline),
|
|
1921
|
+
lineHeight
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1924
|
+
function getComputeTextStorageBuffer(buffer) {
|
|
1925
|
+
return buffer instanceof DynamicBuffer ? buffer.buffer : buffer;
|
|
1926
|
+
}
|
|
1927
|
+
function createTextStorageGlyphFrames(device, props, glyphFrameData) {
|
|
1928
|
+
return {
|
|
1929
|
+
buffer: device.createBuffer({
|
|
1930
|
+
id: `${props.id || 'arrow-text-storage-model'}-glyph-frames`,
|
|
1931
|
+
usage: Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
1932
|
+
data: glyphFrameData.byteLength > 0 ? glyphFrameData : new Float32Array(4)
|
|
1933
|
+
}),
|
|
1934
|
+
byteLength: glyphFrameData.byteLength
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
function getTextAtlasTexture(device, props, fontAtlas) {
|
|
1938
|
+
if (props.resources) {
|
|
1939
|
+
return { atlasTexture: props.resources.atlasTexture, ownsAtlasTexture: false };
|
|
1940
|
+
}
|
|
1941
|
+
return {
|
|
1942
|
+
atlasTexture: new DynamicTexture(device, {
|
|
1943
|
+
id: `${props.id || 'text-model'}-atlas`,
|
|
1944
|
+
dimension: '2d-array',
|
|
1945
|
+
data: [...fontAtlas.pages]
|
|
1946
|
+
}),
|
|
1947
|
+
ownsAtlasTexture: true
|
|
1948
|
+
};
|
|
1949
|
+
}
|
|
1950
|
+
/** Copies deck-style `[x, y, width, height]` Float32 clip rows into packed GPU storage. */
|
|
1951
|
+
export function packTextStorageClipRects(clipRects) {
|
|
1952
|
+
assertClipRects(clipRects, clipRects.length);
|
|
1953
|
+
return new Float32Array(getArrowVectorBufferSource(clipRects));
|
|
1954
|
+
}
|
|
1955
|
+
function getTextAnchorEnum(textAnchor) {
|
|
1956
|
+
switch (textAnchor) {
|
|
1957
|
+
case 'middle':
|
|
1958
|
+
return 1;
|
|
1959
|
+
case 'end':
|
|
1960
|
+
return 2;
|
|
1961
|
+
case 'start':
|
|
1962
|
+
default:
|
|
1963
|
+
return DEFAULT_TEXT_STORAGE_ANCHOR;
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
function getAlignmentBaselineEnum(alignmentBaseline) {
|
|
1967
|
+
switch (alignmentBaseline) {
|
|
1968
|
+
case 'top':
|
|
1969
|
+
return 1;
|
|
1970
|
+
case 'bottom':
|
|
1971
|
+
return 2;
|
|
1972
|
+
case 'center':
|
|
1973
|
+
default:
|
|
1974
|
+
return DEFAULT_STORAGE_ALIGNMENT_BASELINE;
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
function createPartitionedGpuExpandedTextStream(glyphStream, generatedBufferBatch) {
|
|
1978
|
+
const rowCount = generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart;
|
|
1979
|
+
const startIndices = new Array(rowCount + 1);
|
|
1980
|
+
const labelGlyphRanges = new Uint32Array(rowCount * 2);
|
|
1981
|
+
startIndices[0] = 0;
|
|
1982
|
+
for (let localRowIndex = 0; localRowIndex < rowCount; localRowIndex++) {
|
|
1983
|
+
const sourceRowIndex = generatedBufferBatch.rowStart + localRowIndex;
|
|
1984
|
+
const sourceGlyphStart = glyphStream.startIndices[sourceRowIndex] ?? generatedBufferBatch.recordStart;
|
|
1985
|
+
const sourceGlyphEnd = glyphStream.startIndices[sourceRowIndex + 1] ?? generatedBufferBatch.recordStart;
|
|
1986
|
+
const localGlyphStart = sourceGlyphStart - generatedBufferBatch.recordStart;
|
|
1987
|
+
const localGlyphEnd = sourceGlyphEnd - generatedBufferBatch.recordStart;
|
|
1988
|
+
labelGlyphRanges[localRowIndex * 2] = localGlyphStart;
|
|
1989
|
+
labelGlyphRanges[localRowIndex * 2 + 1] = localGlyphEnd;
|
|
1990
|
+
startIndices[localRowIndex + 1] = localGlyphEnd;
|
|
1991
|
+
}
|
|
1992
|
+
const packedGlyphIds = copyPackedUint16Range(glyphStream.packedGlyphIds, generatedBufferBatch.recordStart, generatedBufferBatch.recordEnd);
|
|
1993
|
+
return {
|
|
1994
|
+
...glyphStream,
|
|
1995
|
+
startIndices,
|
|
1996
|
+
glyphCount: generatedBufferBatch.recordCount,
|
|
1997
|
+
labelGlyphRanges,
|
|
1998
|
+
packedGlyphIds,
|
|
1999
|
+
compactStreamByteLength: labelGlyphRanges.byteLength + packedGlyphIds.byteLength,
|
|
2000
|
+
glyphStreamBuildTimeMs: 0
|
|
2001
|
+
};
|
|
2002
|
+
}
|
|
2003
|
+
function createPartitionedGpuUtf8TextInput(utf8TextInput, generatedBufferBatch) {
|
|
2004
|
+
const rowCount = generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart;
|
|
2005
|
+
const rowByteRanges = new Uint32Array(rowCount * 2);
|
|
2006
|
+
const startIndices = new Array(rowCount + 1);
|
|
2007
|
+
startIndices[0] = 0;
|
|
2008
|
+
for (let localRowIndex = 0; localRowIndex < rowCount; localRowIndex++) {
|
|
2009
|
+
const sourceRowIndex = generatedBufferBatch.rowStart + localRowIndex;
|
|
2010
|
+
const sourceByteStart = utf8TextInput.rowByteRanges[sourceRowIndex * 2] ?? 0;
|
|
2011
|
+
const sourceByteEnd = utf8TextInput.rowByteRanges[sourceRowIndex * 2 + 1] ?? sourceByteStart;
|
|
2012
|
+
const hasPartitionLocalBytes = sourceByteEnd > sourceByteStart &&
|
|
2013
|
+
sourceByteStart >= generatedBufferBatch.recordStart &&
|
|
2014
|
+
sourceByteEnd <= generatedBufferBatch.recordEnd;
|
|
2015
|
+
const localByteStart = hasPartitionLocalBytes
|
|
2016
|
+
? sourceByteStart - generatedBufferBatch.recordStart
|
|
2017
|
+
: 0;
|
|
2018
|
+
const localByteEnd = hasPartitionLocalBytes
|
|
2019
|
+
? sourceByteEnd - generatedBufferBatch.recordStart
|
|
2020
|
+
: localByteStart;
|
|
2021
|
+
rowByteRanges[localRowIndex * 2] = localByteStart;
|
|
2022
|
+
rowByteRanges[localRowIndex * 2 + 1] = localByteEnd;
|
|
2023
|
+
startIndices[localRowIndex + 1] = Math.max(startIndices[localRowIndex] ?? 0, localByteEnd);
|
|
2024
|
+
}
|
|
2025
|
+
const packedUtf8Bytes = copyPackedByteRange(utf8TextInput.packedUtf8Bytes, generatedBufferBatch.recordStart, generatedBufferBatch.recordEnd);
|
|
2026
|
+
return {
|
|
2027
|
+
startIndices,
|
|
2028
|
+
rowByteRanges,
|
|
2029
|
+
packedUtf8Bytes,
|
|
2030
|
+
byteLength: generatedBufferBatch.recordCount,
|
|
2031
|
+
inputByteLength: rowByteRanges.byteLength + packedUtf8Bytes.byteLength,
|
|
2032
|
+
textInputBuildTimeMs: 0
|
|
2033
|
+
};
|
|
2034
|
+
}
|
|
2035
|
+
function createPartitionedGpuVectorUtf8TextInput(device, props, textBatch, generatedBufferBatch) {
|
|
2036
|
+
const usesFullBatch = generatedBufferBatch.rowStart === 0 &&
|
|
2037
|
+
generatedBufferBatch.rowEnd === textBatch.rowCount &&
|
|
2038
|
+
generatedBufferBatch.recordStart === 0 &&
|
|
2039
|
+
generatedBufferBatch.recordEnd === textBatch.byteLength;
|
|
2040
|
+
if (usesFullBatch) {
|
|
2041
|
+
return {
|
|
2042
|
+
rowByteRangesBuffer: textBatch.rowByteRangesBuffer,
|
|
2043
|
+
inputByteLength: textBatch.inputByteLength,
|
|
2044
|
+
ownsRowByteRangesBuffer: false
|
|
2045
|
+
};
|
|
2046
|
+
}
|
|
2047
|
+
const rowCount = generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart;
|
|
2048
|
+
const rowByteRanges = new Uint32Array(rowCount * 2);
|
|
2049
|
+
for (let localRowIndex = 0; localRowIndex < rowCount; localRowIndex++) {
|
|
2050
|
+
const sourceRowIndex = generatedBufferBatch.rowStart + localRowIndex;
|
|
2051
|
+
rowByteRanges[localRowIndex * 2] = textBatch.rowByteRanges[sourceRowIndex * 2] ?? 0;
|
|
2052
|
+
rowByteRanges[localRowIndex * 2 + 1] =
|
|
2053
|
+
textBatch.rowByteRanges[sourceRowIndex * 2 + 1] ?? rowByteRanges[localRowIndex * 2];
|
|
2054
|
+
}
|
|
2055
|
+
return {
|
|
2056
|
+
rowByteRangesBuffer: device.createBuffer({
|
|
2057
|
+
id: `${props.id || 'text-storage-model'}-utf8-row-byte-ranges-` +
|
|
2058
|
+
`${generatedBufferBatch.rowStart}`,
|
|
2059
|
+
usage: Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
2060
|
+
data: rowByteRanges.byteLength > 0 ? rowByteRanges : new Uint32Array(2)
|
|
2061
|
+
}),
|
|
2062
|
+
inputByteLength: rowByteRanges.byteLength + generatedBufferBatch.recordCount,
|
|
2063
|
+
ownsRowByteRangesBuffer: true
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
function copyPackedUint16Range(source, startIndex, endIndex) {
|
|
2067
|
+
const valueCount = Math.max(0, endIndex - startIndex);
|
|
2068
|
+
const target = new Uint32Array(Math.ceil(valueCount / 2));
|
|
2069
|
+
for (let localIndex = 0; localIndex < valueCount; localIndex++) {
|
|
2070
|
+
const value = readPackedUint16(source, startIndex + localIndex);
|
|
2071
|
+
writePackedUint16(target, localIndex, value);
|
|
2072
|
+
}
|
|
2073
|
+
return target;
|
|
2074
|
+
}
|
|
2075
|
+
function readPackedUint16(source, index) {
|
|
2076
|
+
const word = source[index >> 1] ?? 0;
|
|
2077
|
+
return index & 1 ? word >>> 16 : word & 0xffff;
|
|
2078
|
+
}
|
|
2079
|
+
function writePackedUint16(target, index, value) {
|
|
2080
|
+
const wordIndex = index >> 1;
|
|
2081
|
+
const word = target[wordIndex] ?? 0;
|
|
2082
|
+
target[wordIndex] = index & 1 ? word | ((value & 0xffff) << 16) : word | (value & 0xffff);
|
|
2083
|
+
}
|
|
2084
|
+
function copyPackedByteRange(source, startByteIndex, endByteIndex) {
|
|
2085
|
+
const byteLength = Math.max(0, endByteIndex - startByteIndex);
|
|
2086
|
+
const target = new Uint32Array(Math.ceil(byteLength / Uint32Array.BYTES_PER_ELEMENT));
|
|
2087
|
+
const sourceBytes = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
2088
|
+
new Uint8Array(target.buffer).set(sourceBytes.subarray(startByteIndex, endByteIndex));
|
|
2089
|
+
return target;
|
|
2090
|
+
}
|
|
2091
|
+
function makeFixedSizeListField(name, childType, listSize) {
|
|
2092
|
+
return new Field(name, new FixedSizeList(listSize, new Field('value', childType, false)), false);
|
|
2093
|
+
}
|
|
2094
|
+
function isInstanceCompatibleArrowType(type) {
|
|
2095
|
+
return (isNumericArrowType(type) ||
|
|
2096
|
+
(DataType.isFixedSizeList(type) && isNumericArrowType(type.children[0].type)));
|
|
2097
|
+
}
|
|
2098
|
+
function isArrowTextRowColorType(type) {
|
|
2099
|
+
return (Boolean(type) &&
|
|
2100
|
+
DataType.isFixedSizeList(type) &&
|
|
2101
|
+
type.listSize === 4 &&
|
|
2102
|
+
type.children[0]?.type instanceof Uint8);
|
|
2103
|
+
}
|
|
2104
|
+
function isArrowTextCharacterColorType(type) {
|
|
2105
|
+
return Boolean(type) && DataType.isList(type) && isArrowTextRowColorType(type.children[0]?.type);
|
|
2106
|
+
}
|
|
2107
|
+
function isArrowTextColorType(type) {
|
|
2108
|
+
return isArrowTextRowColorType(type) || isArrowTextCharacterColorType(type);
|
|
2109
|
+
}
|
|
2110
|
+
function expandArrowTextCharacterColorRows(vector, startIndices, nullValue) {
|
|
2111
|
+
const glyphCount = startIndices[startIndices.length - 1] ?? 0;
|
|
2112
|
+
const expandedValues = new Uint8Array(glyphCount * 4);
|
|
2113
|
+
let rowIndexBase = 0;
|
|
2114
|
+
for (const data of vector.data) {
|
|
2115
|
+
const valueOffsets = data.valueOffsets;
|
|
2116
|
+
const elementData = data.children[0];
|
|
2117
|
+
const valueData = elementData?.children[0];
|
|
2118
|
+
const values = valueData?.values;
|
|
2119
|
+
if (!valueOffsets || !elementData || !valueData || !values) {
|
|
2120
|
+
throw new Error('ArrowTextModel character colors require Arrow list offsets and values');
|
|
2121
|
+
}
|
|
2122
|
+
if (nullValue && ((elementData.nullCount ?? 0) > 0 || (valueData.nullCount ?? 0) > 0)) {
|
|
2123
|
+
throw new Error('ArrowTextModel character colors do not support nullable nested color values');
|
|
2124
|
+
}
|
|
2125
|
+
const firstElementOffset = valueOffsets[0] ?? 0;
|
|
2126
|
+
const valueOffset = valueData.offset ?? 0;
|
|
2127
|
+
for (let localRowIndex = 0; localRowIndex < data.length; localRowIndex++) {
|
|
2128
|
+
const rowIndex = rowIndexBase + localRowIndex;
|
|
2129
|
+
const glyphStart = startIndices[rowIndex] ?? 0;
|
|
2130
|
+
const glyphEnd = startIndices[rowIndex + 1] ?? glyphStart;
|
|
2131
|
+
const glyphRowLength = glyphEnd - glyphStart;
|
|
2132
|
+
if (nullValue && !isArrowDataRowValid(data, localRowIndex)) {
|
|
2133
|
+
for (let glyphIndex = glyphStart; glyphIndex < glyphEnd; glyphIndex++) {
|
|
2134
|
+
expandedValues.set(nullValue, glyphIndex * 4);
|
|
2135
|
+
}
|
|
2136
|
+
continue;
|
|
2137
|
+
}
|
|
2138
|
+
const colorStart = (valueOffsets[localRowIndex] ?? firstElementOffset) - firstElementOffset;
|
|
2139
|
+
const colorEnd = (valueOffsets[localRowIndex + 1] ?? colorStart) - firstElementOffset;
|
|
2140
|
+
if (colorEnd - colorStart !== glyphRowLength) {
|
|
2141
|
+
throw new Error('ArrowTextModel character colors must provide one color per UTF-8 code point');
|
|
2142
|
+
}
|
|
2143
|
+
expandedValues.set(values.subarray(valueOffset + colorStart * 4, valueOffset + colorEnd * 4), glyphStart * 4);
|
|
2144
|
+
}
|
|
2145
|
+
rowIndexBase += data.length;
|
|
2146
|
+
}
|
|
2147
|
+
return makeArrowFixedSizeListVector(new Uint8(), 4, expandedValues);
|
|
2148
|
+
}
|
|
2149
|
+
function getArrowTextExpansionNullValue(fieldName, props) {
|
|
2150
|
+
switch (fieldName) {
|
|
2151
|
+
case 'colors':
|
|
2152
|
+
return props.color;
|
|
2153
|
+
case 'angles':
|
|
2154
|
+
return props.angle;
|
|
2155
|
+
case 'sizes':
|
|
2156
|
+
return props.size;
|
|
2157
|
+
default:
|
|
2158
|
+
return undefined;
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
function isArrowDataRowValid(data, localRowIndex) {
|
|
2162
|
+
if (data.nullCount === 0 || !data.nullBitmap) {
|
|
2163
|
+
return true;
|
|
2164
|
+
}
|
|
2165
|
+
const bitmapIndex = (data.offset ?? 0) + localRowIndex;
|
|
2166
|
+
const bitmapByte = data.nullBitmap[bitmapIndex >> 3] ?? 0;
|
|
2167
|
+
return (bitmapByte & (1 << (bitmapIndex & 7))) !== 0;
|
|
2168
|
+
}
|
|
2169
|
+
function makeNumericArrowVector(type, data) {
|
|
2170
|
+
const makeNumericData = makeData;
|
|
2171
|
+
return makeVector(makeNumericData({
|
|
2172
|
+
type,
|
|
2173
|
+
length: data.length,
|
|
2174
|
+
data
|
|
2175
|
+
}));
|
|
2176
|
+
}
|
|
2177
|
+
/** Appends one glyph layout to another while preserving global row/glyph offsets. */
|
|
2178
|
+
export function appendTextGlyphLayout(glyphLayout, appendedGlyphLayout) {
|
|
2179
|
+
const nextStartIndices = [
|
|
2180
|
+
...glyphLayout.startIndices,
|
|
2181
|
+
...appendedGlyphLayout.startIndices
|
|
2182
|
+
.slice(1)
|
|
2183
|
+
.map(startIndex => startIndex + glyphLayout.glyphCount)
|
|
2184
|
+
];
|
|
2185
|
+
const glyphOffsets = new Int16Array(glyphLayout.glyphOffsets.length + appendedGlyphLayout.glyphOffsets.length);
|
|
2186
|
+
glyphOffsets.set(glyphLayout.glyphOffsets);
|
|
2187
|
+
glyphOffsets.set(appendedGlyphLayout.glyphOffsets, glyphLayout.glyphOffsets.length);
|
|
2188
|
+
const glyphFrames = new Uint16Array(glyphLayout.glyphFrames.length + appendedGlyphLayout.glyphFrames.length);
|
|
2189
|
+
glyphFrames.set(glyphLayout.glyphFrames);
|
|
2190
|
+
glyphFrames.set(appendedGlyphLayout.glyphFrames, glyphLayout.glyphFrames.length);
|
|
2191
|
+
const glyphPages = new Uint16Array(glyphLayout.glyphPages.length + appendedGlyphLayout.glyphPages.length);
|
|
2192
|
+
glyphPages.set(glyphLayout.glyphPages);
|
|
2193
|
+
glyphPages.set(appendedGlyphLayout.glyphPages, glyphLayout.glyphPages.length);
|
|
2194
|
+
const rowAdvances = new Float32Array(glyphLayout.rowAdvances.length + appendedGlyphLayout.rowAdvances.length);
|
|
2195
|
+
rowAdvances.set(glyphLayout.rowAdvances);
|
|
2196
|
+
rowAdvances.set(appendedGlyphLayout.rowAdvances, glyphLayout.rowAdvances.length);
|
|
2197
|
+
const rowBounds = new Float32Array(glyphLayout.rowBounds.length + appendedGlyphLayout.rowBounds.length);
|
|
2198
|
+
rowBounds.set(glyphLayout.rowBounds);
|
|
2199
|
+
rowBounds.set(appendedGlyphLayout.rowBounds, glyphLayout.rowBounds.length);
|
|
2200
|
+
return {
|
|
2201
|
+
startIndices: nextStartIndices,
|
|
2202
|
+
glyphCount: glyphLayout.glyphCount + appendedGlyphLayout.glyphCount,
|
|
2203
|
+
glyphOffsets,
|
|
2204
|
+
glyphFrames,
|
|
2205
|
+
glyphPages,
|
|
2206
|
+
rowAdvances,
|
|
2207
|
+
rowBounds,
|
|
2208
|
+
characterSet: glyphLayout.characterSet
|
|
2209
|
+
};
|
|
2210
|
+
}
|
|
2211
|
+
function makeGlyphRowIndices(startIndices, rowIndexBase = 0) {
|
|
2212
|
+
const glyphCount = startIndices[startIndices.length - 1] ?? 0;
|
|
2213
|
+
const rowIndices = new Uint32Array(glyphCount);
|
|
2214
|
+
for (let rowIndex = 0; rowIndex < startIndices.length - 1; rowIndex++) {
|
|
2215
|
+
rowIndices.fill(rowIndexBase + rowIndex, startIndices[rowIndex], startIndices[rowIndex + 1]);
|
|
2216
|
+
}
|
|
2217
|
+
return rowIndices;
|
|
2218
|
+
}
|
|
2219
|
+
function getGeneratedAttributeByteLength(columns) {
|
|
2220
|
+
let attributeByteLength = 0;
|
|
2221
|
+
for (const vector of Object.values(columns)) {
|
|
2222
|
+
if (isInstanceCompatibleArrowType(vector.type)) {
|
|
2223
|
+
attributeByteLength += getArrowVectorBufferSource(vector).byteLength;
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
return attributeByteLength;
|
|
2227
|
+
}
|
|
2228
|
+
//# sourceMappingURL=convert-arrow-text-vectors.js.map
|