@luma.gl/engine 10.0.0-alpha.8 → 10.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -4
- package/THIRD-PARTY-NOTICES.md +185 -0
- package/dist/animation/node-animation-binding.cjs +10 -0
- package/dist/animation/node-animation-binding.d.ts +1 -1
- package/dist/animation/node-animation-binding.d.ts.map +1 -1
- package/dist/animation/node-animation-binding.js +10 -0
- package/dist/animation/node-animation-binding.js.map +1 -1
- package/dist/arrow/index.cjs +5 -0
- package/dist/arrow/index.cjs.map +3 -3
- package/dist/arrow/index.d.ts +1 -0
- package/dist/arrow/index.d.ts.map +1 -1
- package/dist/arrow/index.js +1 -0
- package/dist/arrow/index.js.map +1 -1
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.cjs +161 -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 +164 -0
- package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.js.map +1 -0
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.d.ts +1 -1
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.d.ts.map +1 -1
- package/dist/arrow/renderers/text/renderers/arrow-text-renderer.js.map +1 -1
- package/dist/arrow/renderers/text/renderers/arrow-text-shaders.cjs +10 -1
- package/dist/arrow/renderers/text/renderers/arrow-text-shaders.d.ts.map +1 -1
- package/dist/arrow/renderers/text/renderers/arrow-text-shaders.js +10 -3
- package/dist/arrow/renderers/text/renderers/arrow-text-shaders.js.map +1 -1
- package/dist/compute/computation.cjs +1 -1
- package/dist/compute/computation.js +1 -1
- package/dist/compute/computation.js.map +1 -1
- package/dist/compute/swap.d.ts +2 -2
- package/dist/compute/swap.d.ts.map +1 -1
- package/dist/compute/swap.js.map +1 -1
- package/dist/dist.dev.js +1149 -657
- package/dist/dist.min.js +76 -69
- package/dist/dynamic-texture/video-texture.cjs +1 -1
- package/dist/dynamic-texture/video-texture.d.ts +3 -3
- package/dist/dynamic-texture/video-texture.d.ts.map +1 -1
- package/dist/dynamic-texture/video-texture.js +1 -1
- package/dist/dynamic-texture/video-texture.js.map +1 -1
- package/dist/effects/index.cjs.map +1 -1
- package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/fxaa/fxaa.js +2 -1
- package/dist/effects/passes/postprocessing/fxaa/fxaa.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/noise.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.js +2 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -1
- package/dist/geometry/gpu-vector-geometry-adapter.cjs +14 -0
- package/dist/geometry/gpu-vector-geometry-adapter.d.ts +7 -0
- package/dist/geometry/gpu-vector-geometry-adapter.d.ts.map +1 -1
- package/dist/geometry/gpu-vector-geometry-adapter.js +17 -0
- package/dist/geometry/gpu-vector-geometry-adapter.js.map +1 -1
- package/dist/geometry/gpu-vector-geometry.cjs +3 -0
- package/dist/geometry/gpu-vector-geometry.d.ts +2 -0
- package/dist/geometry/gpu-vector-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-vector-geometry.js +2 -0
- package/dist/geometry/gpu-vector-geometry.js.map +1 -1
- package/dist/gltf/gltf/animations/animations.d.ts +1 -1
- package/dist/gltf/gltf/animations/animations.d.ts.map +1 -1
- package/dist/gltf/gltf/create-gltf-model.cjs +3 -0
- package/dist/gltf/gltf/create-gltf-model.d.ts.map +1 -1
- package/dist/gltf/gltf/create-gltf-model.js +4 -0
- package/dist/gltf/gltf/create-gltf-model.js.map +1 -1
- package/dist/gltf/gltf/create-scenegraph-from-gltf.cjs +80 -12
- package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts +8 -1
- package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts.map +1 -1
- package/dist/gltf/gltf/create-scenegraph-from-gltf.js +82 -14
- package/dist/gltf/gltf/create-scenegraph-from-gltf.js.map +1 -1
- package/dist/gltf/gltf/gltf-billboard.cjs +6 -1
- package/dist/gltf/gltf/gltf-billboard.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-billboard.js +6 -1
- package/dist/gltf/gltf/gltf-billboard.js.map +1 -1
- package/dist/gltf/gltf/gltf-extension-support.cjs +2 -2
- package/dist/gltf/gltf/gltf-extension-support.js +2 -2
- package/dist/gltf/gltf/gltf-extension-support.js.map +1 -1
- package/dist/gltf/index.cjs +2 -0
- package/dist/gltf/index.cjs.map +3 -3
- package/dist/gltf/index.d.ts +2 -2
- package/dist/gltf/index.d.ts.map +1 -1
- package/dist/gltf/index.js +1 -1
- package/dist/gltf/index.js.map +1 -1
- package/dist/gltf/parsers/parse-gltf-animations.cjs +8 -5
- package/dist/gltf/parsers/parse-gltf-animations.js +20 -5
- package/dist/gltf/parsers/parse-gltf-animations.js.map +1 -1
- package/dist/gltf/parsers/parse-gltf-lights.cjs +36 -72
- package/dist/gltf/parsers/parse-gltf-lights.d.ts +6 -2
- package/dist/gltf/parsers/parse-gltf-lights.d.ts.map +1 -1
- package/dist/gltf/parsers/parse-gltf-lights.js +34 -91
- package/dist/gltf/parsers/parse-gltf-lights.js.map +1 -1
- package/dist/gltf/parsers/parse-gltf-metadata.cjs +60 -0
- package/dist/gltf/parsers/parse-gltf-metadata.d.ts +5 -0
- package/dist/gltf/parsers/parse-gltf-metadata.d.ts.map +1 -0
- package/dist/gltf/parsers/parse-gltf-metadata.js +39 -0
- package/dist/gltf/parsers/parse-gltf-metadata.js.map +1 -0
- package/dist/gltf/parsers/parse-gltf.cjs +23 -14
- package/dist/gltf/parsers/parse-gltf.d.ts +12 -2
- package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -1
- package/dist/gltf/parsers/parse-gltf.js +21 -13
- package/dist/gltf/parsers/parse-gltf.js.map +1 -1
- package/dist/gltf/parsers/parse-pbr-material.cjs +13 -3
- package/dist/gltf/parsers/parse-pbr-material.d.ts +7 -2
- package/dist/gltf/parsers/parse-pbr-material.d.ts.map +1 -1
- package/dist/gltf/parsers/parse-pbr-material.js +17 -5
- package/dist/gltf/parsers/parse-pbr-material.js.map +1 -1
- package/dist/gltf/parsers/post-process-gltf.cjs +1 -0
- package/dist/gltf/parsers/post-process-gltf.d.ts.map +1 -1
- package/dist/gltf/parsers/post-process-gltf.js +1 -0
- package/dist/gltf/parsers/post-process-gltf.js.map +1 -1
- package/dist/gltf/pbr/pbr-environment.cjs +21 -3
- package/dist/gltf/pbr/pbr-environment.d.ts +3 -0
- package/dist/gltf/pbr/pbr-environment.d.ts.map +1 -1
- package/dist/gltf/pbr/pbr-environment.js +19 -1
- package/dist/gltf/pbr/pbr-environment.js.map +1 -1
- package/dist/gltf/pbr/pbr-material.d.ts +3 -3
- package/dist/gltf/pbr/pbr-material.d.ts.map +1 -1
- package/dist/gltf/types/gltf-json-schema.d.ts.map +1 -1
- package/dist/gltf/types/gltf-json-schema.js +1 -0
- package/dist/gltf/types/gltf-json-schema.js.map +1 -1
- package/dist/gltf/types/gltf-postprocessed-schema.d.ts +2 -0
- package/dist/gltf/types/gltf-postprocessed-schema.d.ts.map +1 -1
- package/dist/gltf/types/gltf-postprocessed-schema.js +1 -0
- package/dist/gltf/types/gltf-postprocessed-schema.js.map +1 -1
- package/dist/gltf/types/gltf-types.d.ts +19 -0
- package/dist/gltf/types/gltf-types.d.ts.map +1 -1
- package/dist/graph/models/index.cjs.map +1 -1
- package/dist/graph/models/path/path-attribute-model.cjs +4 -1
- package/dist/graph/models/path/path-attribute-model.d.ts +3 -1
- package/dist/graph/models/path/path-attribute-model.d.ts.map +1 -1
- package/dist/graph/models/path/path-attribute-model.js +6 -1
- package/dist/graph/models/path/path-attribute-model.js.map +1 -1
- package/dist/graph/models/path/path-storage-model.cjs +4 -1
- package/dist/graph/models/path/path-storage-model.d.ts +3 -1
- package/dist/graph/models/path/path-storage-model.d.ts.map +1 -1
- package/dist/graph/models/path/path-storage-model.js +6 -1
- package/dist/graph/models/path/path-storage-model.js.map +1 -1
- package/dist/graph/physics/index.cjs.map +2 -2
- package/dist/graph/physics/physics-controller.cjs +42 -0
- package/dist/graph/physics/physics-controller.d.ts +12 -1
- package/dist/graph/physics/physics-controller.d.ts.map +1 -1
- package/dist/graph/physics/physics-controller.js +41 -0
- package/dist/graph/physics/physics-controller.js.map +1 -1
- package/dist/graph/physics/scenegraph-instance.cjs +7 -0
- package/dist/graph/physics/scenegraph-instance.d.ts.map +1 -1
- package/dist/graph/physics/scenegraph-instance.js +8 -0
- package/dist/graph/physics/scenegraph-instance.js.map +1 -1
- package/dist/graph/tables/gpu-table-model.cjs +2 -2
- package/dist/graph/tables/gpu-table-model.d.ts +2 -1
- package/dist/graph/tables/gpu-table-model.d.ts.map +1 -1
- package/dist/graph/tables/gpu-table-model.js +2 -2
- package/dist/graph/tables/gpu-table-model.js.map +1 -1
- package/dist/graph/tables/index.cjs.map +1 -1
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/lighting/ambient-occlusion-pass.cjs +126 -0
- package/dist/lighting/ambient-occlusion-pass.d.ts +31 -0
- package/dist/lighting/ambient-occlusion-pass.d.ts.map +1 -0
- package/dist/lighting/ambient-occlusion-pass.js +108 -0
- package/dist/lighting/ambient-occlusion-pass.js.map +1 -0
- package/dist/lighting/clustered-light-grid.cjs +378 -0
- package/dist/lighting/clustered-light-grid.d.ts +94 -0
- package/dist/lighting/clustered-light-grid.d.ts.map +1 -0
- package/dist/lighting/clustered-light-grid.js +370 -0
- package/dist/lighting/clustered-light-grid.js.map +1 -0
- package/dist/lighting/contact-shadow-composite.cjs +80 -0
- package/dist/lighting/contact-shadow-composite.d.ts +6 -0
- package/dist/lighting/contact-shadow-composite.d.ts.map +1 -0
- package/dist/lighting/contact-shadow-composite.js +59 -0
- package/dist/lighting/contact-shadow-composite.js.map +1 -0
- package/dist/lighting/contact-shadow-pass.cjs +102 -0
- package/dist/lighting/contact-shadow-pass.d.ts +23 -0
- package/dist/lighting/contact-shadow-pass.d.ts.map +1 -0
- package/dist/lighting/contact-shadow-pass.js +85 -0
- package/dist/lighting/contact-shadow-pass.js.map +1 -0
- package/dist/lighting/index.cjs +128 -0
- package/dist/lighting/index.cjs.map +6 -0
- package/dist/lighting/index.d.ts +35 -0
- package/dist/lighting/index.d.ts.map +1 -0
- package/dist/lighting/index.js +22 -0
- package/dist/lighting/index.js.map +1 -0
- package/dist/lighting/lightmap-atlas.cjs +246 -0
- package/dist/lighting/lightmap-atlas.d.ts +53 -0
- package/dist/lighting/lightmap-atlas.d.ts.map +1 -0
- package/dist/lighting/lightmap-atlas.js +279 -0
- package/dist/lighting/lightmap-atlas.js.map +1 -0
- package/dist/lighting/lightmap-baker.cjs +238 -0
- package/dist/lighting/lightmap-baker.d.ts +62 -0
- package/dist/lighting/lightmap-baker.d.ts.map +1 -0
- package/dist/lighting/lightmap-baker.js +236 -0
- package/dist/lighting/lightmap-baker.js.map +1 -0
- package/dist/lighting/lightmap-data.cjs +117 -0
- package/dist/lighting/lightmap-data.d.ts +20 -0
- package/dist/lighting/lightmap-data.d.ts.map +1 -0
- package/dist/lighting/lightmap-data.js +110 -0
- package/dist/lighting/lightmap-data.js.map +1 -0
- package/dist/lighting/lightmap-environment.cjs +61 -0
- package/dist/lighting/lightmap-environment.d.ts +18 -0
- package/dist/lighting/lightmap-environment.d.ts.map +1 -0
- package/dist/lighting/lightmap-environment.js +46 -0
- package/dist/lighting/lightmap-environment.js.map +1 -0
- package/dist/lighting/pbr-environment.cjs +45 -0
- package/dist/lighting/pbr-environment.d.ts +25 -0
- package/dist/lighting/pbr-environment.d.ts.map +1 -0
- package/dist/lighting/pbr-environment.js +30 -0
- package/dist/lighting/pbr-environment.js.map +1 -0
- package/dist/lighting/pbr-material.cjs +75 -0
- package/dist/lighting/pbr-material.d.ts +33 -0
- package/dist/lighting/pbr-material.d.ts.map +1 -0
- package/dist/lighting/pbr-material.js +52 -0
- package/dist/lighting/pbr-material.js.map +1 -0
- package/dist/lighting/pbr-model.cjs +579 -0
- package/dist/lighting/pbr-model.d.ts +45 -0
- package/dist/lighting/pbr-model.d.ts.map +1 -0
- package/dist/lighting/pbr-model.js +545 -0
- package/dist/lighting/pbr-model.js.map +1 -0
- package/dist/lighting/pbr-surface-pass.cjs +116 -0
- package/dist/lighting/pbr-surface-pass.d.ts +35 -0
- package/dist/lighting/pbr-surface-pass.d.ts.map +1 -0
- package/dist/lighting/pbr-surface-pass.js +98 -0
- package/dist/lighting/pbr-surface-pass.js.map +1 -0
- package/dist/lighting/prefiltered-environment.cjs +275 -0
- package/dist/lighting/prefiltered-environment.d.ts +56 -0
- package/dist/lighting/prefiltered-environment.d.ts.map +1 -0
- package/dist/lighting/prefiltered-environment.js +264 -0
- package/dist/lighting/prefiltered-environment.js.map +1 -0
- package/dist/lighting/reflection-probe.cjs +321 -0
- package/dist/lighting/reflection-probe.d.ts +77 -0
- package/dist/lighting/reflection-probe.d.ts.map +1 -0
- package/dist/lighting/reflection-probe.js +298 -0
- package/dist/lighting/reflection-probe.js.map +1 -0
- package/dist/lighting/shadow-map-renderer.cjs +631 -0
- package/dist/lighting/shadow-map-renderer.d.ts +92 -0
- package/dist/lighting/shadow-map-renderer.d.ts.map +1 -0
- package/dist/lighting/shadow-map-renderer.js +622 -0
- package/dist/lighting/shadow-map-renderer.js.map +1 -0
- package/dist/lighting/shadow-quality.cjs +58 -0
- package/dist/lighting/shadow-quality.d.ts +13 -0
- package/dist/lighting/shadow-quality.d.ts.map +1 -0
- package/dist/lighting/shadow-quality.js +37 -0
- package/dist/lighting/shadow-quality.js.map +1 -0
- package/dist/material/material.cjs +3 -0
- package/dist/material/material.d.ts +2 -0
- package/dist/material/material.d.ts.map +1 -1
- package/dist/material/material.js +3 -0
- package/dist/material/material.js.map +1 -1
- package/dist/model/gpu-vector-bindings.cjs +10 -3
- package/dist/model/gpu-vector-bindings.d.ts +1 -1
- package/dist/model/gpu-vector-bindings.d.ts.map +1 -1
- package/dist/model/gpu-vector-bindings.js +12 -3
- package/dist/model/gpu-vector-bindings.js.map +1 -1
- package/dist/model/gpu-vector-draw-batches.cjs +4 -3
- package/dist/model/gpu-vector-draw-batches.d.ts +1 -1
- package/dist/model/gpu-vector-draw-batches.d.ts.map +1 -1
- package/dist/model/gpu-vector-draw-batches.js +4 -3
- package/dist/model/gpu-vector-draw-batches.js.map +1 -1
- package/dist/model/gpu-vector-model.cjs +42 -17
- package/dist/model/gpu-vector-model.d.ts +28 -4
- package/dist/model/gpu-vector-model.d.ts.map +1 -1
- package/dist/model/gpu-vector-model.js +49 -17
- package/dist/model/gpu-vector-model.js.map +1 -1
- package/dist/model/model.d.ts +1 -1
- package/dist/model/model.d.ts.map +1 -1
- package/dist/models/light-model-utils.cjs +2 -2
- package/dist/models/light-model-utils.d.ts +2 -1
- 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/scenegraph/controllers/punctual-light-controller.cjs +121 -0
- package/dist/scenegraph/controllers/punctual-light-controller.d.ts +31 -0
- package/dist/scenegraph/controllers/punctual-light-controller.d.ts.map +1 -0
- package/dist/scenegraph/controllers/punctual-light-controller.js +117 -0
- package/dist/scenegraph/controllers/punctual-light-controller.js.map +1 -0
- package/dist/scenegraph/scene-metadata.cjs +43 -0
- package/dist/scenegraph/scene-metadata.d.ts +9 -0
- package/dist/scenegraph/scene-metadata.d.ts.map +1 -0
- package/dist/scenegraph/scene-metadata.js +21 -0
- package/dist/scenegraph/scene-metadata.js.map +1 -0
- package/dist/scenegraph/scenegraph-interaction.cjs +99 -0
- package/dist/scenegraph/scenegraph-interaction.d.ts +47 -0
- package/dist/scenegraph/scenegraph-interaction.d.ts.map +1 -0
- package/dist/scenegraph/scenegraph-interaction.js +79 -0
- package/dist/scenegraph/scenegraph-interaction.js.map +1 -0
- package/dist/scenegraph/scenegraph-node.cjs +10 -0
- package/dist/scenegraph/scenegraph-node.d.ts +10 -0
- package/dist/scenegraph/scenegraph-node.d.ts.map +1 -1
- package/dist/scenegraph/scenegraph-node.js +10 -0
- package/dist/scenegraph/scenegraph-node.js.map +1 -1
- package/dist/splats/index.cjs.map +1 -1
- package/dist/splats/splat-data.cjs +34 -23
- package/dist/splats/splat-data.d.ts.map +1 -1
- package/dist/splats/splat-data.js +34 -22
- package/dist/splats/splat-data.js.map +1 -1
- package/dist/text/experimental.cjs.map +1 -1
- package/dist/text/fonts/atlas/text-utils.cjs +1 -1
- package/dist/text/fonts/atlas/text-utils.js +1 -1
- package/dist/text/fonts/atlas/text-utils.js.map +1 -1
- package/dist/text/fonts/index.cjs.map +1 -1
- package/dist/text/index.cjs +2 -0
- package/dist/text/index.cjs.map +2 -2
- package/dist/text/index.d.ts +1 -1
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +1 -1
- package/dist/text/index.js.map +1 -1
- package/dist/text/text-2d/index.cjs +3 -0
- package/dist/text/text-2d/index.d.ts +1 -0
- package/dist/text/text-2d/index.d.ts.map +1 -1
- package/dist/text/text-2d/index.js +1 -0
- package/dist/text/text-2d/index.js.map +1 -1
- package/dist/text/text-2d/model-utils/text-code-point-source.cjs +41 -0
- package/dist/text/text-2d/model-utils/text-code-point-source.d.ts +8 -0
- package/dist/text/text-2d/model-utils/text-code-point-source.d.ts.map +1 -0
- package/dist/text/text-2d/model-utils/text-code-point-source.js +23 -0
- package/dist/text/text-2d/model-utils/text-code-point-source.js.map +1 -0
- package/dist/text/text-2d/models/text-attribute-model.cjs +4 -1
- package/dist/text/text-2d/models/text-attribute-model.d.ts +3 -1
- package/dist/text/text-2d/models/text-attribute-model.d.ts.map +1 -1
- package/dist/text/text-2d/models/text-attribute-model.js +6 -1
- package/dist/text/text-2d/models/text-attribute-model.js.map +1 -1
- package/dist/text/text-2d/models/text-dictionary-model.cjs +4 -1
- package/dist/text/text-2d/models/text-dictionary-model.d.ts +3 -1
- package/dist/text/text-2d/models/text-dictionary-model.d.ts.map +1 -1
- package/dist/text/text-2d/models/text-dictionary-model.js +6 -1
- package/dist/text/text-2d/models/text-dictionary-model.js.map +1 -1
- package/dist/text/text-2d/models/text-storage-model.cjs +4 -1
- package/dist/text/text-2d/models/text-storage-model.d.ts +3 -1
- package/dist/text/text-2d/models/text-storage-model.d.ts.map +1 -1
- package/dist/text/text-2d/models/text-storage-model.js +6 -1
- package/dist/text/text-2d/models/text-storage-model.js.map +1 -1
- package/licenses/cesium.txt +207 -0
- package/licenses/deck-community.txt +19 -0
- package/licenses/deck.txt +19 -0
- package/licenses/glfx.txt +19 -0
- package/licenses/gltf-loader-ts.txt +21 -0
- package/licenses/magenta-font.txt +13 -0
- package/licenses/nvidia-fxaa.txt +25 -0
- package/licenses/philogl.txt +19 -0
- package/licenses/spark.txt +21 -0
- package/licenses/three.txt +21 -0
- package/package.json +17 -9
- package/src/animation/node-animation-binding.ts +18 -1
- package/src/arrow/index.ts +6 -0
- package/src/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.ts +224 -0
- package/src/arrow/renderers/text/renderers/arrow-text-renderer.ts +1 -0
- package/src/arrow/renderers/text/renderers/arrow-text-shaders.ts +12 -5
- package/src/compute/computation.ts +1 -1
- package/src/compute/swap.ts +2 -2
- package/src/dynamic-texture/video-texture.ts +9 -3
- package/src/effects/passes/postprocessing/fxaa/fxaa.ts +2 -1
- package/src/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/denoise.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/huesaturation.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/noise.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/sepia.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/vibrance.ts +2 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/vignette.ts +2 -0
- package/src/geometry/gpu-vector-geometry-adapter.ts +19 -1
- package/src/geometry/gpu-vector-geometry.ts +3 -0
- package/src/gltf/gltf/animations/animations.ts +8 -1
- package/src/gltf/gltf/create-gltf-model.ts +4 -0
- package/src/gltf/gltf/create-scenegraph-from-gltf.ts +98 -17
- package/src/gltf/gltf/gltf-billboard.ts +6 -1
- package/src/gltf/gltf/gltf-extension-support.ts +2 -2
- package/src/gltf/index.ts +2 -0
- package/src/gltf/parsers/parse-gltf-animations.ts +22 -8
- package/src/gltf/parsers/parse-gltf-lights.ts +42 -130
- package/src/gltf/parsers/parse-gltf-metadata.ts +40 -0
- package/src/gltf/parsers/parse-gltf.ts +32 -16
- package/src/gltf/parsers/parse-pbr-material.ts +35 -7
- package/src/gltf/parsers/post-process-gltf.ts +1 -0
- package/src/gltf/pbr/pbr-environment.ts +27 -1
- package/src/gltf/pbr/pbr-material.ts +8 -3
- package/src/gltf/types/gltf-json-schema.ts +1 -0
- package/src/gltf/types/gltf-postprocessed-schema.ts +3 -0
- package/src/gltf/types/gltf-types.ts +20 -0
- package/src/graph/models/path/path-attribute-model.ts +10 -1
- package/src/graph/models/path/path-storage-model.ts +10 -1
- package/src/graph/physics/physics-controller.ts +55 -1
- package/src/graph/physics/scenegraph-instance.ts +10 -0
- package/src/graph/tables/gpu-table-model.ts +3 -2
- package/src/index.ts +19 -0
- package/src/lighting/ambient-occlusion-pass.ts +130 -0
- package/src/lighting/clustered-light-grid.ts +481 -0
- package/src/lighting/contact-shadow-composite.ts +67 -0
- package/src/lighting/contact-shadow-pass.ts +107 -0
- package/src/lighting/index.ts +125 -0
- package/src/lighting/lightmap-atlas.ts +348 -0
- package/src/lighting/lightmap-baker.ts +306 -0
- package/src/lighting/lightmap-data.ts +138 -0
- package/src/lighting/lightmap-environment.ts +70 -0
- package/src/lighting/pbr-environment.ts +55 -0
- package/src/lighting/pbr-material.ts +85 -0
- package/src/lighting/pbr-model.ts +608 -0
- package/src/lighting/pbr-surface-pass.ts +122 -0
- package/src/lighting/prefiltered-environment.ts +354 -0
- package/src/lighting/reflection-probe.ts +360 -0
- package/src/lighting/shadow-map-renderer.ts +918 -0
- package/src/lighting/shadow-quality.ts +50 -0
- package/src/material/material.ts +3 -0
- package/src/model/gpu-vector-bindings.ts +11 -3
- package/src/model/gpu-vector-draw-batches.ts +12 -10
- package/src/model/gpu-vector-model.ts +96 -20
- package/src/model/model.ts +1 -1
- package/src/models/light-model-utils.ts +3 -2
- package/src/scenegraph/controllers/punctual-light-controller.ts +172 -0
- package/src/scenegraph/scene-metadata.ts +23 -0
- package/src/scenegraph/scenegraph-interaction.ts +131 -0
- package/src/scenegraph/scenegraph-node.ts +12 -0
- package/src/splats/README.md +46 -0
- package/src/splats/splat-data.ts +53 -45
- package/src/text/fonts/atlas/text-utils.ts +1 -1
- package/src/text/index.ts +1 -0
- package/src/text/text-2d/index.ts +1 -0
- package/src/text/text-2d/model-utils/text-code-point-source.ts +34 -0
- package/src/text/text-2d/models/text-attribute-model.ts +10 -1
- package/src/text/text-2d/models/text-dictionary-model.ts +10 -1
- package/src/text/text-2d/models/text-storage-model.ts +10 -1
|
@@ -2,13 +2,24 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
+
import {parseGLTFMetadata} from '../parsers/parse-gltf-metadata';
|
|
5
6
|
import {parseGLTFJointDeclarations} from '../parsers/parse-gltf-joints';
|
|
6
7
|
import {Device} from '@luma.gl/core';
|
|
7
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
GroupNode,
|
|
10
|
+
Material,
|
|
11
|
+
ModelNode,
|
|
12
|
+
JointController,
|
|
13
|
+
BillboardController
|
|
14
|
+
} from '@luma.gl/engine';
|
|
8
15
|
import {GLTFPostprocessed} from '../types/gltf-postprocessed-schema';
|
|
9
16
|
import {Light} from '@luma.gl/shaders';
|
|
10
17
|
import {parseGLTF, type ParseGLTFOptions} from '../parsers/parse-gltf';
|
|
11
|
-
import {
|
|
18
|
+
import {bindGLTFPunctualLights} from '../parsers/parse-gltf-lights';
|
|
19
|
+
import {
|
|
20
|
+
PunctualLightController,
|
|
21
|
+
type PunctualLightDefinition
|
|
22
|
+
} from '../../scenegraph/controllers/punctual-light-controller';
|
|
12
23
|
import {GLTFAnimator} from './gltf-animator';
|
|
13
24
|
import {parseGLTFSkins} from './gltf-skin';
|
|
14
25
|
import {SkinController, MaterialVariants} from '@luma.gl/engine';
|
|
@@ -20,6 +31,7 @@ import {
|
|
|
20
31
|
type GLTFExtensionSupport
|
|
21
32
|
} from './gltf-extension-support';
|
|
22
33
|
import {parseGLTFMaterialVariants} from './gltf-material-variants';
|
|
34
|
+
import {parseGLTFBillboards} from './gltf-billboard';
|
|
23
35
|
|
|
24
36
|
export type GLTFScenegraphBounds = {
|
|
25
37
|
/** World-space axis-aligned bounds for the scene or model. */
|
|
@@ -36,6 +48,10 @@ export type GLTFScenegraphBounds = {
|
|
|
36
48
|
|
|
37
49
|
/** Scenegraph bundle returned from a parsed glTF asset. */
|
|
38
50
|
export type GLTFScenegraphs = {
|
|
51
|
+
/** Opt-in camera-facing scene traversal using resolved runtime node bindings. */
|
|
52
|
+
billboards: BillboardController | null;
|
|
53
|
+
/** Metadata associated with source asset and scene resources. */
|
|
54
|
+
metadata: import('@luma.gl/engine').SceneMetadata;
|
|
39
55
|
/** Shared physical joint declarations, separate from skeletal skinning. */
|
|
40
56
|
joints: JointController;
|
|
41
57
|
jointIssues: {code: string; path: string; message: string}[];
|
|
@@ -53,6 +69,8 @@ export type GLTFScenegraphs = {
|
|
|
53
69
|
animations: GLTFAnimation[];
|
|
54
70
|
/** Parsed punctual lights from the asset. */
|
|
55
71
|
lights: Light[];
|
|
72
|
+
/** Updates punctual lights after programmatic transform or visibility changes. */
|
|
73
|
+
punctualLights: PunctualLightController;
|
|
56
74
|
/** Extensions reported by the asset and whether luma.gl supports them. */
|
|
57
75
|
extensionSupport: Map<string, GLTFExtensionSupport>;
|
|
58
76
|
/** Camera-friendly bounds for each scene in `scenes`, in matching order. */
|
|
@@ -83,10 +101,28 @@ export function createScenegraphsFromGLTF(
|
|
|
83
101
|
gltf: GLTFPostprocessed,
|
|
84
102
|
options?: ParseGLTFOptions
|
|
85
103
|
): GLTFScenegraphs {
|
|
104
|
+
const metadata = parseGLTFMetadata(gltf);
|
|
86
105
|
if (options?.strictExtensions) {
|
|
87
106
|
assertSupportedGLTFExtensions(gltf, device);
|
|
88
107
|
}
|
|
89
108
|
|
|
109
|
+
// Validate the optional profile before parseGLTF allocates models, textures, or buffers.
|
|
110
|
+
if (options?.billboards) {
|
|
111
|
+
const validationNodes = new Map<number, GroupNode>();
|
|
112
|
+
gltf.nodes.forEach((node, index) => {
|
|
113
|
+
if (node.extensions?.['KHR_billboard']) validationNodes.set(index, new GroupNode());
|
|
114
|
+
});
|
|
115
|
+
const validation = new BillboardController(
|
|
116
|
+
parseGLTFBillboards({
|
|
117
|
+
gltf,
|
|
118
|
+
scenes: [],
|
|
119
|
+
gltfNodeIndexToNodeMap: validationNodes,
|
|
120
|
+
allowLegacyYAxis: options.billboards.allowLegacyYAxis
|
|
121
|
+
})
|
|
122
|
+
);
|
|
123
|
+
validation.destroy();
|
|
124
|
+
}
|
|
125
|
+
|
|
90
126
|
const {
|
|
91
127
|
scenes,
|
|
92
128
|
materials,
|
|
@@ -97,14 +133,57 @@ export function createScenegraphsFromGLTF(
|
|
|
97
133
|
materialInstances
|
|
98
134
|
} = parseGLTF(device, gltf, options);
|
|
99
135
|
|
|
136
|
+
const billboards = options?.billboards
|
|
137
|
+
? new BillboardController(
|
|
138
|
+
parseGLTFBillboards({
|
|
139
|
+
gltf,
|
|
140
|
+
scenes,
|
|
141
|
+
gltfNodeIndexToNodeMap,
|
|
142
|
+
allowLegacyYAxis: options.billboards.allowLegacyYAxis
|
|
143
|
+
})
|
|
144
|
+
)
|
|
145
|
+
: null;
|
|
146
|
+
scenes.forEach((scene, index) => {
|
|
147
|
+
const packet = metadata.get('scene', index);
|
|
148
|
+
if (packet) scene.metadata['xmp'] = packet;
|
|
149
|
+
const geometryMetadata = gltf.scenes[index]?.extensions?.['FB_geometry_metadata'];
|
|
150
|
+
if (geometryMetadata) scene.metadata['fb:geometry'] = geometryMetadata;
|
|
151
|
+
});
|
|
152
|
+
const meshPackets = new Map<string, Record<string, unknown>>();
|
|
153
|
+
gltf.meshes.forEach((mesh, index) => {
|
|
154
|
+
const packet = metadata.get('mesh', index);
|
|
155
|
+
if (!packet) return;
|
|
156
|
+
meshPackets.set(mesh.id, packet);
|
|
157
|
+
const group = gltfMeshIdToNodeMap.get(mesh.id);
|
|
158
|
+
if (group) group.metadata['xmp'] = packet;
|
|
159
|
+
});
|
|
160
|
+
gltfNodeIndexToNodeMap.forEach((node, index) => {
|
|
161
|
+
const packet = metadata.get('node', index);
|
|
162
|
+
if (packet) node.metadata['xmp'] = packet;
|
|
163
|
+
if (!meshPackets.size) return;
|
|
164
|
+
const sourceMesh = gltf.nodes[index]?.mesh;
|
|
165
|
+
const meshPacket = sourceMesh && meshPackets.get(sourceMesh.id);
|
|
166
|
+
const mesh = node.userData['gltfMesh'];
|
|
167
|
+
if (meshPacket && mesh instanceof GroupNode) mesh.metadata['xmp'] = meshPacket;
|
|
168
|
+
});
|
|
169
|
+
materials.forEach((material, index) => {
|
|
170
|
+
const packet = metadata.get('material', index);
|
|
171
|
+
if (packet) {
|
|
172
|
+
material.metadata['xmp'] = packet;
|
|
173
|
+
for (const instance of materialInstances.get(index) || []) instance.metadata['xmp'] = packet;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
100
177
|
const jointDeclarations = parseGLTFJointDeclarations(gltf, gltfNodeIndexToNodeMap);
|
|
101
178
|
const joints = new JointController(jointDeclarations.declarations.map(item => item.joint));
|
|
102
179
|
const animations = parseGLTFAnimations(gltf);
|
|
103
180
|
const sourceLights =
|
|
104
|
-
(gltf as GLTFPostprocessed & {lights?:
|
|
105
|
-
(gltf.extensions?.['KHR_lights_punctual']?.['lights'] as
|
|
181
|
+
(gltf as GLTFPostprocessed & {lights?: PunctualLightDefinition[]}).lights ||
|
|
182
|
+
(gltf.extensions?.['KHR_lights_punctual']?.['lights'] as
|
|
183
|
+
| PunctualLightDefinition[]
|
|
184
|
+
| undefined) ||
|
|
106
185
|
[];
|
|
107
|
-
const lightDefinitions = sourceLights.map(light => ({
|
|
186
|
+
const lightDefinitions = sourceLights.map<PunctualLightDefinition>(light => ({
|
|
108
187
|
...light,
|
|
109
188
|
...(Array.isArray(light['color']) ? {color: [...light['color']]} : {}),
|
|
110
189
|
...(light['spot'] ? {spot: {...light['spot']}} : {})
|
|
@@ -119,21 +198,16 @@ export function createScenegraphsFromGLTF(
|
|
|
119
198
|
}
|
|
120
199
|
return runtimeCamera;
|
|
121
200
|
});
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
127
|
-
const lights = parseGLTFLights(gltf, lightOptions);
|
|
128
|
-
const refreshLights = () => {
|
|
129
|
-
lights.splice(0, lights.length, ...parseGLTFLights(gltf, lightOptions));
|
|
130
|
-
};
|
|
201
|
+
const lightBindings = bindGLTFPunctualLights(gltf.nodes, gltfNodeIdToNodeMap, lightDefinitions);
|
|
202
|
+
const punctualLights = new PunctualLightController(lightBindings, options?.useByteColors ?? true);
|
|
203
|
+
const lights = punctualLights.lights;
|
|
204
|
+
const refreshLights = () => punctualLights.update();
|
|
131
205
|
const animator = new GLTFAnimator({
|
|
132
|
-
properties: options?.properties ?? undefined,
|
|
133
206
|
onVisibilityChange: refreshLights,
|
|
207
|
+
onLightChange: refreshLights,
|
|
208
|
+
properties: options?.properties ?? undefined,
|
|
134
209
|
cameras,
|
|
135
210
|
lightDefinitions,
|
|
136
|
-
onLightChange: refreshLights,
|
|
137
211
|
animations,
|
|
138
212
|
gltfNodeIdToNodeMap,
|
|
139
213
|
materials,
|
|
@@ -144,7 +218,10 @@ export function createScenegraphsFromGLTF(
|
|
|
144
218
|
const sceneBounds = scenes.map(scene => getScenegraphBounds(scene.getBounds()));
|
|
145
219
|
const modelBounds = getCombinedScenegraphBounds(sceneBounds);
|
|
146
220
|
const skins = new SkinController(parseGLTFSkins({device, gltf, scenes, gltfNodeIndexToNodeMap}));
|
|
147
|
-
animator.setUpdateHandler(() =>
|
|
221
|
+
animator.setUpdateHandler(() => {
|
|
222
|
+
skins.update();
|
|
223
|
+
if (lightBindings.length) refreshLights();
|
|
224
|
+
});
|
|
148
225
|
|
|
149
226
|
let destroyed = false;
|
|
150
227
|
const destroy = (): void => {
|
|
@@ -153,6 +230,7 @@ export function createScenegraphsFromGLTF(
|
|
|
153
230
|
}
|
|
154
231
|
destroyed = true;
|
|
155
232
|
skins.destroy();
|
|
233
|
+
billboards?.destroy();
|
|
156
234
|
|
|
157
235
|
const groups = new Set<GroupNode>([
|
|
158
236
|
...scenes,
|
|
@@ -195,8 +273,10 @@ export function createScenegraphsFromGLTF(
|
|
|
195
273
|
};
|
|
196
274
|
|
|
197
275
|
return {
|
|
276
|
+
metadata,
|
|
198
277
|
scenes,
|
|
199
278
|
materials,
|
|
279
|
+
billboards,
|
|
200
280
|
variants,
|
|
201
281
|
joints,
|
|
202
282
|
jointIssues: jointDeclarations.issues,
|
|
@@ -204,6 +284,7 @@ export function createScenegraphsFromGLTF(
|
|
|
204
284
|
animator,
|
|
205
285
|
animations,
|
|
206
286
|
lights,
|
|
287
|
+
punctualLights,
|
|
207
288
|
extensionSupport,
|
|
208
289
|
sceneBounds,
|
|
209
290
|
modelBounds,
|
|
@@ -41,7 +41,12 @@ export function parseGLTFBillboards(props: ParseGLTFBillboardsProps): BillboardC
|
|
|
41
41
|
);
|
|
42
42
|
bindings.push({
|
|
43
43
|
node,
|
|
44
|
-
definition: {
|
|
44
|
+
definition: {
|
|
45
|
+
...definition,
|
|
46
|
+
...(definition.viewDirection ? {viewDirection: [...definition.viewDirection]} : {}),
|
|
47
|
+
...(definition.up ? {up: [...definition.up]} : {}),
|
|
48
|
+
rotationAxis: definition.rotationAxis === 'y' ? 'y' : 'all'
|
|
49
|
+
},
|
|
45
50
|
matrixAuthored: Boolean(source.matrix)
|
|
46
51
|
});
|
|
47
52
|
});
|
|
@@ -296,9 +296,9 @@ const GLTF_EXTENSION_SUPPORT_REGISTRY: Record<string, GLTFExtensionSupportDefini
|
|
|
296
296
|
comment: 'Metadata payloads remain in the loaded glTF, but luma.gl does not interpret them.'
|
|
297
297
|
},
|
|
298
298
|
KHR_xmp_json_ld: {
|
|
299
|
-
supportLevel: '
|
|
299
|
+
supportLevel: 'parsed-and-wired',
|
|
300
300
|
standardStatus: 'ratified',
|
|
301
|
-
comment: '
|
|
301
|
+
comment: 'XMP packet references are available through scene metadata.'
|
|
302
302
|
},
|
|
303
303
|
EXT_lights_image_based: {
|
|
304
304
|
supportLevel: 'none',
|
package/src/gltf/index.ts
CHANGED
|
@@ -72,6 +72,7 @@ export {
|
|
|
72
72
|
} from './parsers/parse-pbr-material';
|
|
73
73
|
export {
|
|
74
74
|
loadPBREnvironment,
|
|
75
|
+
resolveLoadedPBREnvironment,
|
|
75
76
|
type PBREnvironment,
|
|
76
77
|
type PBREnvironmentProps
|
|
77
78
|
} from './pbr/pbr-environment';
|
|
@@ -183,6 +184,7 @@ export type {
|
|
|
183
184
|
} from './types/gltf-postprocessed-schema';
|
|
184
185
|
export type {
|
|
185
186
|
GLTFWithBuffers,
|
|
187
|
+
GLTFGaussianSplatDescriptor,
|
|
186
188
|
GLTFExternalBuffer,
|
|
187
189
|
GLTFTypedArray,
|
|
188
190
|
GLTFImageData
|
|
@@ -249,10 +249,21 @@ function parseNodePointerAnimationChannel(
|
|
|
249
249
|
pointerSegments[2] === 'extensions' &&
|
|
250
250
|
pointerSegments[3] === 'KHR_node_visibility' &&
|
|
251
251
|
pointerSegments[4] === 'visible';
|
|
252
|
-
|
|
252
|
+
const isSelectablePointer =
|
|
253
|
+
pointerSegments.length === 5 &&
|
|
254
|
+
pointerSegments[2] === 'extensions' &&
|
|
255
|
+
pointerSegments[3] === 'KHR_node_selectability' &&
|
|
256
|
+
pointerSegments[4] === 'selectable';
|
|
257
|
+
const isHoverablePointer =
|
|
258
|
+
pointerSegments.length === 5 &&
|
|
259
|
+
pointerSegments[2] === 'extensions' &&
|
|
260
|
+
pointerSegments[3] === 'KHR_node_hoverability' &&
|
|
261
|
+
pointerSegments[4] === 'hoverable';
|
|
262
|
+
const isBooleanPointer = isVisibilityPointer || isSelectablePointer || isHoverablePointer;
|
|
263
|
+
if (pointerSegments.length !== 3 && !isBooleanPointer) {
|
|
253
264
|
warnUnsupportedAnimationPointer(
|
|
254
265
|
pointer,
|
|
255
|
-
'node pointers must target transforms, morph weights, or
|
|
266
|
+
'node pointers must target transforms, morph weights, visibility, selectability, or hoverability'
|
|
256
267
|
);
|
|
257
268
|
return null;
|
|
258
269
|
}
|
|
@@ -266,15 +277,18 @@ function parseNodePointerAnimationChannel(
|
|
|
266
277
|
return null;
|
|
267
278
|
}
|
|
268
279
|
|
|
269
|
-
if (
|
|
270
|
-
warnUnsupportedAnimationPointer(
|
|
271
|
-
pointer,
|
|
272
|
-
'boolean visibility animation requires STEP interpolation'
|
|
273
|
-
);
|
|
280
|
+
if (isBooleanPointer && sampler.interpolation !== 'STEP') {
|
|
281
|
+
warnUnsupportedAnimationPointer(pointer, 'boolean node animation requires STEP interpolation');
|
|
274
282
|
return null;
|
|
275
283
|
}
|
|
276
284
|
|
|
277
|
-
const path = isVisibilityPointer
|
|
285
|
+
const path = isVisibilityPointer
|
|
286
|
+
? 'visibility'
|
|
287
|
+
: isSelectablePointer
|
|
288
|
+
? 'selectable'
|
|
289
|
+
: isHoverablePointer
|
|
290
|
+
? 'hoverable'
|
|
291
|
+
: getNodeAnimationPath(pointerSegments[2]);
|
|
278
292
|
if (!path) {
|
|
279
293
|
warnUnsupportedAnimationPointer(
|
|
280
294
|
pointer,
|
|
@@ -4,13 +4,46 @@
|
|
|
4
4
|
|
|
5
5
|
import {Matrix4} from '@math.gl/core';
|
|
6
6
|
import type {GLTFNodePostprocessed, GLTFPostprocessed} from '../types/gltf-postprocessed-schema';
|
|
7
|
+
import type {Light} from '@luma.gl/shaders';
|
|
7
8
|
import {
|
|
8
|
-
|
|
9
|
-
type
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
makePunctualLight,
|
|
10
|
+
type PunctualLightBinding,
|
|
11
|
+
type PunctualLightDefinition
|
|
12
|
+
} from '../../scenegraph/controllers/punctual-light-controller';
|
|
13
|
+
import type {ScenegraphNode} from '../../scenegraph/scenegraph-node';
|
|
14
|
+
|
|
15
|
+
/** Resolves source light references to paths of runtime nodes during import. */
|
|
16
|
+
export function bindGLTFPunctualLights(
|
|
17
|
+
nodes: GLTFNodePostprocessed[],
|
|
18
|
+
runtimeNodes: ReadonlyMap<string, ScenegraphNode>,
|
|
19
|
+
definitions: readonly PunctualLightDefinition[]
|
|
20
|
+
): PunctualLightBinding[] {
|
|
21
|
+
if (!definitions.length) return [];
|
|
22
|
+
const parents = createParentNodeMap(nodes);
|
|
23
|
+
const bindings: PunctualLightBinding[] = [];
|
|
24
|
+
for (const node of nodes) {
|
|
25
|
+
const lightIndex = getLightIndex(node);
|
|
26
|
+
const definition = lightIndex === undefined ? undefined : definitions[lightIndex];
|
|
27
|
+
if (!definition) continue;
|
|
28
|
+
const path: ScenegraphNode[] = [];
|
|
29
|
+
let source: GLTFNodePostprocessed | undefined = node;
|
|
30
|
+
while (source && path.length < nodes.length) {
|
|
31
|
+
const runtime = runtimeNodes.get(source.id);
|
|
32
|
+
if (!runtime) break;
|
|
33
|
+
path.push(runtime);
|
|
34
|
+
source = parents.get(source.id);
|
|
35
|
+
}
|
|
36
|
+
if (!source) bindings.push({path: path.reverse(), definition});
|
|
37
|
+
}
|
|
38
|
+
return bindings;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function getLightIndex(node: GLTFNodePostprocessed): number | undefined {
|
|
42
|
+
return (
|
|
43
|
+
(node as GLTFNodePostprocessed & {light?: number}).light ??
|
|
44
|
+
node.extensions?.['KHR_lights_punctual']?.light
|
|
45
|
+
);
|
|
46
|
+
}
|
|
14
47
|
|
|
15
48
|
export type ParseGLTFLightsOptions = {
|
|
16
49
|
/** Restricts authored lights to nodes belonging to the selected scene hierarchy. */
|
|
@@ -46,9 +79,7 @@ export function parseGLTFLights(
|
|
|
46
79
|
continue;
|
|
47
80
|
}
|
|
48
81
|
|
|
49
|
-
const lightIndex =
|
|
50
|
-
(node as GLTFNodePostprocessed & {light?: number}).light ??
|
|
51
|
-
node.extensions?.KHR_lights_punctual?.light;
|
|
82
|
+
const lightIndex = getLightIndex(node);
|
|
52
83
|
if (
|
|
53
84
|
typeof lightIndex !== 'number' ||
|
|
54
85
|
(options.nodeIdentifiers && !options.nodeIdentifiers.has(node.id))
|
|
@@ -62,28 +93,9 @@ export function parseGLTFLights(
|
|
|
62
93
|
continue;
|
|
63
94
|
}
|
|
64
95
|
|
|
65
|
-
const color = normalizeGLTFLightColor(
|
|
66
|
-
(gltfLight.color || [1, 1, 1]) as [number, number, number],
|
|
67
|
-
options.useByteColors ?? true
|
|
68
|
-
);
|
|
69
|
-
const intensity = gltfLight.intensity ?? 1;
|
|
70
|
-
const range = gltfLight.range;
|
|
71
96
|
const worldMatrix = getNodeWorldMatrix(node, parentNodeById, worldMatrixByNodeId);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
case 'directional':
|
|
75
|
-
lights.push(parseDirectionalLight(worldMatrix, color, intensity));
|
|
76
|
-
break;
|
|
77
|
-
case 'point':
|
|
78
|
-
lights.push(parsePointLight(worldMatrix, color, intensity, range));
|
|
79
|
-
break;
|
|
80
|
-
case 'spot':
|
|
81
|
-
lights.push(parseSpotLight(worldMatrix, color, intensity, range, gltfLight.spot));
|
|
82
|
-
break;
|
|
83
|
-
default:
|
|
84
|
-
// Unsupported light type
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
97
|
+
const light = makePunctualLight(gltfLight, worldMatrix, options.useByteColors ?? true);
|
|
98
|
+
if (light) lights.push(light);
|
|
87
99
|
}
|
|
88
100
|
|
|
89
101
|
return lights;
|
|
@@ -110,92 +122,6 @@ function isNodeVisible(
|
|
|
110
122
|
return true;
|
|
111
123
|
}
|
|
112
124
|
|
|
113
|
-
/**
|
|
114
|
-
* Converts glTF colors from the 0-1 spec range to the configured luma light convention.
|
|
115
|
-
*/
|
|
116
|
-
function normalizeGLTFLightColor(
|
|
117
|
-
color: [number, number, number],
|
|
118
|
-
useByteColors: boolean
|
|
119
|
-
): [number, number, number] {
|
|
120
|
-
if (useByteColors) {
|
|
121
|
-
return color.map(component => component * 255) as [number, number, number];
|
|
122
|
-
}
|
|
123
|
-
return normalizeByteColor3(color, false) as [number, number, number];
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Converts a glTF punctual light attached to a node into a point light.
|
|
128
|
-
*/
|
|
129
|
-
function parsePointLight(
|
|
130
|
-
worldMatrix: Matrix4,
|
|
131
|
-
color: [number, number, number],
|
|
132
|
-
intensity: number,
|
|
133
|
-
range?: number
|
|
134
|
-
): PointLight {
|
|
135
|
-
const position = getLightPosition(worldMatrix);
|
|
136
|
-
|
|
137
|
-
let attenuation: Readonly<[number, number, number]> = [1, 0, 0];
|
|
138
|
-
if (range !== undefined && range > 0) {
|
|
139
|
-
attenuation = [1, 0, 1 / (range * range)] as [number, number, number];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return {
|
|
143
|
-
type: 'point',
|
|
144
|
-
position,
|
|
145
|
-
color,
|
|
146
|
-
intensity,
|
|
147
|
-
attenuation
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Converts a glTF punctual light attached to a node into a directional light.
|
|
153
|
-
*/
|
|
154
|
-
function parseDirectionalLight(
|
|
155
|
-
worldMatrix: Matrix4,
|
|
156
|
-
color: [number, number, number],
|
|
157
|
-
intensity: number
|
|
158
|
-
): DirectionalLight {
|
|
159
|
-
const direction = getLightDirection(worldMatrix);
|
|
160
|
-
|
|
161
|
-
return {
|
|
162
|
-
type: 'directional',
|
|
163
|
-
direction,
|
|
164
|
-
color,
|
|
165
|
-
intensity
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Converts a glTF punctual light attached to a node into a spot light.
|
|
171
|
-
*/
|
|
172
|
-
function parseSpotLight(
|
|
173
|
-
worldMatrix: Matrix4,
|
|
174
|
-
color: [number, number, number],
|
|
175
|
-
intensity: number,
|
|
176
|
-
range?: number,
|
|
177
|
-
spot: {innerConeAngle?: number; outerConeAngle?: number} = {}
|
|
178
|
-
): SpotLight {
|
|
179
|
-
const position = getLightPosition(worldMatrix);
|
|
180
|
-
const direction = getLightDirection(worldMatrix);
|
|
181
|
-
|
|
182
|
-
let attenuation: Readonly<[number, number, number]> = [1, 0, 0];
|
|
183
|
-
if (range !== undefined && range > 0) {
|
|
184
|
-
attenuation = [1, 0, 1 / (range * range)] as [number, number, number];
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return {
|
|
188
|
-
type: 'spot',
|
|
189
|
-
position,
|
|
190
|
-
direction,
|
|
191
|
-
color,
|
|
192
|
-
intensity,
|
|
193
|
-
attenuation,
|
|
194
|
-
innerConeAngle: spot.innerConeAngle ?? 0,
|
|
195
|
-
outerConeAngle: spot.outerConeAngle ?? Math.PI / 4
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
|
|
199
125
|
/**
|
|
200
126
|
* Builds a parent lookup so punctual lights can be resolved in world space.
|
|
201
127
|
*/
|
|
@@ -260,17 +186,3 @@ function getNodeLocalMatrix(node: GLTFNodePostprocessed): Matrix4 {
|
|
|
260
186
|
|
|
261
187
|
return matrix;
|
|
262
188
|
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Resolves the world-space position of a glTF light node.
|
|
266
|
-
*/
|
|
267
|
-
function getLightPosition(worldMatrix: Matrix4): [number, number, number] {
|
|
268
|
-
return worldMatrix.transformAsPoint([0, 0, 0]) as [number, number, number];
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Resolves the world-space forward direction of a glTF light node.
|
|
273
|
-
*/
|
|
274
|
-
function getLightDirection(worldMatrix: Matrix4): [number, number, number] {
|
|
275
|
-
return worldMatrix.transformAsVector([0, 0, -1]) as [number, number, number];
|
|
276
|
-
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {SceneMetadata} from '@luma.gl/engine';
|
|
6
|
+
import type {GLTFPostprocessed} from '../types/gltf-postprocessed-schema';
|
|
7
|
+
|
|
8
|
+
/** Populates shared scene metadata from glTF XMP packet references. */
|
|
9
|
+
export function parseGLTFMetadata(gltf: GLTFPostprocessed): SceneMetadata {
|
|
10
|
+
const metadata = new SceneMetadata();
|
|
11
|
+
const rootExtension = gltf.extensions?.['KHR_xmp_json_ld'] as {packets?: unknown[]} | undefined;
|
|
12
|
+
const packets = rootExtension?.packets || [];
|
|
13
|
+
const categories: [string, readonly unknown[]][] = [
|
|
14
|
+
['asset', [gltf.asset]],
|
|
15
|
+
['scene', gltf.scenes || []],
|
|
16
|
+
['node', gltf.nodes || []],
|
|
17
|
+
['mesh', gltf.meshes || []],
|
|
18
|
+
['material', gltf.materials || []],
|
|
19
|
+
['image', gltf.images || []],
|
|
20
|
+
['animation', gltf.animations || []]
|
|
21
|
+
];
|
|
22
|
+
for (const [category, objects] of categories) {
|
|
23
|
+
objects.forEach((object, index) => {
|
|
24
|
+
const reference = (object as {extensions?: Record<string, {packet?: number}>} | undefined)
|
|
25
|
+
?.extensions?.['KHR_xmp_json_ld'];
|
|
26
|
+
if (!reference) return;
|
|
27
|
+
const packetIndex = reference.packet;
|
|
28
|
+
// A packet reference must point to an object in the document's packet array.
|
|
29
|
+
if (!Number.isInteger(packetIndex) || packetIndex! < 0 || packetIndex! >= packets.length) {
|
|
30
|
+
throw new Error(`glTF: invalid XMP packet index ${packetIndex}`);
|
|
31
|
+
}
|
|
32
|
+
const packet = packets[packetIndex!];
|
|
33
|
+
if (!packet || typeof packet !== 'object' || Array.isArray(packet)) {
|
|
34
|
+
throw new Error(`glTF: invalid XMP packet ${packetIndex}`);
|
|
35
|
+
}
|
|
36
|
+
metadata.set(category, index, packet as Record<string, unknown>);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return metadata;
|
|
40
|
+
}
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
} from '../gltf/gltf-lightmap';
|
|
33
33
|
import type {PrimitiveMaterialVariants} from '@luma.gl/engine';
|
|
34
34
|
import {type GLTFMorphTargetState, setGLTFMorphWeights} from '../gltf/morph-targets';
|
|
35
|
+
import {type PBRLightingEnvironment} from '../../lighting/pbr-environment';
|
|
35
36
|
import {type PBREnvironment} from '../pbr/pbr-environment';
|
|
36
37
|
import {resolveTextureCoordinateSet} from '../pbr/texture-transform';
|
|
37
38
|
import {
|
|
@@ -51,14 +52,21 @@ export type ParseGLTFOptions = {
|
|
|
51
52
|
modelOptions?: Partial<ModelProps>;
|
|
52
53
|
/** Enables shader-level PBR debug output. */
|
|
53
54
|
pbrDebug?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Optional image-based lighting environment: a loaded `PBREnvironment`, or a
|
|
57
|
+
* `PBRLightingEnvironment` such as the textures of `createPrefilteredEnvironment`.
|
|
58
|
+
*/
|
|
59
|
+
imageBasedLightingEnvironment?: PBREnvironment | PBRLightingEnvironment;
|
|
56
60
|
/** Enables punctual light extraction. */
|
|
57
61
|
lights?: boolean;
|
|
58
62
|
/** Enables tangent usage when available. */
|
|
59
63
|
useTangents?: boolean;
|
|
60
64
|
/** When true, parsed semantic light colors are converted into luma.gl's legacy byte-style range. */
|
|
61
65
|
useByteColors?: boolean;
|
|
66
|
+
/** Leave Gaussian primitives for a caller-managed splat renderer instead of creating mesh models. */
|
|
67
|
+
excludeGaussianSplatPrimitives?: boolean;
|
|
68
|
+
/** Resolve supported billboard attachments into an engine controller during scene creation. */
|
|
69
|
+
billboards?: {allowLegacyYAxis?: boolean} | null;
|
|
62
70
|
/** Reject documents whose required extensions have no complete runtime implementation. */
|
|
63
71
|
strictExtensions?: boolean;
|
|
64
72
|
};
|
|
@@ -73,6 +81,7 @@ type ParseGLTFInternalOptions = Required<ParseGLTFOptions> & {
|
|
|
73
81
|
|
|
74
82
|
const defaultOptions: Required<ParseGLTFOptions> = {
|
|
75
83
|
properties: null,
|
|
84
|
+
billboards: null,
|
|
76
85
|
publishedTransforms: null,
|
|
77
86
|
modelOptions: {},
|
|
78
87
|
pbrDebug: false,
|
|
@@ -80,7 +89,8 @@ const defaultOptions: Required<ParseGLTFOptions> = {
|
|
|
80
89
|
lights: true,
|
|
81
90
|
useTangents: false,
|
|
82
91
|
useByteColors: true,
|
|
83
|
-
strictExtensions: false
|
|
92
|
+
strictExtensions: false,
|
|
93
|
+
excludeGaussianSplatPrimitives: false
|
|
84
94
|
};
|
|
85
95
|
|
|
86
96
|
/**
|
|
@@ -299,6 +309,8 @@ function createNodeForGLTFNode(
|
|
|
299
309
|
children: [],
|
|
300
310
|
matrix: gltfNode.matrix,
|
|
301
311
|
display: gltfNode.extensions?.['KHR_node_visibility']?.visible !== false,
|
|
312
|
+
selectable: gltfNode.extensions?.['KHR_node_selectability']?.selectable !== false,
|
|
313
|
+
hoverable: gltfNode.extensions?.['KHR_node_hoverability']?.hoverable !== false,
|
|
302
314
|
position: gltfNode.translation,
|
|
303
315
|
rotation: gltfNode.rotation,
|
|
304
316
|
scale: gltfNode.scale
|
|
@@ -346,19 +358,23 @@ function createNodeForGLTFMesh(
|
|
|
346
358
|
)
|
|
347
359
|
});
|
|
348
360
|
}
|
|
349
|
-
const primitives = gltfPrimitives.
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
361
|
+
const primitives = gltfPrimitives.flatMap((gltfPrimitive, i) =>
|
|
362
|
+
options.excludeGaussianSplatPrimitives && gltfPrimitive.extensions?.KHR_gaussian_splatting
|
|
363
|
+
? []
|
|
364
|
+
: [
|
|
365
|
+
createNodeForGLTFPrimitive({
|
|
366
|
+
device,
|
|
367
|
+
gltfPrimitive,
|
|
368
|
+
primitiveIndex: i,
|
|
369
|
+
gltfMesh,
|
|
370
|
+
gltf,
|
|
371
|
+
gltfMaterialIdToMaterialMap,
|
|
372
|
+
options,
|
|
373
|
+
instancing,
|
|
374
|
+
nodeLightmap,
|
|
375
|
+
lightmapInstance
|
|
376
|
+
})
|
|
377
|
+
]
|
|
362
378
|
);
|
|
363
379
|
const mesh = new GroupNode({
|
|
364
380
|
id: gltfMesh.name || gltfMesh.id,
|