@luma.gl/engine 9.4.2 → 10.0.0-alpha.10
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 +46 -0
- package/dist/animation/animation-clip.cjs +36 -0
- package/dist/animation/animation-interpolation.cjs +115 -0
- package/dist/animation/animation-mixer.cjs +302 -0
- package/dist/animation/animation-track.cjs +55 -0
- package/dist/animation/animator.cjs +75 -0
- package/dist/animation/deform-positions.cjs +69 -0
- package/dist/animation/deform-positions.d.ts +13 -0
- package/dist/animation/deform-positions.d.ts.map +1 -0
- package/dist/animation/deform-positions.js +49 -0
- package/dist/animation/deform-positions.js.map +1 -0
- package/dist/animation/key-frames.cjs +81 -0
- package/dist/animation/morph-targets.cjs +162 -0
- package/dist/animation/node-animation-binding.cjs +67 -0
- package/dist/animation/node-animation-binding.d.ts +9 -0
- package/dist/animation/node-animation-binding.d.ts.map +1 -0
- package/dist/animation/node-animation-binding.js +45 -0
- package/dist/animation/node-animation-binding.js.map +1 -0
- package/dist/animation/property-animation-binding.cjs +159 -0
- package/dist/animation/property-animation-binding.d.ts +29 -0
- package/dist/animation/property-animation-binding.d.ts.map +1 -0
- package/dist/animation/property-animation-binding.js +138 -0
- package/dist/animation/property-animation-binding.js.map +1 -0
- package/dist/animation/scenegraph-animator.cjs +122 -0
- package/dist/animation/scenegraph-animator.d.ts +37 -0
- package/dist/animation/scenegraph-animator.d.ts.map +1 -0
- package/dist/animation/scenegraph-animator.js +99 -0
- package/dist/animation/scenegraph-animator.js.map +1 -0
- package/dist/animation/skin.cjs +49 -0
- package/dist/animation/texture-transform.cjs +41 -0
- package/dist/animation/texture-transform.d.ts +8 -0
- package/dist/animation/texture-transform.d.ts.map +1 -0
- package/dist/animation/texture-transform.js +17 -0
- package/dist/animation/texture-transform.js.map +1 -0
- package/dist/animation/timeline.cjs +129 -0
- package/dist/animation-loop/animation-loop-template.cjs +33 -0
- package/dist/animation-loop/animation-loop.cjs +498 -0
- package/dist/animation-loop/animation-loop.d.ts +14 -6
- package/dist/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +12 -4
- package/dist/animation-loop/animation-loop.js.map +1 -1
- package/dist/animation-loop/animation-props.cjs +15 -0
- package/dist/animation-loop/animation-props.d.ts +3 -1
- package/dist/animation-loop/animation-props.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.cjs +104 -0
- package/dist/animation-loop/request-animation-frame.cjs +43 -0
- package/dist/application-utils/load-file.cjs +77 -0
- package/dist/application-utils/random.cjs +38 -0
- 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 +227 -0
- package/dist/arrow/index.cjs.map +6 -0
- package/dist/arrow/index.d.ts +23 -0
- package/dist/arrow/index.d.ts.map +1 -0
- package/dist/arrow/index.js +25 -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/splats/conversion/make-gpu-splat-data-from-gltf.cjs +162 -0
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.d.ts +34 -0
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.d.ts.map +1 -0
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.js +159 -0
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.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 +1005 -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 +951 -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/audio/audio-controller.cjs +429 -0
- package/dist/audio/audio-controller.d.ts +146 -0
- package/dist/audio/audio-controller.d.ts.map +1 -0
- package/dist/audio/audio-controller.js +445 -0
- package/dist/audio/audio-controller.js.map +1 -0
- package/dist/audio/audio-environment.cjs +157 -0
- package/dist/audio/audio-environment.d.ts +49 -0
- package/dist/audio/audio-environment.d.ts.map +1 -0
- package/dist/audio/audio-environment.js +148 -0
- package/dist/audio/audio-environment.js.map +1 -0
- package/dist/audio/audio-graph.cjs +182 -0
- package/dist/audio/audio-graph.d.ts +58 -0
- package/dist/audio/audio-graph.d.ts.map +1 -0
- package/dist/audio/audio-graph.js +181 -0
- package/dist/audio/audio-graph.js.map +1 -0
- package/dist/compute/buffer-transform.cjs +146 -0
- package/dist/compute/buffer-transform.d.ts +15 -5
- package/dist/compute/buffer-transform.d.ts.map +1 -1
- package/dist/compute/buffer-transform.js +57 -13
- package/dist/compute/buffer-transform.js.map +1 -1
- package/dist/compute/computation.cjs +339 -0
- package/dist/compute/computation.d.ts +20 -8
- package/dist/compute/computation.d.ts.map +1 -1
- package/dist/compute/computation.js +109 -43
- package/dist/compute/computation.js.map +1 -1
- package/dist/compute/swap.cjs +132 -0
- package/dist/compute/texture-transform.cjs +142 -0
- package/dist/compute/texture-transform.d.ts +13 -9
- package/dist/compute/texture-transform.d.ts.map +1 -1
- package/dist/compute/texture-transform.js +17 -7
- package/dist/compute/texture-transform.js.map +1 -1
- package/dist/controls/orbit-controls.cjs +283 -0
- package/dist/controls/orbit-controls.d.ts +11 -2
- package/dist/controls/orbit-controls.d.ts.map +1 -1
- package/dist/controls/orbit-controls.js +57 -9
- package/dist/controls/orbit-controls.js.map +1 -1
- package/dist/debug/copy-texture-to-image.cjs +84 -0
- package/dist/debug/debug-framebuffer.cjs +113 -0
- package/dist/debug/debug-shader-layout.cjs +45 -0
- package/dist/debug/pixel-data-utils.cjs +54 -0
- package/dist/dist.dev.js +50746 -7979
- package/dist/dist.min.js +154 -27
- package/dist/dynamic-buffer/dynamic-buffer.cjs +39 -0
- package/dist/dynamic-buffer/dynamic-buffer.d.ts +1 -170
- package/dist/dynamic-buffer/dynamic-buffer.d.ts.map +1 -1
- package/dist/dynamic-buffer/dynamic-buffer.js +2 -312
- package/dist/dynamic-buffer/dynamic-buffer.js.map +1 -1
- package/dist/dynamic-texture/dynamic-texture.cjs +27 -0
- package/dist/dynamic-texture/dynamic-texture.d.ts +1 -114
- package/dist/dynamic-texture/dynamic-texture.d.ts.map +1 -1
- package/dist/dynamic-texture/dynamic-texture.js +2 -584
- package/dist/dynamic-texture/dynamic-texture.js.map +1 -1
- package/dist/dynamic-texture/texture-binding-source.cjs +31 -0
- package/dist/dynamic-texture/texture-binding-source.d.ts +1 -54
- package/dist/dynamic-texture/texture-binding-source.d.ts.map +1 -1
- package/dist/dynamic-texture/texture-binding-source.js +2 -51
- package/dist/dynamic-texture/texture-binding-source.js.map +1 -1
- package/dist/dynamic-texture/texture-data.cjs +53 -0
- package/dist/dynamic-texture/texture-data.d.ts +1 -145
- package/dist/dynamic-texture/texture-data.d.ts.map +1 -1
- package/dist/dynamic-texture/texture-data.js +2 -209
- package/dist/dynamic-texture/texture-data.js.map +1 -1
- package/dist/dynamic-texture/video-texture.cjs +269 -0
- package/dist/dynamic-texture/video-texture.d.ts +1 -1
- package/dist/dynamic-texture/video-texture.d.ts.map +1 -1
- 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/controls/comparison-splitter.cjs +231 -0
- package/dist/experimental/controls/comparison-splitter.d.ts +54 -0
- package/dist/experimental/controls/comparison-splitter.d.ts.map +1 -0
- package/dist/experimental/controls/comparison-splitter.js +215 -0
- package/dist/experimental/controls/comparison-splitter.js.map +1 -0
- package/dist/experimental/controls/flat-controller.cjs +301 -0
- package/dist/experimental/controls/flat-controller.d.ts +80 -0
- package/dist/experimental/controls/flat-controller.d.ts.map +1 -0
- package/dist/experimental/controls/flat-controller.js +295 -0
- package/dist/experimental/controls/flat-controller.js.map +1 -0
- package/dist/experimental/controls/index.cjs +35 -0
- package/dist/experimental/controls/index.cjs.map +6 -0
- package/dist/experimental/controls/index.d.ts +7 -0
- package/dist/experimental/controls/index.d.ts.map +1 -0
- package/dist/experimental/controls/index.js +7 -0
- package/dist/experimental/controls/index.js.map +1 -0
- package/dist/experimental/controls/orbit-controls.cjs +27 -0
- package/dist/experimental/controls/orbit-controls.d.ts +3 -0
- package/dist/experimental/controls/orbit-controls.d.ts.map +1 -0
- package/dist/experimental/controls/orbit-controls.js +5 -0
- package/dist/experimental/controls/orbit-controls.js.map +1 -0
- package/dist/experimental/materials/emissive-material.cjs +126 -0
- package/dist/experimental/materials/emissive-material.d.ts +38 -0
- package/dist/experimental/materials/emissive-material.d.ts.map +1 -0
- package/dist/experimental/materials/emissive-material.js +100 -0
- package/dist/experimental/materials/emissive-material.js.map +1 -0
- package/dist/experimental/materials/glass-material.cjs +570 -0
- package/dist/experimental/materials/glass-material.d.ts +107 -0
- package/dist/experimental/materials/glass-material.d.ts.map +1 -0
- package/dist/experimental/materials/glass-material.js +544 -0
- package/dist/experimental/materials/glass-material.js.map +1 -0
- package/dist/experimental/materials/glass-transmission.cjs +954 -0
- package/dist/experimental/materials/glass-transmission.d.ts +193 -0
- package/dist/experimental/materials/glass-transmission.d.ts.map +1 -0
- package/dist/experimental/materials/glass-transmission.js +928 -0
- package/dist/experimental/materials/glass-transmission.js.map +1 -0
- package/dist/experimental/materials/index.cjs +61 -0
- package/dist/experimental/materials/index.cjs.map +6 -0
- package/dist/experimental/materials/index.d.ts +14 -0
- package/dist/experimental/materials/index.d.ts.map +1 -0
- package/dist/experimental/materials/index.js +11 -0
- package/dist/experimental/materials/index.js.map +1 -0
- package/dist/experimental/materials/optical-caustics.cjs +201 -0
- package/dist/experimental/materials/optical-caustics.d.ts +69 -0
- package/dist/experimental/materials/optical-caustics.d.ts.map +1 -0
- package/dist/experimental/materials/optical-caustics.js +180 -0
- package/dist/experimental/materials/optical-caustics.js.map +1 -0
- package/dist/experimental/materials/optical-lighting.cjs +169 -0
- package/dist/experimental/materials/optical-lighting.d.ts +7 -0
- package/dist/experimental/materials/optical-lighting.d.ts.map +1 -0
- package/dist/experimental/materials/optical-lighting.js +144 -0
- package/dist/experimental/materials/optical-lighting.js.map +1 -0
- package/dist/experimental/materials/optical-point-lights.cjs +258 -0
- package/dist/experimental/materials/optical-point-lights.d.ts +68 -0
- package/dist/experimental/materials/optical-point-lights.d.ts.map +1 -0
- package/dist/experimental/materials/optical-point-lights.js +237 -0
- package/dist/experimental/materials/optical-point-lights.js.map +1 -0
- package/dist/experimental/materials/reflective-material.cjs +216 -0
- package/dist/experimental/materials/reflective-material.d.ts +46 -0
- package/dist/experimental/materials/reflective-material.d.ts.map +1 -0
- package/dist/experimental/materials/reflective-material.js +190 -0
- package/dist/experimental/materials/reflective-material.js.map +1 -0
- package/dist/experimental/textures/html-texture.cjs +221 -0
- package/dist/experimental/textures/html-texture.d.ts +85 -0
- package/dist/experimental/textures/html-texture.d.ts.map +1 -0
- package/dist/experimental/textures/html-texture.js +206 -0
- package/dist/experimental/textures/html-texture.js.map +1 -0
- package/dist/experimental/textures/index.cjs +33 -0
- package/dist/experimental/textures/index.cjs.map +6 -0
- package/dist/experimental/textures/index.d.ts +5 -0
- package/dist/experimental/textures/index.d.ts.map +1 -0
- package/dist/experimental/textures/index.js +7 -0
- package/dist/experimental/textures/index.js.map +1 -0
- package/dist/experimental/textures/packed-pixels.cjs +248 -0
- package/dist/experimental/textures/packed-pixels.d.ts +17 -0
- package/dist/experimental/textures/packed-pixels.d.ts.map +1 -0
- package/dist/experimental/textures/packed-pixels.js +237 -0
- package/dist/experimental/textures/packed-pixels.js.map +1 -0
- package/dist/experimental/textures/rgba-decoder.cjs +60 -0
- package/dist/experimental/textures/rgba-decoder.d.ts +29 -0
- package/dist/experimental/textures/rgba-decoder.d.ts.map +1 -0
- package/dist/experimental/textures/rgba-decoder.js +43 -0
- package/dist/experimental/textures/rgba-decoder.js.map +1 -0
- package/dist/experimental/webxr/index.cjs +38 -0
- package/dist/experimental/webxr/index.cjs.map +6 -0
- package/dist/experimental/webxr/index.d.ts +9 -0
- package/dist/experimental/webxr/index.d.ts.map +1 -0
- package/dist/experimental/webxr/index.js +8 -0
- package/dist/experimental/webxr/index.js.map +1 -0
- package/dist/experimental/webxr/webxr-animation-frame-provider.cjs +38 -0
- package/dist/experimental/webxr/webxr-animation-frame-provider.d.ts +9 -0
- package/dist/experimental/webxr/webxr-animation-frame-provider.d.ts.map +1 -0
- package/dist/experimental/webxr/webxr-animation-frame-provider.js +17 -0
- package/dist/experimental/webxr/webxr-animation-frame-provider.js.map +1 -0
- package/dist/experimental/webxr/webxr-camera-texture.cjs +157 -0
- package/dist/experimental/webxr/webxr-camera-texture.d.ts +48 -0
- package/dist/experimental/webxr/webxr-camera-texture.d.ts.map +1 -0
- package/dist/experimental/webxr/webxr-camera-texture.js +144 -0
- package/dist/experimental/webxr/webxr-camera-texture.js.map +1 -0
- package/dist/experimental/webxr/webxr-input.cjs +93 -0
- package/dist/experimental/webxr/webxr-input.d.ts +24 -0
- package/dist/experimental/webxr/webxr-input.d.ts.map +1 -0
- package/dist/experimental/webxr/webxr-input.js +70 -0
- package/dist/experimental/webxr/webxr-input.js.map +1 -0
- package/dist/experimental/webxr/webxr-manager.cjs +356 -0
- package/dist/experimental/webxr/webxr-manager.d.ts +91 -0
- package/dist/experimental/webxr/webxr-manager.d.ts.map +1 -0
- package/dist/experimental/webxr/webxr-manager.js +354 -0
- package/dist/experimental/webxr/webxr-manager.js.map +1 -0
- package/dist/experimental/webxr/webxr-types.cjs +15 -0
- package/dist/experimental/webxr/webxr-types.d.ts +152 -0
- package/dist/experimental/webxr/webxr-types.d.ts.map +1 -0
- package/dist/experimental/webxr/webxr-types.js +5 -0
- package/dist/experimental/webxr/webxr-types.js.map +1 -0
- package/dist/geometry/edge-geometry.cjs +171 -0
- package/dist/geometry/edge-geometry.d.ts +17 -0
- package/dist/geometry/edge-geometry.d.ts.map +1 -0
- package/dist/geometry/edge-geometry.js +160 -0
- package/dist/geometry/edge-geometry.js.map +1 -0
- package/dist/geometry/geometry-primitives.cjs +189 -0
- package/dist/geometry/geometry-primitives.d.ts +60 -0
- package/dist/geometry/geometry-primitives.d.ts.map +1 -0
- package/dist/geometry/geometry-primitives.js +161 -0
- package/dist/geometry/geometry-primitives.js.map +1 -0
- package/dist/geometry/geometry-table.cjs +15 -0
- package/dist/geometry/geometry-utils.cjs +147 -0
- package/dist/geometry/geometry-utils.d.ts +7 -15
- package/dist/geometry/geometry-utils.d.ts.map +1 -1
- package/dist/geometry/geometry-utils.js +9 -55
- package/dist/geometry/geometry-utils.js.map +1 -1
- package/dist/geometry/geometry.cjs +90 -0
- package/dist/geometry/geometry.d.ts +9 -69
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +27 -93
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/geometry/gpu-geometry.cjs +130 -0
- package/dist/geometry/gpu-geometry.d.ts +4 -2
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +3 -3
- package/dist/geometry/gpu-geometry.js.map +1 -1
- package/dist/geometry/gpu-vector-geometry-adapter.cjs +102 -0
- package/dist/geometry/gpu-vector-geometry-adapter.d.ts +12 -0
- package/dist/geometry/gpu-vector-geometry-adapter.d.ts.map +1 -0
- package/dist/geometry/gpu-vector-geometry-adapter.js +90 -0
- package/dist/geometry/gpu-vector-geometry-adapter.js.map +1 -0
- package/dist/geometry/gpu-vector-geometry.cjs +43 -0
- package/dist/geometry/gpu-vector-geometry.d.ts +23 -0
- package/dist/geometry/gpu-vector-geometry.d.ts.map +1 -0
- package/dist/geometry/gpu-vector-geometry.js +21 -0
- package/dist/geometry/gpu-vector-geometry.js.map +1 -0
- package/dist/geometry/mesh-simplification.cjs +385 -0
- package/dist/geometry/ring-geometry.cjs +104 -0
- package/dist/geometry/ring-geometry.d.ts +17 -0
- package/dist/geometry/ring-geometry.d.ts.map +1 -0
- package/dist/geometry/ring-geometry.js +94 -0
- package/dist/geometry/ring-geometry.js.map +1 -0
- package/dist/geometry/stroke-geometry.cjs +171 -0
- package/dist/geometry/stroke-geometry.d.ts +15 -0
- package/dist/geometry/stroke-geometry.d.ts.map +1 -0
- package/dist/geometry/stroke-geometry.js +168 -0
- package/dist/geometry/stroke-geometry.js.map +1 -0
- 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 +400 -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 +382 -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 +411 -0
- package/dist/gltf/parsers/parse-gltf.d.ts +47 -0
- package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -0
- package/dist/gltf/parsers/parse-gltf.js +410 -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 +561 -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 +582 -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 +659 -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 +98 -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 +66 -0
- package/dist/graph/models/index.cjs.map +6 -0
- package/dist/graph/models/index.d.ts +7 -0
- package/dist/graph/models/index.d.ts.map +1 -0
- package/dist/graph/models/index.js +10 -0
- package/dist/graph/models/index.js.map +1 -0
- package/dist/graph/models/path/path-attribute-model.cjs +424 -0
- package/dist/graph/models/path/path-attribute-model.d.ts +144 -0
- package/dist/graph/models/path/path-attribute-model.d.ts.map +1 -0
- package/dist/graph/models/path/path-attribute-model.js +414 -0
- package/dist/graph/models/path/path-attribute-model.js.map +1 -0
- package/dist/graph/models/path/path-storage-model.cjs +714 -0
- package/dist/graph/models/path/path-storage-model.d.ts +176 -0
- package/dist/graph/models/path/path-storage-model.d.ts.map +1 -0
- package/dist/graph/models/path/path-storage-model.js +725 -0
- package/dist/graph/models/path/path-storage-model.js.map +1 -0
- package/dist/graph/models/path/path-trips-storage-model.cjs +271 -0
- package/dist/graph/models/path/path-trips-storage-model.d.ts +58 -0
- package/dist/graph/models/path/path-trips-storage-model.d.ts.map +1 -0
- package/dist/graph/models/path/path-trips-storage-model.js +248 -0
- package/dist/graph/models/path/path-trips-storage-model.js.map +1 -0
- package/dist/graph/models/polygon/polygon-attribute-model.cjs +117 -0
- package/dist/graph/models/polygon/polygon-attribute-model.d.ts +53 -0
- package/dist/graph/models/polygon/polygon-attribute-model.d.ts.map +1 -0
- package/dist/graph/models/polygon/polygon-attribute-model.js +101 -0
- package/dist/graph/models/polygon/polygon-attribute-model.js.map +1 -0
- package/dist/graph/models/polygon/polygon-shaders.cjs +283 -0
- package/dist/graph/models/polygon/polygon-shaders.d.ts +77 -0
- package/dist/graph/models/polygon/polygon-shaders.d.ts.map +1 -0
- package/dist/graph/models/polygon/polygon-shaders.js +242 -0
- package/dist/graph/models/polygon/polygon-shaders.js.map +1 -0
- package/dist/graph/models/polygon/polygon-storage-model.cjs +111 -0
- package/dist/graph/models/polygon/polygon-storage-model.d.ts +53 -0
- package/dist/graph/models/polygon/polygon-storage-model.d.ts.map +1 -0
- package/dist/graph/models/polygon/polygon-storage-model.js +92 -0
- package/dist/graph/models/polygon/polygon-storage-model.js.map +1 -0
- package/dist/graph/physics/index.cjs +53 -0
- package/dist/graph/physics/index.cjs.map +6 -0
- package/dist/graph/physics/index.d.ts +14 -0
- package/dist/graph/physics/index.d.ts.map +1 -0
- package/dist/graph/physics/index.js +13 -0
- package/dist/graph/physics/index.js.map +1 -0
- package/dist/graph/physics/physics-controller-geometry.cjs +203 -0
- package/dist/graph/physics/physics-controller-geometry.d.ts +6 -0
- package/dist/graph/physics/physics-controller-geometry.d.ts.map +1 -0
- package/dist/graph/physics/physics-controller-geometry.js +205 -0
- package/dist/graph/physics/physics-controller-geometry.js.map +1 -0
- package/dist/graph/physics/physics-controller.cjs +277 -0
- package/dist/graph/physics/physics-controller.d.ts +90 -0
- package/dist/graph/physics/physics-controller.d.ts.map +1 -0
- package/dist/graph/physics/physics-controller.js +266 -0
- package/dist/graph/physics/physics-controller.js.map +1 -0
- package/dist/graph/physics/physics-scenegraph.cjs +92 -0
- package/dist/graph/physics/physics-scenegraph.d.ts +35 -0
- package/dist/graph/physics/physics-scenegraph.d.ts.map +1 -0
- package/dist/graph/physics/physics-scenegraph.js +80 -0
- package/dist/graph/physics/physics-scenegraph.js.map +1 -0
- package/dist/graph/physics/scenegraph-behaviors.cjs +164 -0
- package/dist/graph/physics/scenegraph-behaviors.d.ts +37 -0
- package/dist/graph/physics/scenegraph-behaviors.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-behaviors.js +145 -0
- package/dist/graph/physics/scenegraph-behaviors.js.map +1 -0
- package/dist/graph/physics/scenegraph-instance.cjs +255 -0
- package/dist/graph/physics/scenegraph-instance.d.ts +61 -0
- package/dist/graph/physics/scenegraph-instance.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-instance.js +252 -0
- package/dist/graph/physics/scenegraph-instance.js.map +1 -0
- package/dist/graph/physics/scenegraph-joints.cjs +51 -0
- package/dist/graph/physics/scenegraph-joints.d.ts +5 -0
- package/dist/graph/physics/scenegraph-joints.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-joints.js +31 -0
- package/dist/graph/physics/scenegraph-joints.js.map +1 -0
- package/dist/graph/physics/scenegraph-motion.cjs +177 -0
- package/dist/graph/physics/scenegraph-motion.d.ts +41 -0
- package/dist/graph/physics/scenegraph-motion.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-motion.js +168 -0
- package/dist/graph/physics/scenegraph-motion.js.map +1 -0
- package/dist/graph/physics/scenegraph-properties.cjs +170 -0
- package/dist/graph/physics/scenegraph-properties.d.ts +37 -0
- package/dist/graph/physics/scenegraph-properties.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-properties.js +186 -0
- package/dist/graph/physics/scenegraph-properties.js.map +1 -0
- package/dist/graph/physics/scenegraph-publication.cjs +122 -0
- package/dist/graph/physics/scenegraph-publication.d.ts +25 -0
- package/dist/graph/physics/scenegraph-publication.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-publication.js +110 -0
- package/dist/graph/physics/scenegraph-publication.js.map +1 -0
- package/dist/graph/physics/scenegraph-session.cjs +266 -0
- package/dist/graph/physics/scenegraph-session.d.ts +77 -0
- package/dist/graph/physics/scenegraph-session.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-session.js +261 -0
- package/dist/graph/physics/scenegraph-session.js.map +1 -0
- package/dist/graph/tables/gpu-table-geometry.cjs +84 -0
- package/dist/graph/tables/gpu-table-geometry.d.ts +32 -0
- package/dist/graph/tables/gpu-table-geometry.d.ts.map +1 -0
- package/dist/graph/tables/gpu-table-geometry.js +67 -0
- package/dist/graph/tables/gpu-table-geometry.js.map +1 -0
- package/dist/graph/tables/gpu-table-model.cjs +459 -0
- package/dist/graph/tables/gpu-table-model.d.ts +68 -0
- package/dist/graph/tables/gpu-table-model.d.ts.map +1 -0
- package/dist/graph/tables/gpu-table-model.js +457 -0
- package/dist/graph/tables/gpu-table-model.js.map +1 -0
- package/dist/graph/tables/gpu-table-transform.cjs +341 -0
- package/dist/graph/tables/gpu-table-transform.d.ts +61 -0
- package/dist/graph/tables/gpu-table-transform.d.ts.map +1 -0
- package/dist/graph/tables/gpu-table-transform.js +333 -0
- package/dist/graph/tables/gpu-table-transform.js.map +1 -0
- package/dist/graph/tables/index.cjs +33 -0
- package/dist/graph/tables/index.cjs.map +6 -0
- package/dist/graph/tables/index.d.ts +4 -0
- package/dist/graph/tables/index.d.ts.map +1 -0
- package/dist/graph/tables/index.js +7 -0
- package/dist/graph/tables/index.js.map +1 -0
- package/dist/index.cjs +311 -9953
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +54 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -8
- package/dist/index.js.map +1 -1
- package/dist/interactivity/interactivity.cjs +570 -0
- package/dist/interactivity/interactivity.d.ts +107 -0
- package/dist/interactivity/interactivity.d.ts.map +1 -0
- package/dist/interactivity/interactivity.js +575 -0
- package/dist/interactivity/interactivity.js.map +1 -0
- package/dist/interactivity/physics.cjs +15 -0
- package/dist/interactivity/physics.d.ts +12 -0
- package/dist/interactivity/physics.d.ts.map +1 -0
- package/dist/interactivity/physics.js +5 -0
- package/dist/interactivity/physics.js.map +1 -0
- 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.cjs +99 -0
- package/dist/material/material-factory.d.ts +2 -2
- package/dist/material/material-factory.d.ts.map +1 -1
- package/dist/material/material.cjs +239 -0
- package/dist/material/material.d.ts +3 -3
- package/dist/material/material.d.ts.map +1 -1
- package/dist/material/material.js +2 -2
- package/dist/material/material.js.map +1 -1
- package/dist/model/batch-uniform-buffer.cjs +70 -0
- package/dist/model/batch-uniform-buffer.d.ts +21 -0
- package/dist/model/batch-uniform-buffer.d.ts.map +1 -0
- package/dist/model/batch-uniform-buffer.js +48 -0
- package/dist/model/batch-uniform-buffer.js.map +1 -0
- package/dist/model/gpu-vector-bindings.cjs +274 -0
- package/dist/model/gpu-vector-bindings.d.ts +36 -0
- package/dist/model/gpu-vector-bindings.d.ts.map +1 -0
- package/dist/model/gpu-vector-bindings.js +276 -0
- package/dist/model/gpu-vector-bindings.js.map +1 -0
- package/dist/model/gpu-vector-draw-batches.cjs +85 -0
- package/dist/model/gpu-vector-draw-batches.d.ts +5 -0
- package/dist/model/gpu-vector-draw-batches.d.ts.map +1 -0
- package/dist/model/gpu-vector-draw-batches.js +77 -0
- package/dist/model/gpu-vector-draw-batches.js.map +1 -0
- package/dist/model/gpu-vector-model-batches.cjs +94 -0
- package/dist/model/gpu-vector-model-batches.d.ts +46 -0
- package/dist/model/gpu-vector-model-batches.d.ts.map +1 -0
- package/dist/model/gpu-vector-model-batches.js +77 -0
- package/dist/model/gpu-vector-model-batches.js.map +1 -0
- package/dist/model/gpu-vector-model.cjs +1344 -0
- package/dist/model/gpu-vector-model.d.ts +381 -0
- package/dist/model/gpu-vector-model.d.ts.map +1 -0
- package/dist/model/gpu-vector-model.js +1474 -0
- package/dist/model/gpu-vector-model.js.map +1 -0
- package/dist/model/model.cjs +142 -0
- package/dist/model/model.d.ts +25 -291
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +77 -1022
- package/dist/model/model.js.map +1 -1
- package/dist/model/split-uniforms-and-bindings.cjs +44 -0
- package/dist/model/split-uniforms-and-bindings.d.ts +2 -2
- package/dist/model/split-uniforms-and-bindings.d.ts.map +1 -1
- package/dist/model/split-uniforms-and-bindings.js +5 -2
- package/dist/model/split-uniforms-and-bindings.js.map +1 -1
- package/dist/models/billboard-texture-model.cjs +167 -0
- package/dist/models/billboard-texture-model.d.ts +1 -1
- package/dist/models/billboard-texture-model.d.ts.map +1 -1
- package/dist/models/billboard-texture-model.js +1 -1
- package/dist/models/billboard-texture-model.js.map +1 -1
- package/dist/models/billboard-texture-module.cjs +61 -0
- package/dist/models/clip-space.cjs +103 -0
- package/dist/models/clip-space.d.ts +4 -1
- package/dist/models/clip-space.d.ts.map +1 -1
- package/dist/models/clip-space.js +16 -13
- package/dist/models/clip-space.js.map +1 -1
- package/dist/models/directional-light-model.cjs +45 -0
- package/dist/models/directional-light-model.js +1 -1
- package/dist/models/directional-light-model.js.map +1 -1
- package/dist/models/light-model-utils.cjs +426 -0
- package/dist/models/light-model-utils.d.ts +3 -2
- package/dist/models/light-model-utils.d.ts.map +1 -1
- package/dist/models/light-model-utils.js +2 -2
- package/dist/models/light-model-utils.js.map +1 -1
- package/dist/models/point-light-model.cjs +44 -0
- package/dist/models/point-light-model.js +1 -1
- package/dist/models/point-light-model.js.map +1 -1
- package/dist/models/spot-light-model.cjs +45 -0
- package/dist/models/spot-light-model.js +1 -1
- package/dist/models/spot-light-model.js.map +1 -1
- package/dist/modules/picking/color-picking.cjs +209 -0
- package/dist/modules/picking/color-picking.d.ts +2 -2
- package/dist/modules/picking/index-color-picking.cjs +230 -0
- package/dist/modules/picking/index-color-picking.d.ts +2 -2
- package/dist/modules/picking/index-picking.cjs +201 -0
- package/dist/modules/picking/index-picking.d.ts +2 -2
- package/dist/modules/picking/legacy-color-picking.cjs +28 -0
- package/dist/modules/picking/legacy-color-picking.d.ts +4 -4
- 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.cjs +92 -0
- 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-manager.cjs +360 -0
- package/dist/modules/picking/picking-uniforms.cjs +140 -0
- package/dist/modules/picking/picking-uniforms.d.ts +2 -2
- package/dist/modules/picking/picking-uniforms.d.ts.map +1 -1
- package/dist/modules/picking/picking.cjs +43 -0
- package/dist/modules/picking/picking.d.ts +2 -2
- package/dist/passes/get-fragment-shader.cjs +119 -0
- 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 +722 -0
- package/dist/passes/shader-pass-renderer.d.ts +14 -14
- package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
- package/dist/passes/shader-pass-renderer.js +19 -19
- package/dist/passes/shader-pass-renderer.js.map +1 -1
- package/dist/passes/texture-transform-module.cjs +78 -0
- package/dist/scenegraph/controllers/area-light-controller.cjs +143 -0
- package/dist/scenegraph/controllers/area-light-controller.d.ts +31 -0
- package/dist/scenegraph/controllers/area-light-controller.d.ts.map +1 -0
- package/dist/scenegraph/controllers/area-light-controller.js +130 -0
- package/dist/scenegraph/controllers/area-light-controller.js.map +1 -0
- package/dist/scenegraph/controllers/billboard-controller.cjs +156 -0
- package/dist/scenegraph/controllers/billboard-controller.d.ts +45 -0
- package/dist/scenegraph/controllers/billboard-controller.d.ts.map +1 -0
- package/dist/scenegraph/controllers/billboard-controller.js +156 -0
- package/dist/scenegraph/controllers/billboard-controller.js.map +1 -0
- package/dist/scenegraph/controllers/joint-controller.cjs +71 -0
- package/dist/scenegraph/controllers/joint-controller.d.ts +30 -0
- package/dist/scenegraph/controllers/joint-controller.d.ts.map +1 -0
- package/dist/scenegraph/controllers/joint-controller.js +53 -0
- package/dist/scenegraph/controllers/joint-controller.js.map +1 -0
- package/dist/scenegraph/controllers/material-variants.cjs +61 -0
- package/dist/scenegraph/controllers/material-variants.d.ts +42 -0
- package/dist/scenegraph/controllers/material-variants.d.ts.map +1 -0
- package/dist/scenegraph/controllers/material-variants.js +40 -0
- package/dist/scenegraph/controllers/material-variants.js.map +1 -0
- package/dist/scenegraph/controllers/morph-controller.cjs +61 -0
- package/dist/scenegraph/controllers/morph-controller.d.ts +19 -0
- package/dist/scenegraph/controllers/morph-controller.d.ts.map +1 -0
- package/dist/scenegraph/controllers/morph-controller.js +41 -0
- package/dist/scenegraph/controllers/morph-controller.js.map +1 -0
- package/dist/scenegraph/controllers/skin-controller.cjs +111 -0
- package/dist/scenegraph/controllers/skin-controller.d.ts +36 -0
- package/dist/scenegraph/controllers/skin-controller.d.ts.map +1 -0
- package/dist/scenegraph/controllers/skin-controller.js +90 -0
- package/dist/scenegraph/controllers/skin-controller.js.map +1 -0
- package/dist/scenegraph/geometry-node.cjs +47 -0
- package/dist/scenegraph/geometry-node.d.ts +13 -0
- package/dist/scenegraph/geometry-node.d.ts.map +1 -0
- package/dist/scenegraph/geometry-node.js +26 -0
- package/dist/scenegraph/geometry-node.js.map +1 -0
- package/dist/scenegraph/group-node.cjs +171 -0
- package/dist/scenegraph/group-node.d.ts +8 -0
- package/dist/scenegraph/group-node.d.ts.map +1 -1
- package/dist/scenegraph/group-node.js +47 -1
- package/dist/scenegraph/group-node.js.map +1 -1
- package/dist/scenegraph/model-node.cjs +68 -0
- package/dist/scenegraph/physics-transforms.cjs +95 -0
- package/dist/scenegraph/physics-transforms.d.ts +13 -0
- package/dist/scenegraph/physics-transforms.d.ts.map +1 -0
- package/dist/scenegraph/physics-transforms.js +72 -0
- package/dist/scenegraph/physics-transforms.js.map +1 -0
- package/dist/scenegraph/published-transforms.cjs +37 -0
- package/dist/scenegraph/published-transforms.d.ts +17 -0
- package/dist/scenegraph/published-transforms.d.ts.map +1 -0
- package/dist/scenegraph/published-transforms.js +16 -0
- package/dist/scenegraph/published-transforms.js.map +1 -0
- package/dist/scenegraph/scenegraph-bounds.cjs +51 -0
- package/dist/scenegraph/scenegraph-node.cjs +182 -0
- package/dist/scenegraph/transform-source.cjs +15 -0
- package/dist/scenegraph/transform-source.d.ts +24 -0
- package/dist/scenegraph/transform-source.d.ts.map +1 -0
- package/dist/scenegraph/transform-source.js +5 -0
- package/dist/scenegraph/transform-source.js.map +1 -0
- package/dist/shader-inputs.cjs +231 -0
- package/dist/shader-inputs.d.ts +2 -2
- 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 +275 -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 +266 -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 +984 -0
- package/dist/splats/splat-renderer.d.ts +229 -0
- package/dist/splats/splat-renderer.d.ts.map +1 -0
- package/dist/splats/splat-renderer.js +1008 -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 +82 -0
- package/dist/text/text-2d/models/text-attribute-model.d.ts +113 -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 +73 -0
- package/dist/text/text-2d/models/text-attribute-model.js.map +1 -0
- package/dist/text/text-2d/models/text-dictionary-model.cjs +118 -0
- package/dist/text/text-2d/models/text-dictionary-model.d.ts +97 -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 +105 -0
- package/dist/text/text-2d/models/text-dictionary-model.js.map +1 -0
- package/dist/text/text-2d/models/text-storage-model.cjs +168 -0
- package/dist/text/text-2d/models/text-storage-model.d.ts +96 -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 +167 -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/buffer-layout-helper.cjs +52 -0
- package/dist/utils/buffer-layout-order.cjs +37 -0
- package/dist/utils/deep-equal.cjs +67 -0
- 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 +27 -0
- package/dist/utils/get-platform-info.d.ts +2 -0
- package/dist/utils/get-platform-info.d.ts.map +1 -0
- package/dist/utils/get-platform-info.js +5 -0
- package/dist/utils/get-platform-info.js.map +1 -0
- package/dist/utils/gpu-vector-batch-structure.cjs +45 -0
- package/dist/utils/gpu-vector-batch-structure.d.ts +12 -0
- package/dist/utils/gpu-vector-batch-structure.d.ts.map +1 -0
- package/dist/utils/gpu-vector-batch-structure.js +27 -0
- package/dist/utils/gpu-vector-batch-structure.js.map +1 -0
- package/dist/utils/shader-module-utils.cjs +148 -0
- 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/dist/utils/uid.cjs +32 -0
- package/package.json +98 -8
- package/src/animation/deform-positions.ts +62 -0
- package/src/animation/node-animation-binding.ts +54 -0
- package/src/animation/property-animation-binding.ts +212 -0
- package/src/animation/scenegraph-animator.ts +117 -0
- package/src/animation/texture-transform.ts +59 -0
- package/src/animation-loop/animation-loop.ts +26 -10
- package/src/animation-loop/animation-props.ts +4 -1
- 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 +253 -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/splats/conversion/make-gpu-splat-data-from-gltf.ts +220 -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 +1606 -0
- package/src/arrow/renderers/text/renderers/arrow-text-shaders.ts +1008 -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/audio/audio-controller.ts +583 -0
- package/src/audio/audio-environment.ts +202 -0
- package/src/audio/audio-graph.ts +253 -0
- package/src/compute/buffer-transform.ts +72 -17
- package/src/compute/computation.ts +117 -60
- package/src/compute/texture-transform.ts +28 -15
- package/src/controls/orbit-controls.ts +65 -10
- package/src/dynamic-buffer/dynamic-buffer.ts +15 -449
- package/src/dynamic-texture/dynamic-texture.ts +5 -760
- package/src/dynamic-texture/texture-binding-source.ts +8 -90
- package/src/dynamic-texture/texture-data.ts +31 -340
- package/src/dynamic-texture/video-texture.ts +1 -1
- 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/controls/comparison-splitter.ts +269 -0
- package/src/experimental/controls/flat-controller.ts +403 -0
- package/src/experimental/controls/index.ts +16 -0
- package/src/experimental/controls/orbit-controls.ts +6 -0
- package/src/experimental/materials/emissive-material.ts +120 -0
- package/src/experimental/materials/glass-material.ts +607 -0
- package/src/experimental/materials/glass-transmission.ts +1023 -0
- package/src/experimental/materials/index.ts +49 -0
- package/src/experimental/materials/optical-caustics.ts +234 -0
- package/src/experimental/materials/optical-lighting.ts +148 -0
- package/src/experimental/materials/optical-point-lights.ts +288 -0
- package/src/experimental/materials/reflective-material.ts +214 -0
- package/src/experimental/textures/html-texture.ts +285 -0
- package/src/experimental/textures/index.ts +8 -0
- package/src/experimental/textures/packed-pixels.ts +351 -0
- package/src/experimental/textures/rgba-decoder.ts +79 -0
- package/src/experimental/webxr/index.ts +21 -0
- package/src/experimental/webxr/webxr-animation-frame-provider.ts +22 -0
- package/src/experimental/webxr/webxr-camera-texture.ts +195 -0
- package/src/experimental/webxr/webxr-input.ts +117 -0
- package/src/experimental/webxr/webxr-manager.ts +524 -0
- package/src/experimental/webxr/webxr-types.ts +192 -0
- package/src/geometry/edge-geometry.ts +208 -0
- package/src/geometry/geometry-primitives.ts +226 -0
- package/src/geometry/geometry-utils.ts +16 -71
- package/src/geometry/geometry.ts +36 -163
- package/src/geometry/gpu-geometry.ts +6 -4
- package/src/geometry/gpu-vector-geometry-adapter.ts +96 -0
- package/src/geometry/gpu-vector-geometry.ts +36 -0
- package/src/geometry/ring-geometry.ts +117 -0
- package/src/geometry/stroke-geometry.ts +236 -0
- 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 +505 -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 +190 -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 +662 -0
- package/src/gltf/parsers/parse-pbr-material.ts +1664 -0
- package/src/gltf/parsers/post-process-gltf.ts +757 -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 +790 -0
- package/src/gltf/types/gltf-shape-schema.ts +48 -0
- package/src/gltf/types/gltf-types.ts +122 -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/index.ts +45 -0
- package/src/graph/models/path/path-attribute-model.ts +572 -0
- package/src/graph/models/path/path-storage-model.ts +1005 -0
- package/src/graph/models/path/path-trips-storage-model.ts +286 -0
- package/src/graph/models/polygon/polygon-attribute-model.ts +165 -0
- package/src/graph/models/polygon/polygon-shaders.ts +279 -0
- package/src/graph/models/polygon/polygon-storage-model.ts +146 -0
- package/src/graph/physics/index.ts +34 -0
- package/src/graph/physics/physics-controller-geometry.ts +264 -0
- package/src/graph/physics/physics-controller.ts +348 -0
- package/src/graph/physics/physics-scenegraph.ts +112 -0
- package/src/graph/physics/scenegraph-behaviors.ts +169 -0
- package/src/graph/physics/scenegraph-instance.ts +307 -0
- package/src/graph/physics/scenegraph-joints.ts +37 -0
- package/src/graph/physics/scenegraph-motion.ts +186 -0
- package/src/graph/physics/scenegraph-properties.ts +241 -0
- package/src/graph/physics/scenegraph-publication.ts +136 -0
- package/src/graph/physics/scenegraph-session.ts +349 -0
- package/src/graph/tables/gpu-table-geometry.ts +88 -0
- package/src/graph/tables/gpu-table-model.ts +662 -0
- package/src/graph/tables/gpu-table-transform.ts +497 -0
- package/src/graph/tables/index.ts +18 -0
- package/src/index.ts +162 -15
- package/src/interactivity/interactivity.ts +670 -0
- package/src/interactivity/physics.ts +19 -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 +2 -2
- package/src/material/material.ts +3 -3
- package/src/model/batch-uniform-buffer.ts +51 -0
- package/src/model/gpu-vector-bindings.ts +342 -0
- package/src/model/gpu-vector-draw-batches.ts +121 -0
- package/src/model/gpu-vector-model-batches.ts +147 -0
- package/src/model/gpu-vector-model.ts +1947 -0
- package/src/model/model.ts +100 -1375
- package/src/model/split-uniforms-and-bindings.ts +7 -4
- package/src/models/billboard-texture-model.ts +2 -2
- package/src/models/billboard-texture-module.ts +1 -1
- package/src/models/clip-space.ts +21 -14
- package/src/models/directional-light-model.ts +1 -1
- package/src/models/light-model-utils.ts +4 -9
- package/src/models/point-light-model.ts +1 -1
- package/src/models/spot-light-model.ts +1 -1
- 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 +2 -2
- package/src/modules/picking/picking-uniforms.ts +2 -2
- package/src/modules/picking/picking.ts +1 -1
- package/src/passes/get-fragment-shader.ts +1 -1
- package/src/passes/shader-pass-renderer.ts +32 -29
- package/src/passes/texture-transform-module.ts +1 -1
- package/src/scenegraph/controllers/area-light-controller.ts +152 -0
- package/src/scenegraph/controllers/billboard-controller.ts +204 -0
- package/src/scenegraph/controllers/joint-controller.ts +81 -0
- package/src/scenegraph/controllers/material-variants.ts +70 -0
- package/src/scenegraph/controllers/morph-controller.ts +61 -0
- package/src/scenegraph/controllers/skin-controller.ts +125 -0
- package/src/scenegraph/geometry-node.ts +31 -0
- package/src/scenegraph/group-node.ts +54 -1
- package/src/scenegraph/physics-transforms.ts +82 -0
- package/src/scenegraph/published-transforms.ts +18 -0
- package/src/scenegraph/transform-source.ts +30 -0
- package/src/shader-inputs.ts +2 -2
- package/src/splats/README.md +89 -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 +441 -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 +1289 -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 +156 -0
- package/src/text/text-2d/models/text-dictionary-model.ts +196 -0
- package/src/text/text-2d/models/text-storage-model.ts +263 -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 +5 -0
- package/src/utils/gpu-vector-batch-structure.ts +36 -0
- package/src/utils/shader-module-utils.ts +1 -1
- package/dist/geometries/cone-geometry.d.ts +0 -12
- package/dist/geometries/cone-geometry.d.ts.map +0 -1
- package/dist/geometries/cone-geometry.js +0 -19
- package/dist/geometries/cone-geometry.js.map +0 -1
- package/dist/geometries/cube-geometry.d.ts +0 -14
- package/dist/geometries/cube-geometry.d.ts.map +0 -1
- package/dist/geometries/cube-geometry.js +0 -222
- package/dist/geometries/cube-geometry.js.map +0 -1
- package/dist/geometries/cylinder-geometry.d.ts +0 -11
- package/dist/geometries/cylinder-geometry.d.ts.map +0 -1
- package/dist/geometries/cylinder-geometry.js +0 -17
- package/dist/geometries/cylinder-geometry.js.map +0 -1
- package/dist/geometries/ico-sphere-geometry.d.ts +0 -11
- package/dist/geometries/ico-sphere-geometry.d.ts.map +0 -1
- package/dist/geometries/ico-sphere-geometry.js +0 -158
- package/dist/geometries/ico-sphere-geometry.js.map +0 -1
- package/dist/geometries/plane-geometry.d.ts +0 -20
- package/dist/geometries/plane-geometry.d.ts.map +0 -1
- package/dist/geometries/plane-geometry.js +0 -106
- package/dist/geometries/plane-geometry.js.map +0 -1
- package/dist/geometries/sphere-geometry.d.ts +0 -12
- package/dist/geometries/sphere-geometry.d.ts.map +0 -1
- package/dist/geometries/sphere-geometry.js +0 -88
- package/dist/geometries/sphere-geometry.js.map +0 -1
- package/dist/geometries/truncated-cone-geometry.d.ts +0 -23
- package/dist/geometries/truncated-cone-geometry.d.ts.map +0 -1
- package/dist/geometries/truncated-cone-geometry.js +0 -112
- package/dist/geometries/truncated-cone-geometry.js.map +0 -1
- package/src/geometries/cone-geometry.ts +0 -31
- package/src/geometries/cube-geometry.ts +0 -258
- package/src/geometries/cylinder-geometry.ts +0 -28
- package/src/geometries/ico-sphere-geometry.ts +0 -193
- package/src/geometries/plane-geometry.ts +0 -142
- package/src/geometries/sphere-geometry.ts +0 -113
- package/src/geometries/truncated-cone-geometry.ts +0 -145
|
@@ -0,0 +1,3569 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Buffer, type BufferLayout, type Device, type ShaderLayout} from '@luma.gl/core';
|
|
6
|
+
import {GPUVector, type GPUData} from '@luma.gl/graph/gpu-data';
|
|
7
|
+
import {planGeneratedBufferBatches, type GeneratedBufferBatch} from '@luma.gl/graph/gpu-tables';
|
|
8
|
+
import {type GPUTableModelProps} from '@luma.gl/engine/tables';
|
|
9
|
+
import {expandArrowVector} from '@luma.gl/graph/arrow';
|
|
10
|
+
import {getArrowVectorBufferSource, makeArrowFixedSizeListVector} from '@luma.gl/graph/arrow';
|
|
11
|
+
import {makeGPUTableFromArrowTable} from '@luma.gl/graph/arrow';
|
|
12
|
+
import {makeGPUVectorFromArrow} from '@luma.gl/graph/arrow';
|
|
13
|
+
import {getRequiredArrowGPUVectorDataType} from '@luma.gl/graph/_internal/arrow';
|
|
14
|
+
import {isNumericArrowType, type NumericArrowType} from '@luma.gl/graph/arrow';
|
|
15
|
+
import {DynamicBuffer, DynamicTexture} from '@luma.gl/core/dynamic';
|
|
16
|
+
import {
|
|
17
|
+
Data,
|
|
18
|
+
DataType,
|
|
19
|
+
Field,
|
|
20
|
+
FixedSizeList,
|
|
21
|
+
Float32,
|
|
22
|
+
Int16,
|
|
23
|
+
List,
|
|
24
|
+
Schema,
|
|
25
|
+
Table,
|
|
26
|
+
Uint16,
|
|
27
|
+
Uint32,
|
|
28
|
+
Uint8,
|
|
29
|
+
Utf8,
|
|
30
|
+
Vector,
|
|
31
|
+
makeData,
|
|
32
|
+
makeVector,
|
|
33
|
+
util
|
|
34
|
+
} from 'apache-arrow';
|
|
35
|
+
import {type FontAtlas, type GPUTextResources, type TextGlyphLayout} from '@luma.gl/engine/text';
|
|
36
|
+
import {
|
|
37
|
+
buildTextGpuGlyphDefinitions,
|
|
38
|
+
createTextDefaultFragmentShaderUniforms,
|
|
39
|
+
createGpuExpandedCompactInput,
|
|
40
|
+
createGpuExpandedGeneratedState,
|
|
41
|
+
createGpuUtf8ExpandedInput,
|
|
42
|
+
createGpuUtf8ExpandedInputFromBuffers,
|
|
43
|
+
DEFAULT_TEXT_FS,
|
|
44
|
+
DEFAULT_TEXT_SHADER_LAYOUT,
|
|
45
|
+
DEFAULT_TEXT_VS,
|
|
46
|
+
DEFAULT_CLIPPED_TEXT_SHADER_LAYOUT,
|
|
47
|
+
DEFAULT_CLIPPED_TEXT_VS,
|
|
48
|
+
dispatchGpuExpandedTextCompute,
|
|
49
|
+
dispatchGpuUtf8ExpandedTextCompute,
|
|
50
|
+
GPU_TEXT_EXPANSION_STORAGE_BUFFER_COUNT,
|
|
51
|
+
GPU_UTF8_TEXT_EXPANSION_STORAGE_BUFFER_COUNT,
|
|
52
|
+
ROW_INDEXED_COMPACT_GLYPH_VERTEX_BYTE_STRIDE,
|
|
53
|
+
createTextStorageGlyphLookup,
|
|
54
|
+
createTextStorageGlyphMetrics,
|
|
55
|
+
createTextStorageGlyphPages,
|
|
56
|
+
createTextStorageGlyphKernings,
|
|
57
|
+
supportsGpuTextExpansion,
|
|
58
|
+
supportsGpuUtf8TextExpansion,
|
|
59
|
+
assertTextStorageGPUVectorInputs,
|
|
60
|
+
type TextAttributeState,
|
|
61
|
+
type GpuExpandedTextStream,
|
|
62
|
+
type GpuTextDictionaryCompressedStream,
|
|
63
|
+
type GpuUtf8TextInput,
|
|
64
|
+
type TextDictionaryBatchState,
|
|
65
|
+
type TextDictionaryRenderBatchState,
|
|
66
|
+
type TextDictionaryState,
|
|
67
|
+
type TextStorageBatchState,
|
|
68
|
+
type TextStorageBuffer,
|
|
69
|
+
type TextStorageInputProps,
|
|
70
|
+
type TextStorageRenderBatchState,
|
|
71
|
+
type TextStorageState
|
|
72
|
+
} from '@luma.gl/engine/text-experimental';
|
|
73
|
+
import {
|
|
74
|
+
buildArrowGlyphLayout,
|
|
75
|
+
buildGpuTextDictionaryCompressedStream,
|
|
76
|
+
buildGpuExpandedTextStream,
|
|
77
|
+
buildGpuUtf8TextInput,
|
|
78
|
+
isArrowUtf8DictionaryType,
|
|
79
|
+
isArrowUtf8DictionaryVector,
|
|
80
|
+
isArrowUtf8TextVector,
|
|
81
|
+
isArrowUtf8Vector,
|
|
82
|
+
type ArrowUtf8Dictionary,
|
|
83
|
+
type ArrowUtf8TextVector
|
|
84
|
+
} from './arrow-text';
|
|
85
|
+
|
|
86
|
+
type FontAtlasRenderSettings = FontAtlas['renderSettings'];
|
|
87
|
+
|
|
88
|
+
const GLYPH_OFFSETS_COLUMN = 'glyphOffsets';
|
|
89
|
+
const GLYPH_FRAMES_COLUMN = 'glyphFrames';
|
|
90
|
+
const GLYPH_PAGES_COLUMN = 'glyphPages';
|
|
91
|
+
const GLYPH_CLIP_RECTS_COLUMN = 'glyphClipRects';
|
|
92
|
+
const ROW_INDICES_COLUMN = 'rowIndices';
|
|
93
|
+
const EXPANDED_GLYPH_VERTEX_DATA = 'expandedGlyphVertexData';
|
|
94
|
+
const COMPACT_GLYPH_VERTEX_BYTE_STRIDE = Uint32Array.BYTES_PER_ELEMENT * 2;
|
|
95
|
+
const EXPANDED_GLYPH_VERTEX_BYTE_STRIDE = Uint32Array.BYTES_PER_ELEMENT * 5;
|
|
96
|
+
const CLIPPED_EXPANDED_GLYPH_VERTEX_BYTE_STRIDE =
|
|
97
|
+
EXPANDED_GLYPH_VERTEX_BYTE_STRIDE + Float32Array.BYTES_PER_ELEMENT * 4;
|
|
98
|
+
const DEFAULT_TEXT_STORAGE_COLOR: [number, number, number, number] = [0, 0, 0, 255];
|
|
99
|
+
const DEFAULT_TEXT_STORAGE_ANGLE = 0;
|
|
100
|
+
const DEFAULT_TEXT_STORAGE_SIZE = 32;
|
|
101
|
+
const DEFAULT_TEXT_STORAGE_PIXEL_OFFSET: [number, number] = [0, 0];
|
|
102
|
+
const DEFAULT_TEXT_STORAGE_ANCHOR = 0;
|
|
103
|
+
const DEFAULT_STORAGE_ALIGNMENT_BASELINE = 0;
|
|
104
|
+
const BITMAP_TEXT_SDF_THRESHOLD = -1;
|
|
105
|
+
const INVALID_DICTIONARY_INDEX = 0xffffffff;
|
|
106
|
+
const STORAGE_RENDER_CONFIG_BYTE_LENGTH = Uint32Array.BYTES_PER_ELEMENT * 4;
|
|
107
|
+
const TEXT_DICTIONARY_RENDER_CONFIG_BYTE_LENGTH = Uint32Array.BYTES_PER_ELEMENT * 4;
|
|
108
|
+
|
|
109
|
+
/** Resolved atlas mapping and layout metrics shared by attribute and storage conversion. */
|
|
110
|
+
export type ResolvedCharacterMapping = {
|
|
111
|
+
/** Effective line height in glyph-layout units for one-line label layout. */
|
|
112
|
+
lineHeight: number;
|
|
113
|
+
/** Optional character set accumulated from source labels. */
|
|
114
|
+
characterSet?: Set<string>;
|
|
115
|
+
/** Resolved font atlas texture and metrics. */
|
|
116
|
+
fontAtlas: FontAtlas;
|
|
117
|
+
/** Raster font rendering settings derived from the normalized font atlas/settings. */
|
|
118
|
+
fontRenderSettings: FontAtlasRenderSettings;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** Expanded Arrow glyph table plus layout and allocation diagnostics. */
|
|
122
|
+
export type ArrowTextGlyphTable = {
|
|
123
|
+
/** Expanded Arrow table containing glyph-instance columns. */
|
|
124
|
+
table: Table;
|
|
125
|
+
/** One-line glyph offsets and atlas frames expanded from source text rows. */
|
|
126
|
+
glyphLayout: TextGlyphLayout;
|
|
127
|
+
/** Optional character set accumulated while laying out glyphs. */
|
|
128
|
+
characterSet?: Set<string>;
|
|
129
|
+
/** Bytes occupied by generated glyph-instance Arrow attributes. */
|
|
130
|
+
attributeByteLength: number;
|
|
131
|
+
/** CPU time spent building generated glyph-instance Arrow attributes. */
|
|
132
|
+
glyphAttributeBuildTimeMs: number;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/** CPU Arrow vectors used when one-line text layout expands rows into glyph attributes. */
|
|
136
|
+
export type ArrowTextSourceVectors = {
|
|
137
|
+
/** CPU label origins aligned one-for-one with `texts`. */
|
|
138
|
+
positions: Vector<FixedSizeList<Float32>>;
|
|
139
|
+
/** CPU plain or dictionary-encoded UTF-8 labels used for glyph expansion. */
|
|
140
|
+
texts: ArrowUtf8TextVector;
|
|
141
|
+
/** Optional CPU packed RGBA8 text colors aligned with label rows or label characters. */
|
|
142
|
+
colors?: Vector<ArrowTextColorType>;
|
|
143
|
+
/** Optional CPU per-row angles in degrees. */
|
|
144
|
+
angles?: Vector<Float32>;
|
|
145
|
+
/** Optional CPU per-row deck-style text sizes. */
|
|
146
|
+
sizes?: Vector<Float32>;
|
|
147
|
+
/** Optional CPU per-row pixel offsets. */
|
|
148
|
+
pixelOffsets?: Vector<FixedSizeList<Float32>>;
|
|
149
|
+
/** Optional CPU per-row text anchor enum values. */
|
|
150
|
+
textAnchors?: Vector<Uint8>;
|
|
151
|
+
/** Optional CPU per-row alignment baseline enum values. */
|
|
152
|
+
alignmentBaselines?: Vector<Uint8>;
|
|
153
|
+
/** Optional CPU packed clip rectangles aligned with label rows. */
|
|
154
|
+
clipRects?: Vector<FixedSizeList<Float32>>;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/** CPU Arrow vectors still needed by storage-backed text expansion. */
|
|
158
|
+
export type ArrowTextStorageSourceVectors = {
|
|
159
|
+
/** CPU plain or dictionary-encoded UTF-8 labels used for storage glyph expansion. */
|
|
160
|
+
texts: ArrowUtf8TextVector;
|
|
161
|
+
/** Optional CPU packed clip rectangles aligned with label rows. */
|
|
162
|
+
clipRects?: Vector<FixedSizeList<Float32>>;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Arrow-to-attribute conversion input consumed by layer/data-conversion code.
|
|
167
|
+
*
|
|
168
|
+
* CPU source vectors are retained here only for Arrow conversion helpers. This is not a text model
|
|
169
|
+
* constructor type.
|
|
170
|
+
*/
|
|
171
|
+
export type ArrowTextModelProps = Omit<GPUTableModelProps, 'table' | 'tableCount'> & {
|
|
172
|
+
/** GPU-resident label origins aligned one-for-one with `texts`. */
|
|
173
|
+
positions: GPUVector;
|
|
174
|
+
/** Optional packed RGBA8 text colors, consumed as label or character attributes when declared by the shader. */
|
|
175
|
+
colors?: GPUVector;
|
|
176
|
+
/** Optional per-row angles in degrees, consumed as label attributes when declared by the shader. */
|
|
177
|
+
angles?: GPUVector;
|
|
178
|
+
/** Optional per-row deck-style text sizes, consumed as label attributes when declared by the shader. */
|
|
179
|
+
sizes?: GPUVector;
|
|
180
|
+
/** Optional per-row pixel offsets, consumed as label attributes when declared by the shader. */
|
|
181
|
+
pixelOffsets?: GPUVector;
|
|
182
|
+
/** GPU UTF-8 labels aligned row-for-row with `positions`. */
|
|
183
|
+
texts: GPUVector;
|
|
184
|
+
/** CPU Arrow vectors explicitly retained by the caller for glyph/layout expansion. */
|
|
185
|
+
sourceVectors: ArrowTextSourceVectors;
|
|
186
|
+
/**
|
|
187
|
+
* Optional packed per-label clip rectangles `[x, y, width, height]`.
|
|
188
|
+
* Values are signed 16-bit glyph-layout units relative to the label origin.
|
|
189
|
+
* Negative width or height disables clipping on that axis.
|
|
190
|
+
*/
|
|
191
|
+
clipRects?: GPUVector;
|
|
192
|
+
/** Constant fallback color used when nullable row or character color rows are null. */
|
|
193
|
+
color?: [number, number, number, number];
|
|
194
|
+
/** Constant fallback angle in degrees used when nullable angle rows are null. */
|
|
195
|
+
angle?: number;
|
|
196
|
+
/** Constant fallback deck-style text size used when nullable size rows are null. */
|
|
197
|
+
size?: number;
|
|
198
|
+
/** Normalized atlas-backed font consumed by text layout and rendering. */
|
|
199
|
+
fontAtlas: FontAtlas;
|
|
200
|
+
/** Optional shared GPU atlas resources borrowed by prepared state. */
|
|
201
|
+
resources?: GPUTextResources;
|
|
202
|
+
/** Global source-row index assigned to local row zero. */
|
|
203
|
+
rowIndexBase?: number;
|
|
204
|
+
/** Multiplier applied to the atlas font size for the single-line baseline layout. */
|
|
205
|
+
lineHeight?: number;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Arrow-to-attribute conversion input consumed by `convertArrowTextToAttributeState()`.
|
|
210
|
+
*
|
|
211
|
+
* This type describes the boundary between layer-owned Arrow adaptation and the pure
|
|
212
|
+
* {@link TextAttributeModel}. It intentionally contains GPUVectors plus retained CPU source
|
|
213
|
+
* vectors, and is not a renderer model constructor type.
|
|
214
|
+
*/
|
|
215
|
+
export type ArrowTextAttributeInputProps = ArrowTextModelProps;
|
|
216
|
+
|
|
217
|
+
/** Packed RGBA8 Arrow row-color type accepted by text conversion helpers. */
|
|
218
|
+
export type ArrowTextRowColorType = FixedSizeList<Uint8>;
|
|
219
|
+
/** Nested packed RGBA8 Arrow character-color type accepted by the attribute path. */
|
|
220
|
+
export type ArrowTextCharacterColorType = List<FixedSizeList<Uint8>>;
|
|
221
|
+
/** Arrow text color type accepted by conversion helpers. */
|
|
222
|
+
export type ArrowTextColorType = ArrowTextRowColorType | ArrowTextCharacterColorType;
|
|
223
|
+
|
|
224
|
+
type ArrowTextStorageSharedInputProps = Omit<
|
|
225
|
+
ArrowTextModelProps,
|
|
226
|
+
'sourceVectors' | 'texts' | 'colors'
|
|
227
|
+
> & {
|
|
228
|
+
/**
|
|
229
|
+
* Include a generated per-glyph row-index vertex column.
|
|
230
|
+
* This increases the compact glyph vertex record from 8 to 12 bytes, but lets the storage shader
|
|
231
|
+
* fetch the source row directly instead of binary-searching row glyph starts per glyph.
|
|
232
|
+
*/
|
|
233
|
+
rowIndexColumn?: boolean;
|
|
234
|
+
/** Optional packed RGBA8 text colors aligned with label rows. */
|
|
235
|
+
colors?: GPUVector;
|
|
236
|
+
/** Optional per-row text anchor enum: 0=start, 1=middle, 2=end. */
|
|
237
|
+
textAnchors?: GPUVector;
|
|
238
|
+
/** Optional per-row alignment baseline enum: 0=center, 1=top, 2=bottom. */
|
|
239
|
+
alignmentBaselines?: GPUVector;
|
|
240
|
+
/** Constant fallback color used when `colors` is absent. */
|
|
241
|
+
color?: [number, number, number, number];
|
|
242
|
+
/** Constant fallback angle in degrees used when `angles` is absent. */
|
|
243
|
+
angle?: number;
|
|
244
|
+
/** Constant fallback deck-style text size used when `sizes` is absent. */
|
|
245
|
+
size?: number;
|
|
246
|
+
/** Constant fallback pixel offset used when `pixelOffsets` is absent. */
|
|
247
|
+
pixelOffset?: [number, number];
|
|
248
|
+
/** Constant fallback text anchor used when `textAnchors` is absent. */
|
|
249
|
+
textAnchor?: 'start' | 'middle' | 'end';
|
|
250
|
+
/** Constant fallback alignment baseline used when `alignmentBaselines` is absent. */
|
|
251
|
+
alignmentBaseline?: 'center' | 'top' | 'bottom';
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
/** Arrow-to-storage conversion input consumed by layer/data-conversion code. */
|
|
255
|
+
export type ArrowTextStorageInputProps = ArrowTextStorageSharedInputProps & {
|
|
256
|
+
/** GPU UTF-8 or dictionary-encoded UTF-8 labels aligned row-for-row with `positions`. */
|
|
257
|
+
texts: GPUVector;
|
|
258
|
+
/** CPU Arrow vectors explicitly retained by the caller for storage glyph expansion. */
|
|
259
|
+
sourceVectors: ArrowTextStorageSourceVectors;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/** Arrow-owned storage state that can append later Arrow source batches. */
|
|
263
|
+
export type ArrowTextStorageState = TextStorageState & {
|
|
264
|
+
/** Arrow conversion metadata retained for explicit incremental append behavior. */
|
|
265
|
+
arrowAppendContext: ArrowTextStorageAppendContext;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
/** Prepared GPU UTF-8 batch consumed by GPUVector-only storage text conversion. */
|
|
269
|
+
export type GPUVectorTextStorageBatch = {
|
|
270
|
+
/** Source text rows in this batch. */
|
|
271
|
+
rowCount: number;
|
|
272
|
+
/** Cumulative UTF-8 byte offsets, length = `rowCount + 1`. */
|
|
273
|
+
startIndices: readonly number[];
|
|
274
|
+
/** CPU copy of per-row half-open UTF-8 byte ranges, used for render-batch partitioning. */
|
|
275
|
+
rowByteRanges: Uint32Array;
|
|
276
|
+
/** GPU buffer containing packed per-row half-open UTF-8 byte ranges. */
|
|
277
|
+
rowByteRangesBuffer: Buffer;
|
|
278
|
+
/** GPU buffer containing UTF-8 bytes packed four per `u32` word. */
|
|
279
|
+
utf8BytesBuffer: TextStorageBuffer;
|
|
280
|
+
/** Total UTF-8 byte slots represented by this batch. */
|
|
281
|
+
byteLength: number;
|
|
282
|
+
/** Bytes occupied by row ranges plus UTF-8 bytes. */
|
|
283
|
+
inputByteLength: number;
|
|
284
|
+
/** Whether the storage-state builder should release `rowByteRangesBuffer` after compute. */
|
|
285
|
+
ownsRowByteRangesBuffer?: boolean;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
/** GPUVector-only input for WebGPU storage text conversion. */
|
|
289
|
+
export type GPUVectorTextStorageInputProps = ArrowTextStorageSharedInputProps & {
|
|
290
|
+
/** GPU plain UTF-8 labels aligned row-for-row with `positions`. */
|
|
291
|
+
texts: GPUVector;
|
|
292
|
+
/** Optional prepared UTF-8 GPU batches. Defaults to batches derived from `texts` metadata. */
|
|
293
|
+
textBatches?: GPUVectorTextStorageBatch[];
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
/** CPU Arrow vectors still needed by compressed dictionary storage text expansion. */
|
|
297
|
+
export type ArrowTextDictionaryStorageSourceVectors = {
|
|
298
|
+
/** CPU UTF-8 labels validated as dictionary-encoded before compressed glyph layout. */
|
|
299
|
+
texts: ArrowUtf8TextVector;
|
|
300
|
+
/** Optional CPU packed clip rectangles aligned with label rows. */
|
|
301
|
+
clipRects?: Vector<FixedSizeList<Float32>>;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
/** Arrow-to-dictionary-storage conversion input consumed by layer/data-conversion code. */
|
|
305
|
+
export type ArrowTextDictionaryStorageInputProps = ArrowTextStorageSharedInputProps & {
|
|
306
|
+
/** GPU dictionary-encoded UTF-8 labels aligned row-for-row with `positions`. */
|
|
307
|
+
texts: GPUVector;
|
|
308
|
+
/** CPU Arrow vectors explicitly retained by the caller for compressed dictionary glyph layout. */
|
|
309
|
+
sourceVectors: ArrowTextDictionaryStorageSourceVectors;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
/** Prepared attribute text state plus Arrow diagnostics retained by conversion helpers. */
|
|
313
|
+
export type ArrowTextAttributeState = TextAttributeState & {
|
|
314
|
+
/** Props used to build the prepared attribute state. */
|
|
315
|
+
textProps: ArrowTextModelProps;
|
|
316
|
+
/** Expanded glyph table and layout diagnostics. */
|
|
317
|
+
glyphTable: ArrowTextGlyphTable;
|
|
318
|
+
/** Raster font render settings retained for built-in fragment shader uniforms. */
|
|
319
|
+
fontRenderSettings: FontAtlasRenderSettings;
|
|
320
|
+
/** Character mapping retained for follow-on conversion diagnostics. */
|
|
321
|
+
mappingState: ResolvedCharacterMapping;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
/** Generated attribute text render-batch state. */
|
|
325
|
+
export type ArrowTextRenderBatchState = {
|
|
326
|
+
/** First source text row included in this generated render batch. */
|
|
327
|
+
rowStart: number;
|
|
328
|
+
/** Source text row after the last row included in this generated render batch. */
|
|
329
|
+
rowEnd: number;
|
|
330
|
+
/** Glyph instances drawn by this render batch. */
|
|
331
|
+
glyphCount: number;
|
|
332
|
+
/** Generated expanded glyph vertex attribute buffer. */
|
|
333
|
+
expandedGlyphVertexData: Buffer;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
type TextStorageOwnedResource = Pick<GPUVector, 'destroy'> | Pick<DynamicBuffer, 'destroy'>;
|
|
337
|
+
type AnyTextStorageInputProps =
|
|
338
|
+
| ArrowTextStorageInputProps
|
|
339
|
+
| ArrowTextDictionaryStorageInputProps
|
|
340
|
+
| GPUVectorTextStorageInputProps;
|
|
341
|
+
|
|
342
|
+
/** Build an Arrow glyph table without creating a Model. */
|
|
343
|
+
export function buildArrowTextGlyphTable(props: {
|
|
344
|
+
labelTable: Table;
|
|
345
|
+
texts: ArrowUtf8TextVector;
|
|
346
|
+
clipRects?: Vector<FixedSizeList<Float32>>;
|
|
347
|
+
fontAtlas: FontAtlas;
|
|
348
|
+
lineHeight?: number;
|
|
349
|
+
characterSet?: Set<string>;
|
|
350
|
+
rowIndexBase?: number;
|
|
351
|
+
color?: [number, number, number, number];
|
|
352
|
+
angle?: number;
|
|
353
|
+
size?: number;
|
|
354
|
+
}): ArrowTextGlyphTable {
|
|
355
|
+
if (props.labelTable.numRows !== props.texts.length) {
|
|
356
|
+
throw new Error('ArrowTextModel requires labelTable rows to match UTF-8 text rows');
|
|
357
|
+
}
|
|
358
|
+
assertClipRects(props.clipRects, props.texts.length);
|
|
359
|
+
assertColumnAvailable(props.labelTable, GLYPH_OFFSETS_COLUMN);
|
|
360
|
+
assertColumnAvailable(props.labelTable, GLYPH_FRAMES_COLUMN);
|
|
361
|
+
assertColumnAvailable(props.labelTable, GLYPH_PAGES_COLUMN);
|
|
362
|
+
assertColumnAvailable(props.labelTable, GLYPH_CLIP_RECTS_COLUMN);
|
|
363
|
+
assertColumnAvailable(props.labelTable, ROW_INDICES_COLUMN);
|
|
364
|
+
|
|
365
|
+
const glyphAttributeBuildStartTime = getNow();
|
|
366
|
+
const glyphLayout = buildArrowGlyphLayout({
|
|
367
|
+
texts: props.texts,
|
|
368
|
+
fontAtlas: props.fontAtlas,
|
|
369
|
+
lineHeight: props.lineHeight,
|
|
370
|
+
characterSet: props.characterSet
|
|
371
|
+
});
|
|
372
|
+
const fields: Field[] = [];
|
|
373
|
+
const columns: Record<string, Vector> = {};
|
|
374
|
+
const glyphRowIndices = makeGlyphRowIndices(glyphLayout.startIndices);
|
|
375
|
+
|
|
376
|
+
for (const field of props.labelTable.schema.fields) {
|
|
377
|
+
const vector = props.labelTable.getChild(field.name);
|
|
378
|
+
if (!vector) {
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
if (field.name === 'colors' && isArrowTextCharacterColorType(vector.type)) {
|
|
382
|
+
fields.push(
|
|
383
|
+
new Field(field.name, vector.type.children[0]!.type, field.nullable, field.metadata)
|
|
384
|
+
);
|
|
385
|
+
columns[field.name] = expandArrowTextCharacterColorRows(
|
|
386
|
+
vector as Vector<ArrowTextCharacterColorType>,
|
|
387
|
+
glyphLayout.startIndices,
|
|
388
|
+
props.color
|
|
389
|
+
);
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
if (!isInstanceCompatibleArrowType(vector.type)) {
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
fields.push(field);
|
|
396
|
+
columns[field.name] = expandArrowVector(
|
|
397
|
+
vector as Vector<any>,
|
|
398
|
+
glyphRowIndices,
|
|
399
|
+
getArrowTextExpansionNullValue(field.name, props)
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
fields.push(makeFixedSizeListField(GLYPH_OFFSETS_COLUMN, new Int16(), 2));
|
|
404
|
+
fields.push(makeFixedSizeListField(GLYPH_FRAMES_COLUMN, new Uint16(), 4));
|
|
405
|
+
fields.push(new Field(GLYPH_PAGES_COLUMN, new Uint16(), false));
|
|
406
|
+
if (props.clipRects) {
|
|
407
|
+
fields.push(makeFixedSizeListField(GLYPH_CLIP_RECTS_COLUMN, new Int16(), 4));
|
|
408
|
+
}
|
|
409
|
+
fields.push(new Field(ROW_INDICES_COLUMN, new Uint32(), false));
|
|
410
|
+
columns[GLYPH_OFFSETS_COLUMN] = makeArrowFixedSizeListVector(
|
|
411
|
+
new Int16(),
|
|
412
|
+
2,
|
|
413
|
+
glyphLayout.glyphOffsets
|
|
414
|
+
);
|
|
415
|
+
columns[GLYPH_FRAMES_COLUMN] = makeArrowFixedSizeListVector(
|
|
416
|
+
new Uint16(),
|
|
417
|
+
4,
|
|
418
|
+
glyphLayout.glyphFrames
|
|
419
|
+
);
|
|
420
|
+
columns[GLYPH_PAGES_COLUMN] = makeNumericArrowVector(new Uint16(), glyphLayout.glyphPages);
|
|
421
|
+
if (props.clipRects) {
|
|
422
|
+
columns[GLYPH_CLIP_RECTS_COLUMN] = expandArrowVector(props.clipRects, glyphRowIndices);
|
|
423
|
+
}
|
|
424
|
+
columns[ROW_INDICES_COLUMN] = makeNumericArrowVector(
|
|
425
|
+
new Uint32(),
|
|
426
|
+
makeGlyphRowIndices(glyphLayout.startIndices, props.rowIndexBase)
|
|
427
|
+
);
|
|
428
|
+
const attributeByteLength = getGeneratedAttributeByteLength(columns);
|
|
429
|
+
const glyphAttributeBuildTimeMs = getNow() - glyphAttributeBuildStartTime;
|
|
430
|
+
|
|
431
|
+
return {
|
|
432
|
+
table: new Table(new Schema(fields, props.labelTable.schema.metadata), columns),
|
|
433
|
+
glyphLayout,
|
|
434
|
+
characterSet: props.characterSet,
|
|
435
|
+
attributeByteLength,
|
|
436
|
+
glyphAttributeBuildTimeMs
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
type ResolvedArrowTextInputs = {
|
|
441
|
+
labelTable: Table;
|
|
442
|
+
texts: ArrowUtf8TextVector;
|
|
443
|
+
clipRects?: Vector<FixedSizeList<Float32>>;
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
function resolveArrowTextInputs(props: ArrowTextModelProps): ResolvedArrowTextInputs {
|
|
447
|
+
if (!props.sourceVectors) {
|
|
448
|
+
throw new Error('ArrowTextModel requires explicit sourceVectors for CPU glyph expansion');
|
|
449
|
+
}
|
|
450
|
+
assertArrowTextVectorTypes(props);
|
|
451
|
+
assertArrowTextVectorRowAlignment(props);
|
|
452
|
+
assertArrowTextSourceVectorAlignment(props);
|
|
453
|
+
const {sourceVectors} = props;
|
|
454
|
+
const columns: Record<string, Vector> = {
|
|
455
|
+
positions: sourceVectors.positions
|
|
456
|
+
};
|
|
457
|
+
if (sourceVectors.colors) {
|
|
458
|
+
columns['colors'] = sourceVectors.colors;
|
|
459
|
+
}
|
|
460
|
+
if (sourceVectors.angles) {
|
|
461
|
+
columns['angles'] = sourceVectors.angles;
|
|
462
|
+
}
|
|
463
|
+
if (sourceVectors.sizes) {
|
|
464
|
+
columns['sizes'] = sourceVectors.sizes;
|
|
465
|
+
}
|
|
466
|
+
if (sourceVectors.pixelOffsets) {
|
|
467
|
+
columns['pixelOffsets'] = sourceVectors.pixelOffsets;
|
|
468
|
+
}
|
|
469
|
+
const labelTable = new Table(columns);
|
|
470
|
+
|
|
471
|
+
return {
|
|
472
|
+
labelTable,
|
|
473
|
+
texts: sourceVectors.texts,
|
|
474
|
+
clipRects: sourceVectors.clipRects
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/** Resolves one aligned Arrow source-vector batch for attribute glyph expansion. */
|
|
479
|
+
export function resolveArrowTextBatchInputs(
|
|
480
|
+
props: ArrowTextModelProps,
|
|
481
|
+
batchIndex: number
|
|
482
|
+
): ResolvedArrowTextInputs {
|
|
483
|
+
const {sourceVectors} = props;
|
|
484
|
+
const columns: Record<string, Vector> = {
|
|
485
|
+
positions: getArrowTextSourceBatch(sourceVectors.positions, 'positions', batchIndex)
|
|
486
|
+
};
|
|
487
|
+
appendArrowTextBatchSourceColumn(columns, 'colors', sourceVectors.colors, batchIndex);
|
|
488
|
+
appendArrowTextBatchSourceColumn(columns, 'angles', sourceVectors.angles, batchIndex);
|
|
489
|
+
appendArrowTextBatchSourceColumn(columns, 'sizes', sourceVectors.sizes, batchIndex);
|
|
490
|
+
appendArrowTextBatchSourceColumn(columns, 'pixelOffsets', sourceVectors.pixelOffsets, batchIndex);
|
|
491
|
+
|
|
492
|
+
return {
|
|
493
|
+
labelTable: new Table(columns),
|
|
494
|
+
texts: getArrowTextSourceBatch(sourceVectors.texts, 'texts', batchIndex),
|
|
495
|
+
clipRects: sourceVectors.clipRects
|
|
496
|
+
? (getArrowTextSourceBatch(sourceVectors.clipRects, 'clipRects', batchIndex) as Vector<
|
|
497
|
+
FixedSizeList<Float32>
|
|
498
|
+
>)
|
|
499
|
+
: undefined
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function appendArrowTextBatchSourceColumn(
|
|
504
|
+
columns: Record<string, Vector>,
|
|
505
|
+
columnName: string,
|
|
506
|
+
vector: Vector | undefined,
|
|
507
|
+
batchIndex: number
|
|
508
|
+
): void {
|
|
509
|
+
if (!vector) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
columns[columnName] = getArrowTextSourceBatch(vector, columnName, batchIndex);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
function getArrowTextSourceBatch<T extends DataType>(
|
|
516
|
+
vector: Vector<T>,
|
|
517
|
+
vectorName: string,
|
|
518
|
+
batchIndex: number
|
|
519
|
+
): Vector<T> {
|
|
520
|
+
const data = vector.data[batchIndex];
|
|
521
|
+
if (!data) {
|
|
522
|
+
throw new Error(`Arrow text ${vectorName} source is missing batch ${batchIndex}`);
|
|
523
|
+
}
|
|
524
|
+
return new Vector([data]) as Vector<T>;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function getArrowGPUVectorDataType(vector: GPUVector): DataType {
|
|
528
|
+
return getRequiredArrowGPUVectorDataType<DataType>(vector);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
function isArrowUtf8TextGPUVector(vector: GPUVector): boolean {
|
|
532
|
+
const type = getArrowGPUVectorDataType(vector);
|
|
533
|
+
return type instanceof Utf8 || isArrowUtf8DictionaryType(type);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function isArrowUtf8DictionaryGPUVector(vector: GPUVector): boolean {
|
|
537
|
+
return isArrowUtf8DictionaryType(getArrowGPUVectorDataType(vector));
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/** Validates the GPUVector Arrow types accepted by attribute text conversion. */
|
|
541
|
+
export function assertArrowTextVectorTypes(props: ArrowTextModelProps): void {
|
|
542
|
+
const textType = getArrowGPUVectorDataType(props.texts);
|
|
543
|
+
const positionType = getArrowGPUVectorDataType(props.positions);
|
|
544
|
+
const colorType = props.colors ? getArrowGPUVectorDataType(props.colors) : undefined;
|
|
545
|
+
const angleType = props.angles ? getArrowGPUVectorDataType(props.angles) : undefined;
|
|
546
|
+
const sizeType = props.sizes ? getArrowGPUVectorDataType(props.sizes) : undefined;
|
|
547
|
+
const pixelOffsetType = props.pixelOffsets
|
|
548
|
+
? getArrowGPUVectorDataType(props.pixelOffsets)
|
|
549
|
+
: undefined;
|
|
550
|
+
|
|
551
|
+
if (!isArrowUtf8TextGPUVector(props.texts)) {
|
|
552
|
+
throw new Error('ArrowTextModel texts must be GPUVector');
|
|
553
|
+
}
|
|
554
|
+
if (!isArrowUtf8TextVector(props.sourceVectors.texts)) {
|
|
555
|
+
throw new Error('ArrowTextModel sourceVectors.texts must be Utf8 or Dictionary<Utf8>');
|
|
556
|
+
}
|
|
557
|
+
if (!util.compareTypes(props.sourceVectors.texts.type, textType)) {
|
|
558
|
+
throw new Error('ArrowTextModel sourceVectors.texts type must match GPU texts type');
|
|
559
|
+
}
|
|
560
|
+
if (
|
|
561
|
+
!DataType.isFixedSizeList(positionType) ||
|
|
562
|
+
positionType.listSize !== 2 ||
|
|
563
|
+
!(positionType.children[0]?.type instanceof Float32)
|
|
564
|
+
) {
|
|
565
|
+
throw new Error('ArrowTextModel positions must be GPUVector');
|
|
566
|
+
}
|
|
567
|
+
if (colorType && !isArrowTextColorType(colorType)) {
|
|
568
|
+
throw new Error(
|
|
569
|
+
'ArrowTextModel colors must be GPUVector or GPUVector<List<FixedSizeList<Uint8>[4]>>'
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
if (angleType && !(angleType instanceof Float32)) {
|
|
573
|
+
throw new Error('ArrowTextModel angles must be GPUVector');
|
|
574
|
+
}
|
|
575
|
+
if (sizeType && !(sizeType instanceof Float32)) {
|
|
576
|
+
throw new Error('ArrowTextModel sizes must be GPUVector');
|
|
577
|
+
}
|
|
578
|
+
if (
|
|
579
|
+
pixelOffsetType &&
|
|
580
|
+
(!DataType.isFixedSizeList(pixelOffsetType) ||
|
|
581
|
+
pixelOffsetType.listSize !== 2 ||
|
|
582
|
+
!(pixelOffsetType.children[0]?.type instanceof Float32))
|
|
583
|
+
) {
|
|
584
|
+
throw new Error('ArrowTextModel pixelOffsets must be GPUVector');
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function assertArrowTextVectorRowAlignment(props: ArrowTextModelProps): void {
|
|
589
|
+
const rowInputs: Array<[string, GPUVector | undefined]> = [
|
|
590
|
+
['positions', props.positions],
|
|
591
|
+
['texts', props.texts],
|
|
592
|
+
['colors', props.colors],
|
|
593
|
+
['angles', props.angles],
|
|
594
|
+
['sizes', props.sizes],
|
|
595
|
+
['pixelOffsets', props.pixelOffsets],
|
|
596
|
+
['clipRects', props.clipRects]
|
|
597
|
+
];
|
|
598
|
+
const suppliedInputs = rowInputs.filter(([, vector]) => vector !== undefined) as Array<
|
|
599
|
+
[string, GPUVector]
|
|
600
|
+
>;
|
|
601
|
+
const [referenceName, referenceVector] = suppliedInputs[0];
|
|
602
|
+
for (const [name, vector] of suppliedInputs.slice(1)) {
|
|
603
|
+
if (vector.length !== referenceVector.length) {
|
|
604
|
+
throw new Error(
|
|
605
|
+
`ArrowTextModel ${name} rows must match ${referenceName} rows (${vector.length} !== ${referenceVector.length})`
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/** Validates that all attribute text GPUVectors preserve matching batch boundaries. */
|
|
612
|
+
export function assertArrowTextVectorBatchAlignment(props: ArrowTextModelProps): void {
|
|
613
|
+
assertArrowTextVectorRowAlignment(props);
|
|
614
|
+
const rowInputs = getArrowTextRowInputs(props);
|
|
615
|
+
const [referenceName, referenceVector] = rowInputs[0];
|
|
616
|
+
for (const [name, vector] of rowInputs.slice(1)) {
|
|
617
|
+
if (vector.data.length !== referenceVector.data.length) {
|
|
618
|
+
throw new Error(`ArrowTextModel ${name} batch count must match ${referenceName} batch count`);
|
|
619
|
+
}
|
|
620
|
+
for (let batchIndex = 0; batchIndex < vector.data.length; batchIndex++) {
|
|
621
|
+
if (vector.data[batchIndex].length !== referenceVector.data[batchIndex].length) {
|
|
622
|
+
throw new Error(
|
|
623
|
+
`ArrowTextModel ${name} batch ${batchIndex} rows must match ${referenceName}`
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
function assertArrowTextSourceVectorAlignment(props: ArrowTextModelProps): void {
|
|
631
|
+
const sourceInputs: Array<[string, GPUVector | undefined, Vector | undefined]> = [
|
|
632
|
+
['positions', props.positions, props.sourceVectors.positions],
|
|
633
|
+
['texts', props.texts, props.sourceVectors.texts],
|
|
634
|
+
['colors', props.colors, props.sourceVectors.colors],
|
|
635
|
+
['angles', props.angles, props.sourceVectors.angles],
|
|
636
|
+
['sizes', props.sizes, props.sourceVectors.sizes],
|
|
637
|
+
['pixelOffsets', props.pixelOffsets, props.sourceVectors.pixelOffsets],
|
|
638
|
+
['clipRects', props.clipRects, props.sourceVectors.clipRects]
|
|
639
|
+
];
|
|
640
|
+
|
|
641
|
+
for (const [name, gpuVector, sourceVector] of sourceInputs) {
|
|
642
|
+
if (gpuVector && !sourceVector) {
|
|
643
|
+
throw new Error(`ArrowTextModel ${name} GPU rows require matching sourceVectors rows`);
|
|
644
|
+
}
|
|
645
|
+
if (!gpuVector && sourceVector) {
|
|
646
|
+
throw new Error(`ArrowTextModel sourceVectors.${name} requires matching GPU rows`);
|
|
647
|
+
}
|
|
648
|
+
if (!gpuVector || !sourceVector) {
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
651
|
+
assertSourceVectorMatchesGPUVector('ArrowTextModel', name, gpuVector, sourceVector);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
function getArrowTextRowInputs(props: ArrowTextModelProps): Array<[string, GPUVector]> {
|
|
656
|
+
return [
|
|
657
|
+
['positions', props.positions],
|
|
658
|
+
['texts', props.texts],
|
|
659
|
+
['colors', props.colors],
|
|
660
|
+
['angles', props.angles],
|
|
661
|
+
['sizes', props.sizes],
|
|
662
|
+
['pixelOffsets', props.pixelOffsets],
|
|
663
|
+
['clipRects', props.clipRects]
|
|
664
|
+
].filter(([, vector]) => vector !== undefined) as Array<[string, GPUVector]>;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
function assertSourceVectorMatchesGPUVector(
|
|
668
|
+
ownerName: 'ArrowTextModel' | 'ArrowTextStorageModel' | 'ArrowTextDictionaryStorageModel',
|
|
669
|
+
vectorName: string,
|
|
670
|
+
gpuVector: GPUVector,
|
|
671
|
+
sourceVector: Vector
|
|
672
|
+
): void {
|
|
673
|
+
if (sourceVector.length !== gpuVector.length) {
|
|
674
|
+
throw new Error(
|
|
675
|
+
`${ownerName} sourceVectors.${vectorName} rows must match GPU rows (${sourceVector.length} !== ${gpuVector.length})`
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
if (sourceVector.data.length !== gpuVector.data.length) {
|
|
679
|
+
throw new Error(`${ownerName} sourceVectors.${vectorName} batch count must match GPU batches`);
|
|
680
|
+
}
|
|
681
|
+
for (let batchIndex = 0; batchIndex < sourceVector.data.length; batchIndex++) {
|
|
682
|
+
if (sourceVector.data[batchIndex].length !== gpuVector.data[batchIndex].length) {
|
|
683
|
+
throw new Error(
|
|
684
|
+
`${ownerName} sourceVectors.${vectorName} batch ${batchIndex} rows must match GPU rows`
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
type ResolvedTextStorageBatchRowInputs = {
|
|
691
|
+
batchRowIndexBase: number;
|
|
692
|
+
rowStorageIndexBase: number;
|
|
693
|
+
clipRects?: Vector<FixedSizeList<Float32>>;
|
|
694
|
+
clipRectsBuffer?: TextStorageBuffer;
|
|
695
|
+
positionsBuffer: TextStorageBuffer;
|
|
696
|
+
colorsBuffer?: TextStorageBuffer;
|
|
697
|
+
anglesBuffer?: TextStorageBuffer;
|
|
698
|
+
sizesBuffer?: TextStorageBuffer;
|
|
699
|
+
pixelOffsetsBuffer?: TextStorageBuffer;
|
|
700
|
+
textAnchorsBuffer?: TextStorageBuffer;
|
|
701
|
+
alignmentBaselinesBuffer?: TextStorageBuffer;
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
type ResolvedArrowTextStorageBatchInputs = ResolvedTextStorageBatchRowInputs & {
|
|
705
|
+
texts: ArrowUtf8TextVector;
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
type ResolvedArrowTextStorageInputs = {
|
|
709
|
+
texts: ArrowUtf8TextVector;
|
|
710
|
+
batches: ResolvedArrowTextStorageBatchInputs[];
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
function resolveArrowTextStorageInputs(
|
|
714
|
+
props: ArrowTextStorageInputProps
|
|
715
|
+
): ResolvedArrowTextStorageInputs {
|
|
716
|
+
if (!props.sourceVectors) {
|
|
717
|
+
throw new Error(
|
|
718
|
+
'ArrowTextStorageModel requires explicit sourceVectors for CPU glyph expansion'
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
assertStorageVectorTypes(props);
|
|
722
|
+
assertTextStorageVectorBatchAlignment(props);
|
|
723
|
+
assertStorageSourceVectorAlignment(props);
|
|
724
|
+
const {sourceVectors} = props;
|
|
725
|
+
const batches: ResolvedArrowTextStorageBatchInputs[] = [];
|
|
726
|
+
let batchRowIndexBase = props.rowIndexBase ?? 0;
|
|
727
|
+
|
|
728
|
+
for (let batchIndex = 0; batchIndex < props.texts.data.length; batchIndex++) {
|
|
729
|
+
const textData = props.texts.data[batchIndex];
|
|
730
|
+
const positionsData = props.positions.data[batchIndex];
|
|
731
|
+
batches.push({
|
|
732
|
+
batchRowIndexBase,
|
|
733
|
+
rowStorageIndexBase: getGpuDataRowStorageIndexBase(positionsData, 'positions', batchIndex),
|
|
734
|
+
texts: getArrowTextSourceBatch(sourceVectors.texts, 'texts', batchIndex),
|
|
735
|
+
clipRects: sourceVectors.clipRects
|
|
736
|
+
? (getArrowTextSourceBatch(sourceVectors.clipRects, 'clipRects', batchIndex) as Vector<
|
|
737
|
+
FixedSizeList<Float32>
|
|
738
|
+
>)
|
|
739
|
+
: undefined,
|
|
740
|
+
positionsBuffer: positionsData.buffer,
|
|
741
|
+
colorsBuffer: props.colors?.data[batchIndex].buffer,
|
|
742
|
+
anglesBuffer: props.angles?.data[batchIndex].buffer,
|
|
743
|
+
sizesBuffer: props.sizes?.data[batchIndex].buffer,
|
|
744
|
+
pixelOffsetsBuffer: props.pixelOffsets?.data[batchIndex].buffer,
|
|
745
|
+
textAnchorsBuffer: props.textAnchors?.data[batchIndex].buffer,
|
|
746
|
+
alignmentBaselinesBuffer: props.alignmentBaselines?.data[batchIndex].buffer
|
|
747
|
+
});
|
|
748
|
+
batchRowIndexBase += textData.length;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
return {texts: sourceVectors.texts, batches};
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
function resolveArrowTextDictionaryStorageInputs(
|
|
755
|
+
props: ArrowTextDictionaryStorageInputProps
|
|
756
|
+
): ResolvedArrowTextStorageInputs {
|
|
757
|
+
if (!props.sourceVectors) {
|
|
758
|
+
throw new Error(
|
|
759
|
+
'ArrowTextDictionaryStorageModel requires explicit sourceVectors for compressed dictionary glyph layout'
|
|
760
|
+
);
|
|
761
|
+
}
|
|
762
|
+
assertTextDictionaryStorageVectorTypes(props);
|
|
763
|
+
assertTextStorageVectorBatchAlignment(props, 'ArrowTextDictionaryStorageModel');
|
|
764
|
+
assertTextDictionaryStorageSourceVectorAlignment(props);
|
|
765
|
+
const {sourceVectors} = props;
|
|
766
|
+
const batches: ResolvedArrowTextStorageBatchInputs[] = [];
|
|
767
|
+
let batchRowIndexBase = props.rowIndexBase ?? 0;
|
|
768
|
+
|
|
769
|
+
for (let batchIndex = 0; batchIndex < props.texts.data.length; batchIndex++) {
|
|
770
|
+
const textData = props.texts.data[batchIndex];
|
|
771
|
+
const positionsData = props.positions.data[batchIndex];
|
|
772
|
+
batches.push({
|
|
773
|
+
batchRowIndexBase,
|
|
774
|
+
rowStorageIndexBase: getGpuDataRowStorageIndexBase(positionsData, 'positions', batchIndex),
|
|
775
|
+
texts: getArrowTextSourceBatch(sourceVectors.texts, 'texts', batchIndex),
|
|
776
|
+
clipRects: sourceVectors.clipRects
|
|
777
|
+
? (getArrowTextSourceBatch(sourceVectors.clipRects, 'clipRects', batchIndex) as Vector<
|
|
778
|
+
FixedSizeList<Float32>
|
|
779
|
+
>)
|
|
780
|
+
: undefined,
|
|
781
|
+
positionsBuffer: positionsData.buffer,
|
|
782
|
+
colorsBuffer: props.colors?.data[batchIndex].buffer,
|
|
783
|
+
anglesBuffer: props.angles?.data[batchIndex].buffer,
|
|
784
|
+
sizesBuffer: props.sizes?.data[batchIndex].buffer,
|
|
785
|
+
pixelOffsetsBuffer: props.pixelOffsets?.data[batchIndex].buffer,
|
|
786
|
+
textAnchorsBuffer: props.textAnchors?.data[batchIndex].buffer,
|
|
787
|
+
alignmentBaselinesBuffer: props.alignmentBaselines?.data[batchIndex].buffer
|
|
788
|
+
});
|
|
789
|
+
batchRowIndexBase += textData.length;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
return {texts: sourceVectors.texts, batches};
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
type ResolvedGPUVectorTextStorageBatchInputs = ResolvedTextStorageBatchRowInputs &
|
|
796
|
+
GPUVectorTextStorageBatch;
|
|
797
|
+
|
|
798
|
+
type ResolvedGPUVectorTextStorageInputs = {
|
|
799
|
+
batches: ResolvedGPUVectorTextStorageBatchInputs[];
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
function resolveGPUVectorTextStorageInputs(
|
|
803
|
+
device: Device,
|
|
804
|
+
props: GPUVectorTextStorageInputProps
|
|
805
|
+
): ResolvedGPUVectorTextStorageInputs {
|
|
806
|
+
assertGPUVectorTextStorageInputTypes(props);
|
|
807
|
+
assertTextStorageVectorBatchAlignment(props, 'TextStorageModel');
|
|
808
|
+
|
|
809
|
+
const preparedTextBatches =
|
|
810
|
+
props.textBatches ?? createGPUVectorTextStorageBatchesFromTexts(device, props);
|
|
811
|
+
if (preparedTextBatches.length !== props.texts.data.length) {
|
|
812
|
+
throw new Error('TextStorageModel textBatches must match texts GPUVector batch count');
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
const batches: ResolvedGPUVectorTextStorageBatchInputs[] = [];
|
|
816
|
+
let batchRowIndexBase = props.rowIndexBase ?? 0;
|
|
817
|
+
for (let batchIndex = 0; batchIndex < props.texts.data.length; batchIndex++) {
|
|
818
|
+
const textData = props.texts.data[batchIndex];
|
|
819
|
+
const positionsData = props.positions.data[batchIndex];
|
|
820
|
+
const textBatch = preparedTextBatches[batchIndex];
|
|
821
|
+
if (!textBatch) {
|
|
822
|
+
throw new Error(`TextStorageModel textBatches is missing batch ${batchIndex}`);
|
|
823
|
+
}
|
|
824
|
+
if (textBatch.rowCount !== textData.length) {
|
|
825
|
+
throw new Error('TextStorageModel textBatches rows must match texts GPU rows');
|
|
826
|
+
}
|
|
827
|
+
batches.push({
|
|
828
|
+
...textBatch,
|
|
829
|
+
batchRowIndexBase,
|
|
830
|
+
rowStorageIndexBase: getGpuDataRowStorageIndexBase(positionsData, 'positions', batchIndex),
|
|
831
|
+
positionsBuffer: positionsData.buffer,
|
|
832
|
+
colorsBuffer: props.colors?.data[batchIndex].buffer,
|
|
833
|
+
anglesBuffer: props.angles?.data[batchIndex].buffer,
|
|
834
|
+
sizesBuffer: props.sizes?.data[batchIndex].buffer,
|
|
835
|
+
pixelOffsetsBuffer: props.pixelOffsets?.data[batchIndex].buffer,
|
|
836
|
+
textAnchorsBuffer: props.textAnchors?.data[batchIndex].buffer,
|
|
837
|
+
alignmentBaselinesBuffer: props.alignmentBaselines?.data[batchIndex].buffer,
|
|
838
|
+
clipRectsBuffer: props.clipRects
|
|
839
|
+
? getGPUVectorTextStorageClipRectsBuffer(props.clipRects, batchIndex)
|
|
840
|
+
: undefined
|
|
841
|
+
});
|
|
842
|
+
batchRowIndexBase += textData.length;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
return {batches};
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
function assertStorageVectorTypes(props: ArrowTextStorageInputProps): void {
|
|
849
|
+
const textType = getArrowGPUVectorDataType(props.texts);
|
|
850
|
+
const positionType = getArrowGPUVectorDataType(props.positions);
|
|
851
|
+
const colorType = props.colors ? getArrowGPUVectorDataType(props.colors) : undefined;
|
|
852
|
+
const angleType = props.angles ? getArrowGPUVectorDataType(props.angles) : undefined;
|
|
853
|
+
const sizeType = props.sizes ? getArrowGPUVectorDataType(props.sizes) : undefined;
|
|
854
|
+
const pixelOffsetType = props.pixelOffsets
|
|
855
|
+
? getArrowGPUVectorDataType(props.pixelOffsets)
|
|
856
|
+
: undefined;
|
|
857
|
+
const textAnchorType = props.textAnchors
|
|
858
|
+
? getArrowGPUVectorDataType(props.textAnchors)
|
|
859
|
+
: undefined;
|
|
860
|
+
const alignmentBaselineType = props.alignmentBaselines
|
|
861
|
+
? getArrowGPUVectorDataType(props.alignmentBaselines)
|
|
862
|
+
: undefined;
|
|
863
|
+
|
|
864
|
+
if (!isArrowUtf8TextGPUVector(props.texts)) {
|
|
865
|
+
throw new Error('ArrowTextStorageModel texts must be GPUVector');
|
|
866
|
+
}
|
|
867
|
+
if (!isArrowUtf8TextVector(props.sourceVectors.texts)) {
|
|
868
|
+
throw new Error('ArrowTextStorageModel sourceVectors.texts must be Utf8 or Dictionary<Utf8>');
|
|
869
|
+
}
|
|
870
|
+
if (!util.compareTypes(props.sourceVectors.texts.type, textType)) {
|
|
871
|
+
throw new Error('ArrowTextStorageModel sourceVectors.texts type must match GPU texts type');
|
|
872
|
+
}
|
|
873
|
+
if (
|
|
874
|
+
!DataType.isFixedSizeList(positionType) ||
|
|
875
|
+
positionType.listSize !== 2 ||
|
|
876
|
+
!(positionType.children[0]?.type instanceof Float32)
|
|
877
|
+
) {
|
|
878
|
+
throw new Error('ArrowTextStorageModel positions must be GPUVector');
|
|
879
|
+
}
|
|
880
|
+
if (
|
|
881
|
+
colorType &&
|
|
882
|
+
(!DataType.isFixedSizeList(colorType) ||
|
|
883
|
+
colorType.listSize !== 4 ||
|
|
884
|
+
!(colorType.children[0]?.type instanceof Uint8))
|
|
885
|
+
) {
|
|
886
|
+
throw new Error('ArrowTextStorageModel colors must be GPUVector');
|
|
887
|
+
}
|
|
888
|
+
if (angleType && !(angleType instanceof Float32)) {
|
|
889
|
+
throw new Error('ArrowTextStorageModel angles must be GPUVector');
|
|
890
|
+
}
|
|
891
|
+
if (sizeType && !(sizeType instanceof Float32)) {
|
|
892
|
+
throw new Error('ArrowTextStorageModel sizes must be GPUVector');
|
|
893
|
+
}
|
|
894
|
+
if (
|
|
895
|
+
pixelOffsetType &&
|
|
896
|
+
(!DataType.isFixedSizeList(pixelOffsetType) ||
|
|
897
|
+
pixelOffsetType.listSize !== 2 ||
|
|
898
|
+
!(pixelOffsetType.children[0]?.type instanceof Float32))
|
|
899
|
+
) {
|
|
900
|
+
throw new Error('ArrowTextStorageModel pixelOffsets must be GPUVector');
|
|
901
|
+
}
|
|
902
|
+
if (textAnchorType && !(textAnchorType instanceof Uint8)) {
|
|
903
|
+
throw new Error('ArrowTextStorageModel textAnchors must be GPUVector');
|
|
904
|
+
}
|
|
905
|
+
if (alignmentBaselineType && !(alignmentBaselineType instanceof Uint8)) {
|
|
906
|
+
throw new Error('ArrowTextStorageModel alignmentBaselines must be GPUVector');
|
|
907
|
+
}
|
|
908
|
+
const clipRects = props.sourceVectors.clipRects;
|
|
909
|
+
assertClipRects(clipRects as Vector<FixedSizeList<Float32>> | undefined, props.texts.length);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
function assertGPUVectorTextStorageInputTypes(props: GPUVectorTextStorageInputProps): void {
|
|
913
|
+
assertTextStorageGPUVectorInputs(props as TextStorageInputProps);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
function createGPUVectorTextStorageBatchesFromTexts(
|
|
917
|
+
device: Device,
|
|
918
|
+
props: GPUVectorTextStorageInputProps
|
|
919
|
+
): GPUVectorTextStorageBatch[] {
|
|
920
|
+
return props.texts.data.map((data, batchIndex) => {
|
|
921
|
+
if (data.byteOffset !== 0 || data.byteStride !== 1) {
|
|
922
|
+
throw new Error('TextStorageModel GPUVector UTF-8 batches must be zero-offset byte buffers');
|
|
923
|
+
}
|
|
924
|
+
const {valueOffsets, nullBitmap, valueByteLength} = data;
|
|
925
|
+
if (!valueOffsets || valueByteLength === undefined) {
|
|
926
|
+
throw new Error('TextStorageModel GPUVector UTF-8 batches require row offset metadata');
|
|
927
|
+
}
|
|
928
|
+
const rowByteRanges = new Uint32Array(data.length * 2);
|
|
929
|
+
const startIndices = new Array<number>(data.length + 1);
|
|
930
|
+
startIndices[0] = 0;
|
|
931
|
+
|
|
932
|
+
for (let rowIndex = 0; rowIndex < data.length; rowIndex++) {
|
|
933
|
+
const isValid = isGPUVectorTextStorageRowValid(nullBitmap, rowIndex);
|
|
934
|
+
const startIndex = isValid ? (valueOffsets[rowIndex] ?? 0) : 0;
|
|
935
|
+
const endIndex = isValid ? (valueOffsets[rowIndex + 1] ?? startIndex) : startIndex;
|
|
936
|
+
rowByteRanges[rowIndex * 2] = startIndex;
|
|
937
|
+
rowByteRanges[rowIndex * 2 + 1] = endIndex;
|
|
938
|
+
startIndices[rowIndex + 1] = Math.max(startIndices[rowIndex] ?? 0, endIndex);
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
const rowByteRangesBuffer = device.createBuffer({
|
|
942
|
+
id: `${props.id || 'text-storage-model'}-utf8-row-byte-ranges-${batchIndex}`,
|
|
943
|
+
usage: Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
944
|
+
data: rowByteRanges.byteLength > 0 ? rowByteRanges : new Uint32Array(2)
|
|
945
|
+
});
|
|
946
|
+
return {
|
|
947
|
+
rowCount: data.length,
|
|
948
|
+
startIndices,
|
|
949
|
+
rowByteRanges,
|
|
950
|
+
rowByteRangesBuffer,
|
|
951
|
+
utf8BytesBuffer: data.buffer,
|
|
952
|
+
byteLength: valueByteLength,
|
|
953
|
+
inputByteLength: rowByteRanges.byteLength + valueByteLength,
|
|
954
|
+
ownsRowByteRangesBuffer: true
|
|
955
|
+
};
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
function isGPUVectorTextStorageRowValid(
|
|
960
|
+
nullBitmap: Uint8Array | undefined,
|
|
961
|
+
rowIndex: number
|
|
962
|
+
): boolean {
|
|
963
|
+
if (!nullBitmap) {
|
|
964
|
+
return true;
|
|
965
|
+
}
|
|
966
|
+
return (nullBitmap[rowIndex >> 3] & (1 << (rowIndex & 7))) !== 0;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
function getGPUVectorTextStorageClipRectsBuffer(
|
|
970
|
+
clipRects: GPUVector,
|
|
971
|
+
batchIndex: number
|
|
972
|
+
): TextStorageBuffer {
|
|
973
|
+
const clipRectsData = clipRects.data[batchIndex];
|
|
974
|
+
if (!clipRectsData) {
|
|
975
|
+
throw new Error(`TextStorageModel clipRects is missing batch ${batchIndex}`);
|
|
976
|
+
}
|
|
977
|
+
if (
|
|
978
|
+
clipRectsData.byteOffset !== 0 ||
|
|
979
|
+
clipRectsData.byteStride !== Float32Array.BYTES_PER_ELEMENT * 4
|
|
980
|
+
) {
|
|
981
|
+
throw new Error(
|
|
982
|
+
'TextStorageModel GPUVector clipRects batches must be zero-offset packed Float32x4 buffers'
|
|
983
|
+
);
|
|
984
|
+
}
|
|
985
|
+
return clipRectsData.buffer;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
function assertTextStorageVectorBatchAlignment(
|
|
989
|
+
props: AnyTextStorageInputProps,
|
|
990
|
+
ownerName:
|
|
991
|
+
| 'ArrowTextStorageModel'
|
|
992
|
+
| 'ArrowTextDictionaryStorageModel'
|
|
993
|
+
| 'TextStorageModel' = 'ArrowTextStorageModel'
|
|
994
|
+
): void {
|
|
995
|
+
const rowInputs: Array<[string, GPUVector | undefined]> = [
|
|
996
|
+
['positions', props.positions],
|
|
997
|
+
['texts', props.texts],
|
|
998
|
+
['colors', props.colors],
|
|
999
|
+
['angles', props.angles],
|
|
1000
|
+
['sizes', props.sizes],
|
|
1001
|
+
['pixelOffsets', props.pixelOffsets],
|
|
1002
|
+
['textAnchors', props.textAnchors],
|
|
1003
|
+
['alignmentBaselines', props.alignmentBaselines],
|
|
1004
|
+
['clipRects', props.clipRects]
|
|
1005
|
+
];
|
|
1006
|
+
const suppliedInputs = rowInputs.filter(([, vector]) => vector !== undefined) as Array<
|
|
1007
|
+
[string, GPUVector]
|
|
1008
|
+
>;
|
|
1009
|
+
const [referenceName, referenceVector] = suppliedInputs[0];
|
|
1010
|
+
for (const [name, vector] of suppliedInputs.slice(1)) {
|
|
1011
|
+
if (vector.length !== referenceVector.length) {
|
|
1012
|
+
throw new Error(
|
|
1013
|
+
`${ownerName} ${name} rows must match ${referenceName} rows (${vector.length} !== ${referenceVector.length})`
|
|
1014
|
+
);
|
|
1015
|
+
}
|
|
1016
|
+
if (vector.data.length !== referenceVector.data.length) {
|
|
1017
|
+
throw new Error(`${ownerName} ${name} batch count must match ${referenceName} batch count`);
|
|
1018
|
+
}
|
|
1019
|
+
for (let batchIndex = 0; batchIndex < vector.data.length; batchIndex++) {
|
|
1020
|
+
if (vector.data[batchIndex].length !== referenceVector.data[batchIndex].length) {
|
|
1021
|
+
throw new Error(
|
|
1022
|
+
`${ownerName} ${name} batch ${batchIndex} rows must match ${referenceName}`
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
function assertStorageSourceVectorAlignment(props: ArrowTextStorageInputProps): void {
|
|
1030
|
+
assertSourceVectorMatchesGPUVector(
|
|
1031
|
+
'ArrowTextStorageModel',
|
|
1032
|
+
'texts',
|
|
1033
|
+
props.texts,
|
|
1034
|
+
props.sourceVectors.texts
|
|
1035
|
+
);
|
|
1036
|
+
if (props.clipRects && !props.sourceVectors.clipRects) {
|
|
1037
|
+
throw new Error('ArrowTextStorageModel clipRects GPU rows require matching sourceVectors rows');
|
|
1038
|
+
}
|
|
1039
|
+
if (!props.clipRects && props.sourceVectors.clipRects) {
|
|
1040
|
+
throw new Error(
|
|
1041
|
+
'ArrowTextStorageModel sourceVectors.clipRects requires matching GPU clipRects rows'
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
if (props.clipRects && props.sourceVectors.clipRects) {
|
|
1045
|
+
assertSourceVectorMatchesGPUVector(
|
|
1046
|
+
'ArrowTextStorageModel',
|
|
1047
|
+
'clipRects',
|
|
1048
|
+
props.clipRects,
|
|
1049
|
+
props.sourceVectors.clipRects
|
|
1050
|
+
);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
function assertTextDictionaryStorageVectorTypes(props: ArrowTextDictionaryStorageInputProps): void {
|
|
1055
|
+
const textType = getArrowGPUVectorDataType(props.texts);
|
|
1056
|
+
const positionType = getArrowGPUVectorDataType(props.positions);
|
|
1057
|
+
const colorType = props.colors ? getArrowGPUVectorDataType(props.colors) : undefined;
|
|
1058
|
+
const angleType = props.angles ? getArrowGPUVectorDataType(props.angles) : undefined;
|
|
1059
|
+
const sizeType = props.sizes ? getArrowGPUVectorDataType(props.sizes) : undefined;
|
|
1060
|
+
const pixelOffsetType = props.pixelOffsets
|
|
1061
|
+
? getArrowGPUVectorDataType(props.pixelOffsets)
|
|
1062
|
+
: undefined;
|
|
1063
|
+
const textAnchorType = props.textAnchors
|
|
1064
|
+
? getArrowGPUVectorDataType(props.textAnchors)
|
|
1065
|
+
: undefined;
|
|
1066
|
+
const alignmentBaselineType = props.alignmentBaselines
|
|
1067
|
+
? getArrowGPUVectorDataType(props.alignmentBaselines)
|
|
1068
|
+
: undefined;
|
|
1069
|
+
|
|
1070
|
+
if (!isArrowUtf8DictionaryGPUVector(props.texts)) {
|
|
1071
|
+
throw new Error('ArrowTextDictionaryStorageModel texts must be GPUVector');
|
|
1072
|
+
}
|
|
1073
|
+
if (!isArrowUtf8DictionaryVector(props.sourceVectors.texts)) {
|
|
1074
|
+
throw new Error('ArrowTextDictionaryStorageModel sourceVectors.texts must be Dictionary<Utf8>');
|
|
1075
|
+
}
|
|
1076
|
+
if (!util.compareTypes(props.sourceVectors.texts.type, textType)) {
|
|
1077
|
+
throw new Error(
|
|
1078
|
+
'ArrowTextDictionaryStorageModel sourceVectors.texts type must match GPU texts type'
|
|
1079
|
+
);
|
|
1080
|
+
}
|
|
1081
|
+
if (
|
|
1082
|
+
!DataType.isFixedSizeList(positionType) ||
|
|
1083
|
+
positionType.listSize !== 2 ||
|
|
1084
|
+
!(positionType.children[0]?.type instanceof Float32)
|
|
1085
|
+
) {
|
|
1086
|
+
throw new Error('ArrowTextDictionaryStorageModel positions must be GPUVector');
|
|
1087
|
+
}
|
|
1088
|
+
if (
|
|
1089
|
+
colorType &&
|
|
1090
|
+
(!DataType.isFixedSizeList(colorType) ||
|
|
1091
|
+
colorType.listSize !== 4 ||
|
|
1092
|
+
!(colorType.children[0]?.type instanceof Uint8))
|
|
1093
|
+
) {
|
|
1094
|
+
throw new Error('ArrowTextDictionaryStorageModel colors must be GPUVector');
|
|
1095
|
+
}
|
|
1096
|
+
if (angleType && !(angleType instanceof Float32)) {
|
|
1097
|
+
throw new Error('ArrowTextDictionaryStorageModel angles must be GPUVector');
|
|
1098
|
+
}
|
|
1099
|
+
if (sizeType && !(sizeType instanceof Float32)) {
|
|
1100
|
+
throw new Error('ArrowTextDictionaryStorageModel sizes must be GPUVector');
|
|
1101
|
+
}
|
|
1102
|
+
if (
|
|
1103
|
+
pixelOffsetType &&
|
|
1104
|
+
(!DataType.isFixedSizeList(pixelOffsetType) ||
|
|
1105
|
+
pixelOffsetType.listSize !== 2 ||
|
|
1106
|
+
!(pixelOffsetType.children[0]?.type instanceof Float32))
|
|
1107
|
+
) {
|
|
1108
|
+
throw new Error('ArrowTextDictionaryStorageModel pixelOffsets must be GPUVector');
|
|
1109
|
+
}
|
|
1110
|
+
if (textAnchorType && !(textAnchorType instanceof Uint8)) {
|
|
1111
|
+
throw new Error('ArrowTextDictionaryStorageModel textAnchors must be GPUVector');
|
|
1112
|
+
}
|
|
1113
|
+
if (alignmentBaselineType && !(alignmentBaselineType instanceof Uint8)) {
|
|
1114
|
+
throw new Error('ArrowTextDictionaryStorageModel alignmentBaselines must be GPUVector');
|
|
1115
|
+
}
|
|
1116
|
+
const clipRects = props.sourceVectors.clipRects;
|
|
1117
|
+
assertClipRects(clipRects as Vector<FixedSizeList<Float32>> | undefined, props.texts.length);
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
function assertTextDictionaryStorageSourceVectorAlignment(
|
|
1121
|
+
props: ArrowTextDictionaryStorageInputProps
|
|
1122
|
+
): void {
|
|
1123
|
+
assertSourceVectorMatchesGPUVector(
|
|
1124
|
+
'ArrowTextDictionaryStorageModel',
|
|
1125
|
+
'texts',
|
|
1126
|
+
props.texts,
|
|
1127
|
+
props.sourceVectors.texts
|
|
1128
|
+
);
|
|
1129
|
+
if (props.clipRects && !props.sourceVectors.clipRects) {
|
|
1130
|
+
throw new Error(
|
|
1131
|
+
'ArrowTextDictionaryStorageModel clipRects GPU rows require matching sourceVectors rows'
|
|
1132
|
+
);
|
|
1133
|
+
}
|
|
1134
|
+
if (!props.clipRects && props.sourceVectors.clipRects) {
|
|
1135
|
+
throw new Error(
|
|
1136
|
+
'ArrowTextDictionaryStorageModel sourceVectors.clipRects requires matching GPU clipRects rows'
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
if (props.clipRects && props.sourceVectors.clipRects) {
|
|
1140
|
+
assertSourceVectorMatchesGPUVector(
|
|
1141
|
+
'ArrowTextDictionaryStorageModel',
|
|
1142
|
+
'clipRects',
|
|
1143
|
+
props.clipRects,
|
|
1144
|
+
props.sourceVectors.clipRects
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
function getGpuDataRowStorageIndexBase(
|
|
1150
|
+
data: GPUData,
|
|
1151
|
+
vectorName: string,
|
|
1152
|
+
batchIndex: number
|
|
1153
|
+
): number {
|
|
1154
|
+
if (!Number.isFinite(data.byteStride) || data.byteStride <= 0) {
|
|
1155
|
+
throw new Error(
|
|
1156
|
+
`ArrowTextStorageModel ${vectorName} batch ${batchIndex} has invalid byte stride`
|
|
1157
|
+
);
|
|
1158
|
+
}
|
|
1159
|
+
const rowStorageIndexBase = data.byteOffset / data.byteStride;
|
|
1160
|
+
if (!Number.isInteger(rowStorageIndexBase)) {
|
|
1161
|
+
throw new Error(
|
|
1162
|
+
`ArrowTextStorageModel ${vectorName} batch ${batchIndex} byte offset is not row aligned`
|
|
1163
|
+
);
|
|
1164
|
+
}
|
|
1165
|
+
return rowStorageIndexBase;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/** Builds reusable attribute text state for GPU/state-only model construction. */
|
|
1169
|
+
export function createArrowTextAttributeState(
|
|
1170
|
+
device: Device,
|
|
1171
|
+
props: ArrowTextModelProps
|
|
1172
|
+
): ArrowTextAttributeState {
|
|
1173
|
+
return {
|
|
1174
|
+
...makeArrowTextModelProps(device, props),
|
|
1175
|
+
textProps: props
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
function makeArrowTextModelProps(
|
|
1180
|
+
device: Device,
|
|
1181
|
+
props: ArrowTextModelProps
|
|
1182
|
+
): {
|
|
1183
|
+
modelProps: GPUTableModelProps;
|
|
1184
|
+
glyphLayout: TextGlyphLayout;
|
|
1185
|
+
glyphTable: ArrowTextGlyphTable;
|
|
1186
|
+
expandedGlyphVertexData: Buffer;
|
|
1187
|
+
renderBatches: ArrowTextRenderBatchState[];
|
|
1188
|
+
atlasTexture?: DynamicTexture;
|
|
1189
|
+
glyphAttributeBuildTimeMs: number;
|
|
1190
|
+
glyphAttributeByteLength: number;
|
|
1191
|
+
fontRenderSettings: FontAtlasRenderSettings;
|
|
1192
|
+
defaultFragmentShaderUniforms?: Record<string, unknown>;
|
|
1193
|
+
mappingState: ResolvedCharacterMapping;
|
|
1194
|
+
destroy: () => void;
|
|
1195
|
+
} {
|
|
1196
|
+
const textInputs = resolveArrowTextInputs(props);
|
|
1197
|
+
const mappingState = resolveCharacterMapping(props);
|
|
1198
|
+
const defaultFragmentShaderUniforms = createTextDefaultFragmentShaderUniforms(
|
|
1199
|
+
props.uniforms,
|
|
1200
|
+
mappingState.fontRenderSettings
|
|
1201
|
+
);
|
|
1202
|
+
const glyphTable = buildArrowTextGlyphTable({
|
|
1203
|
+
labelTable: textInputs.labelTable,
|
|
1204
|
+
texts: textInputs.texts,
|
|
1205
|
+
clipRects: textInputs.clipRects,
|
|
1206
|
+
fontAtlas: mappingState.fontAtlas,
|
|
1207
|
+
lineHeight: mappingState.lineHeight,
|
|
1208
|
+
characterSet: mappingState.characterSet,
|
|
1209
|
+
rowIndexBase: props.rowIndexBase,
|
|
1210
|
+
color: props.color,
|
|
1211
|
+
angle: props.angle,
|
|
1212
|
+
size: props.size
|
|
1213
|
+
});
|
|
1214
|
+
const shaderLayout = resolveArrowTextShaderLayout(props);
|
|
1215
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
1216
|
+
device,
|
|
1217
|
+
recordOffsets: glyphTable.glyphLayout.startIndices,
|
|
1218
|
+
recordByteStride: textInputs.clipRects
|
|
1219
|
+
? CLIPPED_EXPANDED_GLYPH_VERTEX_BYTE_STRIDE
|
|
1220
|
+
: EXPANDED_GLYPH_VERTEX_BYTE_STRIDE,
|
|
1221
|
+
resourceLabel: 'ArrowTextModel expanded glyph vertex data'
|
|
1222
|
+
});
|
|
1223
|
+
const expandedGlyphVertexStates = generatedBufferBatches.map(generatedBufferBatch =>
|
|
1224
|
+
createExpandedGlyphVertexData(device, props, {
|
|
1225
|
+
glyphTable,
|
|
1226
|
+
shaderLayout,
|
|
1227
|
+
generatedBufferBatch,
|
|
1228
|
+
rowIndexBase: 0
|
|
1229
|
+
})
|
|
1230
|
+
);
|
|
1231
|
+
const firstExpandedGlyphVertexState = expandedGlyphVertexStates[0];
|
|
1232
|
+
if (!firstExpandedGlyphVertexState) {
|
|
1233
|
+
throw new Error('ArrowTextModel requires at least one generated glyph render batch');
|
|
1234
|
+
}
|
|
1235
|
+
const renderBatches = generatedBufferBatches.map((generatedBufferBatch, batchIndex) => ({
|
|
1236
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
1237
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
1238
|
+
glyphCount: generatedBufferBatch.recordCount,
|
|
1239
|
+
expandedGlyphVertexData: expandedGlyphVertexStates[batchIndex]!.buffer
|
|
1240
|
+
}));
|
|
1241
|
+
const expandedGlyphVertexState = firstExpandedGlyphVertexState;
|
|
1242
|
+
const {atlasTexture, ownsAtlasTexture} = getTextAtlasTexture(
|
|
1243
|
+
device,
|
|
1244
|
+
props,
|
|
1245
|
+
mappingState.fontAtlas
|
|
1246
|
+
);
|
|
1247
|
+
const modelProps = {
|
|
1248
|
+
...props,
|
|
1249
|
+
vs: props.vs ?? (textInputs.clipRects ? DEFAULT_CLIPPED_TEXT_VS : DEFAULT_TEXT_VS),
|
|
1250
|
+
fs: props.fs ?? DEFAULT_TEXT_FS,
|
|
1251
|
+
uniforms: defaultFragmentShaderUniforms,
|
|
1252
|
+
shaderLayout,
|
|
1253
|
+
bindings: {
|
|
1254
|
+
...(props.bindings || {}),
|
|
1255
|
+
fontAtlasTexture: atlasTexture
|
|
1256
|
+
},
|
|
1257
|
+
attributes: {
|
|
1258
|
+
...(props.attributes || {}),
|
|
1259
|
+
[EXPANDED_GLYPH_VERTEX_DATA]: expandedGlyphVertexState.buffer
|
|
1260
|
+
},
|
|
1261
|
+
bufferLayout: [...(props.bufferLayout || []), expandedGlyphVertexState.bufferLayout],
|
|
1262
|
+
vertexCount: props.vertexCount ?? 6,
|
|
1263
|
+
instanceCount: glyphTable.glyphLayout.glyphCount,
|
|
1264
|
+
table: makeGPUTableFromArrowTable(
|
|
1265
|
+
device,
|
|
1266
|
+
createArrowTextRenderTable(glyphTable.table, generatedBufferBatches),
|
|
1267
|
+
{shaderLayout}
|
|
1268
|
+
),
|
|
1269
|
+
tableCount: 'none'
|
|
1270
|
+
} satisfies GPUTableModelProps;
|
|
1271
|
+
let destroyed = false;
|
|
1272
|
+
|
|
1273
|
+
return {
|
|
1274
|
+
modelProps,
|
|
1275
|
+
glyphLayout: glyphTable.glyphLayout,
|
|
1276
|
+
glyphTable,
|
|
1277
|
+
expandedGlyphVertexData: expandedGlyphVertexState.buffer,
|
|
1278
|
+
renderBatches,
|
|
1279
|
+
atlasTexture,
|
|
1280
|
+
glyphAttributeBuildTimeMs: glyphTable.glyphAttributeBuildTimeMs,
|
|
1281
|
+
glyphAttributeByteLength: glyphTable.attributeByteLength,
|
|
1282
|
+
fontRenderSettings: mappingState.fontRenderSettings,
|
|
1283
|
+
defaultFragmentShaderUniforms,
|
|
1284
|
+
mappingState,
|
|
1285
|
+
destroy: () => {
|
|
1286
|
+
if (destroyed) {
|
|
1287
|
+
return;
|
|
1288
|
+
}
|
|
1289
|
+
destroyed = true;
|
|
1290
|
+
if (ownsAtlasTexture) {
|
|
1291
|
+
atlasTexture.destroy();
|
|
1292
|
+
}
|
|
1293
|
+
for (const renderBatch of renderBatches) {
|
|
1294
|
+
renderBatch.expandedGlyphVertexData.destroy();
|
|
1295
|
+
}
|
|
1296
|
+
modelProps.table?.destroy();
|
|
1297
|
+
}
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
/** Resolves the attribute text shader layout, selecting the clipped layout when needed. */
|
|
1302
|
+
export function resolveArrowTextShaderLayout(props: ArrowTextModelProps): ShaderLayout {
|
|
1303
|
+
return (
|
|
1304
|
+
props.shaderLayout ??
|
|
1305
|
+
(props.clipRects ? DEFAULT_CLIPPED_TEXT_SHADER_LAYOUT : DEFAULT_TEXT_SHADER_LAYOUT)
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
/** Builds the glyph render table and splits it to match generated buffer batches when needed. */
|
|
1310
|
+
export function createArrowTextRenderTable(
|
|
1311
|
+
glyphTable: Table,
|
|
1312
|
+
generatedBufferBatches?: GeneratedBufferBatch[]
|
|
1313
|
+
): Table {
|
|
1314
|
+
const generatedGlyphColumnNames = new Set([
|
|
1315
|
+
GLYPH_OFFSETS_COLUMN,
|
|
1316
|
+
GLYPH_FRAMES_COLUMN,
|
|
1317
|
+
GLYPH_PAGES_COLUMN,
|
|
1318
|
+
GLYPH_CLIP_RECTS_COLUMN,
|
|
1319
|
+
ROW_INDICES_COLUMN
|
|
1320
|
+
]);
|
|
1321
|
+
const fields: Field[] = [];
|
|
1322
|
+
const columns: Record<string, Vector> = {};
|
|
1323
|
+
|
|
1324
|
+
for (const field of glyphTable.schema.fields) {
|
|
1325
|
+
if (generatedGlyphColumnNames.has(field.name)) {
|
|
1326
|
+
continue;
|
|
1327
|
+
}
|
|
1328
|
+
const vector = glyphTable.getChild(field.name);
|
|
1329
|
+
if (!vector) {
|
|
1330
|
+
continue;
|
|
1331
|
+
}
|
|
1332
|
+
fields.push(field);
|
|
1333
|
+
columns[field.name] = vector;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
const renderTable = new Table(new Schema(fields, new Map(glyphTable.schema.metadata)), columns);
|
|
1337
|
+
if (!generatedBufferBatches || generatedBufferBatches.length <= 1) {
|
|
1338
|
+
return renderTable;
|
|
1339
|
+
}
|
|
1340
|
+
const recordBatches = generatedBufferBatches.flatMap(
|
|
1341
|
+
batch => renderTable.slice(batch.recordStart, batch.recordEnd).batches
|
|
1342
|
+
);
|
|
1343
|
+
return new Table(renderTable.schema, recordBatches);
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
/** Creates the interleaved expanded glyph vertex buffer consumed by the attribute model. */
|
|
1347
|
+
export function createExpandedGlyphVertexData(
|
|
1348
|
+
device: Device,
|
|
1349
|
+
props: ArrowTextModelProps,
|
|
1350
|
+
{
|
|
1351
|
+
glyphTable,
|
|
1352
|
+
shaderLayout,
|
|
1353
|
+
generatedBufferBatch,
|
|
1354
|
+
rowIndexBase = 0
|
|
1355
|
+
}: {
|
|
1356
|
+
glyphTable: ArrowTextGlyphTable;
|
|
1357
|
+
shaderLayout: ShaderLayout;
|
|
1358
|
+
generatedBufferBatch: GeneratedBufferBatch;
|
|
1359
|
+
rowIndexBase?: number;
|
|
1360
|
+
}
|
|
1361
|
+
): {
|
|
1362
|
+
buffer: Buffer;
|
|
1363
|
+
bufferLayout: BufferLayout;
|
|
1364
|
+
byteLength: number;
|
|
1365
|
+
} {
|
|
1366
|
+
const {glyphLayout} = glyphTable;
|
|
1367
|
+
const glyphClipRects = glyphTable.table.getChild(GLYPH_CLIP_RECTS_COLUMN) as Vector<
|
|
1368
|
+
FixedSizeList<Float32>
|
|
1369
|
+
> | null;
|
|
1370
|
+
const glyphClipRectValues = glyphClipRects
|
|
1371
|
+
? (getArrowVectorBufferSource(glyphClipRects) as Float32Array)
|
|
1372
|
+
: undefined;
|
|
1373
|
+
const byteStride = glyphClipRectValues
|
|
1374
|
+
? CLIPPED_EXPANDED_GLYPH_VERTEX_BYTE_STRIDE
|
|
1375
|
+
: EXPANDED_GLYPH_VERTEX_BYTE_STRIDE;
|
|
1376
|
+
const byteLength = generatedBufferBatch.byteLength;
|
|
1377
|
+
const arrayBuffer = new ArrayBuffer(Math.max(byteLength, byteStride));
|
|
1378
|
+
const int16Values = new Int16Array(arrayBuffer);
|
|
1379
|
+
const uint16Values = new Uint16Array(arrayBuffer);
|
|
1380
|
+
const uint32Values = new Uint32Array(arrayBuffer);
|
|
1381
|
+
const float32Values = new Float32Array(arrayBuffer);
|
|
1382
|
+
const rowIndices = makeGlyphRowIndices(glyphLayout.startIndices, rowIndexBase);
|
|
1383
|
+
|
|
1384
|
+
for (
|
|
1385
|
+
let glyphIndex = generatedBufferBatch.recordStart;
|
|
1386
|
+
glyphIndex < generatedBufferBatch.recordEnd;
|
|
1387
|
+
glyphIndex++
|
|
1388
|
+
) {
|
|
1389
|
+
const batchGlyphIndex = glyphIndex - generatedBufferBatch.recordStart;
|
|
1390
|
+
const recordInt16Index = (batchGlyphIndex * byteStride) / Int16Array.BYTES_PER_ELEMENT;
|
|
1391
|
+
const recordUint32Index = (batchGlyphIndex * byteStride) / Uint32Array.BYTES_PER_ELEMENT;
|
|
1392
|
+
const recordFloat32Index = (batchGlyphIndex * byteStride) / Float32Array.BYTES_PER_ELEMENT;
|
|
1393
|
+
const glyphOffsetIndex = glyphIndex * 2;
|
|
1394
|
+
const glyphFrameIndex = glyphIndex * 4;
|
|
1395
|
+
|
|
1396
|
+
int16Values[recordInt16Index] = glyphLayout.glyphOffsets[glyphOffsetIndex];
|
|
1397
|
+
int16Values[recordInt16Index + 1] = glyphLayout.glyphOffsets[glyphOffsetIndex + 1];
|
|
1398
|
+
uint16Values[recordInt16Index + 2] = glyphLayout.glyphFrames[glyphFrameIndex];
|
|
1399
|
+
uint16Values[recordInt16Index + 3] = glyphLayout.glyphFrames[glyphFrameIndex + 1];
|
|
1400
|
+
uint16Values[recordInt16Index + 4] = glyphLayout.glyphFrames[glyphFrameIndex + 2];
|
|
1401
|
+
uint16Values[recordInt16Index + 5] = glyphLayout.glyphFrames[glyphFrameIndex + 3];
|
|
1402
|
+
uint16Values[recordInt16Index + 6] = glyphLayout.glyphPages[glyphIndex];
|
|
1403
|
+
uint32Values[recordUint32Index + 4] = rowIndices[glyphIndex];
|
|
1404
|
+
|
|
1405
|
+
if (glyphClipRectValues) {
|
|
1406
|
+
const glyphClipRectIndex = glyphIndex * 4;
|
|
1407
|
+
float32Values[recordFloat32Index + 5] = glyphClipRectValues[glyphClipRectIndex];
|
|
1408
|
+
float32Values[recordFloat32Index + 6] = glyphClipRectValues[glyphClipRectIndex + 1];
|
|
1409
|
+
float32Values[recordFloat32Index + 7] = glyphClipRectValues[glyphClipRectIndex + 2];
|
|
1410
|
+
float32Values[recordFloat32Index + 8] = glyphClipRectValues[glyphClipRectIndex + 3];
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
const shaderAttributeNames = new Set(shaderLayout.attributes.map(attribute => attribute.name));
|
|
1415
|
+
const attributes: NonNullable<BufferLayout['attributes']> = [];
|
|
1416
|
+
if (shaderAttributeNames.has(GLYPH_OFFSETS_COLUMN)) {
|
|
1417
|
+
attributes.push({attribute: GLYPH_OFFSETS_COLUMN, format: 'sint16x2', byteOffset: 0});
|
|
1418
|
+
}
|
|
1419
|
+
if (shaderAttributeNames.has(GLYPH_FRAMES_COLUMN)) {
|
|
1420
|
+
attributes.push({
|
|
1421
|
+
attribute: GLYPH_FRAMES_COLUMN,
|
|
1422
|
+
format: 'uint16x4',
|
|
1423
|
+
byteOffset: Int16Array.BYTES_PER_ELEMENT * 2
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
if (shaderAttributeNames.has(GLYPH_PAGES_COLUMN)) {
|
|
1427
|
+
attributes.push({
|
|
1428
|
+
attribute: GLYPH_PAGES_COLUMN,
|
|
1429
|
+
format: 'uint16',
|
|
1430
|
+
byteOffset: Int16Array.BYTES_PER_ELEMENT * 6
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
if (shaderAttributeNames.has(ROW_INDICES_COLUMN)) {
|
|
1434
|
+
attributes.push({
|
|
1435
|
+
attribute: ROW_INDICES_COLUMN,
|
|
1436
|
+
format: 'uint32',
|
|
1437
|
+
byteOffset: Int16Array.BYTES_PER_ELEMENT * 8
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
if (glyphClipRectValues && shaderAttributeNames.has(GLYPH_CLIP_RECTS_COLUMN)) {
|
|
1441
|
+
attributes.push({
|
|
1442
|
+
attribute: GLYPH_CLIP_RECTS_COLUMN,
|
|
1443
|
+
format: 'float32x4',
|
|
1444
|
+
byteOffset: EXPANDED_GLYPH_VERTEX_BYTE_STRIDE
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
return {
|
|
1449
|
+
buffer: device.createBuffer({
|
|
1450
|
+
id:
|
|
1451
|
+
`${props.id || 'arrow-text-model'}-expanded-glyph-vertex-data-` +
|
|
1452
|
+
`${generatedBufferBatch.rowStart}`,
|
|
1453
|
+
usage: Buffer.VERTEX | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
1454
|
+
data: new Uint8Array(arrayBuffer)
|
|
1455
|
+
}),
|
|
1456
|
+
bufferLayout: {
|
|
1457
|
+
name: EXPANDED_GLYPH_VERTEX_DATA,
|
|
1458
|
+
stepMode: 'instance',
|
|
1459
|
+
byteStride,
|
|
1460
|
+
attributes
|
|
1461
|
+
},
|
|
1462
|
+
byteLength
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
/** Builds reusable WebGPU storage text expansion and row-binding state. */
|
|
1467
|
+
export function createArrowTextStorageState(
|
|
1468
|
+
device: Device,
|
|
1469
|
+
props: ArrowTextStorageInputProps
|
|
1470
|
+
): ArrowTextStorageState {
|
|
1471
|
+
if (device.type !== 'webgpu') {
|
|
1472
|
+
throw new Error('createArrowTextStorageState requires a WebGPU device');
|
|
1473
|
+
}
|
|
1474
|
+
if (!supportsGpuTextExpansion(device)) {
|
|
1475
|
+
throw new Error(
|
|
1476
|
+
'createArrowTextStorageState requires at least ' +
|
|
1477
|
+
`${GPU_TEXT_EXPANSION_STORAGE_BUFFER_COUNT} storage buffer bindings per shader stage`
|
|
1478
|
+
);
|
|
1479
|
+
}
|
|
1480
|
+
const textInputs = resolveArrowTextStorageInputs(props);
|
|
1481
|
+
const mappingState = resolveCharacterMapping(props);
|
|
1482
|
+
const {atlasTexture, ownsAtlasTexture} = getTextAtlasTexture(
|
|
1483
|
+
device,
|
|
1484
|
+
props,
|
|
1485
|
+
mappingState.fontAtlas
|
|
1486
|
+
);
|
|
1487
|
+
const useGpuUtf8Decode = Boolean(
|
|
1488
|
+
supportsGpuUtf8TextExpansion(device) &&
|
|
1489
|
+
mappingState.characterSet &&
|
|
1490
|
+
isArrowUtf8Vector(textInputs.texts)
|
|
1491
|
+
);
|
|
1492
|
+
const hasGlyphRowIndices = props.rowIndexColumn === true;
|
|
1493
|
+
const compactGlyphVertexByteStride = hasGlyphRowIndices
|
|
1494
|
+
? ROW_INDEXED_COMPACT_GLYPH_VERTEX_BYTE_STRIDE
|
|
1495
|
+
: COMPACT_GLYPH_VERTEX_BYTE_STRIDE;
|
|
1496
|
+
|
|
1497
|
+
let glyphStream: GpuExpandedTextStream | undefined;
|
|
1498
|
+
let glyphFrames: TextStorageGlyphFrameState | undefined;
|
|
1499
|
+
let utf8GlyphDefinitions: ReturnType<typeof buildTextGpuGlyphDefinitions> | undefined;
|
|
1500
|
+
let glyphCount = 0;
|
|
1501
|
+
let glyphAttributeBuildTimeMs = 0;
|
|
1502
|
+
let compactStreamByteLength = 0;
|
|
1503
|
+
let generatedRenderBufferByteLength = 0;
|
|
1504
|
+
let renderControlByteLength = 0;
|
|
1505
|
+
let rowStorageByteLength = 0;
|
|
1506
|
+
let glyphDefinitionStorageByteLength = 0;
|
|
1507
|
+
let transientComputeInputByteLength = 0;
|
|
1508
|
+
const ownedRowStorageResources: TextStorageOwnedResource[] = [];
|
|
1509
|
+
const ownedGlyphResources: TextStorageOwnedResource[] = [];
|
|
1510
|
+
const batches: TextStorageBatchState[] = [];
|
|
1511
|
+
const renderBatches: TextStorageRenderBatchState[] = [];
|
|
1512
|
+
const defaultBuffers = createTextStorageDefaultBuffers(device, props);
|
|
1513
|
+
ownedRowStorageResources.push(...defaultBuffers.ownedResources);
|
|
1514
|
+
rowStorageByteLength += defaultBuffers.byteLength;
|
|
1515
|
+
|
|
1516
|
+
if (useGpuUtf8Decode) {
|
|
1517
|
+
const glyphDefinitions = buildTextGpuGlyphDefinitions(mappingState.characterSet!, {
|
|
1518
|
+
fontAtlas: mappingState.fontAtlas,
|
|
1519
|
+
lineHeight: mappingState.lineHeight
|
|
1520
|
+
});
|
|
1521
|
+
utf8GlyphDefinitions = glyphDefinitions;
|
|
1522
|
+
glyphFrames = createTextStorageGlyphFrames(device, props, glyphDefinitions.glyphFrames);
|
|
1523
|
+
glyphDefinitionStorageByteLength = glyphFrames.byteLength;
|
|
1524
|
+
for (const [rowBindingBatchIndex, batchInput] of textInputs.batches.entries()) {
|
|
1525
|
+
const rowState = createTextStorageBatchRowState(
|
|
1526
|
+
device,
|
|
1527
|
+
props,
|
|
1528
|
+
batchInput,
|
|
1529
|
+
defaultBuffers,
|
|
1530
|
+
mappingState.fontRenderSettings
|
|
1531
|
+
);
|
|
1532
|
+
const utf8TextInput = buildGpuUtf8TextInput(batchInput.texts as Vector<Utf8>);
|
|
1533
|
+
const rowGlyphStarts = createStorageRowGlyphStartsBuffer(
|
|
1534
|
+
device,
|
|
1535
|
+
props,
|
|
1536
|
+
batchInput.batchRowIndexBase,
|
|
1537
|
+
utf8TextInput.startIndices
|
|
1538
|
+
);
|
|
1539
|
+
ownedGlyphResources.push(rowGlyphStarts.buffer);
|
|
1540
|
+
renderControlByteLength += rowGlyphStarts.byteLength;
|
|
1541
|
+
const glyphMetrics = createTextStorageGlyphMetrics(
|
|
1542
|
+
device,
|
|
1543
|
+
{id: props.id},
|
|
1544
|
+
glyphDefinitions.glyphMetrics
|
|
1545
|
+
);
|
|
1546
|
+
const glyphLookup = createTextStorageGlyphLookup(
|
|
1547
|
+
device,
|
|
1548
|
+
{id: props.id},
|
|
1549
|
+
glyphDefinitions.glyphLookup
|
|
1550
|
+
);
|
|
1551
|
+
const glyphPages = createTextStorageGlyphPages(
|
|
1552
|
+
device,
|
|
1553
|
+
{id: props.id},
|
|
1554
|
+
glyphDefinitions.glyphPages
|
|
1555
|
+
);
|
|
1556
|
+
const glyphKernings = createTextStorageGlyphKernings(
|
|
1557
|
+
device,
|
|
1558
|
+
{id: props.id},
|
|
1559
|
+
glyphDefinitions.glyphKernings
|
|
1560
|
+
);
|
|
1561
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
1562
|
+
device,
|
|
1563
|
+
recordOffsets: utf8TextInput.startIndices,
|
|
1564
|
+
recordByteStride: compactGlyphVertexByteStride,
|
|
1565
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
1566
|
+
resourceLabel: 'ArrowTextStorageModel UTF-8 generated glyph vertex data'
|
|
1567
|
+
});
|
|
1568
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
1569
|
+
const partitionedUtf8TextInput = createPartitionedGpuUtf8TextInput(
|
|
1570
|
+
utf8TextInput,
|
|
1571
|
+
generatedBufferBatch
|
|
1572
|
+
);
|
|
1573
|
+
const utf8Input = createGpuUtf8ExpandedInput(
|
|
1574
|
+
device,
|
|
1575
|
+
{id: props.id},
|
|
1576
|
+
{
|
|
1577
|
+
utf8TextInput: partitionedUtf8TextInput,
|
|
1578
|
+
baselineOffsetY: glyphDefinitions.baselineOffsetY,
|
|
1579
|
+
glyphLookupCount: glyphDefinitions.glyphLookup.length / 2,
|
|
1580
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
1581
|
+
batchRowIndexBase: generatedBufferBatch.rowStart,
|
|
1582
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase + generatedBufferBatch.rowStart,
|
|
1583
|
+
alignment: createGpuTextAlignmentOptions(props, rowState, mappingState.lineHeight)
|
|
1584
|
+
}
|
|
1585
|
+
);
|
|
1586
|
+
const generated = createGpuExpandedGeneratedState(
|
|
1587
|
+
device,
|
|
1588
|
+
{id: props.id},
|
|
1589
|
+
partitionedUtf8TextInput.byteLength,
|
|
1590
|
+
hasGlyphRowIndices
|
|
1591
|
+
);
|
|
1592
|
+
dispatchGpuUtf8ExpandedTextCompute(
|
|
1593
|
+
device,
|
|
1594
|
+
{id: props.id},
|
|
1595
|
+
{
|
|
1596
|
+
utf8Input,
|
|
1597
|
+
glyphLookup,
|
|
1598
|
+
glyphMetrics,
|
|
1599
|
+
glyphPages,
|
|
1600
|
+
glyphKernings,
|
|
1601
|
+
generated,
|
|
1602
|
+
outputSlotCount: partitionedUtf8TextInput.byteLength,
|
|
1603
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
1604
|
+
alignment: {
|
|
1605
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
1606
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(
|
|
1607
|
+
rowState.rowAlignmentBaselinesBuffer
|
|
1608
|
+
)
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
);
|
|
1612
|
+
const storageRenderConfigBuffer = createStorageRenderConfigBuffer(
|
|
1613
|
+
device,
|
|
1614
|
+
props,
|
|
1615
|
+
batchInput.batchRowIndexBase,
|
|
1616
|
+
generatedBufferBatch
|
|
1617
|
+
);
|
|
1618
|
+
renderBatches.push({
|
|
1619
|
+
rowBindingBatchIndex,
|
|
1620
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
1621
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
1622
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
1623
|
+
glyphCount: partitionedUtf8TextInput.byteLength,
|
|
1624
|
+
compactGlyphVertexData: generated.compactGlyphVertexData,
|
|
1625
|
+
storageRenderConfigBuffer
|
|
1626
|
+
});
|
|
1627
|
+
ownedGlyphResources.push(storageRenderConfigBuffer);
|
|
1628
|
+
renderControlByteLength += storageRenderConfigBuffer.byteLength;
|
|
1629
|
+
generatedRenderBufferByteLength += generated.byteLength;
|
|
1630
|
+
transientComputeInputByteLength += utf8Input.byteLength;
|
|
1631
|
+
utf8Input.rowByteRangesBuffer.destroy();
|
|
1632
|
+
utf8Input.utf8BytesBuffer.destroy();
|
|
1633
|
+
utf8Input.expansionConfigBuffer.destroy();
|
|
1634
|
+
}
|
|
1635
|
+
batches.push({
|
|
1636
|
+
...rowState,
|
|
1637
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
1638
|
+
rowCount: batchInput.texts.length,
|
|
1639
|
+
glyphCount: utf8TextInput.byteLength,
|
|
1640
|
+
rowGlyphStartsBuffer: rowGlyphStarts.buffer
|
|
1641
|
+
});
|
|
1642
|
+
glyphCount += utf8TextInput.byteLength;
|
|
1643
|
+
glyphAttributeBuildTimeMs += utf8TextInput.textInputBuildTimeMs;
|
|
1644
|
+
compactStreamByteLength += utf8TextInput.inputByteLength;
|
|
1645
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
1646
|
+
transientComputeInputByteLength +=
|
|
1647
|
+
glyphLookup.byteLength +
|
|
1648
|
+
glyphMetrics.byteLength +
|
|
1649
|
+
glyphPages.byteLength +
|
|
1650
|
+
glyphKernings.byteLength;
|
|
1651
|
+
ownedRowStorageResources.push(...rowState.ownedResources);
|
|
1652
|
+
glyphMetrics.buffer.destroy();
|
|
1653
|
+
glyphLookup.buffer.destroy();
|
|
1654
|
+
glyphPages.buffer.destroy();
|
|
1655
|
+
glyphKernings.buffer.destroy();
|
|
1656
|
+
}
|
|
1657
|
+
} else {
|
|
1658
|
+
for (const [batchIndex, batchInput] of textInputs.batches.entries()) {
|
|
1659
|
+
const rowState = createTextStorageBatchRowState(
|
|
1660
|
+
device,
|
|
1661
|
+
props,
|
|
1662
|
+
batchInput,
|
|
1663
|
+
defaultBuffers,
|
|
1664
|
+
mappingState.fontRenderSettings
|
|
1665
|
+
);
|
|
1666
|
+
const batchGlyphStream = buildGpuExpandedTextStream({
|
|
1667
|
+
texts: batchInput.texts,
|
|
1668
|
+
fontAtlas: mappingState.fontAtlas,
|
|
1669
|
+
lineHeight: mappingState.lineHeight,
|
|
1670
|
+
characterSet: mappingState.characterSet
|
|
1671
|
+
});
|
|
1672
|
+
const rowGlyphStarts = createStorageRowGlyphStartsBuffer(
|
|
1673
|
+
device,
|
|
1674
|
+
props,
|
|
1675
|
+
batchInput.batchRowIndexBase,
|
|
1676
|
+
batchGlyphStream.startIndices
|
|
1677
|
+
);
|
|
1678
|
+
ownedGlyphResources.push(rowGlyphStarts.buffer);
|
|
1679
|
+
renderControlByteLength += rowGlyphStarts.byteLength;
|
|
1680
|
+
glyphStream ??= batchGlyphStream;
|
|
1681
|
+
glyphFrames ??= createTextStorageGlyphFrames(device, props, batchGlyphStream.glyphFrames);
|
|
1682
|
+
if (batchIndex === 0) {
|
|
1683
|
+
glyphDefinitionStorageByteLength = glyphFrames.byteLength;
|
|
1684
|
+
}
|
|
1685
|
+
const glyphMetrics = createTextStorageGlyphMetrics(
|
|
1686
|
+
device,
|
|
1687
|
+
{id: props.id},
|
|
1688
|
+
batchGlyphStream.glyphMetrics
|
|
1689
|
+
);
|
|
1690
|
+
const glyphPages = createTextStorageGlyphPages(
|
|
1691
|
+
device,
|
|
1692
|
+
{id: props.id},
|
|
1693
|
+
batchGlyphStream.glyphPages
|
|
1694
|
+
);
|
|
1695
|
+
const glyphKernings = createTextStorageGlyphKernings(
|
|
1696
|
+
device,
|
|
1697
|
+
{id: props.id},
|
|
1698
|
+
batchGlyphStream.glyphKernings
|
|
1699
|
+
);
|
|
1700
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
1701
|
+
device,
|
|
1702
|
+
recordOffsets: batchGlyphStream.startIndices,
|
|
1703
|
+
recordByteStride: compactGlyphVertexByteStride,
|
|
1704
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
1705
|
+
resourceLabel: 'ArrowTextStorageModel compact generated glyph vertex data'
|
|
1706
|
+
});
|
|
1707
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
1708
|
+
const partitionedGlyphStream = createPartitionedGpuExpandedTextStream(
|
|
1709
|
+
batchGlyphStream,
|
|
1710
|
+
generatedBufferBatch
|
|
1711
|
+
);
|
|
1712
|
+
const compactInput = createGpuExpandedCompactInput(
|
|
1713
|
+
device,
|
|
1714
|
+
{id: props.id},
|
|
1715
|
+
partitionedGlyphStream,
|
|
1716
|
+
generatedBufferBatch.rowStart,
|
|
1717
|
+
createGpuTextAlignmentOptions(props, rowState, mappingState.lineHeight),
|
|
1718
|
+
batchInput.rowStorageIndexBase + generatedBufferBatch.rowStart
|
|
1719
|
+
);
|
|
1720
|
+
const generated = createGpuExpandedGeneratedState(
|
|
1721
|
+
device,
|
|
1722
|
+
{id: props.id},
|
|
1723
|
+
partitionedGlyphStream.glyphCount,
|
|
1724
|
+
hasGlyphRowIndices
|
|
1725
|
+
);
|
|
1726
|
+
dispatchGpuExpandedTextCompute(
|
|
1727
|
+
device,
|
|
1728
|
+
{id: props.id},
|
|
1729
|
+
{
|
|
1730
|
+
compactInput,
|
|
1731
|
+
glyphMetrics,
|
|
1732
|
+
glyphPages,
|
|
1733
|
+
glyphKernings,
|
|
1734
|
+
generated,
|
|
1735
|
+
glyphCount: partitionedGlyphStream.glyphCount,
|
|
1736
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
1737
|
+
alignment: {
|
|
1738
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
1739
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(
|
|
1740
|
+
rowState.rowAlignmentBaselinesBuffer
|
|
1741
|
+
),
|
|
1742
|
+
useRowTextAnchors: Boolean(props.textAnchors),
|
|
1743
|
+
useRowAlignmentBaselines: Boolean(props.alignmentBaselines)
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
);
|
|
1747
|
+
const storageRenderConfigBuffer = createStorageRenderConfigBuffer(
|
|
1748
|
+
device,
|
|
1749
|
+
props,
|
|
1750
|
+
batchInput.batchRowIndexBase,
|
|
1751
|
+
generatedBufferBatch
|
|
1752
|
+
);
|
|
1753
|
+
renderBatches.push({
|
|
1754
|
+
rowBindingBatchIndex: batchIndex,
|
|
1755
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
1756
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
1757
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
1758
|
+
glyphCount: partitionedGlyphStream.glyphCount,
|
|
1759
|
+
compactGlyphVertexData: generated.compactGlyphVertexData,
|
|
1760
|
+
storageRenderConfigBuffer
|
|
1761
|
+
});
|
|
1762
|
+
ownedGlyphResources.push(storageRenderConfigBuffer);
|
|
1763
|
+
renderControlByteLength += storageRenderConfigBuffer.byteLength;
|
|
1764
|
+
generatedRenderBufferByteLength += generated.byteLength;
|
|
1765
|
+
transientComputeInputByteLength += compactInput.byteLength;
|
|
1766
|
+
compactInput.glyphRangesBuffer.destroy();
|
|
1767
|
+
compactInput.glyphIdsBuffer.destroy();
|
|
1768
|
+
compactInput.expansionConfigBuffer.destroy();
|
|
1769
|
+
}
|
|
1770
|
+
batches.push({
|
|
1771
|
+
...rowState,
|
|
1772
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
1773
|
+
rowCount: batchInput.texts.length,
|
|
1774
|
+
glyphCount: batchGlyphStream.glyphCount,
|
|
1775
|
+
rowGlyphStartsBuffer: rowGlyphStarts.buffer
|
|
1776
|
+
});
|
|
1777
|
+
glyphCount += batchGlyphStream.glyphCount;
|
|
1778
|
+
glyphAttributeBuildTimeMs += batchGlyphStream.glyphStreamBuildTimeMs;
|
|
1779
|
+
compactStreamByteLength += batchGlyphStream.compactStreamByteLength;
|
|
1780
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
1781
|
+
transientComputeInputByteLength +=
|
|
1782
|
+
glyphMetrics.byteLength + glyphPages.byteLength + glyphKernings.byteLength;
|
|
1783
|
+
ownedRowStorageResources.push(...rowState.ownedResources);
|
|
1784
|
+
glyphMetrics.buffer.destroy();
|
|
1785
|
+
glyphPages.buffer.destroy();
|
|
1786
|
+
glyphKernings.buffer.destroy();
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
glyphFrames ??= createTextStorageGlyphFrames(device, props, new Float32Array(4));
|
|
1791
|
+
let destroyed = false;
|
|
1792
|
+
const storageState: ArrowTextStorageState = {
|
|
1793
|
+
glyphStream,
|
|
1794
|
+
atlasTexture,
|
|
1795
|
+
characterSet: mappingState.characterSet,
|
|
1796
|
+
glyphCount,
|
|
1797
|
+
glyphAttributeBuildTimeMs,
|
|
1798
|
+
glyphAttributeByteLength: generatedRenderBufferByteLength + renderControlByteLength,
|
|
1799
|
+
compactStreamBuildTimeMs: glyphAttributeBuildTimeMs,
|
|
1800
|
+
compactStreamByteLength,
|
|
1801
|
+
generatedRenderBufferByteLength,
|
|
1802
|
+
renderControlByteLength,
|
|
1803
|
+
rowStorageByteLength,
|
|
1804
|
+
glyphDefinitionStorageByteLength,
|
|
1805
|
+
transientComputeInputByteLength,
|
|
1806
|
+
hasGlyphRowIndices,
|
|
1807
|
+
fontRenderSettings: mappingState.fontRenderSettings,
|
|
1808
|
+
batches,
|
|
1809
|
+
renderBatches,
|
|
1810
|
+
ownedRowBindingResources: ownedRowStorageResources,
|
|
1811
|
+
ownedGlyphResources,
|
|
1812
|
+
glyphFramesBuffer: glyphFrames.buffer,
|
|
1813
|
+
arrowAppendContext: {
|
|
1814
|
+
defaultBuffers,
|
|
1815
|
+
mappingState,
|
|
1816
|
+
useGpuUtf8Decode,
|
|
1817
|
+
utf8GlyphDefinitions
|
|
1818
|
+
},
|
|
1819
|
+
destroy: () => {
|
|
1820
|
+
if (destroyed) {
|
|
1821
|
+
return;
|
|
1822
|
+
}
|
|
1823
|
+
destroyed = true;
|
|
1824
|
+
if (ownsAtlasTexture) {
|
|
1825
|
+
atlasTexture.destroy();
|
|
1826
|
+
}
|
|
1827
|
+
destroyTextStorageResources(ownedRowStorageResources);
|
|
1828
|
+
destroyTextStorageResources(ownedGlyphResources);
|
|
1829
|
+
glyphFrames.buffer.destroy();
|
|
1830
|
+
for (const renderBatch of renderBatches) {
|
|
1831
|
+
renderBatch.compactGlyphVertexData.destroy();
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
};
|
|
1835
|
+
return storageState;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
/** Builds reusable WebGPU storage text state directly from GPUVector inputs. */
|
|
1839
|
+
export function createTextStorageStateFromGPUVectors(
|
|
1840
|
+
device: Device,
|
|
1841
|
+
props: GPUVectorTextStorageInputProps
|
|
1842
|
+
): TextStorageState {
|
|
1843
|
+
if (device.type !== 'webgpu') {
|
|
1844
|
+
throw new Error('createTextStorageStateFromGPUVectors requires a WebGPU device');
|
|
1845
|
+
}
|
|
1846
|
+
if (!supportsGpuUtf8TextExpansion(device)) {
|
|
1847
|
+
throw new Error(
|
|
1848
|
+
'createTextStorageStateFromGPUVectors requires at least ' +
|
|
1849
|
+
`${GPU_UTF8_TEXT_EXPANSION_STORAGE_BUFFER_COUNT} storage buffer bindings per shader stage`
|
|
1850
|
+
);
|
|
1851
|
+
}
|
|
1852
|
+
const textInputs = resolveGPUVectorTextStorageInputs(device, props);
|
|
1853
|
+
const mappingState = resolveGPUVectorStorageCharacterMapping(props);
|
|
1854
|
+
const characterSet =
|
|
1855
|
+
mappingState.characterSet ?? new Set(Object.keys(mappingState.fontAtlas.mapping));
|
|
1856
|
+
const {atlasTexture, ownsAtlasTexture} = getTextAtlasTexture(
|
|
1857
|
+
device,
|
|
1858
|
+
props,
|
|
1859
|
+
mappingState.fontAtlas
|
|
1860
|
+
);
|
|
1861
|
+
const glyphDefinitions = buildTextGpuGlyphDefinitions(characterSet, {
|
|
1862
|
+
fontAtlas: mappingState.fontAtlas,
|
|
1863
|
+
lineHeight: mappingState.lineHeight
|
|
1864
|
+
});
|
|
1865
|
+
const glyphFrames = createTextStorageGlyphFrames(device, props, glyphDefinitions.glyphFrames);
|
|
1866
|
+
const hasGlyphRowIndices = props.rowIndexColumn === true;
|
|
1867
|
+
const compactGlyphVertexByteStride = hasGlyphRowIndices
|
|
1868
|
+
? ROW_INDEXED_COMPACT_GLYPH_VERTEX_BYTE_STRIDE
|
|
1869
|
+
: COMPACT_GLYPH_VERTEX_BYTE_STRIDE;
|
|
1870
|
+
|
|
1871
|
+
let glyphCount = 0;
|
|
1872
|
+
let compactStreamByteLength = 0;
|
|
1873
|
+
let generatedRenderBufferByteLength = 0;
|
|
1874
|
+
let renderControlByteLength = 0;
|
|
1875
|
+
let rowStorageByteLength = 0;
|
|
1876
|
+
let transientComputeInputByteLength = 0;
|
|
1877
|
+
const ownedRowStorageResources: TextStorageOwnedResource[] = [];
|
|
1878
|
+
const ownedGlyphResources: TextStorageOwnedResource[] = [];
|
|
1879
|
+
const batches: TextStorageBatchState[] = [];
|
|
1880
|
+
const renderBatches: TextStorageRenderBatchState[] = [];
|
|
1881
|
+
const defaultBuffers = createTextStorageDefaultBuffers(device, props);
|
|
1882
|
+
ownedRowStorageResources.push(...defaultBuffers.ownedResources);
|
|
1883
|
+
rowStorageByteLength += defaultBuffers.byteLength;
|
|
1884
|
+
|
|
1885
|
+
for (const [rowBindingBatchIndex, batchInput] of textInputs.batches.entries()) {
|
|
1886
|
+
const rowState = createTextStorageBatchRowState(
|
|
1887
|
+
device,
|
|
1888
|
+
props,
|
|
1889
|
+
batchInput,
|
|
1890
|
+
defaultBuffers,
|
|
1891
|
+
mappingState.fontRenderSettings
|
|
1892
|
+
);
|
|
1893
|
+
const rowGlyphStarts = createStorageRowGlyphStartsBuffer(
|
|
1894
|
+
device,
|
|
1895
|
+
props,
|
|
1896
|
+
batchInput.batchRowIndexBase,
|
|
1897
|
+
batchInput.startIndices
|
|
1898
|
+
);
|
|
1899
|
+
ownedGlyphResources.push(rowGlyphStarts.buffer);
|
|
1900
|
+
renderControlByteLength += rowGlyphStarts.byteLength;
|
|
1901
|
+
const glyphMetrics = createTextStorageGlyphMetrics(
|
|
1902
|
+
device,
|
|
1903
|
+
{id: props.id},
|
|
1904
|
+
glyphDefinitions.glyphMetrics
|
|
1905
|
+
);
|
|
1906
|
+
const glyphPages = createTextStorageGlyphPages(
|
|
1907
|
+
device,
|
|
1908
|
+
{id: props.id},
|
|
1909
|
+
glyphDefinitions.glyphPages
|
|
1910
|
+
);
|
|
1911
|
+
const glyphKernings = createTextStorageGlyphKernings(
|
|
1912
|
+
device,
|
|
1913
|
+
{id: props.id},
|
|
1914
|
+
glyphDefinitions.glyphKernings
|
|
1915
|
+
);
|
|
1916
|
+
const glyphLookup = createTextStorageGlyphLookup(
|
|
1917
|
+
device,
|
|
1918
|
+
{id: props.id},
|
|
1919
|
+
glyphDefinitions.glyphLookup
|
|
1920
|
+
);
|
|
1921
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
1922
|
+
device,
|
|
1923
|
+
recordOffsets: batchInput.startIndices,
|
|
1924
|
+
recordByteStride: compactGlyphVertexByteStride,
|
|
1925
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
1926
|
+
resourceLabel: 'TextStorageModel GPUVector UTF-8 generated glyph vertex data'
|
|
1927
|
+
});
|
|
1928
|
+
|
|
1929
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
1930
|
+
const partitionedInput = createPartitionedGpuVectorUtf8TextInput(
|
|
1931
|
+
device,
|
|
1932
|
+
props,
|
|
1933
|
+
batchInput,
|
|
1934
|
+
generatedBufferBatch
|
|
1935
|
+
);
|
|
1936
|
+
const utf8Input = createGpuUtf8ExpandedInputFromBuffers(
|
|
1937
|
+
device,
|
|
1938
|
+
{id: props.id},
|
|
1939
|
+
{
|
|
1940
|
+
rowByteRangesBuffer: partitionedInput.rowByteRangesBuffer,
|
|
1941
|
+
utf8BytesBuffer: getComputeTextStorageBuffer(batchInput.utf8BytesBuffer),
|
|
1942
|
+
inputByteLength: partitionedInput.inputByteLength,
|
|
1943
|
+
baselineOffsetY: glyphDefinitions.baselineOffsetY,
|
|
1944
|
+
glyphLookupCount: glyphDefinitions.glyphLookup.length / 2,
|
|
1945
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
1946
|
+
batchRowIndexBase: generatedBufferBatch.rowStart,
|
|
1947
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase + generatedBufferBatch.rowStart,
|
|
1948
|
+
outputByteBase: generatedBufferBatch.recordStart,
|
|
1949
|
+
alignment: createGpuTextAlignmentOptions(props, rowState, mappingState.lineHeight)
|
|
1950
|
+
}
|
|
1951
|
+
);
|
|
1952
|
+
const generated = createGpuExpandedGeneratedState(
|
|
1953
|
+
device,
|
|
1954
|
+
{id: props.id},
|
|
1955
|
+
generatedBufferBatch.recordCount,
|
|
1956
|
+
hasGlyphRowIndices
|
|
1957
|
+
);
|
|
1958
|
+
dispatchGpuUtf8ExpandedTextCompute(
|
|
1959
|
+
device,
|
|
1960
|
+
{id: props.id},
|
|
1961
|
+
{
|
|
1962
|
+
utf8Input,
|
|
1963
|
+
glyphLookup,
|
|
1964
|
+
glyphMetrics,
|
|
1965
|
+
glyphPages,
|
|
1966
|
+
glyphKernings,
|
|
1967
|
+
generated,
|
|
1968
|
+
outputSlotCount: generatedBufferBatch.recordCount,
|
|
1969
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
1970
|
+
alignment: {
|
|
1971
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
1972
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(
|
|
1973
|
+
rowState.rowAlignmentBaselinesBuffer
|
|
1974
|
+
)
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
);
|
|
1978
|
+
const storageRenderConfigBuffer = createStorageRenderConfigBuffer(
|
|
1979
|
+
device,
|
|
1980
|
+
props,
|
|
1981
|
+
batchInput.batchRowIndexBase,
|
|
1982
|
+
generatedBufferBatch
|
|
1983
|
+
);
|
|
1984
|
+
renderBatches.push({
|
|
1985
|
+
rowBindingBatchIndex,
|
|
1986
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
1987
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
1988
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
1989
|
+
glyphCount: generatedBufferBatch.recordCount,
|
|
1990
|
+
compactGlyphVertexData: generated.compactGlyphVertexData,
|
|
1991
|
+
storageRenderConfigBuffer
|
|
1992
|
+
});
|
|
1993
|
+
ownedGlyphResources.push(storageRenderConfigBuffer);
|
|
1994
|
+
renderControlByteLength += storageRenderConfigBuffer.byteLength;
|
|
1995
|
+
generatedRenderBufferByteLength += generated.byteLength;
|
|
1996
|
+
transientComputeInputByteLength += utf8Input.byteLength;
|
|
1997
|
+
utf8Input.expansionConfigBuffer.destroy();
|
|
1998
|
+
if (partitionedInput.ownsRowByteRangesBuffer) {
|
|
1999
|
+
partitionedInput.rowByteRangesBuffer.destroy();
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
batches.push({
|
|
2004
|
+
...rowState,
|
|
2005
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
2006
|
+
rowCount: batchInput.rowCount,
|
|
2007
|
+
glyphCount: batchInput.byteLength,
|
|
2008
|
+
rowGlyphStartsBuffer: rowGlyphStarts.buffer
|
|
2009
|
+
});
|
|
2010
|
+
glyphCount += batchInput.byteLength;
|
|
2011
|
+
compactStreamByteLength += batchInput.inputByteLength;
|
|
2012
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
2013
|
+
transientComputeInputByteLength +=
|
|
2014
|
+
glyphLookup.byteLength +
|
|
2015
|
+
glyphMetrics.byteLength +
|
|
2016
|
+
glyphPages.byteLength +
|
|
2017
|
+
glyphKernings.byteLength;
|
|
2018
|
+
ownedRowStorageResources.push(...rowState.ownedResources);
|
|
2019
|
+
glyphMetrics.buffer.destroy();
|
|
2020
|
+
glyphLookup.buffer.destroy();
|
|
2021
|
+
glyphPages.buffer.destroy();
|
|
2022
|
+
glyphKernings.buffer.destroy();
|
|
2023
|
+
if (batchInput.ownsRowByteRangesBuffer) {
|
|
2024
|
+
batchInput.rowByteRangesBuffer.destroy();
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
let destroyed = false;
|
|
2029
|
+
return {
|
|
2030
|
+
atlasTexture,
|
|
2031
|
+
characterSet,
|
|
2032
|
+
glyphCount,
|
|
2033
|
+
glyphAttributeBuildTimeMs: 0,
|
|
2034
|
+
glyphAttributeByteLength: generatedRenderBufferByteLength + renderControlByteLength,
|
|
2035
|
+
compactStreamBuildTimeMs: 0,
|
|
2036
|
+
compactStreamByteLength,
|
|
2037
|
+
generatedRenderBufferByteLength,
|
|
2038
|
+
renderControlByteLength,
|
|
2039
|
+
rowStorageByteLength,
|
|
2040
|
+
glyphDefinitionStorageByteLength: glyphFrames.byteLength,
|
|
2041
|
+
transientComputeInputByteLength,
|
|
2042
|
+
hasGlyphRowIndices,
|
|
2043
|
+
fontRenderSettings: mappingState.fontRenderSettings,
|
|
2044
|
+
glyphFramesBuffer: glyphFrames.buffer,
|
|
2045
|
+
batches,
|
|
2046
|
+
renderBatches,
|
|
2047
|
+
ownedRowBindingResources: ownedRowStorageResources,
|
|
2048
|
+
ownedGlyphResources,
|
|
2049
|
+
destroy: () => {
|
|
2050
|
+
if (destroyed) {
|
|
2051
|
+
return;
|
|
2052
|
+
}
|
|
2053
|
+
destroyed = true;
|
|
2054
|
+
if (ownsAtlasTexture) {
|
|
2055
|
+
atlasTexture.destroy();
|
|
2056
|
+
}
|
|
2057
|
+
destroyTextStorageResources(ownedRowStorageResources);
|
|
2058
|
+
destroyTextStorageResources(ownedGlyphResources);
|
|
2059
|
+
glyphFrames.buffer.destroy();
|
|
2060
|
+
for (const renderBatch of renderBatches) {
|
|
2061
|
+
renderBatch.compactGlyphVertexData.destroy();
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
/** Builds reusable WebGPU compressed dictionary text storage state. */
|
|
2068
|
+
export function createArrowTextDictionaryStorageState(
|
|
2069
|
+
device: Device,
|
|
2070
|
+
props: ArrowTextDictionaryStorageInputProps
|
|
2071
|
+
): TextDictionaryState {
|
|
2072
|
+
if (device.type !== 'webgpu') {
|
|
2073
|
+
throw new Error('createArrowTextDictionaryStorageState requires a WebGPU device');
|
|
2074
|
+
}
|
|
2075
|
+
const textInputs = resolveArrowTextDictionaryStorageInputs(props);
|
|
2076
|
+
const mappingState = resolveCharacterMapping(props);
|
|
2077
|
+
const {atlasTexture, ownsAtlasTexture} = getTextAtlasTexture(
|
|
2078
|
+
device,
|
|
2079
|
+
props,
|
|
2080
|
+
mappingState.fontAtlas
|
|
2081
|
+
);
|
|
2082
|
+
|
|
2083
|
+
let glyphStream: GpuTextDictionaryCompressedStream | undefined;
|
|
2084
|
+
let glyphCount = 0;
|
|
2085
|
+
let dictionaryGlyphCount = 0;
|
|
2086
|
+
let dictionaryValueCount = 0;
|
|
2087
|
+
let glyphAttributeBuildTimeMs = 0;
|
|
2088
|
+
let compactStreamByteLength = 0;
|
|
2089
|
+
let generatedRenderBufferByteLength = 0;
|
|
2090
|
+
let rowStorageByteLength = 0;
|
|
2091
|
+
let glyphDefinitionStorageByteLength = 0;
|
|
2092
|
+
const ownedRowStorageResources: TextStorageOwnedResource[] = [];
|
|
2093
|
+
const ownedDictionaryResources: TextStorageOwnedResource[] = [];
|
|
2094
|
+
const batches: TextDictionaryBatchState[] = [];
|
|
2095
|
+
const renderBatches: TextDictionaryRenderBatchState[] = [];
|
|
2096
|
+
const defaultBuffers = createTextStorageDefaultBuffers(device, props);
|
|
2097
|
+
ownedRowStorageResources.push(...defaultBuffers.ownedResources);
|
|
2098
|
+
rowStorageByteLength += defaultBuffers.byteLength;
|
|
2099
|
+
|
|
2100
|
+
for (const [rowBindingBatchIndex, batchInput] of textInputs.batches.entries()) {
|
|
2101
|
+
// Row/style buffers stay row-aligned and are shared with the storage text path.
|
|
2102
|
+
// The dictionary-specific buffers below only describe text content.
|
|
2103
|
+
const rowState = createTextStorageBatchRowState(
|
|
2104
|
+
device,
|
|
2105
|
+
props,
|
|
2106
|
+
batchInput,
|
|
2107
|
+
defaultBuffers,
|
|
2108
|
+
mappingState.fontRenderSettings
|
|
2109
|
+
);
|
|
2110
|
+
const batchGlyphStream = buildGpuTextDictionaryCompressedStream({
|
|
2111
|
+
texts: batchInput.texts as Vector<ArrowUtf8Dictionary>,
|
|
2112
|
+
fontAtlas: mappingState.fontAtlas,
|
|
2113
|
+
lineHeight: mappingState.lineHeight,
|
|
2114
|
+
characterSet: mappingState.characterSet
|
|
2115
|
+
});
|
|
2116
|
+
// One record per row plus a terminal sentinel lets the shader recover the
|
|
2117
|
+
// row for an instance_index by binary-searching visible glyph starts.
|
|
2118
|
+
const rowDictionaryRecords = createTextDictionaryRowRecords(batchGlyphStream);
|
|
2119
|
+
const rowDictionaryRecordsBuffer = createTextDictionaryStorageBuffer(
|
|
2120
|
+
device,
|
|
2121
|
+
props,
|
|
2122
|
+
`row-dictionary-records-${batchInput.batchRowIndexBase}`,
|
|
2123
|
+
rowDictionaryRecords,
|
|
2124
|
+
new Uint32Array(2)
|
|
2125
|
+
);
|
|
2126
|
+
// One range per unique dictionary value. Repeated rows reference these
|
|
2127
|
+
// ranges instead of storing their own glyph ids and layout offsets.
|
|
2128
|
+
const dictionaryGlyphRangesBuffer = createTextDictionaryStorageBuffer(
|
|
2129
|
+
device,
|
|
2130
|
+
props,
|
|
2131
|
+
`dictionary-glyph-ranges-${batchInput.batchRowIndexBase}`,
|
|
2132
|
+
batchGlyphStream.dictionaryGlyphRanges,
|
|
2133
|
+
new Uint32Array(2)
|
|
2134
|
+
);
|
|
2135
|
+
// Shared glyph layout records for dictionary strings in this Arrow batch.
|
|
2136
|
+
// This is the main compressed payload and scales with unique dictionary text.
|
|
2137
|
+
const dictionaryGlyphRecordsBuffer = createTextDictionaryStorageBuffer(
|
|
2138
|
+
device,
|
|
2139
|
+
props,
|
|
2140
|
+
`dictionary-glyph-records-${batchInput.batchRowIndexBase}`,
|
|
2141
|
+
batchGlyphStream.dictionaryGlyphRecords,
|
|
2142
|
+
new Uint32Array(2)
|
|
2143
|
+
);
|
|
2144
|
+
const glyphFrames = createTextStorageGlyphFrames(device, props, batchGlyphStream.glyphFrames);
|
|
2145
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
2146
|
+
device,
|
|
2147
|
+
recordOffsets: batchGlyphStream.startIndices,
|
|
2148
|
+
// The dictionary model does not allocate a generated vertex buffer; the
|
|
2149
|
+
// planner is used only to split draw instance counts by device limits.
|
|
2150
|
+
recordByteStride: 1,
|
|
2151
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
2152
|
+
resourceLabel: 'ArrowTextDictionaryStorageModel glyph instances'
|
|
2153
|
+
});
|
|
2154
|
+
|
|
2155
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
2156
|
+
const dictionaryRenderConfigBuffer = createTextDictionaryRenderConfigBuffer(
|
|
2157
|
+
device,
|
|
2158
|
+
props,
|
|
2159
|
+
batchInput.batchRowIndexBase,
|
|
2160
|
+
generatedBufferBatch
|
|
2161
|
+
);
|
|
2162
|
+
renderBatches.push({
|
|
2163
|
+
rowBindingBatchIndex,
|
|
2164
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
2165
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
2166
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
2167
|
+
glyphCount: generatedBufferBatch.recordCount,
|
|
2168
|
+
dictionaryRenderConfigBuffer
|
|
2169
|
+
});
|
|
2170
|
+
ownedDictionaryResources.push(dictionaryRenderConfigBuffer);
|
|
2171
|
+
compactStreamByteLength += dictionaryRenderConfigBuffer.byteLength;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
batches.push({
|
|
2175
|
+
...rowState,
|
|
2176
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
2177
|
+
rowCount: batchInput.texts.length,
|
|
2178
|
+
glyphCount: batchGlyphStream.glyphCount,
|
|
2179
|
+
rowDictionaryRecordsBuffer,
|
|
2180
|
+
dictionaryGlyphRangesBuffer,
|
|
2181
|
+
dictionaryGlyphRecordsBuffer,
|
|
2182
|
+
glyphFramesBuffer: glyphFrames.buffer,
|
|
2183
|
+
dictionaryGlyphCount: batchGlyphStream.dictionaryGlyphCount,
|
|
2184
|
+
dictionaryValueCount: batchGlyphStream.dictionaryValueCount
|
|
2185
|
+
});
|
|
2186
|
+
glyphStream ??= batchGlyphStream;
|
|
2187
|
+
glyphCount += batchGlyphStream.glyphCount;
|
|
2188
|
+
dictionaryGlyphCount += batchGlyphStream.dictionaryGlyphCount;
|
|
2189
|
+
dictionaryValueCount += batchGlyphStream.dictionaryValueCount;
|
|
2190
|
+
glyphAttributeBuildTimeMs += batchGlyphStream.glyphStreamBuildTimeMs;
|
|
2191
|
+
compactStreamByteLength +=
|
|
2192
|
+
rowDictionaryRecords.byteLength +
|
|
2193
|
+
batchGlyphStream.dictionaryGlyphRanges.byteLength +
|
|
2194
|
+
batchGlyphStream.dictionaryGlyphRecords.byteLength;
|
|
2195
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
2196
|
+
glyphDefinitionStorageByteLength += glyphFrames.byteLength;
|
|
2197
|
+
ownedRowStorageResources.push(...rowState.ownedResources);
|
|
2198
|
+
ownedDictionaryResources.push(
|
|
2199
|
+
rowDictionaryRecordsBuffer,
|
|
2200
|
+
dictionaryGlyphRangesBuffer,
|
|
2201
|
+
dictionaryGlyphRecordsBuffer,
|
|
2202
|
+
glyphFrames.buffer
|
|
2203
|
+
);
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
let destroyed = false;
|
|
2207
|
+
const storageState: TextDictionaryState = {
|
|
2208
|
+
glyphStream,
|
|
2209
|
+
atlasTexture,
|
|
2210
|
+
characterSet: mappingState.characterSet,
|
|
2211
|
+
glyphCount,
|
|
2212
|
+
dictionaryGlyphCount,
|
|
2213
|
+
dictionaryValueCount,
|
|
2214
|
+
glyphAttributeBuildTimeMs,
|
|
2215
|
+
glyphAttributeByteLength: generatedRenderBufferByteLength,
|
|
2216
|
+
compactStreamBuildTimeMs: glyphAttributeBuildTimeMs,
|
|
2217
|
+
compactStreamByteLength,
|
|
2218
|
+
generatedRenderBufferByteLength,
|
|
2219
|
+
rowStorageByteLength,
|
|
2220
|
+
glyphDefinitionStorageByteLength,
|
|
2221
|
+
transientComputeInputByteLength: 0,
|
|
2222
|
+
fontRenderSettings: mappingState.fontRenderSettings,
|
|
2223
|
+
batches,
|
|
2224
|
+
renderBatches,
|
|
2225
|
+
ownedRowBindingResources: ownedRowStorageResources,
|
|
2226
|
+
ownedDictionaryResources,
|
|
2227
|
+
destroy: () => {
|
|
2228
|
+
if (destroyed) {
|
|
2229
|
+
return;
|
|
2230
|
+
}
|
|
2231
|
+
destroyed = true;
|
|
2232
|
+
if (ownsAtlasTexture) {
|
|
2233
|
+
atlasTexture.destroy();
|
|
2234
|
+
}
|
|
2235
|
+
destroyTextStorageResources(ownedRowStorageResources);
|
|
2236
|
+
destroyTextStorageResources(ownedDictionaryResources);
|
|
2237
|
+
}
|
|
2238
|
+
};
|
|
2239
|
+
return storageState;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
function createTextDictionaryRenderConfigBuffer(
|
|
2243
|
+
device: Device,
|
|
2244
|
+
props: ArrowTextDictionaryStorageInputProps,
|
|
2245
|
+
batchRowIndexBase: number,
|
|
2246
|
+
generatedBufferBatch: GeneratedBufferBatch
|
|
2247
|
+
): DynamicBuffer {
|
|
2248
|
+
// The render config is the only per-render-batch dictionary allocation. It
|
|
2249
|
+
// tells WGSL which visible-glyph instance range and row range this draw owns.
|
|
2250
|
+
const data = new Uint32Array(
|
|
2251
|
+
TEXT_DICTIONARY_RENDER_CONFIG_BYTE_LENGTH / Uint32Array.BYTES_PER_ELEMENT
|
|
2252
|
+
);
|
|
2253
|
+
data[0] = generatedBufferBatch.recordStart;
|
|
2254
|
+
data[1] = generatedBufferBatch.rowStart;
|
|
2255
|
+
data[2] = generatedBufferBatch.rowEnd;
|
|
2256
|
+
data[3] = 0;
|
|
2257
|
+
return new DynamicBuffer(device, {
|
|
2258
|
+
id:
|
|
2259
|
+
`${props.id || 'arrow-text-dictionary-storage-model'}-render-config-` +
|
|
2260
|
+
`${batchRowIndexBase}-${generatedBufferBatch.rowStart}`,
|
|
2261
|
+
usage: Buffer.UNIFORM | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
2262
|
+
data
|
|
2263
|
+
});
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
function createStorageRenderConfigBuffer(
|
|
2267
|
+
device: Device,
|
|
2268
|
+
props: AnyTextStorageInputProps,
|
|
2269
|
+
batchRowIndexBase: number,
|
|
2270
|
+
generatedBufferBatch: GeneratedBufferBatch
|
|
2271
|
+
): DynamicBuffer {
|
|
2272
|
+
const data = new Uint32Array(STORAGE_RENDER_CONFIG_BYTE_LENGTH / Uint32Array.BYTES_PER_ELEMENT);
|
|
2273
|
+
data[0] = generatedBufferBatch.recordStart;
|
|
2274
|
+
data[1] = generatedBufferBatch.rowStart;
|
|
2275
|
+
data[2] = generatedBufferBatch.rowEnd;
|
|
2276
|
+
data[3] = 0;
|
|
2277
|
+
return new DynamicBuffer(device, {
|
|
2278
|
+
id:
|
|
2279
|
+
`${props.id || 'arrow-text-storage-model'}-render-config-` +
|
|
2280
|
+
`${batchRowIndexBase}-${generatedBufferBatch.rowStart}`,
|
|
2281
|
+
usage: Buffer.UNIFORM | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
2282
|
+
data
|
|
2283
|
+
});
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
function createStorageRowGlyphStartsBuffer(
|
|
2287
|
+
device: Device,
|
|
2288
|
+
props: AnyTextStorageInputProps,
|
|
2289
|
+
batchRowIndexBase: number,
|
|
2290
|
+
startIndices: readonly number[]
|
|
2291
|
+
): {buffer: Buffer; byteLength: number} {
|
|
2292
|
+
const rowGlyphStarts = new Uint32Array(startIndices);
|
|
2293
|
+
return {
|
|
2294
|
+
buffer: device.createBuffer({
|
|
2295
|
+
id: `${props.id || 'arrow-text-storage-model'}-row-glyph-starts-${batchRowIndexBase}`,
|
|
2296
|
+
usage: Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
2297
|
+
data: rowGlyphStarts.byteLength > 0 ? rowGlyphStarts : new Uint32Array(1)
|
|
2298
|
+
}),
|
|
2299
|
+
byteLength: rowGlyphStarts.byteLength
|
|
2300
|
+
};
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
function createTextDictionaryRowRecords(
|
|
2304
|
+
glyphStream: GpuTextDictionaryCompressedStream
|
|
2305
|
+
): Uint32Array {
|
|
2306
|
+
const rowCount = glyphStream.rowDictionaryIndices.length;
|
|
2307
|
+
const records = new Uint32Array((rowCount + 1) * 2);
|
|
2308
|
+
// Pair each row's dictionary key with the first visible glyph occurrence for
|
|
2309
|
+
// that row. The final sentinel makes row-end lookup a single indexed read.
|
|
2310
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
2311
|
+
records[rowIndex * 2] = glyphStream.rowDictionaryIndices[rowIndex] ?? INVALID_DICTIONARY_INDEX;
|
|
2312
|
+
records[rowIndex * 2 + 1] = glyphStream.rowGlyphRanges[rowIndex * 2] ?? 0;
|
|
2313
|
+
}
|
|
2314
|
+
records[rowCount * 2] = INVALID_DICTIONARY_INDEX;
|
|
2315
|
+
records[rowCount * 2 + 1] = glyphStream.glyphCount;
|
|
2316
|
+
return records;
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
function getNow(): number {
|
|
2320
|
+
return globalThis.performance?.now() ?? Date.now();
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
function resolveCharacterMapping(
|
|
2324
|
+
props: ArrowTextModelProps | AnyTextStorageInputProps
|
|
2325
|
+
): ResolvedCharacterMapping {
|
|
2326
|
+
return resolveFontAtlasMapping(props.fontAtlas, props.lineHeight ?? 1);
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
function resolveGPUVectorStorageCharacterMapping(
|
|
2330
|
+
props: GPUVectorTextStorageInputProps
|
|
2331
|
+
): ResolvedCharacterMapping {
|
|
2332
|
+
return resolveFontAtlasMapping(props.fontAtlas, props.lineHeight ?? 1);
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
function resolveFontAtlasMapping(
|
|
2336
|
+
fontAtlas: FontAtlas,
|
|
2337
|
+
lineHeightMultiplier: number
|
|
2338
|
+
): ResolvedCharacterMapping {
|
|
2339
|
+
return {
|
|
2340
|
+
lineHeight: lineHeightMultiplier * fontAtlas.lineHeight,
|
|
2341
|
+
characterSet: new Set(Object.keys(fontAtlas.mapping)),
|
|
2342
|
+
fontAtlas,
|
|
2343
|
+
fontRenderSettings: fontAtlas.renderSettings
|
|
2344
|
+
};
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
function assertColumnAvailable(table: Table, columnName: string): void {
|
|
2348
|
+
if (table.getChild(columnName)) {
|
|
2349
|
+
throw new Error(`ArrowTextModel labelTable column "${columnName}" is reserved`);
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
function assertClipRects(
|
|
2354
|
+
clipRects: Vector<FixedSizeList<Float32>> | undefined,
|
|
2355
|
+
labelCount: number
|
|
2356
|
+
): void {
|
|
2357
|
+
if (!clipRects) {
|
|
2358
|
+
return;
|
|
2359
|
+
}
|
|
2360
|
+
if (clipRects.length !== labelCount) {
|
|
2361
|
+
throw new Error('ArrowTextModel clipRects rows must match UTF-8 text rows');
|
|
2362
|
+
}
|
|
2363
|
+
if (
|
|
2364
|
+
!DataType.isFixedSizeList(clipRects.type) ||
|
|
2365
|
+
clipRects.type.listSize !== 4 ||
|
|
2366
|
+
!(clipRects.type.children[0]?.type instanceof Float32)
|
|
2367
|
+
) {
|
|
2368
|
+
throw new Error('ArrowTextModel clipRects must be FixedSizeList<Float32>[4]');
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
type TextStorageDefaultBuffers = {
|
|
2373
|
+
colorsBuffer: Buffer;
|
|
2374
|
+
anglesBuffer: Buffer;
|
|
2375
|
+
sizesBuffer: Buffer;
|
|
2376
|
+
pixelOffsetsBuffer: Buffer;
|
|
2377
|
+
textAnchorsBuffer: Buffer;
|
|
2378
|
+
alignmentBaselinesBuffer: Buffer;
|
|
2379
|
+
clipRectsBuffer: Buffer;
|
|
2380
|
+
byteLength: number;
|
|
2381
|
+
ownedResources: TextStorageOwnedResource[];
|
|
2382
|
+
};
|
|
2383
|
+
|
|
2384
|
+
type TextStorageBatchRowState = {
|
|
2385
|
+
rowStorageIndexBase: number;
|
|
2386
|
+
rowPositionsBuffer: TextStorageBuffer;
|
|
2387
|
+
rowColorsBuffer: TextStorageBuffer;
|
|
2388
|
+
rowAnglesBuffer: TextStorageBuffer;
|
|
2389
|
+
rowSizesBuffer: TextStorageBuffer;
|
|
2390
|
+
rowPixelOffsetsBuffer: TextStorageBuffer;
|
|
2391
|
+
rowTextAnchorsBuffer: TextStorageBuffer;
|
|
2392
|
+
rowAlignmentBaselinesBuffer: TextStorageBuffer;
|
|
2393
|
+
rowClipRectsBuffer: Buffer;
|
|
2394
|
+
styleConfigBuffer: DynamicBuffer;
|
|
2395
|
+
ownedResources: TextStorageOwnedResource[];
|
|
2396
|
+
ownedByteLength: number;
|
|
2397
|
+
};
|
|
2398
|
+
|
|
2399
|
+
type TextStorageGlyphFrameState = {
|
|
2400
|
+
buffer: Buffer;
|
|
2401
|
+
byteLength: number;
|
|
2402
|
+
};
|
|
2403
|
+
|
|
2404
|
+
type ArrowTextStorageAppendContext = {
|
|
2405
|
+
defaultBuffers: TextStorageDefaultBuffers;
|
|
2406
|
+
mappingState: ResolvedCharacterMapping;
|
|
2407
|
+
useGpuUtf8Decode: boolean;
|
|
2408
|
+
utf8GlyphDefinitions?: ReturnType<typeof buildTextGpuGlyphDefinitions>;
|
|
2409
|
+
};
|
|
2410
|
+
|
|
2411
|
+
function createTextStorageDefaultBuffers(
|
|
2412
|
+
device: Device,
|
|
2413
|
+
props: AnyTextStorageInputProps
|
|
2414
|
+
): TextStorageDefaultBuffers {
|
|
2415
|
+
const id = props.id || 'text-storage-model';
|
|
2416
|
+
const colorsVector = createTextStorageOwnedGpuVector(
|
|
2417
|
+
device,
|
|
2418
|
+
`${id}-default-row-colors`,
|
|
2419
|
+
makeArrowFixedSizeListVector(
|
|
2420
|
+
new Uint8(),
|
|
2421
|
+
4,
|
|
2422
|
+
new Uint8Array(props.color ?? DEFAULT_TEXT_STORAGE_COLOR)
|
|
2423
|
+
)
|
|
2424
|
+
);
|
|
2425
|
+
const anglesVector = createTextStorageOwnedGpuVector(
|
|
2426
|
+
device,
|
|
2427
|
+
`${id}-default-row-angles`,
|
|
2428
|
+
makeNumericArrowVector(
|
|
2429
|
+
new Float32(),
|
|
2430
|
+
new Float32Array([props.angle ?? DEFAULT_TEXT_STORAGE_ANGLE])
|
|
2431
|
+
)
|
|
2432
|
+
);
|
|
2433
|
+
const sizesVector = createTextStorageOwnedGpuVector(
|
|
2434
|
+
device,
|
|
2435
|
+
`${id}-default-row-sizes`,
|
|
2436
|
+
makeNumericArrowVector(
|
|
2437
|
+
new Float32(),
|
|
2438
|
+
new Float32Array([props.size ?? DEFAULT_TEXT_STORAGE_SIZE])
|
|
2439
|
+
)
|
|
2440
|
+
);
|
|
2441
|
+
const pixelOffsetsVector = createTextStorageOwnedGpuVector(
|
|
2442
|
+
device,
|
|
2443
|
+
`${id}-default-row-pixel-offsets`,
|
|
2444
|
+
makeArrowFixedSizeListVector(
|
|
2445
|
+
new Float32(),
|
|
2446
|
+
2,
|
|
2447
|
+
new Float32Array(props.pixelOffset ?? DEFAULT_TEXT_STORAGE_PIXEL_OFFSET)
|
|
2448
|
+
)
|
|
2449
|
+
);
|
|
2450
|
+
const textAnchorsVector = createTextStorageOwnedGpuVector(
|
|
2451
|
+
device,
|
|
2452
|
+
`${id}-default-row-text-anchors`,
|
|
2453
|
+
makeNumericArrowVector(new Uint32(), new Uint32Array([getTextAnchorEnum(props.textAnchor)]))
|
|
2454
|
+
);
|
|
2455
|
+
const alignmentBaselinesVector = createTextStorageOwnedGpuVector(
|
|
2456
|
+
device,
|
|
2457
|
+
`${id}-default-row-alignment-baselines`,
|
|
2458
|
+
makeNumericArrowVector(
|
|
2459
|
+
new Uint32(),
|
|
2460
|
+
new Uint32Array([getAlignmentBaselineEnum(props.alignmentBaseline)])
|
|
2461
|
+
)
|
|
2462
|
+
);
|
|
2463
|
+
const clipRectsVector = createTextStorageOwnedGpuVector(
|
|
2464
|
+
device,
|
|
2465
|
+
`${id}-default-row-clip-rects`,
|
|
2466
|
+
makeArrowFixedSizeListVector(new Float32(), 4, new Float32Array([0, 0, -1, -1]))
|
|
2467
|
+
);
|
|
2468
|
+
return {
|
|
2469
|
+
colorsBuffer: getTextStorageGpuVectorBuffer(colorsVector),
|
|
2470
|
+
anglesBuffer: getTextStorageGpuVectorBuffer(anglesVector),
|
|
2471
|
+
sizesBuffer: getTextStorageGpuVectorBuffer(sizesVector),
|
|
2472
|
+
pixelOffsetsBuffer: getTextStorageGpuVectorBuffer(pixelOffsetsVector),
|
|
2473
|
+
textAnchorsBuffer: getTextStorageGpuVectorBuffer(textAnchorsVector),
|
|
2474
|
+
alignmentBaselinesBuffer: getTextStorageGpuVectorBuffer(alignmentBaselinesVector),
|
|
2475
|
+
clipRectsBuffer: getTextStorageGpuVectorBuffer(clipRectsVector),
|
|
2476
|
+
byteLength:
|
|
2477
|
+
Uint8Array.BYTES_PER_ELEMENT * 4 +
|
|
2478
|
+
Float32Array.BYTES_PER_ELEMENT +
|
|
2479
|
+
Float32Array.BYTES_PER_ELEMENT +
|
|
2480
|
+
Float32Array.BYTES_PER_ELEMENT * 2 +
|
|
2481
|
+
Uint32Array.BYTES_PER_ELEMENT +
|
|
2482
|
+
Uint32Array.BYTES_PER_ELEMENT +
|
|
2483
|
+
Float32Array.BYTES_PER_ELEMENT * 4,
|
|
2484
|
+
ownedResources: [
|
|
2485
|
+
colorsVector,
|
|
2486
|
+
anglesVector,
|
|
2487
|
+
sizesVector,
|
|
2488
|
+
pixelOffsetsVector,
|
|
2489
|
+
textAnchorsVector,
|
|
2490
|
+
alignmentBaselinesVector,
|
|
2491
|
+
clipRectsVector
|
|
2492
|
+
]
|
|
2493
|
+
};
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2496
|
+
function createTextStorageBatchRowState(
|
|
2497
|
+
device: Device,
|
|
2498
|
+
props: AnyTextStorageInputProps,
|
|
2499
|
+
batchInput: ResolvedTextStorageBatchRowInputs,
|
|
2500
|
+
defaultBuffers: TextStorageDefaultBuffers,
|
|
2501
|
+
fontRenderSettings: FontAtlasRenderSettings
|
|
2502
|
+
): TextStorageBatchRowState {
|
|
2503
|
+
const packedClipRects = batchInput.clipRects
|
|
2504
|
+
? packTextStorageClipRects(batchInput.clipRects)
|
|
2505
|
+
: undefined;
|
|
2506
|
+
const rowClipRectsVector = packedClipRects
|
|
2507
|
+
? createTextStorageOwnedGpuVector(
|
|
2508
|
+
device,
|
|
2509
|
+
`${props.id || 'text-storage-model'}-row-clip-rects-${batchInput.batchRowIndexBase}`,
|
|
2510
|
+
makeArrowFixedSizeListVector(
|
|
2511
|
+
new Float32(),
|
|
2512
|
+
4,
|
|
2513
|
+
packedClipRects.byteLength > 0 ? packedClipRects : new Float32Array(4)
|
|
2514
|
+
)
|
|
2515
|
+
)
|
|
2516
|
+
: undefined;
|
|
2517
|
+
const rowClipRectsBuffer = rowClipRectsVector
|
|
2518
|
+
? getTextStorageGpuVectorBuffer(rowClipRectsVector)
|
|
2519
|
+
: batchInput.clipRectsBuffer
|
|
2520
|
+
? getComputeTextStorageBuffer(batchInput.clipRectsBuffer)
|
|
2521
|
+
: defaultBuffers.clipRectsBuffer;
|
|
2522
|
+
const styleConfigData = createTextStorageStyleConfigData(
|
|
2523
|
+
props,
|
|
2524
|
+
batchInput.batchRowIndexBase,
|
|
2525
|
+
batchInput.rowStorageIndexBase,
|
|
2526
|
+
fontRenderSettings
|
|
2527
|
+
);
|
|
2528
|
+
const styleConfigBuffer = new DynamicBuffer(device, {
|
|
2529
|
+
id: `${props.id || 'text-storage-model'}-style-config-${batchInput.batchRowIndexBase}`,
|
|
2530
|
+
usage: Buffer.UNIFORM | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
2531
|
+
data: styleConfigData
|
|
2532
|
+
});
|
|
2533
|
+
const ownedResources = [styleConfigBuffer, ...(rowClipRectsVector ? [rowClipRectsVector] : [])];
|
|
2534
|
+
|
|
2535
|
+
return {
|
|
2536
|
+
rowPositionsBuffer: batchInput.positionsBuffer,
|
|
2537
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase,
|
|
2538
|
+
rowColorsBuffer: batchInput.colorsBuffer ?? defaultBuffers.colorsBuffer,
|
|
2539
|
+
rowAnglesBuffer: batchInput.anglesBuffer ?? defaultBuffers.anglesBuffer,
|
|
2540
|
+
rowSizesBuffer: batchInput.sizesBuffer ?? defaultBuffers.sizesBuffer,
|
|
2541
|
+
rowPixelOffsetsBuffer: batchInput.pixelOffsetsBuffer ?? defaultBuffers.pixelOffsetsBuffer,
|
|
2542
|
+
rowTextAnchorsBuffer: batchInput.textAnchorsBuffer ?? defaultBuffers.textAnchorsBuffer,
|
|
2543
|
+
rowAlignmentBaselinesBuffer:
|
|
2544
|
+
batchInput.alignmentBaselinesBuffer ?? defaultBuffers.alignmentBaselinesBuffer,
|
|
2545
|
+
rowClipRectsBuffer,
|
|
2546
|
+
styleConfigBuffer,
|
|
2547
|
+
ownedResources,
|
|
2548
|
+
ownedByteLength: styleConfigData.byteLength + (packedClipRects?.byteLength ?? 0)
|
|
2549
|
+
};
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
function createTextStorageOwnedGpuVector<T extends DataType>(
|
|
2553
|
+
device: Device,
|
|
2554
|
+
name: string,
|
|
2555
|
+
vector: Vector<T>
|
|
2556
|
+
): GPUVector {
|
|
2557
|
+
return makeGPUVectorFromArrow(device, vector, {
|
|
2558
|
+
name,
|
|
2559
|
+
id: name,
|
|
2560
|
+
usage: Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC
|
|
2561
|
+
});
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
function getTextStorageGpuVectorBuffer(vector: GPUVector): Buffer {
|
|
2565
|
+
const [data, ...remainingData] = vector.data;
|
|
2566
|
+
if (!data || remainingData.length > 0) {
|
|
2567
|
+
throw new Error(`Storage text vector "${vector.name}" requires exactly one GPUData chunk`);
|
|
2568
|
+
}
|
|
2569
|
+
const buffer = data.buffer;
|
|
2570
|
+
return buffer instanceof DynamicBuffer ? buffer.buffer : buffer;
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
function createTextDictionaryStorageBuffer(
|
|
2574
|
+
device: Device,
|
|
2575
|
+
props: ArrowTextDictionaryStorageInputProps,
|
|
2576
|
+
name: string,
|
|
2577
|
+
data: Uint32Array | Float32Array,
|
|
2578
|
+
emptyData: Uint32Array | Float32Array,
|
|
2579
|
+
usage: number = Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC
|
|
2580
|
+
): Buffer {
|
|
2581
|
+
return device.createBuffer({
|
|
2582
|
+
id: `${props.id || 'arrow-text-dictionary-storage-model'}-${name}`,
|
|
2583
|
+
usage,
|
|
2584
|
+
data: data.byteLength > 0 ? data : emptyData
|
|
2585
|
+
});
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
/** Appends new source-vector batches to an owned storage text state without rebuilding old batches. */
|
|
2589
|
+
export function appendArrowTextStorageStateBatches(
|
|
2590
|
+
device: Device,
|
|
2591
|
+
props: ArrowTextStorageInputProps,
|
|
2592
|
+
storageState: ArrowTextStorageState
|
|
2593
|
+
): void {
|
|
2594
|
+
const appendContext = storageState.arrowAppendContext;
|
|
2595
|
+
if (!appendContext) {
|
|
2596
|
+
throw new Error('ArrowTextStorageState requires append context');
|
|
2597
|
+
}
|
|
2598
|
+
const textInputs = resolveArrowTextStorageInputs(props);
|
|
2599
|
+
assertTextStorageAppendCompatible(storageState, textInputs.batches);
|
|
2600
|
+
if (textInputs.batches.length === storageState.batches.length) {
|
|
2601
|
+
return;
|
|
2602
|
+
}
|
|
2603
|
+
const hasGlyphRowIndices = storageState.hasGlyphRowIndices === true;
|
|
2604
|
+
const compactGlyphVertexByteStride = hasGlyphRowIndices
|
|
2605
|
+
? ROW_INDEXED_COMPACT_GLYPH_VERTEX_BYTE_STRIDE
|
|
2606
|
+
: COMPACT_GLYPH_VERTEX_BYTE_STRIDE;
|
|
2607
|
+
|
|
2608
|
+
for (
|
|
2609
|
+
let batchIndex = storageState.batches.length;
|
|
2610
|
+
batchIndex < textInputs.batches.length;
|
|
2611
|
+
batchIndex++
|
|
2612
|
+
) {
|
|
2613
|
+
const batchInput = textInputs.batches[batchIndex];
|
|
2614
|
+
const rowState = createTextStorageBatchRowState(
|
|
2615
|
+
device,
|
|
2616
|
+
props,
|
|
2617
|
+
batchInput,
|
|
2618
|
+
appendContext.defaultBuffers,
|
|
2619
|
+
appendContext.mappingState.fontRenderSettings
|
|
2620
|
+
);
|
|
2621
|
+
const rowBindingBatchIndex = storageState.batches.length;
|
|
2622
|
+
storageState.ownedRowBindingResources.push(...rowState.ownedResources);
|
|
2623
|
+
storageState.rowStorageByteLength += rowState.ownedByteLength;
|
|
2624
|
+
|
|
2625
|
+
if (appendContext.useGpuUtf8Decode) {
|
|
2626
|
+
const glyphDefinitions = appendContext.utf8GlyphDefinitions;
|
|
2627
|
+
if (!glyphDefinitions) {
|
|
2628
|
+
throw new Error('TextStorageState is missing UTF-8 glyph definitions');
|
|
2629
|
+
}
|
|
2630
|
+
const utf8TextInput = buildGpuUtf8TextInput(batchInput.texts as Vector<Utf8>);
|
|
2631
|
+
const rowGlyphStarts = createStorageRowGlyphStartsBuffer(
|
|
2632
|
+
device,
|
|
2633
|
+
props,
|
|
2634
|
+
batchInput.batchRowIndexBase,
|
|
2635
|
+
utf8TextInput.startIndices
|
|
2636
|
+
);
|
|
2637
|
+
storageState.ownedGlyphResources.push(rowGlyphStarts.buffer);
|
|
2638
|
+
storageState.renderControlByteLength += rowGlyphStarts.byteLength;
|
|
2639
|
+
const glyphMetrics = createTextStorageGlyphMetrics(
|
|
2640
|
+
device,
|
|
2641
|
+
{id: props.id},
|
|
2642
|
+
glyphDefinitions.glyphMetrics
|
|
2643
|
+
);
|
|
2644
|
+
const glyphLookup = createTextStorageGlyphLookup(
|
|
2645
|
+
device,
|
|
2646
|
+
{id: props.id},
|
|
2647
|
+
glyphDefinitions.glyphLookup
|
|
2648
|
+
);
|
|
2649
|
+
const glyphPages = createTextStorageGlyphPages(
|
|
2650
|
+
device,
|
|
2651
|
+
{id: props.id},
|
|
2652
|
+
glyphDefinitions.glyphPages
|
|
2653
|
+
);
|
|
2654
|
+
const glyphKernings = createTextStorageGlyphKernings(
|
|
2655
|
+
device,
|
|
2656
|
+
{id: props.id},
|
|
2657
|
+
glyphDefinitions.glyphKernings
|
|
2658
|
+
);
|
|
2659
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
2660
|
+
device,
|
|
2661
|
+
recordOffsets: utf8TextInput.startIndices,
|
|
2662
|
+
recordByteStride: compactGlyphVertexByteStride,
|
|
2663
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
2664
|
+
resourceLabel: 'ArrowTextStorageModel UTF-8 generated glyph vertex data'
|
|
2665
|
+
});
|
|
2666
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
2667
|
+
const partitionedUtf8TextInput = createPartitionedGpuUtf8TextInput(
|
|
2668
|
+
utf8TextInput,
|
|
2669
|
+
generatedBufferBatch
|
|
2670
|
+
);
|
|
2671
|
+
const utf8Input = createGpuUtf8ExpandedInput(
|
|
2672
|
+
device,
|
|
2673
|
+
{id: props.id},
|
|
2674
|
+
{
|
|
2675
|
+
utf8TextInput: partitionedUtf8TextInput,
|
|
2676
|
+
baselineOffsetY: glyphDefinitions.baselineOffsetY,
|
|
2677
|
+
glyphLookupCount: glyphDefinitions.glyphLookup.length / 2,
|
|
2678
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
2679
|
+
batchRowIndexBase: generatedBufferBatch.rowStart,
|
|
2680
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase + generatedBufferBatch.rowStart,
|
|
2681
|
+
alignment: createGpuTextAlignmentOptions(
|
|
2682
|
+
props,
|
|
2683
|
+
rowState,
|
|
2684
|
+
appendContext.mappingState.lineHeight
|
|
2685
|
+
)
|
|
2686
|
+
}
|
|
2687
|
+
);
|
|
2688
|
+
const generated = createGpuExpandedGeneratedState(
|
|
2689
|
+
device,
|
|
2690
|
+
{id: props.id},
|
|
2691
|
+
partitionedUtf8TextInput.byteLength,
|
|
2692
|
+
hasGlyphRowIndices
|
|
2693
|
+
);
|
|
2694
|
+
dispatchGpuUtf8ExpandedTextCompute(
|
|
2695
|
+
device,
|
|
2696
|
+
{id: props.id},
|
|
2697
|
+
{
|
|
2698
|
+
utf8Input,
|
|
2699
|
+
glyphLookup,
|
|
2700
|
+
glyphMetrics,
|
|
2701
|
+
glyphPages,
|
|
2702
|
+
glyphKernings,
|
|
2703
|
+
generated,
|
|
2704
|
+
outputSlotCount: partitionedUtf8TextInput.byteLength,
|
|
2705
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
2706
|
+
alignment: {
|
|
2707
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
2708
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(
|
|
2709
|
+
rowState.rowAlignmentBaselinesBuffer
|
|
2710
|
+
)
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
);
|
|
2714
|
+
const storageRenderConfigBuffer = createStorageRenderConfigBuffer(
|
|
2715
|
+
device,
|
|
2716
|
+
props,
|
|
2717
|
+
batchInput.batchRowIndexBase,
|
|
2718
|
+
generatedBufferBatch
|
|
2719
|
+
);
|
|
2720
|
+
storageState.renderBatches.push({
|
|
2721
|
+
rowBindingBatchIndex,
|
|
2722
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
2723
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
2724
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
2725
|
+
glyphCount: partitionedUtf8TextInput.byteLength,
|
|
2726
|
+
compactGlyphVertexData: generated.compactGlyphVertexData,
|
|
2727
|
+
storageRenderConfigBuffer
|
|
2728
|
+
});
|
|
2729
|
+
storageState.ownedGlyphResources.push(storageRenderConfigBuffer);
|
|
2730
|
+
storageState.renderControlByteLength += storageRenderConfigBuffer.byteLength;
|
|
2731
|
+
storageState.generatedRenderBufferByteLength += generated.byteLength;
|
|
2732
|
+
storageState.transientComputeInputByteLength += utf8Input.byteLength;
|
|
2733
|
+
utf8Input.rowByteRangesBuffer.destroy();
|
|
2734
|
+
utf8Input.utf8BytesBuffer.destroy();
|
|
2735
|
+
utf8Input.expansionConfigBuffer.destroy();
|
|
2736
|
+
}
|
|
2737
|
+
storageState.batches.push({
|
|
2738
|
+
...rowState,
|
|
2739
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
2740
|
+
rowCount: batchInput.texts.length,
|
|
2741
|
+
glyphCount: utf8TextInput.byteLength,
|
|
2742
|
+
rowGlyphStartsBuffer: rowGlyphStarts.buffer
|
|
2743
|
+
});
|
|
2744
|
+
storageState.glyphCount += utf8TextInput.byteLength;
|
|
2745
|
+
storageState.glyphAttributeBuildTimeMs += utf8TextInput.textInputBuildTimeMs;
|
|
2746
|
+
storageState.compactStreamBuildTimeMs = storageState.glyphAttributeBuildTimeMs;
|
|
2747
|
+
storageState.compactStreamByteLength += utf8TextInput.inputByteLength;
|
|
2748
|
+
storageState.transientComputeInputByteLength +=
|
|
2749
|
+
glyphLookup.byteLength +
|
|
2750
|
+
glyphMetrics.byteLength +
|
|
2751
|
+
glyphPages.byteLength +
|
|
2752
|
+
glyphKernings.byteLength;
|
|
2753
|
+
glyphMetrics.buffer.destroy();
|
|
2754
|
+
glyphLookup.buffer.destroy();
|
|
2755
|
+
glyphPages.buffer.destroy();
|
|
2756
|
+
glyphKernings.buffer.destroy();
|
|
2757
|
+
} else {
|
|
2758
|
+
const batchGlyphStream = buildGpuExpandedTextStream({
|
|
2759
|
+
texts: batchInput.texts,
|
|
2760
|
+
fontAtlas: appendContext.mappingState.fontAtlas,
|
|
2761
|
+
lineHeight: appendContext.mappingState.lineHeight,
|
|
2762
|
+
characterSet: appendContext.mappingState.characterSet
|
|
2763
|
+
});
|
|
2764
|
+
const rowGlyphStarts = createStorageRowGlyphStartsBuffer(
|
|
2765
|
+
device,
|
|
2766
|
+
props,
|
|
2767
|
+
batchInput.batchRowIndexBase,
|
|
2768
|
+
batchGlyphStream.startIndices
|
|
2769
|
+
);
|
|
2770
|
+
storageState.ownedGlyphResources.push(rowGlyphStarts.buffer);
|
|
2771
|
+
storageState.renderControlByteLength += rowGlyphStarts.byteLength;
|
|
2772
|
+
const glyphMetrics = createTextStorageGlyphMetrics(
|
|
2773
|
+
device,
|
|
2774
|
+
{id: props.id},
|
|
2775
|
+
batchGlyphStream.glyphMetrics
|
|
2776
|
+
);
|
|
2777
|
+
const glyphPages = createTextStorageGlyphPages(
|
|
2778
|
+
device,
|
|
2779
|
+
{id: props.id},
|
|
2780
|
+
batchGlyphStream.glyphPages
|
|
2781
|
+
);
|
|
2782
|
+
const glyphKernings = createTextStorageGlyphKernings(
|
|
2783
|
+
device,
|
|
2784
|
+
{id: props.id},
|
|
2785
|
+
batchGlyphStream.glyphKernings
|
|
2786
|
+
);
|
|
2787
|
+
const generatedBufferBatches = planGeneratedBufferBatches({
|
|
2788
|
+
device,
|
|
2789
|
+
recordOffsets: batchGlyphStream.startIndices,
|
|
2790
|
+
recordByteStride: compactGlyphVertexByteStride,
|
|
2791
|
+
maxBatchByteLength: device.limits.maxStorageBufferBindingSize,
|
|
2792
|
+
resourceLabel: 'ArrowTextStorageModel compact generated glyph vertex data'
|
|
2793
|
+
});
|
|
2794
|
+
for (const generatedBufferBatch of generatedBufferBatches) {
|
|
2795
|
+
const partitionedGlyphStream = createPartitionedGpuExpandedTextStream(
|
|
2796
|
+
batchGlyphStream,
|
|
2797
|
+
generatedBufferBatch
|
|
2798
|
+
);
|
|
2799
|
+
const compactInput = createGpuExpandedCompactInput(
|
|
2800
|
+
device,
|
|
2801
|
+
{id: props.id},
|
|
2802
|
+
partitionedGlyphStream,
|
|
2803
|
+
generatedBufferBatch.rowStart,
|
|
2804
|
+
createGpuTextAlignmentOptions(props, rowState, appendContext.mappingState.lineHeight),
|
|
2805
|
+
batchInput.rowStorageIndexBase + generatedBufferBatch.rowStart
|
|
2806
|
+
);
|
|
2807
|
+
const generated = createGpuExpandedGeneratedState(
|
|
2808
|
+
device,
|
|
2809
|
+
{id: props.id},
|
|
2810
|
+
partitionedGlyphStream.glyphCount,
|
|
2811
|
+
hasGlyphRowIndices
|
|
2812
|
+
);
|
|
2813
|
+
dispatchGpuExpandedTextCompute(
|
|
2814
|
+
device,
|
|
2815
|
+
{id: props.id},
|
|
2816
|
+
{
|
|
2817
|
+
compactInput,
|
|
2818
|
+
glyphMetrics,
|
|
2819
|
+
glyphPages,
|
|
2820
|
+
glyphKernings,
|
|
2821
|
+
generated,
|
|
2822
|
+
glyphCount: partitionedGlyphStream.glyphCount,
|
|
2823
|
+
labelCount: generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart,
|
|
2824
|
+
alignment: {
|
|
2825
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
2826
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(
|
|
2827
|
+
rowState.rowAlignmentBaselinesBuffer
|
|
2828
|
+
),
|
|
2829
|
+
useRowTextAnchors: Boolean(props.textAnchors),
|
|
2830
|
+
useRowAlignmentBaselines: Boolean(props.alignmentBaselines)
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
);
|
|
2834
|
+
const storageRenderConfigBuffer = createStorageRenderConfigBuffer(
|
|
2835
|
+
device,
|
|
2836
|
+
props,
|
|
2837
|
+
batchInput.batchRowIndexBase,
|
|
2838
|
+
generatedBufferBatch
|
|
2839
|
+
);
|
|
2840
|
+
storageState.renderBatches.push({
|
|
2841
|
+
rowBindingBatchIndex,
|
|
2842
|
+
rowStart: generatedBufferBatch.rowStart,
|
|
2843
|
+
rowEnd: generatedBufferBatch.rowEnd,
|
|
2844
|
+
glyphIndexBase: generatedBufferBatch.recordStart,
|
|
2845
|
+
glyphCount: partitionedGlyphStream.glyphCount,
|
|
2846
|
+
compactGlyphVertexData: generated.compactGlyphVertexData,
|
|
2847
|
+
storageRenderConfigBuffer
|
|
2848
|
+
});
|
|
2849
|
+
storageState.ownedGlyphResources.push(storageRenderConfigBuffer);
|
|
2850
|
+
storageState.renderControlByteLength += storageRenderConfigBuffer.byteLength;
|
|
2851
|
+
storageState.generatedRenderBufferByteLength += generated.byteLength;
|
|
2852
|
+
storageState.transientComputeInputByteLength += compactInput.byteLength;
|
|
2853
|
+
compactInput.glyphRangesBuffer.destroy();
|
|
2854
|
+
compactInput.glyphIdsBuffer.destroy();
|
|
2855
|
+
compactInput.expansionConfigBuffer.destroy();
|
|
2856
|
+
}
|
|
2857
|
+
storageState.batches.push({
|
|
2858
|
+
...rowState,
|
|
2859
|
+
batchRowIndexBase: batchInput.batchRowIndexBase,
|
|
2860
|
+
rowCount: batchInput.texts.length,
|
|
2861
|
+
glyphCount: batchGlyphStream.glyphCount,
|
|
2862
|
+
rowGlyphStartsBuffer: rowGlyphStarts.buffer
|
|
2863
|
+
});
|
|
2864
|
+
storageState.glyphCount += batchGlyphStream.glyphCount;
|
|
2865
|
+
storageState.glyphAttributeBuildTimeMs += batchGlyphStream.glyphStreamBuildTimeMs;
|
|
2866
|
+
storageState.compactStreamBuildTimeMs = storageState.glyphAttributeBuildTimeMs;
|
|
2867
|
+
storageState.compactStreamByteLength += batchGlyphStream.compactStreamByteLength;
|
|
2868
|
+
storageState.transientComputeInputByteLength +=
|
|
2869
|
+
glyphMetrics.byteLength + glyphPages.byteLength + glyphKernings.byteLength;
|
|
2870
|
+
glyphMetrics.buffer.destroy();
|
|
2871
|
+
glyphPages.buffer.destroy();
|
|
2872
|
+
glyphKernings.buffer.destroy();
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
storageState.glyphAttributeByteLength =
|
|
2877
|
+
storageState.generatedRenderBufferByteLength + storageState.renderControlByteLength;
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2880
|
+
function assertTextStorageAppendCompatible(
|
|
2881
|
+
storageState: TextStorageState,
|
|
2882
|
+
batches: ResolvedArrowTextStorageBatchInputs[]
|
|
2883
|
+
): void {
|
|
2884
|
+
if (batches.length < storageState.batches.length) {
|
|
2885
|
+
throw new Error('ArrowTextStorageModel appended text batches cannot remove existing batches');
|
|
2886
|
+
}
|
|
2887
|
+
for (const [batchIndex, existingBatch] of storageState.batches.entries()) {
|
|
2888
|
+
const batchInput = batches[batchIndex];
|
|
2889
|
+
if (
|
|
2890
|
+
!batchInput ||
|
|
2891
|
+
batchInput.batchRowIndexBase !== existingBatch.batchRowIndexBase ||
|
|
2892
|
+
batchInput.rowStorageIndexBase !== existingBatch.rowStorageIndexBase ||
|
|
2893
|
+
batchInput.texts.length !== existingBatch.rowCount ||
|
|
2894
|
+
batchInput.positionsBuffer !== existingBatch.rowPositionsBuffer
|
|
2895
|
+
) {
|
|
2896
|
+
throw new Error(
|
|
2897
|
+
'ArrowTextStorageModel appended text batches require existing row batches to stay unchanged'
|
|
2898
|
+
);
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
/** Rebuilds row/style binding buffers for an existing storage text state without replacing glyph buffers. */
|
|
2904
|
+
export function refreshArrowTextStorageRowBindings(
|
|
2905
|
+
device: Device,
|
|
2906
|
+
props: ArrowTextStorageInputProps,
|
|
2907
|
+
storageState: TextStorageState
|
|
2908
|
+
): void {
|
|
2909
|
+
const textInputs = resolveArrowTextStorageInputs(props);
|
|
2910
|
+
assertTextStorageRowBindingRefreshCompatible(storageState, textInputs.batches);
|
|
2911
|
+
|
|
2912
|
+
const nextOwnedRowBindingResources: TextStorageOwnedResource[] = [];
|
|
2913
|
+
const defaultBuffers = createTextStorageDefaultBuffers(device, props);
|
|
2914
|
+
nextOwnedRowBindingResources.push(...defaultBuffers.ownedResources);
|
|
2915
|
+
|
|
2916
|
+
let rowStorageByteLength = defaultBuffers.byteLength;
|
|
2917
|
+
let nextBatches: TextStorageBatchState[] = [];
|
|
2918
|
+
try {
|
|
2919
|
+
nextBatches = textInputs.batches.map((batchInput, batchIndex) => {
|
|
2920
|
+
const previousBatch = storageState.batches[batchIndex];
|
|
2921
|
+
const rowState = createTextStorageBatchRowState(
|
|
2922
|
+
device,
|
|
2923
|
+
props,
|
|
2924
|
+
batchInput,
|
|
2925
|
+
defaultBuffers,
|
|
2926
|
+
storageState.fontRenderSettings
|
|
2927
|
+
);
|
|
2928
|
+
nextOwnedRowBindingResources.push(...rowState.ownedResources);
|
|
2929
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
2930
|
+
return {
|
|
2931
|
+
...rowState,
|
|
2932
|
+
batchRowIndexBase: previousBatch.batchRowIndexBase,
|
|
2933
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase,
|
|
2934
|
+
rowCount: previousBatch.rowCount,
|
|
2935
|
+
glyphCount: previousBatch.glyphCount,
|
|
2936
|
+
rowGlyphStartsBuffer: previousBatch.rowGlyphStartsBuffer
|
|
2937
|
+
};
|
|
2938
|
+
});
|
|
2939
|
+
} catch (error) {
|
|
2940
|
+
destroyTextStorageResources(nextOwnedRowBindingResources);
|
|
2941
|
+
throw error;
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
replaceOwnedTextStorageResources(
|
|
2945
|
+
storageState.ownedRowBindingResources,
|
|
2946
|
+
nextOwnedRowBindingResources
|
|
2947
|
+
);
|
|
2948
|
+
storageState.batches = nextBatches;
|
|
2949
|
+
storageState.rowStorageByteLength = rowStorageByteLength;
|
|
2950
|
+
const appendContext = getArrowTextStorageAppendContext(storageState);
|
|
2951
|
+
if (appendContext) {
|
|
2952
|
+
appendContext.defaultBuffers = defaultBuffers;
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
function assertTextStorageRowBindingRefreshCompatible(
|
|
2957
|
+
storageState: TextStorageState,
|
|
2958
|
+
batches: ResolvedArrowTextStorageBatchInputs[]
|
|
2959
|
+
): void {
|
|
2960
|
+
if (batches.length !== storageState.batches.length) {
|
|
2961
|
+
throw new Error('ArrowTextStorageModel row-binding updates must preserve text batch count');
|
|
2962
|
+
}
|
|
2963
|
+
for (const [batchIndex, batchInput] of batches.entries()) {
|
|
2964
|
+
const existingBatch = storageState.batches[batchIndex];
|
|
2965
|
+
if (
|
|
2966
|
+
!existingBatch ||
|
|
2967
|
+
existingBatch.batchRowIndexBase !== batchInput.batchRowIndexBase ||
|
|
2968
|
+
existingBatch.rowCount !== batchInput.texts.length
|
|
2969
|
+
) {
|
|
2970
|
+
throw new Error('ArrowTextStorageModel row-binding updates must preserve text batch rows');
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
function getArrowTextStorageAppendContext(
|
|
2976
|
+
storageState: TextStorageState
|
|
2977
|
+
): ArrowTextStorageAppendContext | undefined {
|
|
2978
|
+
return isArrowTextStorageState(storageState) ? storageState.arrowAppendContext : undefined;
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
function isArrowTextStorageState(
|
|
2982
|
+
storageState: TextStorageState
|
|
2983
|
+
): storageState is ArrowTextStorageState {
|
|
2984
|
+
return 'arrowAppendContext' in storageState;
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
/** Rebuilds row/style binding buffers for an existing dictionary text state without replacing glyph buffers. */
|
|
2988
|
+
export function refreshArrowTextDictionaryStorageRowBindings(
|
|
2989
|
+
device: Device,
|
|
2990
|
+
props: ArrowTextDictionaryStorageInputProps,
|
|
2991
|
+
storageState: TextDictionaryState
|
|
2992
|
+
): void {
|
|
2993
|
+
const textInputs = resolveArrowTextDictionaryStorageInputs(props);
|
|
2994
|
+
assertTextDictionaryStorageRowBindingRefreshCompatible(storageState, textInputs.batches);
|
|
2995
|
+
|
|
2996
|
+
const nextOwnedRowBindingResources: TextStorageOwnedResource[] = [];
|
|
2997
|
+
const defaultBuffers = createTextStorageDefaultBuffers(device, props);
|
|
2998
|
+
nextOwnedRowBindingResources.push(...defaultBuffers.ownedResources);
|
|
2999
|
+
|
|
3000
|
+
let rowStorageByteLength = defaultBuffers.byteLength;
|
|
3001
|
+
let nextBatches: TextDictionaryBatchState[] = [];
|
|
3002
|
+
try {
|
|
3003
|
+
nextBatches = textInputs.batches.map((batchInput, batchIndex) => {
|
|
3004
|
+
const previousBatch = storageState.batches[batchIndex];
|
|
3005
|
+
const rowState = createTextStorageBatchRowState(
|
|
3006
|
+
device,
|
|
3007
|
+
props,
|
|
3008
|
+
batchInput,
|
|
3009
|
+
defaultBuffers,
|
|
3010
|
+
storageState.fontRenderSettings
|
|
3011
|
+
);
|
|
3012
|
+
nextOwnedRowBindingResources.push(...rowState.ownedResources);
|
|
3013
|
+
rowStorageByteLength += rowState.ownedByteLength;
|
|
3014
|
+
return {
|
|
3015
|
+
...rowState,
|
|
3016
|
+
batchRowIndexBase: previousBatch.batchRowIndexBase,
|
|
3017
|
+
rowStorageIndexBase: batchInput.rowStorageIndexBase,
|
|
3018
|
+
rowCount: previousBatch.rowCount,
|
|
3019
|
+
glyphCount: previousBatch.glyphCount,
|
|
3020
|
+
rowDictionaryRecordsBuffer: previousBatch.rowDictionaryRecordsBuffer,
|
|
3021
|
+
dictionaryGlyphRangesBuffer: previousBatch.dictionaryGlyphRangesBuffer,
|
|
3022
|
+
dictionaryGlyphRecordsBuffer: previousBatch.dictionaryGlyphRecordsBuffer,
|
|
3023
|
+
glyphFramesBuffer: previousBatch.glyphFramesBuffer,
|
|
3024
|
+
dictionaryGlyphCount: previousBatch.dictionaryGlyphCount,
|
|
3025
|
+
dictionaryValueCount: previousBatch.dictionaryValueCount
|
|
3026
|
+
};
|
|
3027
|
+
});
|
|
3028
|
+
} catch (error) {
|
|
3029
|
+
destroyTextStorageResources(nextOwnedRowBindingResources);
|
|
3030
|
+
throw error;
|
|
3031
|
+
}
|
|
3032
|
+
|
|
3033
|
+
replaceOwnedTextStorageResources(
|
|
3034
|
+
storageState.ownedRowBindingResources,
|
|
3035
|
+
nextOwnedRowBindingResources
|
|
3036
|
+
);
|
|
3037
|
+
storageState.batches = nextBatches;
|
|
3038
|
+
storageState.rowStorageByteLength = rowStorageByteLength;
|
|
3039
|
+
}
|
|
3040
|
+
|
|
3041
|
+
function assertTextDictionaryStorageRowBindingRefreshCompatible(
|
|
3042
|
+
storageState: TextDictionaryState,
|
|
3043
|
+
batches: ResolvedArrowTextStorageBatchInputs[]
|
|
3044
|
+
): void {
|
|
3045
|
+
if (batches.length !== storageState.batches.length) {
|
|
3046
|
+
throw new Error(
|
|
3047
|
+
'ArrowTextDictionaryStorageModel row-binding updates must preserve text batch count'
|
|
3048
|
+
);
|
|
3049
|
+
}
|
|
3050
|
+
for (const [batchIndex, batchInput] of batches.entries()) {
|
|
3051
|
+
const existingBatch = storageState.batches[batchIndex];
|
|
3052
|
+
if (
|
|
3053
|
+
!existingBatch ||
|
|
3054
|
+
existingBatch.batchRowIndexBase !== batchInput.batchRowIndexBase ||
|
|
3055
|
+
existingBatch.rowStorageIndexBase !== batchInput.rowStorageIndexBase ||
|
|
3056
|
+
existingBatch.rowCount !== batchInput.texts.length
|
|
3057
|
+
) {
|
|
3058
|
+
throw new Error(
|
|
3059
|
+
'ArrowTextDictionaryStorageModel row-binding updates must preserve text batch rows'
|
|
3060
|
+
);
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3065
|
+
function destroyTextStorageResources(resources: TextStorageOwnedResource[]): void {
|
|
3066
|
+
for (const resource of resources) {
|
|
3067
|
+
resource.destroy();
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
|
|
3071
|
+
function replaceOwnedTextStorageResources(
|
|
3072
|
+
currentResources: TextStorageOwnedResource[],
|
|
3073
|
+
nextResources: TextStorageOwnedResource[]
|
|
3074
|
+
): void {
|
|
3075
|
+
destroyTextStorageResources(currentResources);
|
|
3076
|
+
currentResources.splice(0, currentResources.length, ...nextResources);
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
function createTextStorageStyleConfigData(
|
|
3080
|
+
props: AnyTextStorageInputProps,
|
|
3081
|
+
batchRowIndexBase: number,
|
|
3082
|
+
rowStorageIndexBase: number,
|
|
3083
|
+
fontRenderSettings: FontAtlasRenderSettings
|
|
3084
|
+
): Uint32Array {
|
|
3085
|
+
const arrayBuffer = new ArrayBuffer(80);
|
|
3086
|
+
const floatValues = new Float32Array(arrayBuffer);
|
|
3087
|
+
const uintValues = new Uint32Array(arrayBuffer);
|
|
3088
|
+
const color = props.color ?? DEFAULT_TEXT_STORAGE_COLOR;
|
|
3089
|
+
floatValues[0] = color[0] / 255;
|
|
3090
|
+
floatValues[1] = color[1] / 255;
|
|
3091
|
+
floatValues[2] = color[2] / 255;
|
|
3092
|
+
floatValues[3] = color[3] / 255;
|
|
3093
|
+
floatValues[4] = props.angle ?? DEFAULT_TEXT_STORAGE_ANGLE;
|
|
3094
|
+
floatValues[5] = props.size ?? DEFAULT_TEXT_STORAGE_SIZE;
|
|
3095
|
+
floatValues[6] = (props.pixelOffset ?? DEFAULT_TEXT_STORAGE_PIXEL_OFFSET)[0];
|
|
3096
|
+
floatValues[7] = (props.pixelOffset ?? DEFAULT_TEXT_STORAGE_PIXEL_OFFSET)[1];
|
|
3097
|
+
uintValues[8] = props.colors ? 1 : 0;
|
|
3098
|
+
uintValues[9] = props.angles ? 1 : 0;
|
|
3099
|
+
uintValues[10] = props.sizes ? 1 : 0;
|
|
3100
|
+
uintValues[11] = props.pixelOffsets ? 1 : 0;
|
|
3101
|
+
uintValues[12] = props.clipRects ? 1 : 0;
|
|
3102
|
+
uintValues[13] = batchRowIndexBase;
|
|
3103
|
+
uintValues[14] = rowStorageIndexBase;
|
|
3104
|
+
uintValues[15] = 0;
|
|
3105
|
+
floatValues[16] =
|
|
3106
|
+
fontRenderSettings.mode === 'bitmap' ? BITMAP_TEXT_SDF_THRESHOLD : fontRenderSettings.threshold;
|
|
3107
|
+
floatValues[17] = fontRenderSettings.smoothing;
|
|
3108
|
+
uintValues[18] =
|
|
3109
|
+
fontRenderSettings.mode === 'bitmap' ? 0 : fontRenderSettings.mode === 'sdf' ? 1 : 2;
|
|
3110
|
+
floatValues[19] = fontRenderSettings.distanceRange ?? 0;
|
|
3111
|
+
return uintValues;
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
function createGpuTextAlignmentOptions(
|
|
3115
|
+
props: AnyTextStorageInputProps,
|
|
3116
|
+
rowState: TextStorageBatchRowState,
|
|
3117
|
+
lineHeight: number
|
|
3118
|
+
) {
|
|
3119
|
+
return {
|
|
3120
|
+
rowTextAnchorsBuffer: getComputeTextStorageBuffer(rowState.rowTextAnchorsBuffer),
|
|
3121
|
+
rowAlignmentBaselinesBuffer: getComputeTextStorageBuffer(rowState.rowAlignmentBaselinesBuffer),
|
|
3122
|
+
useRowTextAnchors: Boolean(props.textAnchors),
|
|
3123
|
+
useRowAlignmentBaselines: Boolean(props.alignmentBaselines),
|
|
3124
|
+
textAnchor: getTextAnchorEnum(props.textAnchor),
|
|
3125
|
+
alignmentBaseline: getAlignmentBaselineEnum(props.alignmentBaseline),
|
|
3126
|
+
lineHeight
|
|
3127
|
+
};
|
|
3128
|
+
}
|
|
3129
|
+
|
|
3130
|
+
function getComputeTextStorageBuffer(buffer: TextStorageBuffer): Buffer {
|
|
3131
|
+
return buffer instanceof DynamicBuffer ? buffer.buffer : buffer;
|
|
3132
|
+
}
|
|
3133
|
+
|
|
3134
|
+
function createTextStorageGlyphFrames(
|
|
3135
|
+
device: Device,
|
|
3136
|
+
props: ArrowTextModelProps | AnyTextStorageInputProps,
|
|
3137
|
+
glyphFrameData: Float32Array
|
|
3138
|
+
): TextStorageGlyphFrameState {
|
|
3139
|
+
return {
|
|
3140
|
+
buffer: device.createBuffer({
|
|
3141
|
+
id: `${props.id || 'arrow-text-storage-model'}-glyph-frames`,
|
|
3142
|
+
usage: Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
3143
|
+
data: glyphFrameData.byteLength > 0 ? glyphFrameData : new Float32Array(4)
|
|
3144
|
+
}),
|
|
3145
|
+
byteLength: glyphFrameData.byteLength
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
function getTextAtlasTexture(
|
|
3150
|
+
device: Device,
|
|
3151
|
+
props: Pick<ArrowTextModelProps | AnyTextStorageInputProps, 'id' | 'resources'>,
|
|
3152
|
+
fontAtlas: FontAtlas
|
|
3153
|
+
): {atlasTexture: DynamicTexture; ownsAtlasTexture: boolean} {
|
|
3154
|
+
if (props.resources) {
|
|
3155
|
+
return {atlasTexture: props.resources.atlasTexture, ownsAtlasTexture: false};
|
|
3156
|
+
}
|
|
3157
|
+
return {
|
|
3158
|
+
atlasTexture: new DynamicTexture(device, {
|
|
3159
|
+
id: `${props.id || 'text-model'}-atlas`,
|
|
3160
|
+
dimension: '2d-array',
|
|
3161
|
+
data: [...fontAtlas.pages]
|
|
3162
|
+
}),
|
|
3163
|
+
ownsAtlasTexture: true
|
|
3164
|
+
};
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
/** Copies deck-style `[x, y, width, height]` Float32 clip rows into packed GPU storage. */
|
|
3168
|
+
export function packTextStorageClipRects(clipRects: Vector<FixedSizeList<Float32>>): Float32Array {
|
|
3169
|
+
assertClipRects(clipRects, clipRects.length);
|
|
3170
|
+
return new Float32Array(getArrowVectorBufferSource(clipRects) as Float32Array);
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
function getTextAnchorEnum(textAnchor: AnyTextStorageInputProps['textAnchor']): number {
|
|
3174
|
+
switch (textAnchor) {
|
|
3175
|
+
case 'middle':
|
|
3176
|
+
return 1;
|
|
3177
|
+
case 'end':
|
|
3178
|
+
return 2;
|
|
3179
|
+
case 'start':
|
|
3180
|
+
default:
|
|
3181
|
+
return DEFAULT_TEXT_STORAGE_ANCHOR;
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
function getAlignmentBaselineEnum(
|
|
3186
|
+
alignmentBaseline: AnyTextStorageInputProps['alignmentBaseline']
|
|
3187
|
+
): number {
|
|
3188
|
+
switch (alignmentBaseline) {
|
|
3189
|
+
case 'top':
|
|
3190
|
+
return 1;
|
|
3191
|
+
case 'bottom':
|
|
3192
|
+
return 2;
|
|
3193
|
+
case 'center':
|
|
3194
|
+
default:
|
|
3195
|
+
return DEFAULT_STORAGE_ALIGNMENT_BASELINE;
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3199
|
+
function createPartitionedGpuExpandedTextStream(
|
|
3200
|
+
glyphStream: GpuExpandedTextStream,
|
|
3201
|
+
generatedBufferBatch: GeneratedBufferBatch
|
|
3202
|
+
): GpuExpandedTextStream {
|
|
3203
|
+
const rowCount = generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart;
|
|
3204
|
+
const startIndices = new Array<number>(rowCount + 1);
|
|
3205
|
+
const labelGlyphRanges = new Uint32Array(rowCount * 2);
|
|
3206
|
+
startIndices[0] = 0;
|
|
3207
|
+
|
|
3208
|
+
for (let localRowIndex = 0; localRowIndex < rowCount; localRowIndex++) {
|
|
3209
|
+
const sourceRowIndex = generatedBufferBatch.rowStart + localRowIndex;
|
|
3210
|
+
const sourceGlyphStart =
|
|
3211
|
+
glyphStream.startIndices[sourceRowIndex] ?? generatedBufferBatch.recordStart;
|
|
3212
|
+
const sourceGlyphEnd =
|
|
3213
|
+
glyphStream.startIndices[sourceRowIndex + 1] ?? generatedBufferBatch.recordStart;
|
|
3214
|
+
const localGlyphStart = sourceGlyphStart - generatedBufferBatch.recordStart;
|
|
3215
|
+
const localGlyphEnd = sourceGlyphEnd - generatedBufferBatch.recordStart;
|
|
3216
|
+
labelGlyphRanges[localRowIndex * 2] = localGlyphStart;
|
|
3217
|
+
labelGlyphRanges[localRowIndex * 2 + 1] = localGlyphEnd;
|
|
3218
|
+
startIndices[localRowIndex + 1] = localGlyphEnd;
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
const packedGlyphIds = copyPackedUint16Range(
|
|
3222
|
+
glyphStream.packedGlyphIds,
|
|
3223
|
+
generatedBufferBatch.recordStart,
|
|
3224
|
+
generatedBufferBatch.recordEnd
|
|
3225
|
+
);
|
|
3226
|
+
return {
|
|
3227
|
+
...glyphStream,
|
|
3228
|
+
startIndices,
|
|
3229
|
+
glyphCount: generatedBufferBatch.recordCount,
|
|
3230
|
+
labelGlyphRanges,
|
|
3231
|
+
packedGlyphIds,
|
|
3232
|
+
compactStreamByteLength: labelGlyphRanges.byteLength + packedGlyphIds.byteLength,
|
|
3233
|
+
glyphStreamBuildTimeMs: 0
|
|
3234
|
+
};
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
function createPartitionedGpuUtf8TextInput(
|
|
3238
|
+
utf8TextInput: GpuUtf8TextInput,
|
|
3239
|
+
generatedBufferBatch: GeneratedBufferBatch
|
|
3240
|
+
): GpuUtf8TextInput {
|
|
3241
|
+
const rowCount = generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart;
|
|
3242
|
+
const rowByteRanges = new Uint32Array(rowCount * 2);
|
|
3243
|
+
const startIndices = new Array<number>(rowCount + 1);
|
|
3244
|
+
startIndices[0] = 0;
|
|
3245
|
+
|
|
3246
|
+
for (let localRowIndex = 0; localRowIndex < rowCount; localRowIndex++) {
|
|
3247
|
+
const sourceRowIndex = generatedBufferBatch.rowStart + localRowIndex;
|
|
3248
|
+
const sourceByteStart = utf8TextInput.rowByteRanges[sourceRowIndex * 2] ?? 0;
|
|
3249
|
+
const sourceByteEnd = utf8TextInput.rowByteRanges[sourceRowIndex * 2 + 1] ?? sourceByteStart;
|
|
3250
|
+
const hasPartitionLocalBytes =
|
|
3251
|
+
sourceByteEnd > sourceByteStart &&
|
|
3252
|
+
sourceByteStart >= generatedBufferBatch.recordStart &&
|
|
3253
|
+
sourceByteEnd <= generatedBufferBatch.recordEnd;
|
|
3254
|
+
const localByteStart = hasPartitionLocalBytes
|
|
3255
|
+
? sourceByteStart - generatedBufferBatch.recordStart
|
|
3256
|
+
: 0;
|
|
3257
|
+
const localByteEnd = hasPartitionLocalBytes
|
|
3258
|
+
? sourceByteEnd - generatedBufferBatch.recordStart
|
|
3259
|
+
: localByteStart;
|
|
3260
|
+
rowByteRanges[localRowIndex * 2] = localByteStart;
|
|
3261
|
+
rowByteRanges[localRowIndex * 2 + 1] = localByteEnd;
|
|
3262
|
+
startIndices[localRowIndex + 1] = Math.max(startIndices[localRowIndex] ?? 0, localByteEnd);
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
const packedUtf8Bytes = copyPackedByteRange(
|
|
3266
|
+
utf8TextInput.packedUtf8Bytes,
|
|
3267
|
+
generatedBufferBatch.recordStart,
|
|
3268
|
+
generatedBufferBatch.recordEnd
|
|
3269
|
+
);
|
|
3270
|
+
return {
|
|
3271
|
+
startIndices,
|
|
3272
|
+
rowByteRanges,
|
|
3273
|
+
packedUtf8Bytes,
|
|
3274
|
+
byteLength: generatedBufferBatch.recordCount,
|
|
3275
|
+
inputByteLength: rowByteRanges.byteLength + packedUtf8Bytes.byteLength,
|
|
3276
|
+
textInputBuildTimeMs: 0
|
|
3277
|
+
};
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3280
|
+
function createPartitionedGpuVectorUtf8TextInput(
|
|
3281
|
+
device: Device,
|
|
3282
|
+
props: GPUVectorTextStorageInputProps,
|
|
3283
|
+
textBatch: GPUVectorTextStorageBatch,
|
|
3284
|
+
generatedBufferBatch: GeneratedBufferBatch
|
|
3285
|
+
): {
|
|
3286
|
+
rowByteRangesBuffer: Buffer;
|
|
3287
|
+
inputByteLength: number;
|
|
3288
|
+
ownsRowByteRangesBuffer: boolean;
|
|
3289
|
+
} {
|
|
3290
|
+
const usesFullBatch =
|
|
3291
|
+
generatedBufferBatch.rowStart === 0 &&
|
|
3292
|
+
generatedBufferBatch.rowEnd === textBatch.rowCount &&
|
|
3293
|
+
generatedBufferBatch.recordStart === 0 &&
|
|
3294
|
+
generatedBufferBatch.recordEnd === textBatch.byteLength;
|
|
3295
|
+
if (usesFullBatch) {
|
|
3296
|
+
return {
|
|
3297
|
+
rowByteRangesBuffer: textBatch.rowByteRangesBuffer,
|
|
3298
|
+
inputByteLength: textBatch.inputByteLength,
|
|
3299
|
+
ownsRowByteRangesBuffer: false
|
|
3300
|
+
};
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
const rowCount = generatedBufferBatch.rowEnd - generatedBufferBatch.rowStart;
|
|
3304
|
+
const rowByteRanges = new Uint32Array(rowCount * 2);
|
|
3305
|
+
for (let localRowIndex = 0; localRowIndex < rowCount; localRowIndex++) {
|
|
3306
|
+
const sourceRowIndex = generatedBufferBatch.rowStart + localRowIndex;
|
|
3307
|
+
rowByteRanges[localRowIndex * 2] = textBatch.rowByteRanges[sourceRowIndex * 2] ?? 0;
|
|
3308
|
+
rowByteRanges[localRowIndex * 2 + 1] =
|
|
3309
|
+
textBatch.rowByteRanges[sourceRowIndex * 2 + 1] ?? rowByteRanges[localRowIndex * 2];
|
|
3310
|
+
}
|
|
3311
|
+
|
|
3312
|
+
return {
|
|
3313
|
+
rowByteRangesBuffer: device.createBuffer({
|
|
3314
|
+
id:
|
|
3315
|
+
`${props.id || 'text-storage-model'}-utf8-row-byte-ranges-` +
|
|
3316
|
+
`${generatedBufferBatch.rowStart}`,
|
|
3317
|
+
usage: Buffer.STORAGE | Buffer.COPY_DST | Buffer.COPY_SRC,
|
|
3318
|
+
data: rowByteRanges.byteLength > 0 ? rowByteRanges : new Uint32Array(2)
|
|
3319
|
+
}),
|
|
3320
|
+
inputByteLength: rowByteRanges.byteLength + generatedBufferBatch.recordCount,
|
|
3321
|
+
ownsRowByteRangesBuffer: true
|
|
3322
|
+
};
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
function copyPackedUint16Range(
|
|
3326
|
+
source: Uint32Array,
|
|
3327
|
+
startIndex: number,
|
|
3328
|
+
endIndex: number
|
|
3329
|
+
): Uint32Array {
|
|
3330
|
+
const valueCount = Math.max(0, endIndex - startIndex);
|
|
3331
|
+
const target = new Uint32Array(Math.ceil(valueCount / 2));
|
|
3332
|
+
for (let localIndex = 0; localIndex < valueCount; localIndex++) {
|
|
3333
|
+
const value = readPackedUint16(source, startIndex + localIndex);
|
|
3334
|
+
writePackedUint16(target, localIndex, value);
|
|
3335
|
+
}
|
|
3336
|
+
return target;
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
function readPackedUint16(source: Uint32Array, index: number): number {
|
|
3340
|
+
const word = source[index >> 1] ?? 0;
|
|
3341
|
+
return index & 1 ? word >>> 16 : word & 0xffff;
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
function writePackedUint16(target: Uint32Array, index: number, value: number): void {
|
|
3345
|
+
const wordIndex = index >> 1;
|
|
3346
|
+
const word = target[wordIndex] ?? 0;
|
|
3347
|
+
target[wordIndex] = index & 1 ? word | ((value & 0xffff) << 16) : word | (value & 0xffff);
|
|
3348
|
+
}
|
|
3349
|
+
|
|
3350
|
+
function copyPackedByteRange(
|
|
3351
|
+
source: Uint32Array,
|
|
3352
|
+
startByteIndex: number,
|
|
3353
|
+
endByteIndex: number
|
|
3354
|
+
): Uint32Array {
|
|
3355
|
+
const byteLength = Math.max(0, endByteIndex - startByteIndex);
|
|
3356
|
+
const target = new Uint32Array(Math.ceil(byteLength / Uint32Array.BYTES_PER_ELEMENT));
|
|
3357
|
+
const sourceBytes = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
3358
|
+
new Uint8Array(target.buffer).set(sourceBytes.subarray(startByteIndex, endByteIndex));
|
|
3359
|
+
return target;
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3362
|
+
function makeFixedSizeListField(name: string, childType: Int16 | Uint16, listSize: 2 | 4): Field {
|
|
3363
|
+
return new Field(name, new FixedSizeList(listSize, new Field('value', childType, false)), false);
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
function isInstanceCompatibleArrowType(type: DataType): boolean {
|
|
3367
|
+
return (
|
|
3368
|
+
isNumericArrowType(type) ||
|
|
3369
|
+
(DataType.isFixedSizeList(type) && isNumericArrowType(type.children[0].type))
|
|
3370
|
+
);
|
|
3371
|
+
}
|
|
3372
|
+
|
|
3373
|
+
function isArrowTextRowColorType(type: DataType | undefined): type is ArrowTextRowColorType {
|
|
3374
|
+
return (
|
|
3375
|
+
Boolean(type) &&
|
|
3376
|
+
DataType.isFixedSizeList(type) &&
|
|
3377
|
+
type.listSize === 4 &&
|
|
3378
|
+
type.children[0]?.type instanceof Uint8
|
|
3379
|
+
);
|
|
3380
|
+
}
|
|
3381
|
+
|
|
3382
|
+
function isArrowTextCharacterColorType(
|
|
3383
|
+
type: DataType | undefined
|
|
3384
|
+
): type is ArrowTextCharacterColorType {
|
|
3385
|
+
return Boolean(type) && DataType.isList(type) && isArrowTextRowColorType(type.children[0]?.type);
|
|
3386
|
+
}
|
|
3387
|
+
|
|
3388
|
+
function isArrowTextColorType(type: DataType | undefined): type is ArrowTextColorType {
|
|
3389
|
+
return isArrowTextRowColorType(type) || isArrowTextCharacterColorType(type);
|
|
3390
|
+
}
|
|
3391
|
+
|
|
3392
|
+
function expandArrowTextCharacterColorRows(
|
|
3393
|
+
vector: Vector<ArrowTextCharacterColorType>,
|
|
3394
|
+
startIndices: number[],
|
|
3395
|
+
nullValue?: [number, number, number, number]
|
|
3396
|
+
): Vector<ArrowTextRowColorType> {
|
|
3397
|
+
const glyphCount = startIndices[startIndices.length - 1] ?? 0;
|
|
3398
|
+
const expandedValues = new Uint8Array(glyphCount * 4);
|
|
3399
|
+
let rowIndexBase = 0;
|
|
3400
|
+
|
|
3401
|
+
for (const data of vector.data) {
|
|
3402
|
+
const valueOffsets = data.valueOffsets as Int32Array | undefined;
|
|
3403
|
+
const elementData = data.children[0] as Data<ArrowTextRowColorType> | undefined;
|
|
3404
|
+
const valueData = elementData?.children[0] as Data<Uint8> | undefined;
|
|
3405
|
+
const values = valueData?.values as Uint8Array | undefined;
|
|
3406
|
+
if (!valueOffsets || !elementData || !valueData || !values) {
|
|
3407
|
+
throw new Error('ArrowTextModel character colors require Arrow list offsets and values');
|
|
3408
|
+
}
|
|
3409
|
+
if (nullValue && ((elementData.nullCount ?? 0) > 0 || (valueData.nullCount ?? 0) > 0)) {
|
|
3410
|
+
throw new Error(
|
|
3411
|
+
'ArrowTextModel character colors do not support nullable nested color values'
|
|
3412
|
+
);
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3415
|
+
const firstElementOffset = valueOffsets[0] ?? 0;
|
|
3416
|
+
const valueOffset = valueData.offset ?? 0;
|
|
3417
|
+
for (let localRowIndex = 0; localRowIndex < data.length; localRowIndex++) {
|
|
3418
|
+
const rowIndex = rowIndexBase + localRowIndex;
|
|
3419
|
+
const glyphStart = startIndices[rowIndex] ?? 0;
|
|
3420
|
+
const glyphEnd = startIndices[rowIndex + 1] ?? glyphStart;
|
|
3421
|
+
const glyphRowLength = glyphEnd - glyphStart;
|
|
3422
|
+
if (nullValue && !isArrowDataRowValid(data, localRowIndex)) {
|
|
3423
|
+
for (let glyphIndex = glyphStart; glyphIndex < glyphEnd; glyphIndex++) {
|
|
3424
|
+
expandedValues.set(nullValue, glyphIndex * 4);
|
|
3425
|
+
}
|
|
3426
|
+
continue;
|
|
3427
|
+
}
|
|
3428
|
+
const colorStart = (valueOffsets[localRowIndex] ?? firstElementOffset) - firstElementOffset;
|
|
3429
|
+
const colorEnd = (valueOffsets[localRowIndex + 1] ?? colorStart) - firstElementOffset;
|
|
3430
|
+
|
|
3431
|
+
if (colorEnd - colorStart !== glyphRowLength) {
|
|
3432
|
+
throw new Error(
|
|
3433
|
+
'ArrowTextModel character colors must provide one color per UTF-8 code point'
|
|
3434
|
+
);
|
|
3435
|
+
}
|
|
3436
|
+
|
|
3437
|
+
expandedValues.set(
|
|
3438
|
+
values.subarray(valueOffset + colorStart * 4, valueOffset + colorEnd * 4),
|
|
3439
|
+
glyphStart * 4
|
|
3440
|
+
);
|
|
3441
|
+
}
|
|
3442
|
+
rowIndexBase += data.length;
|
|
3443
|
+
}
|
|
3444
|
+
|
|
3445
|
+
return makeArrowFixedSizeListVector(new Uint8(), 4, expandedValues);
|
|
3446
|
+
}
|
|
3447
|
+
|
|
3448
|
+
function getArrowTextExpansionNullValue(
|
|
3449
|
+
fieldName: string,
|
|
3450
|
+
props: {
|
|
3451
|
+
color?: [number, number, number, number];
|
|
3452
|
+
angle?: number;
|
|
3453
|
+
size?: number;
|
|
3454
|
+
}
|
|
3455
|
+
): number | readonly number[] | undefined {
|
|
3456
|
+
switch (fieldName) {
|
|
3457
|
+
case 'colors':
|
|
3458
|
+
return props.color;
|
|
3459
|
+
case 'angles':
|
|
3460
|
+
return props.angle;
|
|
3461
|
+
case 'sizes':
|
|
3462
|
+
return props.size;
|
|
3463
|
+
default:
|
|
3464
|
+
return undefined;
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
function isArrowDataRowValid(data: Data, localRowIndex: number): boolean {
|
|
3469
|
+
if (data.nullCount === 0 || !data.nullBitmap) {
|
|
3470
|
+
return true;
|
|
3471
|
+
}
|
|
3472
|
+
const bitmapIndex = (data.offset ?? 0) + localRowIndex;
|
|
3473
|
+
const bitmapByte = data.nullBitmap[bitmapIndex >> 3] ?? 0;
|
|
3474
|
+
return (bitmapByte & (1 << (bitmapIndex & 7))) !== 0;
|
|
3475
|
+
}
|
|
3476
|
+
|
|
3477
|
+
function makeNumericArrowVector<TypeT extends NumericArrowType>(
|
|
3478
|
+
type: TypeT,
|
|
3479
|
+
data: TypeT['TArray']
|
|
3480
|
+
): Vector<TypeT> {
|
|
3481
|
+
const makeNumericData = makeData as <NumericTypeT extends NumericArrowType>(props: {
|
|
3482
|
+
type: NumericTypeT;
|
|
3483
|
+
length: number;
|
|
3484
|
+
data: NumericTypeT['TArray'];
|
|
3485
|
+
}) => Data<NumericTypeT>;
|
|
3486
|
+
return makeVector(
|
|
3487
|
+
makeNumericData({
|
|
3488
|
+
type,
|
|
3489
|
+
length: data.length,
|
|
3490
|
+
data
|
|
3491
|
+
})
|
|
3492
|
+
);
|
|
3493
|
+
}
|
|
3494
|
+
|
|
3495
|
+
/** Appends one glyph layout to another while preserving global row/glyph offsets. */
|
|
3496
|
+
export function appendTextGlyphLayout(
|
|
3497
|
+
glyphLayout: TextGlyphLayout,
|
|
3498
|
+
appendedGlyphLayout: TextGlyphLayout
|
|
3499
|
+
): TextGlyphLayout {
|
|
3500
|
+
const nextStartIndices = [
|
|
3501
|
+
...glyphLayout.startIndices,
|
|
3502
|
+
...appendedGlyphLayout.startIndices
|
|
3503
|
+
.slice(1)
|
|
3504
|
+
.map(startIndex => startIndex + glyphLayout.glyphCount)
|
|
3505
|
+
];
|
|
3506
|
+
const glyphOffsets = new Int16Array(
|
|
3507
|
+
glyphLayout.glyphOffsets.length + appendedGlyphLayout.glyphOffsets.length
|
|
3508
|
+
);
|
|
3509
|
+
glyphOffsets.set(glyphLayout.glyphOffsets);
|
|
3510
|
+
glyphOffsets.set(appendedGlyphLayout.glyphOffsets, glyphLayout.glyphOffsets.length);
|
|
3511
|
+
const glyphFrames = new Uint16Array(
|
|
3512
|
+
glyphLayout.glyphFrames.length + appendedGlyphLayout.glyphFrames.length
|
|
3513
|
+
);
|
|
3514
|
+
glyphFrames.set(glyphLayout.glyphFrames);
|
|
3515
|
+
glyphFrames.set(appendedGlyphLayout.glyphFrames, glyphLayout.glyphFrames.length);
|
|
3516
|
+
const glyphPages = new Uint16Array(
|
|
3517
|
+
glyphLayout.glyphPages.length + appendedGlyphLayout.glyphPages.length
|
|
3518
|
+
);
|
|
3519
|
+
glyphPages.set(glyphLayout.glyphPages);
|
|
3520
|
+
glyphPages.set(appendedGlyphLayout.glyphPages, glyphLayout.glyphPages.length);
|
|
3521
|
+
const rowAdvances = new Float32Array(
|
|
3522
|
+
glyphLayout.rowAdvances.length + appendedGlyphLayout.rowAdvances.length
|
|
3523
|
+
);
|
|
3524
|
+
rowAdvances.set(glyphLayout.rowAdvances);
|
|
3525
|
+
rowAdvances.set(appendedGlyphLayout.rowAdvances, glyphLayout.rowAdvances.length);
|
|
3526
|
+
const rowBounds = new Float32Array(
|
|
3527
|
+
glyphLayout.rowBounds.length + appendedGlyphLayout.rowBounds.length
|
|
3528
|
+
);
|
|
3529
|
+
rowBounds.set(glyphLayout.rowBounds);
|
|
3530
|
+
rowBounds.set(appendedGlyphLayout.rowBounds, glyphLayout.rowBounds.length);
|
|
3531
|
+
return {
|
|
3532
|
+
startIndices: nextStartIndices,
|
|
3533
|
+
glyphCount: glyphLayout.glyphCount + appendedGlyphLayout.glyphCount,
|
|
3534
|
+
glyphOffsets,
|
|
3535
|
+
glyphFrames,
|
|
3536
|
+
glyphPages,
|
|
3537
|
+
rowAdvances,
|
|
3538
|
+
rowBounds,
|
|
3539
|
+
characterSet: glyphLayout.characterSet
|
|
3540
|
+
};
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
function makeGlyphRowIndices(startIndices: number[], rowIndexBase: number = 0): Uint32Array {
|
|
3544
|
+
const glyphCount = startIndices[startIndices.length - 1] ?? 0;
|
|
3545
|
+
const rowIndices = new Uint32Array(glyphCount);
|
|
3546
|
+
for (let rowIndex = 0; rowIndex < startIndices.length - 1; rowIndex++) {
|
|
3547
|
+
rowIndices.fill(rowIndexBase + rowIndex, startIndices[rowIndex], startIndices[rowIndex + 1]);
|
|
3548
|
+
}
|
|
3549
|
+
return rowIndices;
|
|
3550
|
+
}
|
|
3551
|
+
|
|
3552
|
+
type NumericArray =
|
|
3553
|
+
| Float32Array
|
|
3554
|
+
| Int8Array
|
|
3555
|
+
| Int16Array
|
|
3556
|
+
| Int32Array
|
|
3557
|
+
| Uint8Array
|
|
3558
|
+
| Uint16Array
|
|
3559
|
+
| Uint32Array;
|
|
3560
|
+
|
|
3561
|
+
function getGeneratedAttributeByteLength(columns: Record<string, Vector>): number {
|
|
3562
|
+
let attributeByteLength = 0;
|
|
3563
|
+
for (const vector of Object.values(columns)) {
|
|
3564
|
+
if (isInstanceCompatibleArrowType(vector.type)) {
|
|
3565
|
+
attributeByteLength += (getArrowVectorBufferSource(vector) as NumericArray).byteLength;
|
|
3566
|
+
}
|
|
3567
|
+
}
|
|
3568
|
+
return attributeByteLength;
|
|
3569
|
+
}
|