@luma.gl/engine 10.0.0-alpha.4 → 10.0.0-alpha.5
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 +9 -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 +2 -1
- package/dist/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +9 -3
- package/dist/animation-loop/animation-loop.js.map +1 -1
- package/dist/animation-loop/animation-props.cjs +15 -0
- 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/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 +56 -12
- package/dist/compute/buffer-transform.js.map +1 -1
- package/dist/compute/computation.cjs +331 -0
- package/dist/compute/computation.d.ts +2 -4
- package/dist/compute/computation.d.ts.map +1 -1
- package/dist/compute/computation.js +3 -14
- 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 +11 -7
- package/dist/compute/texture-transform.d.ts.map +1 -1
- package/dist/compute/texture-transform.js +16 -6
- package/dist/compute/texture-transform.js.map +1 -1
- package/dist/controls/orbit-controls.cjs +283 -0
- package/dist/controls/orbit-controls.d.ts +2 -0
- package/dist/controls/orbit-controls.d.ts.map +1 -1
- package/dist/controls/orbit-controls.js +2 -1
- 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 +11756 -5632
- package/dist/dist.min.js +39 -35
- 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/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/geometry-primitives.cjs +189 -0
- package/dist/geometry/geometry-primitives.d.ts +6 -0
- package/dist/geometry/geometry-primitives.d.ts.map +1 -1
- package/dist/geometry/geometry-primitives.js +8 -0
- package/dist/geometry/geometry-primitives.js.map +1 -1
- package/dist/geometry/geometry-table.cjs +15 -0
- package/dist/geometry/geometry-utils.cjs +147 -0
- package/dist/geometry/geometry.cjs +90 -0
- package/dist/geometry/gpu-geometry.cjs +130 -0
- package/dist/geometry/gpu-vector-geometry-adapter.cjs +88 -0
- package/dist/geometry/gpu-vector-geometry-adapter.d.ts +5 -0
- package/dist/geometry/gpu-vector-geometry-adapter.d.ts.map +1 -0
- package/dist/geometry/gpu-vector-geometry-adapter.js +73 -0
- package/dist/geometry/gpu-vector-geometry-adapter.js.map +1 -0
- package/dist/geometry/gpu-vector-geometry.cjs +40 -0
- package/dist/geometry/gpu-vector-geometry.d.ts +21 -0
- package/dist/geometry/gpu-vector-geometry.d.ts.map +1 -0
- package/dist/geometry/gpu-vector-geometry.js +19 -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/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 +421 -0
- package/dist/graph/models/path/path-attribute-model.d.ts +142 -0
- package/dist/graph/models/path/path-attribute-model.d.ts.map +1 -0
- package/dist/graph/models/path/path-attribute-model.js +409 -0
- package/dist/graph/models/path/path-attribute-model.js.map +1 -0
- package/dist/graph/models/path/path-storage-model.cjs +711 -0
- package/dist/graph/models/path/path-storage-model.d.ts +174 -0
- package/dist/graph/models/path/path-storage-model.d.ts.map +1 -0
- package/dist/graph/models/path/path-storage-model.js +720 -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 +50 -0
- package/dist/graph/physics/index.cjs.map +6 -0
- package/dist/graph/physics/index.d.ts +12 -0
- package/dist/graph/physics/index.d.ts.map +1 -0
- package/dist/graph/physics/index.js +12 -0
- package/dist/graph/physics/index.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 +246 -0
- package/dist/graph/physics/scenegraph-instance.d.ts +59 -0
- package/dist/graph/physics/scenegraph-instance.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-instance.js +241 -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 +37 -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 +112 -0
- package/dist/graph/physics/scenegraph-publication.d.ts +23 -0
- package/dist/graph/physics/scenegraph-publication.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-publication.js +99 -0
- package/dist/graph/physics/scenegraph-publication.js.map +1 -0
- package/dist/graph/physics/scenegraph-session.cjs +256 -0
- package/dist/graph/physics/scenegraph-session.d.ts +68 -0
- package/dist/graph/physics/scenegraph-session.d.ts.map +1 -0
- package/dist/graph/physics/scenegraph-session.js +249 -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 +67 -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 +303 -9569
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +32 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -3
- 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/material/material-factory.cjs +99 -0
- package/dist/material/material-factory.d.ts +1 -1
- package/dist/material/material-factory.d.ts.map +1 -1
- package/dist/material/material.cjs +239 -0
- package/dist/material/material.d.ts +2 -2
- 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/gpu-vector-bindings.cjs +226 -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 +217 -0
- package/dist/model/gpu-vector-bindings.js.map +1 -0
- package/dist/model/gpu-vector-draw-batches.cjs +82 -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 +73 -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 +41 -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 +1264 -0
- package/dist/model/gpu-vector-model.d.ts +352 -0
- package/dist/model/gpu-vector-model.d.ts.map +1 -0
- package/dist/model/gpu-vector-model.js +1375 -0
- package/dist/model/gpu-vector-model.js.map +1 -0
- package/dist/model/model.cjs +134 -0
- package/dist/model/model.d.ts +21 -305
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +68 -1092
- 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 +1 -1
- 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/directional-light-model.cjs +45 -0
- package/dist/models/light-model-utils.cjs +426 -0
- package/dist/models/point-light-model.cjs +44 -0
- package/dist/models/spot-light-model.cjs +45 -0
- package/dist/modules/picking/color-picking.cjs +209 -0
- package/dist/modules/picking/color-picking.d.ts +1 -1
- package/dist/modules/picking/index-color-picking.cjs +230 -0
- package/dist/modules/picking/index-color-picking.d.ts +1 -1
- package/dist/modules/picking/index-picking.cjs +201 -0
- package/dist/modules/picking/index-picking.d.ts +1 -1
- package/dist/modules/picking/legacy-color-picking.cjs +28 -0
- package/dist/modules/picking/legacy-color-picking.d.ts +1 -1
- package/dist/modules/picking/legacy-picking-manager.cjs +92 -0
- 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 +1 -1
- 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 +1 -1
- package/dist/passes/get-fragment-shader.cjs +119 -0
- package/dist/passes/shader-pass-renderer.cjs +722 -0
- package/dist/passes/shader-pass-renderer.d.ts +2 -2
- package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
- package/dist/passes/shader-pass-renderer.js +1 -1
- package/dist/passes/shader-pass-renderer.js.map +1 -1
- package/dist/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/group-node.cjs +129 -0
- 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/shader-inputs.cjs +231 -0
- package/dist/shader-inputs.d.ts +1 -1
- package/dist/shader-inputs.d.ts.map +1 -1
- package/dist/utils/buffer-layout-helper.cjs +52 -0
- package/dist/utils/buffer-layout-order.cjs +37 -0
- package/dist/utils/deep-equal.cjs +65 -0
- package/dist/utils/get-platform-info.cjs +21 -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/uid.cjs +32 -0
- package/package.json +45 -7
- 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 +10 -3
- 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 +71 -16
- package/src/compute/computation.ts +4 -19
- package/src/compute/texture-transform.ts +25 -12
- package/src/controls/orbit-controls.ts +4 -1
- 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/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/geometry-primitives.ts +11 -0
- package/src/geometry/gpu-vector-geometry-adapter.ts +78 -0
- package/src/geometry/gpu-vector-geometry.ts +33 -0
- package/src/geometry/ring-geometry.ts +117 -0
- package/src/graph/models/index.ts +45 -0
- package/src/graph/models/path/path-attribute-model.ts +563 -0
- package/src/graph/models/path/path-storage-model.ts +996 -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 +24 -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 +296 -0
- package/src/graph/physics/scenegraph-joints.ts +37 -0
- package/src/graph/physics/scenegraph-motion.ts +175 -0
- package/src/graph/physics/scenegraph-properties.ts +241 -0
- package/src/graph/physics/scenegraph-publication.ts +116 -0
- package/src/graph/physics/scenegraph-session.ts +317 -0
- package/src/graph/tables/gpu-table-geometry.ts +88 -0
- package/src/graph/tables/gpu-table-model.ts +661 -0
- package/src/graph/tables/gpu-table-transform.ts +497 -0
- package/src/graph/tables/index.ts +18 -0
- package/src/index.ts +130 -13
- package/src/interactivity/interactivity.ts +670 -0
- package/src/interactivity/physics.ts +19 -0
- package/src/material/material-factory.ts +1 -1
- package/src/material/material.ts +2 -2
- package/src/model/gpu-vector-bindings.ts +276 -0
- package/src/model/gpu-vector-draw-batches.ts +116 -0
- package/src/model/gpu-vector-model-batches.ts +142 -0
- package/src/model/gpu-vector-model.ts +1819 -0
- package/src/model/model.ts +91 -1444
- package/src/model/split-uniforms-and-bindings.ts +6 -3
- package/src/models/billboard-texture-model.ts +1 -1
- package/src/modules/picking/legacy-picking-manager.ts +1 -1
- package/src/modules/picking/picking-uniforms.ts +1 -1
- package/src/passes/shader-pass-renderer.ts +2 -2
- 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/physics-transforms.ts +82 -0
- package/src/scenegraph/published-transforms.ts +18 -0
- package/src/shader-inputs.ts +1 -1
- package/src/utils/get-platform-info.ts +5 -0
- package/src/utils/gpu-vector-batch-structure.ts +36 -0
- package/dist/compute/kernel.d.ts +0 -54
- package/dist/compute/kernel.d.ts.map +0 -1
- package/dist/compute/kernel.js +0 -103
- package/dist/compute/kernel.js.map +0 -1
- package/dist/compute/render-kernel.d.ts +0 -65
- package/dist/compute/render-kernel.d.ts.map +0 -1
- package/dist/compute/render-kernel.js +0 -129
- package/dist/compute/render-kernel.js.map +0 -1
- package/src/compute/kernel.ts +0 -146
- package/src/compute/render-kernel.ts +0 -192
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type Buffer,
|
|
7
|
+
type BufferLayout,
|
|
8
|
+
type Device,
|
|
9
|
+
type RenderPass,
|
|
10
|
+
type ShaderLayout
|
|
11
|
+
} from '@luma.gl/core';
|
|
12
|
+
import {GPUTableModel, type GPUTableModelProps} from '@luma.gl/engine/tables';
|
|
13
|
+
import type {GPUTable} from '@luma.gl/graph/gpu-tables';
|
|
14
|
+
import type {GPUVector} from '@luma.gl/gpgpu/gpu-data';
|
|
15
|
+
import {getGPUDataBuffersForLayout, getGPUDataByteOffsetsForLayout} from '@luma.gl/gpgpu/gpu-data';
|
|
16
|
+
import {isVertexListGPUVectorFormat, type VertexList} from '@luma.gl/gpgpu/gpu-data';
|
|
17
|
+
import type {GeneratedBufferBatch} from '@luma.gl/graph/gpu-tables';
|
|
18
|
+
import {type GPUInputSchema, validateGPUInputVectors} from '@luma.gl/graph/gpu-tables';
|
|
19
|
+
|
|
20
|
+
const SEGMENT_START_POSITIONS_COLUMN = 'segmentStartPositions';
|
|
21
|
+
const SEGMENT_END_POSITIONS_COLUMN = 'segmentEndPositions';
|
|
22
|
+
const SEGMENT_PREVIOUS_POSITIONS_COLUMN = 'segmentPreviousPositions';
|
|
23
|
+
const SEGMENT_NEXT_POSITIONS_COLUMN = 'segmentNextPositions';
|
|
24
|
+
const SEGMENT_START_COLORS_COLUMN = 'segmentStartColors';
|
|
25
|
+
const SEGMENT_END_COLORS_COLUMN = 'segmentEndColors';
|
|
26
|
+
const SEGMENT_FLAGS_COLUMN = 'segmentFlags';
|
|
27
|
+
const ROW_INDICES_COLUMN = 'rowIndices';
|
|
28
|
+
const EXPANDED_PATH_VERTEX_DATA = 'expandedPathVertexData';
|
|
29
|
+
const PATH_VIEW_ORIGINS_COLUMN = 'pathViewOrigins';
|
|
30
|
+
const PATH_VIEW_ORIGIN_DATA = 'pathViewOriginData';
|
|
31
|
+
|
|
32
|
+
const EXPANDED_PATH_VERTEX_BYTE_STRIDE =
|
|
33
|
+
Float32Array.BYTES_PER_ELEMENT * 16 + Uint32Array.BYTES_PER_ELEMENT * 4;
|
|
34
|
+
const SEGMENT_END_POSITIONS_BYTE_OFFSET = Float32Array.BYTES_PER_ELEMENT * 4;
|
|
35
|
+
const SEGMENT_PREVIOUS_POSITIONS_BYTE_OFFSET = Float32Array.BYTES_PER_ELEMENT * 8;
|
|
36
|
+
const SEGMENT_NEXT_POSITIONS_BYTE_OFFSET = Float32Array.BYTES_PER_ELEMENT * 12;
|
|
37
|
+
const SEGMENT_FLAGS_BYTE_OFFSET = Float32Array.BYTES_PER_ELEMENT * 16;
|
|
38
|
+
const ROW_INDICES_BYTE_OFFSET = SEGMENT_FLAGS_BYTE_OFFSET + Uint32Array.BYTES_PER_ELEMENT;
|
|
39
|
+
const SEGMENT_START_COLORS_BYTE_OFFSET = ROW_INDICES_BYTE_OFFSET + Uint32Array.BYTES_PER_ELEMENT;
|
|
40
|
+
const SEGMENT_END_COLORS_BYTE_OFFSET =
|
|
41
|
+
SEGMENT_START_COLORS_BYTE_OFFSET + Uint32Array.BYTES_PER_ELEMENT;
|
|
42
|
+
|
|
43
|
+
/** Prepared GPU inputs consumed by the attribute-backed path model. */
|
|
44
|
+
export const PATH_ATTRIBUTE_GPU_INPUT_SCHEMA = [
|
|
45
|
+
{
|
|
46
|
+
columnName: 'paths',
|
|
47
|
+
kind: 'positions',
|
|
48
|
+
required: true,
|
|
49
|
+
formats: ['vertex-list<float32x2>', 'vertex-list<float32x3>', 'vertex-list<float32x4>']
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
columnName: 'colors',
|
|
53
|
+
kind: 'colors',
|
|
54
|
+
required: false,
|
|
55
|
+
formats: ['unorm8x4', 'vertex-list<unorm8x4>']
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
columnName: 'widths',
|
|
59
|
+
kind: 'scalars',
|
|
60
|
+
required: false,
|
|
61
|
+
formats: ['float32']
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
columnName: 'viewOrigins',
|
|
65
|
+
kind: 'positions',
|
|
66
|
+
required: false,
|
|
67
|
+
formats: ['float32x4'],
|
|
68
|
+
internal: true
|
|
69
|
+
}
|
|
70
|
+
] as const satisfies GPUInputSchema;
|
|
71
|
+
|
|
72
|
+
const DEFAULT_PATH_SHADER_LAYOUT: ShaderLayout = {
|
|
73
|
+
attributes: [
|
|
74
|
+
{name: SEGMENT_START_POSITIONS_COLUMN, location: 0, type: 'vec4<f32>', stepMode: 'instance'},
|
|
75
|
+
{name: SEGMENT_END_POSITIONS_COLUMN, location: 1, type: 'vec4<f32>', stepMode: 'instance'},
|
|
76
|
+
{name: SEGMENT_START_COLORS_COLUMN, location: 2, type: 'u32', stepMode: 'instance'},
|
|
77
|
+
{name: SEGMENT_END_COLORS_COLUMN, location: 3, type: 'u32', stepMode: 'instance'},
|
|
78
|
+
{name: PATH_VIEW_ORIGINS_COLUMN, location: 4, type: 'vec4<f32>', stepMode: 'instance'}
|
|
79
|
+
],
|
|
80
|
+
bindings: []
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const DEFAULT_PATH_VS = `#version 300 es
|
|
84
|
+
precision highp float;
|
|
85
|
+
|
|
86
|
+
in vec4 segmentStartPositions;
|
|
87
|
+
in vec4 segmentEndPositions;
|
|
88
|
+
in uint segmentStartColors;
|
|
89
|
+
in uint segmentEndColors;
|
|
90
|
+
in vec4 pathViewOrigins;
|
|
91
|
+
|
|
92
|
+
void main() {
|
|
93
|
+
vec4 pathDelta = gl_VertexID % 2 == 0 ? segmentStartPositions : segmentEndPositions;
|
|
94
|
+
vec4 pathPosition = pathViewOrigins + pathDelta;
|
|
95
|
+
gl_Position = vec4(pathPosition.xyz, 1.0);
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
const DEFAULT_PATH_FS = `#version 300 es
|
|
100
|
+
precision highp float;
|
|
101
|
+
|
|
102
|
+
out vec4 fragColor;
|
|
103
|
+
|
|
104
|
+
void main() {
|
|
105
|
+
fragColor = vec4(1.0);
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
|
|
109
|
+
/** CPU-generated segment geometry diagnostics retained by prepared path render state. */
|
|
110
|
+
export type PathSegmentLayout = {
|
|
111
|
+
/** Cumulative segment offsets, length = source path rows + 1. */
|
|
112
|
+
startIndices: number[];
|
|
113
|
+
/** Number of generated segment records. */
|
|
114
|
+
segmentCount: number;
|
|
115
|
+
/** Generated segment starts, padded to four Float32 lanes per segment. */
|
|
116
|
+
segmentStartPositions: Float32Array;
|
|
117
|
+
/** Generated segment ends, padded to four Float32 lanes per segment. */
|
|
118
|
+
segmentEndPositions: Float32Array;
|
|
119
|
+
/** Previous coordinate used for join/cap decisions, padded to four Float32 lanes. */
|
|
120
|
+
segmentPreviousPositions: Float32Array;
|
|
121
|
+
/** Next coordinate used for join/cap decisions, padded to four Float32 lanes. */
|
|
122
|
+
segmentNextPositions: Float32Array;
|
|
123
|
+
/** Per-segment view-space path origin, padded to four Float32 lanes. */
|
|
124
|
+
segmentViewOrigins: Float32Array;
|
|
125
|
+
/** Packed first/last/closed flags for each generated segment. */
|
|
126
|
+
segmentFlags: Uint32Array;
|
|
127
|
+
/** Packed RGBA8 color at each generated segment start point. */
|
|
128
|
+
segmentStartColors: Uint32Array;
|
|
129
|
+
/** Packed RGBA8 color at each generated segment end point. */
|
|
130
|
+
segmentEndColors: Uint32Array;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/** Generated render-batch state consumed by {@link PathAttributeModel}. */
|
|
134
|
+
export type PathRenderBatchState = {
|
|
135
|
+
/** First source path row included in this generated render batch. */
|
|
136
|
+
rowStart: number;
|
|
137
|
+
/** Source path row after the last row included in this generated render batch. */
|
|
138
|
+
rowEnd: number;
|
|
139
|
+
/** Generated segment records drawn by this render batch. */
|
|
140
|
+
segmentCount: number;
|
|
141
|
+
/** Generated packed segment vertex attribute buffer. */
|
|
142
|
+
expandedPathVertexData: Buffer;
|
|
143
|
+
/** Generated per-segment Float32 view-origin attribute buffer. */
|
|
144
|
+
pathViewOriginData: Buffer;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/** GPU-only path render state prepared before constructing {@link PathAttributeModel}. */
|
|
148
|
+
export type PathAttributeModelState = {
|
|
149
|
+
/** Generated path segment layout diagnostics. */
|
|
150
|
+
segmentLayout: PathSegmentLayout;
|
|
151
|
+
/** Generated render batches preserved for device buffer-size limits. */
|
|
152
|
+
renderBatches: PathRenderBatchState[];
|
|
153
|
+
/** Planning metadata for generated render batches. */
|
|
154
|
+
generatedBufferBatches: GeneratedBufferBatch[];
|
|
155
|
+
/** First generated packed segment vertex attribute buffer. */
|
|
156
|
+
expandedPathVertexData: Buffer;
|
|
157
|
+
/** First generated per-segment Float32 view-origin attribute buffer. */
|
|
158
|
+
pathViewOriginData: Buffer;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/** Props for the GPU-only attribute-backed path renderer. */
|
|
162
|
+
export type PathAttributeModelProps = Omit<GPUTableModelProps, 'table' | 'tableCount'> & {
|
|
163
|
+
/** GPU table supplying already prepared segment-compatible row attributes. */
|
|
164
|
+
table: GPUTable;
|
|
165
|
+
/** Whether the model should destroy its prepared GPU table. Defaults to `false`. */
|
|
166
|
+
ownsTable?: boolean;
|
|
167
|
+
/** Variable-length Float32 XY, XYZ, or XYZM path coordinates, one GPU row per path. */
|
|
168
|
+
paths: GPUVector<VertexList<'float32x2' | 'float32x3' | 'float32x4'>>;
|
|
169
|
+
/** Optional packed RGBA8 path colors, either one per path row or one per path vertex. */
|
|
170
|
+
colors?: GPUVector<'unorm8x4' | VertexList<'unorm8x4'>>;
|
|
171
|
+
/** Optional per-path widths, one GPU row per path. */
|
|
172
|
+
widths?: GPUVector<'float32'>;
|
|
173
|
+
/** Optional per-path view-space origins, one GPU row per path. */
|
|
174
|
+
viewOrigins?: GPUVector<'float32x4'>;
|
|
175
|
+
/** Prepared GPU-only path expansion state. */
|
|
176
|
+
pathState: PathAttributeModelState;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
type PreparedPathAttributeModel = {
|
|
180
|
+
modelProps: GPUTableModelProps;
|
|
181
|
+
segmentLayout: PathSegmentLayout;
|
|
182
|
+
expandedPathVertexData: Buffer;
|
|
183
|
+
pathViewOriginData: Buffer;
|
|
184
|
+
renderBatches: PathRenderBatchState[];
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
/** GPU-only path renderer that consumes already prepared path GPU vectors and render state. */
|
|
188
|
+
export class PathAttributeModel extends GPUTableModel {
|
|
189
|
+
/** Prepared GPU vectors consumed by the attribute-backed path model. */
|
|
190
|
+
static readonly gpuInputSchema = PATH_ATTRIBUTE_GPU_INPUT_SCHEMA;
|
|
191
|
+
|
|
192
|
+
/** Generated path segment layout diagnostics. */
|
|
193
|
+
segmentLayout: PathSegmentLayout;
|
|
194
|
+
/** First generated packed segment vertex attribute buffer. */
|
|
195
|
+
expandedPathVertexData: Buffer;
|
|
196
|
+
/** First generated per-segment Float32 view-origin attribute buffer. */
|
|
197
|
+
pathViewOriginData: Buffer;
|
|
198
|
+
/** Generated render batches preserved for device buffer-size limits. */
|
|
199
|
+
renderBatches: PathRenderBatchState[];
|
|
200
|
+
private pathProps: PathAttributeModelProps;
|
|
201
|
+
private pathShaderLayout: ShaderLayout;
|
|
202
|
+
private pathTable: GPUTable;
|
|
203
|
+
private ownsPathTable: boolean;
|
|
204
|
+
|
|
205
|
+
/** Creates an attribute-backed path model from prepared GPU props. */
|
|
206
|
+
constructor(device: Device, props: PathAttributeModelProps) {
|
|
207
|
+
const prepared = preparePathAttributeModel(props);
|
|
208
|
+
super(device, prepared.modelProps);
|
|
209
|
+
this.pathTable = props.table;
|
|
210
|
+
this.ownsPathTable = props.ownsTable ?? false;
|
|
211
|
+
this.pathProps = props;
|
|
212
|
+
this.pathShaderLayout = prepared.modelProps.shaderLayout!;
|
|
213
|
+
this.segmentLayout = prepared.segmentLayout;
|
|
214
|
+
this.expandedPathVertexData = prepared.expandedPathVertexData;
|
|
215
|
+
this.pathViewOriginData = prepared.pathViewOriginData;
|
|
216
|
+
this.renderBatches = prepared.renderBatches;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** Replace generated segment records with new prepared GPU path state. */
|
|
220
|
+
override setProps(props: Partial<PathAttributeModelProps>): void {
|
|
221
|
+
const nextProps = {...this.pathProps, ...props};
|
|
222
|
+
const shouldRebuild =
|
|
223
|
+
props.pathState !== undefined || props.table !== undefined || props.ownsTable !== undefined;
|
|
224
|
+
|
|
225
|
+
this.pathProps = nextProps;
|
|
226
|
+
if (!shouldRebuild) {
|
|
227
|
+
super.setProps({});
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const prepared = preparePathAttributeModel(nextProps);
|
|
232
|
+
this.segmentLayout = prepared.segmentLayout;
|
|
233
|
+
this.expandedPathVertexData = prepared.expandedPathVertexData;
|
|
234
|
+
this.pathViewOriginData = prepared.pathViewOriginData;
|
|
235
|
+
this.renderBatches = prepared.renderBatches;
|
|
236
|
+
this.pathShaderLayout = prepared.modelProps.shaderLayout!;
|
|
237
|
+
|
|
238
|
+
const previousPathTable = this.pathTable;
|
|
239
|
+
const previousOwnsPathTable = this.ownsPathTable;
|
|
240
|
+
this.pathTable = nextProps.table;
|
|
241
|
+
this.ownsPathTable = nextProps.ownsTable ?? false;
|
|
242
|
+
super.setProps({table: this.pathTable});
|
|
243
|
+
if (previousOwnsPathTable && previousPathTable !== this.pathTable) {
|
|
244
|
+
previousPathTable.destroy();
|
|
245
|
+
}
|
|
246
|
+
this.setAttributes(
|
|
247
|
+
getPathAttributeModelAttributes(prepared.modelProps.shaderLayout!, prepared)
|
|
248
|
+
);
|
|
249
|
+
this.setInstanceCount(prepared.segmentLayout.segmentCount);
|
|
250
|
+
this.setNeedsRedraw('Path segment state updated');
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Draws each generated path render batch against the supplied render pass. */
|
|
254
|
+
override draw(renderPass: RenderPass): boolean {
|
|
255
|
+
const tableBatches = this.table?.batches || [];
|
|
256
|
+
if (tableBatches.length > 0 && tableBatches.length !== this.renderBatches.length) {
|
|
257
|
+
throw new Error(
|
|
258
|
+
'PathAttributeModel draw batches must align with generated path render batches'
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
let drawSuccess = true;
|
|
263
|
+
try {
|
|
264
|
+
for (const [batchIndex, renderBatch] of this.renderBatches.entries()) {
|
|
265
|
+
const tableBatch = tableBatches[batchIndex];
|
|
266
|
+
this.setAttributes(
|
|
267
|
+
{
|
|
268
|
+
...(tableBatch
|
|
269
|
+
? getGPUDataBuffersForLayout(tableBatch.bufferLayout, tableBatch.gpuData)
|
|
270
|
+
: {}),
|
|
271
|
+
...getPathAttributeModelBatchAttributes(this.pathShaderLayout, renderBatch)
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
byteOffsets: tableBatch
|
|
275
|
+
? getGPUDataByteOffsetsForLayout(tableBatch.bufferLayout, tableBatch.gpuData)
|
|
276
|
+
: {}
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
this.setInstanceCount(renderBatch.segmentCount);
|
|
280
|
+
drawSuccess = super.draw(renderPass) && drawSuccess;
|
|
281
|
+
}
|
|
282
|
+
} finally {
|
|
283
|
+
const firstBatch = this.table?.batches[0];
|
|
284
|
+
this.setAttributes(
|
|
285
|
+
{
|
|
286
|
+
...getPathTableAttributes(this.table),
|
|
287
|
+
...getPathAttributeModelAttributes(this.pathShaderLayout, {
|
|
288
|
+
expandedPathVertexData: this.expandedPathVertexData,
|
|
289
|
+
pathViewOriginData: this.pathViewOriginData
|
|
290
|
+
})
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
byteOffsets: firstBatch
|
|
294
|
+
? getGPUDataByteOffsetsForLayout(firstBatch.bufferLayout, firstBatch.gpuData)
|
|
295
|
+
: {}
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
this.setInstanceCount(this.segmentLayout.segmentCount);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return drawSuccess;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/** Releases inherited model resources. Prepared GPU path state remains caller-owned. */
|
|
305
|
+
override destroy(): void {
|
|
306
|
+
super.destroy();
|
|
307
|
+
if (this.ownsPathTable) {
|
|
308
|
+
this.pathTable.destroy();
|
|
309
|
+
this.ownsPathTable = false;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function getPathTableAttributes(table?: GPUTable): ReturnType<typeof getGPUDataBuffersForLayout> {
|
|
315
|
+
const firstBatch = table?.batches[0];
|
|
316
|
+
if (!firstBatch) {
|
|
317
|
+
return {};
|
|
318
|
+
}
|
|
319
|
+
return getGPUDataBuffersForLayout(firstBatch.bufferLayout, firstBatch.gpuData);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function preparePathAttributeModel(props: PathAttributeModelProps): PreparedPathAttributeModel {
|
|
323
|
+
assertArrowPathVectorTypes(props);
|
|
324
|
+
assertArrowPathVectorRowAlignment(props);
|
|
325
|
+
assertPathPreparedStateAlignment(props);
|
|
326
|
+
const shaderLayout = props.shaderLayout ?? DEFAULT_PATH_SHADER_LAYOUT;
|
|
327
|
+
const firstRenderBatch = props.pathState.renderBatches[0];
|
|
328
|
+
if (!firstRenderBatch) {
|
|
329
|
+
throw new Error('PathAttributeModel requires at least one prepared path render batch');
|
|
330
|
+
}
|
|
331
|
+
const explicitShaderAttributeNames = getExplicitShaderAttributeNames(props);
|
|
332
|
+
|
|
333
|
+
return {
|
|
334
|
+
modelProps: {
|
|
335
|
+
...props,
|
|
336
|
+
vs: props.vs ?? DEFAULT_PATH_VS,
|
|
337
|
+
fs: props.fs ?? DEFAULT_PATH_FS,
|
|
338
|
+
shaderLayout,
|
|
339
|
+
attributes: {
|
|
340
|
+
...(props.attributes || {}),
|
|
341
|
+
...getPathAttributeModelBatchAttributes(shaderLayout, firstRenderBatch)
|
|
342
|
+
},
|
|
343
|
+
bufferLayout: [
|
|
344
|
+
...(props.bufferLayout || []),
|
|
345
|
+
...createArrowPathBufferLayouts(shaderLayout, explicitShaderAttributeNames)
|
|
346
|
+
],
|
|
347
|
+
topology: props.topology ?? 'line-list',
|
|
348
|
+
vertexCount: props.vertexCount ?? 2,
|
|
349
|
+
instanceCount: props.pathState.segmentLayout.segmentCount,
|
|
350
|
+
table: props.table,
|
|
351
|
+
tableCount: 'none'
|
|
352
|
+
},
|
|
353
|
+
segmentLayout: props.pathState.segmentLayout,
|
|
354
|
+
expandedPathVertexData: firstRenderBatch.expandedPathVertexData,
|
|
355
|
+
pathViewOriginData: firstRenderBatch.pathViewOriginData,
|
|
356
|
+
renderBatches: props.pathState.renderBatches
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function assertArrowPathVectorTypes(props: PathAttributeModelProps): void {
|
|
361
|
+
validateGPUInputVectors('PathAttributeModel', PathAttributeModel.gpuInputSchema, {
|
|
362
|
+
paths: props.paths,
|
|
363
|
+
colors: props.colors,
|
|
364
|
+
widths: props.widths,
|
|
365
|
+
viewOrigins: props.viewOrigins
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function assertArrowPathVectorRowAlignment(props: PathAttributeModelProps): void {
|
|
370
|
+
const rowInputs = getArrowPathRowInputs(props);
|
|
371
|
+
const [referenceName, referenceVector] = rowInputs[0];
|
|
372
|
+
for (const [name, vector] of rowInputs.slice(1)) {
|
|
373
|
+
if (vector.length !== referenceVector.length) {
|
|
374
|
+
throw new Error(
|
|
375
|
+
`PathAttributeModel ${name} rows must match ${referenceName} rows (${vector.length} !== ${referenceVector.length})`
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
if (vector.data.length !== referenceVector.data.length) {
|
|
379
|
+
throw new Error(
|
|
380
|
+
`PathAttributeModel ${name} batch count must match ${referenceName} batch count`
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
for (let batchIndex = 0; batchIndex < vector.data.length; batchIndex++) {
|
|
384
|
+
if (vector.data[batchIndex].length !== referenceVector.data[batchIndex].length) {
|
|
385
|
+
throw new Error(
|
|
386
|
+
`PathAttributeModel ${name} batch ${batchIndex} rows must match ${referenceName}`
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
if (props.colors && isPathVertexColorGPUVector(props.colors)) {
|
|
392
|
+
assertPathVertexColorGPUVectorAlignment(props.paths, props.colors);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function getArrowPathRowInputs(props: PathAttributeModelProps): Array<[string, GPUVector]> {
|
|
397
|
+
return [
|
|
398
|
+
['paths', props.paths],
|
|
399
|
+
['colors', props.colors],
|
|
400
|
+
['widths', props.widths],
|
|
401
|
+
['viewOrigins', props.viewOrigins]
|
|
402
|
+
].filter(([, vector]) => vector !== undefined) as Array<[string, GPUVector]>;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function isPathVertexColorGPUVector(
|
|
406
|
+
colors: NonNullable<PathAttributeModelProps['colors']>
|
|
407
|
+
): boolean {
|
|
408
|
+
return colors.format !== undefined && isVertexListGPUVectorFormat(colors.format);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function assertPathPreparedStateAlignment(props: PathAttributeModelProps): void {
|
|
412
|
+
if (!props.pathState) {
|
|
413
|
+
throw new Error('PathAttributeModel requires prepared pathState');
|
|
414
|
+
}
|
|
415
|
+
const preparedRowCount = props.pathState.segmentLayout.startIndices.length - 1;
|
|
416
|
+
if (preparedRowCount !== props.paths.length) {
|
|
417
|
+
throw new Error(
|
|
418
|
+
`PathAttributeModel prepared path rows must match path GPU rows (${preparedRowCount} !== ${props.paths.length})`
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function assertPathVertexColorGPUVectorAlignment(paths: GPUVector, colors: GPUVector): void {
|
|
424
|
+
for (let batchIndex = 0; batchIndex < paths.data.length; batchIndex++) {
|
|
425
|
+
const pathOffsets = paths.data[batchIndex]?.valueOffsets;
|
|
426
|
+
const colorOffsets = colors.data[batchIndex]?.valueOffsets;
|
|
427
|
+
if (!pathOffsets || !colorOffsets || !arePathOffsetsEqual(pathOffsets, colorOffsets)) {
|
|
428
|
+
throw new Error('PathAttributeModel vertex colors must align with path vertex offsets');
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function arePathOffsetsEqual(left: Int32Array, right: Int32Array): boolean {
|
|
434
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function getExplicitShaderAttributeNames(props: PathAttributeModelProps): Set<string> {
|
|
438
|
+
const attributeNames = new Set(Object.keys(props.constantAttributes || {}));
|
|
439
|
+
for (const layout of props.bufferLayout || []) {
|
|
440
|
+
if (layout.attributes) {
|
|
441
|
+
for (const attribute of layout.attributes) {
|
|
442
|
+
attributeNames.add(attribute.attribute);
|
|
443
|
+
}
|
|
444
|
+
} else {
|
|
445
|
+
attributeNames.add(layout.name);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return attributeNames;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function createArrowPathBufferLayouts(
|
|
452
|
+
shaderLayout: ShaderLayout,
|
|
453
|
+
excludedAttributeNames: Set<string>
|
|
454
|
+
): BufferLayout[] {
|
|
455
|
+
const shaderAttributeNames = new Set(
|
|
456
|
+
shaderLayout.attributes
|
|
457
|
+
.map(attribute => attribute.name)
|
|
458
|
+
.filter(attributeName => !excludedAttributeNames.has(attributeName))
|
|
459
|
+
);
|
|
460
|
+
const expandedAttributes: NonNullable<BufferLayout['attributes']> = [];
|
|
461
|
+
if (shaderAttributeNames.has(SEGMENT_START_POSITIONS_COLUMN)) {
|
|
462
|
+
expandedAttributes.push({
|
|
463
|
+
attribute: SEGMENT_START_POSITIONS_COLUMN,
|
|
464
|
+
format: 'float32x4',
|
|
465
|
+
byteOffset: 0
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
if (shaderAttributeNames.has(SEGMENT_END_POSITIONS_COLUMN)) {
|
|
469
|
+
expandedAttributes.push({
|
|
470
|
+
attribute: SEGMENT_END_POSITIONS_COLUMN,
|
|
471
|
+
format: 'float32x4',
|
|
472
|
+
byteOffset: SEGMENT_END_POSITIONS_BYTE_OFFSET
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
if (shaderAttributeNames.has(SEGMENT_PREVIOUS_POSITIONS_COLUMN)) {
|
|
476
|
+
expandedAttributes.push({
|
|
477
|
+
attribute: SEGMENT_PREVIOUS_POSITIONS_COLUMN,
|
|
478
|
+
format: 'float32x4',
|
|
479
|
+
byteOffset: SEGMENT_PREVIOUS_POSITIONS_BYTE_OFFSET
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
if (shaderAttributeNames.has(SEGMENT_NEXT_POSITIONS_COLUMN)) {
|
|
483
|
+
expandedAttributes.push({
|
|
484
|
+
attribute: SEGMENT_NEXT_POSITIONS_COLUMN,
|
|
485
|
+
format: 'float32x4',
|
|
486
|
+
byteOffset: SEGMENT_NEXT_POSITIONS_BYTE_OFFSET
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
if (shaderAttributeNames.has(SEGMENT_FLAGS_COLUMN)) {
|
|
490
|
+
expandedAttributes.push({
|
|
491
|
+
attribute: SEGMENT_FLAGS_COLUMN,
|
|
492
|
+
format: 'uint32',
|
|
493
|
+
byteOffset: SEGMENT_FLAGS_BYTE_OFFSET
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
if (shaderAttributeNames.has(ROW_INDICES_COLUMN)) {
|
|
497
|
+
expandedAttributes.push({
|
|
498
|
+
attribute: ROW_INDICES_COLUMN,
|
|
499
|
+
format: 'uint32',
|
|
500
|
+
byteOffset: ROW_INDICES_BYTE_OFFSET
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
if (shaderAttributeNames.has(SEGMENT_START_COLORS_COLUMN)) {
|
|
504
|
+
expandedAttributes.push({
|
|
505
|
+
attribute: SEGMENT_START_COLORS_COLUMN,
|
|
506
|
+
format: 'uint32',
|
|
507
|
+
byteOffset: SEGMENT_START_COLORS_BYTE_OFFSET
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
if (shaderAttributeNames.has(SEGMENT_END_COLORS_COLUMN)) {
|
|
511
|
+
expandedAttributes.push({
|
|
512
|
+
attribute: SEGMENT_END_COLORS_COLUMN,
|
|
513
|
+
format: 'uint32',
|
|
514
|
+
byteOffset: SEGMENT_END_COLORS_BYTE_OFFSET
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
const bufferLayouts: BufferLayout[] = [
|
|
519
|
+
{
|
|
520
|
+
name: EXPANDED_PATH_VERTEX_DATA,
|
|
521
|
+
byteStride: EXPANDED_PATH_VERTEX_BYTE_STRIDE,
|
|
522
|
+
stepMode: 'instance',
|
|
523
|
+
attributes: expandedAttributes
|
|
524
|
+
}
|
|
525
|
+
];
|
|
526
|
+
|
|
527
|
+
if (shaderAttributeNames.has(PATH_VIEW_ORIGINS_COLUMN)) {
|
|
528
|
+
bufferLayouts.push({
|
|
529
|
+
name: PATH_VIEW_ORIGIN_DATA,
|
|
530
|
+
byteStride: Float32Array.BYTES_PER_ELEMENT * 4,
|
|
531
|
+
stepMode: 'instance',
|
|
532
|
+
attributes: [
|
|
533
|
+
{
|
|
534
|
+
attribute: PATH_VIEW_ORIGINS_COLUMN,
|
|
535
|
+
format: 'float32x4',
|
|
536
|
+
byteOffset: 0
|
|
537
|
+
}
|
|
538
|
+
]
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return bufferLayouts;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function getPathAttributeModelAttributes(
|
|
546
|
+
shaderLayout: ShaderLayout,
|
|
547
|
+
state: Pick<PathAttributeModelState, 'expandedPathVertexData' | 'pathViewOriginData'>
|
|
548
|
+
): Record<string, Buffer> {
|
|
549
|
+
const shaderAttributeNames = new Set(shaderLayout.attributes.map(attribute => attribute.name));
|
|
550
|
+
return {
|
|
551
|
+
[EXPANDED_PATH_VERTEX_DATA]: state.expandedPathVertexData,
|
|
552
|
+
...(shaderAttributeNames.has(PATH_VIEW_ORIGINS_COLUMN)
|
|
553
|
+
? {[PATH_VIEW_ORIGIN_DATA]: state.pathViewOriginData}
|
|
554
|
+
: {})
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function getPathAttributeModelBatchAttributes(
|
|
559
|
+
shaderLayout: ShaderLayout,
|
|
560
|
+
renderBatch: PathRenderBatchState
|
|
561
|
+
): Record<string, Buffer> {
|
|
562
|
+
return getPathAttributeModelAttributes(shaderLayout, renderBatch);
|
|
563
|
+
}
|