@luma.gl/engine 10.0.0-alpha.10 → 10.0.0-alpha.11
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/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/dist.dev.js +325 -80
- package/dist/dist.min.js +58 -58
- 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-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 +1 -1
- 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 +4 -1
- package/dist/gltf/parsers/parse-gltf.d.ts +4 -0
- package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -1
- package/dist/gltf/parsers/parse-gltf.js +3 -0
- package/dist/gltf/parsers/parse-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/graph/models/index.cjs.map +1 -1
- package/dist/graph/models/path/path-attribute-model.cjs +1 -1
- package/dist/graph/models/path/path-attribute-model.js +1 -1
- package/dist/graph/models/path/path-attribute-model.js.map +1 -1
- package/dist/graph/models/path/path-storage-model.cjs +1 -1
- package/dist/graph/models/path/path-storage-model.js +1 -1
- package/dist/graph/models/path/path-storage-model.js.map +1 -1
- package/dist/graph/physics/index.cjs.map +1 -1
- package/dist/graph/tables/index.cjs.map +1 -1
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -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 +98 -0
- package/dist/lighting/index.cjs.map +6 -0
- package/dist/lighting/index.d.ts +23 -0
- package/dist/lighting/index.d.ts.map +1 -0
- package/dist/lighting/index.js +16 -0
- package/dist/lighting/index.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 +509 -0
- package/dist/lighting/pbr-model.d.ts +41 -0
- package/dist/lighting/pbr-model.d.ts.map +1 -0
- package/dist/lighting/pbr-model.js +475 -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/shadow-map-renderer.cjs +627 -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 +617 -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-model.cjs +11 -1
- package/dist/model/gpu-vector-model.d.ts +4 -2
- package/dist/model/gpu-vector-model.d.ts.map +1 -1
- package/dist/model/gpu-vector-model.js +12 -1
- package/dist/model/gpu-vector-model.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/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.map +1 -1
- package/dist/text/text-2d/models/text-attribute-model.cjs +1 -1
- package/dist/text/text-2d/models/text-attribute-model.js +1 -1
- package/dist/text/text-2d/models/text-attribute-model.js.map +1 -1
- package/dist/text/text-2d/models/text-dictionary-model.cjs +1 -1
- package/dist/text/text-2d/models/text-dictionary-model.js +1 -1
- package/dist/text/text-2d/models/text-dictionary-model.js.map +1 -1
- package/dist/text/text-2d/models/text-storage-model.cjs +1 -1
- package/dist/text/text-2d/models/text-storage-model.js +1 -1
- package/dist/text/text-2d/models/text-storage-model.js.map +1 -1
- package/package.json +13 -8
- package/src/animation/node-animation-binding.ts +18 -1
- package/src/gltf/gltf/animations/animations.ts +8 -1
- 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 +1 -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 +5 -0
- package/src/gltf/pbr/pbr-environment.ts +27 -1
- package/src/graph/models/path/path-attribute-model.ts +1 -1
- package/src/graph/models/path/path-storage-model.ts +1 -1
- package/src/index.ts +16 -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 +88 -0
- package/src/lighting/pbr-environment.ts +55 -0
- package/src/lighting/pbr-material.ts +85 -0
- package/src/lighting/pbr-model.ts +531 -0
- package/src/lighting/pbr-surface-pass.ts +122 -0
- package/src/lighting/prefiltered-environment.ts +354 -0
- package/src/lighting/shadow-map-renderer.ts +909 -0
- package/src/lighting/shadow-quality.ts +50 -0
- package/src/material/material.ts +3 -0
- package/src/model/gpu-vector-model.ts +18 -3
- 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/text/fonts/atlas/text-utils.ts +1 -1
- package/src/text/text-2d/models/text-attribute-model.ts +1 -1
- package/src/text/text-2d/models/text-dictionary-model.ts +1 -1
- package/src/text/text-2d/models/text-storage-model.ts +1 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var punctual_light_controller_exports = {};
|
|
19
|
+
__export(punctual_light_controller_exports, {
|
|
20
|
+
PunctualLightController: () => PunctualLightController,
|
|
21
|
+
makePunctualLight: () => makePunctualLight
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(punctual_light_controller_exports);
|
|
24
|
+
var import_core = require("@math.gl/core");
|
|
25
|
+
var import_shaders = require("@luma.gl/shaders");
|
|
26
|
+
class PunctualLightController {
|
|
27
|
+
bindings;
|
|
28
|
+
useByteColors;
|
|
29
|
+
lights = [];
|
|
30
|
+
constructor(bindings, useByteColors = true) {
|
|
31
|
+
this.bindings = bindings;
|
|
32
|
+
this.useByteColors = useByteColors;
|
|
33
|
+
this.update();
|
|
34
|
+
}
|
|
35
|
+
/** Refreshes the stable light array after node or light properties change. */
|
|
36
|
+
update() {
|
|
37
|
+
this.lights.length = 0;
|
|
38
|
+
for (const { path, definition } of this.bindings) {
|
|
39
|
+
if (!path.length || path.some((node) => !node.display))
|
|
40
|
+
continue;
|
|
41
|
+
const worldMatrix = new import_core.Matrix4();
|
|
42
|
+
for (const node of path)
|
|
43
|
+
worldMatrix.multiplyRight(node.matrix);
|
|
44
|
+
const light = makePunctualLight(definition, worldMatrix, this.useByteColors);
|
|
45
|
+
if (light)
|
|
46
|
+
this.lights.push(light);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function makePunctualLight(definition, worldMatrix, useByteColors) {
|
|
51
|
+
const color = normalizePunctualLightColor(definition.color || [1, 1, 1], useByteColors);
|
|
52
|
+
const intensity = definition.intensity ?? 1;
|
|
53
|
+
switch (definition.type) {
|
|
54
|
+
case "directional":
|
|
55
|
+
return makeDirectionalLight(worldMatrix, color, intensity);
|
|
56
|
+
case "point":
|
|
57
|
+
return makePointLight(worldMatrix, color, intensity, definition.range);
|
|
58
|
+
case "spot":
|
|
59
|
+
return makeSpotLight(worldMatrix, color, intensity, definition.range, definition.spot);
|
|
60
|
+
default:
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function normalizePunctualLightColor(color, useByteColors) {
|
|
65
|
+
if (useByteColors) {
|
|
66
|
+
return color.map((component) => component * 255);
|
|
67
|
+
}
|
|
68
|
+
return (0, import_shaders.normalizeByteColor3)(color, false);
|
|
69
|
+
}
|
|
70
|
+
function makePointLight(worldMatrix, color, intensity, range) {
|
|
71
|
+
const position = getLightPosition(worldMatrix);
|
|
72
|
+
let attenuation = [1, 0, 0];
|
|
73
|
+
if (range !== void 0 && range > 0) {
|
|
74
|
+
attenuation = [1, 0, 1 / (range * range)];
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
type: "point",
|
|
78
|
+
position,
|
|
79
|
+
color,
|
|
80
|
+
intensity,
|
|
81
|
+
attenuation
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function makeDirectionalLight(worldMatrix, color, intensity) {
|
|
85
|
+
const direction = getLightDirection(worldMatrix);
|
|
86
|
+
return {
|
|
87
|
+
type: "directional",
|
|
88
|
+
direction,
|
|
89
|
+
color,
|
|
90
|
+
intensity
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function makeSpotLight(worldMatrix, color, intensity, range, spot = {}) {
|
|
94
|
+
const position = getLightPosition(worldMatrix);
|
|
95
|
+
const direction = getLightDirection(worldMatrix);
|
|
96
|
+
let attenuation = [1, 0, 0];
|
|
97
|
+
if (range !== void 0 && range > 0) {
|
|
98
|
+
attenuation = [1, 0, 1 / (range * range)];
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
type: "spot",
|
|
102
|
+
position,
|
|
103
|
+
direction,
|
|
104
|
+
color,
|
|
105
|
+
intensity,
|
|
106
|
+
attenuation,
|
|
107
|
+
innerConeAngle: spot.innerConeAngle ?? 0,
|
|
108
|
+
outerConeAngle: spot.outerConeAngle ?? Math.PI / 4
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function getLightPosition(worldMatrix) {
|
|
112
|
+
return worldMatrix.transformAsPoint([0, 0, 0]);
|
|
113
|
+
}
|
|
114
|
+
function getLightDirection(worldMatrix) {
|
|
115
|
+
return worldMatrix.transformAsVector([0, 0, -1]);
|
|
116
|
+
}
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
PunctualLightController,
|
|
120
|
+
makePunctualLight
|
|
121
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Matrix4 } from '@math.gl/core';
|
|
2
|
+
import { type Light } from '@luma.gl/shaders';
|
|
3
|
+
import type { ScenegraphNode } from "../scenegraph-node.js";
|
|
4
|
+
/** Light parameters in local space with normalized RGB color. */
|
|
5
|
+
export type PunctualLightDefinition = {
|
|
6
|
+
type: 'directional' | 'point' | 'spot';
|
|
7
|
+
color?: [number, number, number];
|
|
8
|
+
intensity?: number;
|
|
9
|
+
range?: number;
|
|
10
|
+
spot?: {
|
|
11
|
+
innerConeAngle?: number;
|
|
12
|
+
outerConeAngle?: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
/** A light and its root-to-light scenegraph path. */
|
|
16
|
+
export type PunctualLightBinding = {
|
|
17
|
+
path: readonly ScenegraphNode[];
|
|
18
|
+
definition: PunctualLightDefinition;
|
|
19
|
+
};
|
|
20
|
+
/** Projects bound lights using live node transforms and inherited visibility. */
|
|
21
|
+
export declare class PunctualLightController {
|
|
22
|
+
private readonly bindings;
|
|
23
|
+
private readonly useByteColors;
|
|
24
|
+
readonly lights: Light[];
|
|
25
|
+
constructor(bindings: readonly PunctualLightBinding[], useByteColors?: boolean);
|
|
26
|
+
/** Refreshes the stable light array after node or light properties change. */
|
|
27
|
+
update(): void;
|
|
28
|
+
}
|
|
29
|
+
/** Projects a local light definition into the shader's world-space light format. */
|
|
30
|
+
export declare function makePunctualLight(definition: PunctualLightDefinition, worldMatrix: Matrix4, useByteColors: boolean): Light | undefined;
|
|
31
|
+
//# sourceMappingURL=punctual-light-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"punctual-light-controller.d.ts","sourceRoot":"","sources":["../../../src/scenegraph/controllers/punctual-light-controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAGL,KAAK,KAAK,EAGX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAC,cAAc,EAAC,8BAA2B;AAEvD,iEAAiE;AACjE,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;IACvC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE;QAAC,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;CAC3D,CAAC;AAEF,qDAAqD;AACrD,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,SAAS,cAAc,EAAE,CAAC;IAChC,UAAU,EAAE,uBAAuB,CAAC;CACrC,CAAC;AAEF,iFAAiF;AACjF,qBAAa,uBAAuB;IAIhC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAJhC,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,CAAM;gBAGX,QAAQ,EAAE,SAAS,oBAAoB,EAAE,EACzC,aAAa,UAAO;IAKvC,8EAA8E;IAC9E,MAAM,IAAI,IAAI;CAUf;AAED,oFAAoF;AACpF,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,uBAAuB,EACnC,WAAW,EAAE,OAAO,EACpB,aAAa,EAAE,OAAO,GACrB,KAAK,GAAG,SAAS,CAanB"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { Matrix4 } from '@math.gl/core';
|
|
5
|
+
import { normalizeByteColor3 } from '@luma.gl/shaders';
|
|
6
|
+
/** Projects bound lights using live node transforms and inherited visibility. */
|
|
7
|
+
export class PunctualLightController {
|
|
8
|
+
bindings;
|
|
9
|
+
useByteColors;
|
|
10
|
+
lights = [];
|
|
11
|
+
constructor(bindings, useByteColors = true) {
|
|
12
|
+
this.bindings = bindings;
|
|
13
|
+
this.useByteColors = useByteColors;
|
|
14
|
+
this.update();
|
|
15
|
+
}
|
|
16
|
+
/** Refreshes the stable light array after node or light properties change. */
|
|
17
|
+
update() {
|
|
18
|
+
this.lights.length = 0;
|
|
19
|
+
for (const { path, definition } of this.bindings) {
|
|
20
|
+
if (!path.length || path.some(node => !node.display))
|
|
21
|
+
continue;
|
|
22
|
+
const worldMatrix = new Matrix4();
|
|
23
|
+
for (const node of path)
|
|
24
|
+
worldMatrix.multiplyRight(node.matrix);
|
|
25
|
+
const light = makePunctualLight(definition, worldMatrix, this.useByteColors);
|
|
26
|
+
if (light)
|
|
27
|
+
this.lights.push(light);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Projects a local light definition into the shader's world-space light format. */
|
|
32
|
+
export function makePunctualLight(definition, worldMatrix, useByteColors) {
|
|
33
|
+
const color = normalizePunctualLightColor(definition.color || [1, 1, 1], useByteColors);
|
|
34
|
+
const intensity = definition.intensity ?? 1;
|
|
35
|
+
switch (definition.type) {
|
|
36
|
+
case 'directional':
|
|
37
|
+
return makeDirectionalLight(worldMatrix, color, intensity);
|
|
38
|
+
case 'point':
|
|
39
|
+
return makePointLight(worldMatrix, color, intensity, definition.range);
|
|
40
|
+
case 'spot':
|
|
41
|
+
return makeSpotLight(worldMatrix, color, intensity, definition.range, definition.spot);
|
|
42
|
+
default:
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Converts normalized colors from the 0-1 spec range to the configured luma light convention.
|
|
48
|
+
*/
|
|
49
|
+
function normalizePunctualLightColor(color, useByteColors) {
|
|
50
|
+
if (useByteColors) {
|
|
51
|
+
return color.map(component => component * 255);
|
|
52
|
+
}
|
|
53
|
+
return normalizeByteColor3(color, false);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Converts a punctual light attached to a node into a point light.
|
|
57
|
+
*/
|
|
58
|
+
function makePointLight(worldMatrix, color, intensity, range) {
|
|
59
|
+
const position = getLightPosition(worldMatrix);
|
|
60
|
+
let attenuation = [1, 0, 0];
|
|
61
|
+
if (range !== undefined && range > 0) {
|
|
62
|
+
attenuation = [1, 0, 1 / (range * range)];
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
type: 'point',
|
|
66
|
+
position,
|
|
67
|
+
color,
|
|
68
|
+
intensity,
|
|
69
|
+
attenuation
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Converts a punctual light attached to a node into a directional light.
|
|
74
|
+
*/
|
|
75
|
+
function makeDirectionalLight(worldMatrix, color, intensity) {
|
|
76
|
+
const direction = getLightDirection(worldMatrix);
|
|
77
|
+
return {
|
|
78
|
+
type: 'directional',
|
|
79
|
+
direction,
|
|
80
|
+
color,
|
|
81
|
+
intensity
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Converts a punctual light attached to a node into a spot light.
|
|
86
|
+
*/
|
|
87
|
+
function makeSpotLight(worldMatrix, color, intensity, range, spot = {}) {
|
|
88
|
+
const position = getLightPosition(worldMatrix);
|
|
89
|
+
const direction = getLightDirection(worldMatrix);
|
|
90
|
+
let attenuation = [1, 0, 0];
|
|
91
|
+
if (range !== undefined && range > 0) {
|
|
92
|
+
attenuation = [1, 0, 1 / (range * range)];
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
type: 'spot',
|
|
96
|
+
position,
|
|
97
|
+
direction,
|
|
98
|
+
color,
|
|
99
|
+
intensity,
|
|
100
|
+
attenuation,
|
|
101
|
+
innerConeAngle: spot.innerConeAngle ?? 0,
|
|
102
|
+
outerConeAngle: spot.outerConeAngle ?? Math.PI / 4
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Resolves the world-space position of a light node.
|
|
107
|
+
*/
|
|
108
|
+
function getLightPosition(worldMatrix) {
|
|
109
|
+
return worldMatrix.transformAsPoint([0, 0, 0]);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Resolves the world-space forward direction of a light node.
|
|
113
|
+
*/
|
|
114
|
+
function getLightDirection(worldMatrix) {
|
|
115
|
+
return worldMatrix.transformAsVector([0, 0, -1]);
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=punctual-light-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"punctual-light-controller.js","sourceRoot":"","sources":["../../../src/scenegraph/controllers/punctual-light-controller.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EACL,mBAAmB,EAKpB,MAAM,kBAAkB,CAAC;AAkB1B,iFAAiF;AACjF,MA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OwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var scene_metadata_exports = {};
|
|
19
|
+
__export(scene_metadata_exports, {
|
|
20
|
+
SceneMetadata: () => SceneMetadata
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(scene_metadata_exports);
|
|
23
|
+
class SceneMetadata {
|
|
24
|
+
entries = /* @__PURE__ */ new Map();
|
|
25
|
+
/** Associates metadata with a resource category and its source index. */
|
|
26
|
+
set(category, index, metadata) {
|
|
27
|
+
let categoryEntries = this.entries.get(category);
|
|
28
|
+
if (!categoryEntries) {
|
|
29
|
+
categoryEntries = /* @__PURE__ */ new Map();
|
|
30
|
+
this.entries.set(category, categoryEntries);
|
|
31
|
+
}
|
|
32
|
+
categoryEntries.set(index, metadata);
|
|
33
|
+
}
|
|
34
|
+
/** Returns metadata for a resource, or undefined when none was supplied. */
|
|
35
|
+
get(category, index = 0) {
|
|
36
|
+
var _a;
|
|
37
|
+
return (_a = this.entries.get(category)) == null ? void 0 : _a.get(index);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
SceneMetadata
|
|
43
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A collection of source metadata associated with indexed scene resources. */
|
|
2
|
+
export declare class SceneMetadata {
|
|
3
|
+
private readonly entries;
|
|
4
|
+
/** Associates metadata with a resource category and its source index. */
|
|
5
|
+
set(category: string, index: number, metadata: Readonly<Record<string, unknown>>): void;
|
|
6
|
+
/** Returns metadata for a resource, or undefined when none was supplied. */
|
|
7
|
+
get(category: string, index?: number): Readonly<Record<string, unknown>> | undefined;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=scene-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene-metadata.d.ts","sourceRoot":"","sources":["../../src/scenegraph/scene-metadata.ts"],"names":[],"mappings":"AAIA,+EAA+E;AAC/E,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqE;IAE7F,yEAAyE;IACzE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI;IASvF,4EAA4E;IAC5E,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS;CAGhF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
/** A collection of source metadata associated with indexed scene resources. */
|
|
5
|
+
export class SceneMetadata {
|
|
6
|
+
entries = new Map();
|
|
7
|
+
/** Associates metadata with a resource category and its source index. */
|
|
8
|
+
set(category, index, metadata) {
|
|
9
|
+
let categoryEntries = this.entries.get(category);
|
|
10
|
+
if (!categoryEntries) {
|
|
11
|
+
categoryEntries = new Map();
|
|
12
|
+
this.entries.set(category, categoryEntries);
|
|
13
|
+
}
|
|
14
|
+
categoryEntries.set(index, metadata);
|
|
15
|
+
}
|
|
16
|
+
/** Returns metadata for a resource, or undefined when none was supplied. */
|
|
17
|
+
get(category, index = 0) {
|
|
18
|
+
return this.entries.get(category)?.get(index);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=scene-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene-metadata.js","sourceRoot":"","sources":["../../src/scenegraph/scene-metadata.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,+EAA+E;AAC/E,MAAM,OAAO,aAAa;IACP,OAAO,GAAG,IAAI,GAAG,EAA0D,CAAC;IAE7F,yEAAyE;IACzE,GAAG,CAAC,QAAgB,EAAE,KAAa,EAAE,QAA2C;QAC9E,IAAI,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC9C,CAAC;QACD,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,4EAA4E;IAC5E,GAAG,CAAC,QAAgB,EAAE,KAAK,GAAG,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var scenegraph_interaction_exports = {};
|
|
19
|
+
__export(scenegraph_interaction_exports, {
|
|
20
|
+
ScenegraphInteractionManager: () => ScenegraphInteractionManager,
|
|
21
|
+
getFirstScenegraphInteractionHit: () => getFirstScenegraphInteractionHit,
|
|
22
|
+
isScenegraphInteractionEnabled: () => isScenegraphInteractionEnabled
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(scenegraph_interaction_exports);
|
|
25
|
+
function isScenegraphInteractionEnabled(path, kind) {
|
|
26
|
+
return path.length > 0 && path.every((node) => kind === "select" ? node.selectable : node.hoverable);
|
|
27
|
+
}
|
|
28
|
+
function getFirstScenegraphInteractionHit(hits, kind) {
|
|
29
|
+
return hits.find((hit) => isScenegraphInteractionEnabled(hit.path, kind));
|
|
30
|
+
}
|
|
31
|
+
class ScenegraphInteractionManager {
|
|
32
|
+
hoveredHits = /* @__PURE__ */ new Map();
|
|
33
|
+
pendingHover = /* @__PURE__ */ new Map();
|
|
34
|
+
onEvent;
|
|
35
|
+
/** Creates a controller that reports bubbled selection and hover events. */
|
|
36
|
+
constructor(onEvent) {
|
|
37
|
+
this.onEvent = onEvent;
|
|
38
|
+
}
|
|
39
|
+
/** Selects the first eligible nearest-first hit and bubbles from target to root. */
|
|
40
|
+
select(hits, controllerIndex = 0) {
|
|
41
|
+
const hit = getFirstScenegraphInteractionHit(hits, "select");
|
|
42
|
+
if (!hit)
|
|
43
|
+
return void 0;
|
|
44
|
+
this.emitPath("select", hit, 0, controllerIndex);
|
|
45
|
+
return hit;
|
|
46
|
+
}
|
|
47
|
+
/** Updates hover from current hits; call after pointer, camera, object, or flag changes. */
|
|
48
|
+
updateHover(hits, controllerIndex = 0) {
|
|
49
|
+
const hit = getFirstScenegraphInteractionHit(hits, "hover");
|
|
50
|
+
const queuedHit = hit ? { ...hit, path: [...hit.path] } : void 0;
|
|
51
|
+
const activeQueue = this.pendingHover.get(controllerIndex);
|
|
52
|
+
if (activeQueue) {
|
|
53
|
+
activeQueue.push(queuedHit);
|
|
54
|
+
return hit;
|
|
55
|
+
}
|
|
56
|
+
const queue = [queuedHit];
|
|
57
|
+
this.pendingHover.set(controllerIndex, queue);
|
|
58
|
+
try {
|
|
59
|
+
while (queue.length) {
|
|
60
|
+
const next = queue.shift();
|
|
61
|
+
const previous = this.hoveredHits.get(controllerIndex);
|
|
62
|
+
const previousPath = (previous == null ? void 0 : previous.path) || [];
|
|
63
|
+
const nextPath = (next == null ? void 0 : next.path) || [];
|
|
64
|
+
let shared = 0;
|
|
65
|
+
while (shared < previousPath.length && shared < nextPath.length && previousPath[shared] === nextPath[shared])
|
|
66
|
+
shared++;
|
|
67
|
+
if (next)
|
|
68
|
+
this.hoveredHits.set(controllerIndex, next);
|
|
69
|
+
else
|
|
70
|
+
this.hoveredHits.delete(controllerIndex);
|
|
71
|
+
if (previous)
|
|
72
|
+
this.emitPath("hover-out", previous, shared, controllerIndex);
|
|
73
|
+
if (next)
|
|
74
|
+
this.emitPath("hover-in", next, shared, controllerIndex);
|
|
75
|
+
}
|
|
76
|
+
} finally {
|
|
77
|
+
this.pendingHover.delete(controllerIndex);
|
|
78
|
+
}
|
|
79
|
+
return hit;
|
|
80
|
+
}
|
|
81
|
+
/** Emits exits for one controller and drops its tracked hover path. */
|
|
82
|
+
clearHover(controllerIndex = 0) {
|
|
83
|
+
this.updateHover([], controllerIndex);
|
|
84
|
+
}
|
|
85
|
+
/** Emits events from the target towards the first ancestor outside the shared subtree. */
|
|
86
|
+
emitPath(type, hit, first, controllerIndex) {
|
|
87
|
+
const { path } = hit;
|
|
88
|
+
const target = path[path.length - 1];
|
|
89
|
+
for (let index = path.length - 1; index >= first; index--) {
|
|
90
|
+
this.onEvent({ type, target, currentTarget: path[index], controllerIndex, hit });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
+
0 && (module.exports = {
|
|
96
|
+
ScenegraphInteractionManager,
|
|
97
|
+
getFirstScenegraphInteractionHit,
|
|
98
|
+
isScenegraphInteractionEnabled
|
|
99
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ScenegraphNode } from "./scenegraph-node.js";
|
|
2
|
+
/** Action whose authored subtree eligibility is being evaluated. */
|
|
3
|
+
export type ScenegraphInteractionKind = 'select' | 'hover';
|
|
4
|
+
/** A hit with its particular root-to-target path, ordered nearest to farthest by the caller. */
|
|
5
|
+
export type ScenegraphInteractionHit = {
|
|
6
|
+
/** Root-to-target path, including the hit node; distinguishes shared instances. */
|
|
7
|
+
path: readonly ScenegraphNode[];
|
|
8
|
+
/** Optional intersection point in world coordinates. */
|
|
9
|
+
point?: readonly [number, number, number];
|
|
10
|
+
/** Optional world-space ray origin. */
|
|
11
|
+
rayOrigin?: readonly [number, number, number];
|
|
12
|
+
/** Application-specific picking information. */
|
|
13
|
+
data?: unknown;
|
|
14
|
+
};
|
|
15
|
+
/** Returns whether all nodes on an instance path permit the specified action. */
|
|
16
|
+
export declare function isScenegraphInteractionEnabled(path: readonly ScenegraphNode[], kind: ScenegraphInteractionKind): boolean;
|
|
17
|
+
/** Finds the first eligible hit without letting an ineligible hit occlude later candidates. */
|
|
18
|
+
export declare function getFirstScenegraphInteractionHit<Hit extends ScenegraphInteractionHit>(hits: readonly Hit[], kind: ScenegraphInteractionKind): Hit | undefined;
|
|
19
|
+
/** One bubbled host interaction event. */
|
|
20
|
+
export type ScenegraphInteractionEvent = {
|
|
21
|
+
type: 'select' | 'hover-in' | 'hover-out';
|
|
22
|
+
/** Target object where the interaction began or ended. */
|
|
23
|
+
target: ScenegraphNode;
|
|
24
|
+
/** Node receiving this step of the event's upward propagation. */
|
|
25
|
+
currentTarget: ScenegraphNode;
|
|
26
|
+
/** Identifies the pointer or controller. */
|
|
27
|
+
controllerIndex: number;
|
|
28
|
+
/** The original host hit associated with this event. */
|
|
29
|
+
hit: ScenegraphInteractionHit;
|
|
30
|
+
};
|
|
31
|
+
/** Caller-owned hit testing with per-controller hover tracking and subtree event propagation. */
|
|
32
|
+
export declare class ScenegraphInteractionManager {
|
|
33
|
+
private readonly hoveredHits;
|
|
34
|
+
private readonly pendingHover;
|
|
35
|
+
private readonly onEvent;
|
|
36
|
+
/** Creates a controller that reports bubbled selection and hover events. */
|
|
37
|
+
constructor(onEvent: (event: ScenegraphInteractionEvent) => void);
|
|
38
|
+
/** Selects the first eligible nearest-first hit and bubbles from target to root. */
|
|
39
|
+
select<Hit extends ScenegraphInteractionHit>(hits: readonly Hit[], controllerIndex?: number): Hit | undefined;
|
|
40
|
+
/** Updates hover from current hits; call after pointer, camera, object, or flag changes. */
|
|
41
|
+
updateHover<Hit extends ScenegraphInteractionHit>(hits: readonly Hit[], controllerIndex?: number): Hit | undefined;
|
|
42
|
+
/** Emits exits for one controller and drops its tracked hover path. */
|
|
43
|
+
clearHover(controllerIndex?: number): void;
|
|
44
|
+
/** Emits events from the target towards the first ancestor outside the shared subtree. */
|
|
45
|
+
private emitPath;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=scenegraph-interaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenegraph-interaction.d.ts","sourceRoot":"","sources":["../../src/scenegra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QAAQ,CAAC,OAAO,CAA8C;IAEtE,4EAA4E;gBAChE,OAAO,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI;IAIhE,oFAAoF;IACpF,MAAM,CAAC,GAAG,SAAS,wBAAwB,EACzC,IAAI,EAAE,SAAS,GAAG,EAAE,EACpB,eAAe,SAAI,GAClB,GAAG,GAAG,SAAS;IAOlB,4FAA4F;IAC5F,WAAW,CAAC,GAAG,SAAS,wBAAwB,EAC9C,IAAI,EAAE,SAAS,GAAG,EAAE,EACpB,eAAe,SAAI,GAClB,GAAG,GAAG,SAAS;IAkClB,uEAAuE;IACvE,UAAU,CAAC,eAAe,SAAI,GAAG,IAAI;IAIrC,0FAA0F;IAC1F,OAAO,CAAC,QAAQ;CAYjB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
/** Returns whether all nodes on an instance path permit the specified action. */
|
|
5
|
+
export function isScenegraphInteractionEnabled(path, kind) {
|
|
6
|
+
return (path.length > 0 && path.every(node => (kind === 'select' ? node.selectable : node.hoverable)));
|
|
7
|
+
}
|
|
8
|
+
/** Finds the first eligible hit without letting an ineligible hit occlude later candidates. */
|
|
9
|
+
export function getFirstScenegraphInteractionHit(hits, kind) {
|
|
10
|
+
return hits.find(hit => isScenegraphInteractionEnabled(hit.path, kind));
|
|
11
|
+
}
|
|
12
|
+
/** Caller-owned hit testing with per-controller hover tracking and subtree event propagation. */
|
|
13
|
+
export class ScenegraphInteractionManager {
|
|
14
|
+
hoveredHits = new Map();
|
|
15
|
+
pendingHover = new Map();
|
|
16
|
+
onEvent;
|
|
17
|
+
/** Creates a controller that reports bubbled selection and hover events. */
|
|
18
|
+
constructor(onEvent) {
|
|
19
|
+
this.onEvent = onEvent;
|
|
20
|
+
}
|
|
21
|
+
/** Selects the first eligible nearest-first hit and bubbles from target to root. */
|
|
22
|
+
select(hits, controllerIndex = 0) {
|
|
23
|
+
const hit = getFirstScenegraphInteractionHit(hits, 'select');
|
|
24
|
+
if (!hit)
|
|
25
|
+
return undefined;
|
|
26
|
+
this.emitPath('select', hit, 0, controllerIndex);
|
|
27
|
+
return hit;
|
|
28
|
+
}
|
|
29
|
+
/** Updates hover from current hits; call after pointer, camera, object, or flag changes. */
|
|
30
|
+
updateHover(hits, controllerIndex = 0) {
|
|
31
|
+
const hit = getFirstScenegraphInteractionHit(hits, 'hover');
|
|
32
|
+
const queuedHit = hit ? { ...hit, path: [...hit.path] } : undefined;
|
|
33
|
+
const activeQueue = this.pendingHover.get(controllerIndex);
|
|
34
|
+
if (activeQueue) {
|
|
35
|
+
activeQueue.push(queuedHit);
|
|
36
|
+
return hit;
|
|
37
|
+
}
|
|
38
|
+
const queue = [queuedHit];
|
|
39
|
+
this.pendingHover.set(controllerIndex, queue);
|
|
40
|
+
try {
|
|
41
|
+
while (queue.length) {
|
|
42
|
+
const next = queue.shift();
|
|
43
|
+
const previous = this.hoveredHits.get(controllerIndex);
|
|
44
|
+
const previousPath = previous?.path || [];
|
|
45
|
+
const nextPath = next?.path || [];
|
|
46
|
+
let shared = 0;
|
|
47
|
+
while (shared < previousPath.length &&
|
|
48
|
+
shared < nextPath.length &&
|
|
49
|
+
previousPath[shared] === nextPath[shared])
|
|
50
|
+
shared++;
|
|
51
|
+
if (next)
|
|
52
|
+
this.hoveredHits.set(controllerIndex, next);
|
|
53
|
+
else
|
|
54
|
+
this.hoveredHits.delete(controllerIndex);
|
|
55
|
+
if (previous)
|
|
56
|
+
this.emitPath('hover-out', previous, shared, controllerIndex);
|
|
57
|
+
if (next)
|
|
58
|
+
this.emitPath('hover-in', next, shared, controllerIndex);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
this.pendingHover.delete(controllerIndex);
|
|
63
|
+
}
|
|
64
|
+
return hit;
|
|
65
|
+
}
|
|
66
|
+
/** Emits exits for one controller and drops its tracked hover path. */
|
|
67
|
+
clearHover(controllerIndex = 0) {
|
|
68
|
+
this.updateHover([], controllerIndex);
|
|
69
|
+
}
|
|
70
|
+
/** Emits events from the target towards the first ancestor outside the shared subtree. */
|
|
71
|
+
emitPath(type, hit, first, controllerIndex) {
|
|
72
|
+
const { path } = hit;
|
|
73
|
+
const target = path[path.length - 1];
|
|
74
|
+
for (let index = path.length - 1; index >= first; index--) {
|
|
75
|
+
this.onEvent({ type, target, currentTarget: path[index], controllerIndex, hit });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=scenegraph-interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenegraph-interaction.js","sourceRoot":"","sources":["../../src/scenegraph/scenegraph-interaction.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAmB5D,iFAAiF;AACjF,MAAM,UAAU,8BAA8B,CAC5C,IAA+B,EAC/B,IAA+B;IAE/B,OAAO,CACL,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAC9F,CAAC;AACJ,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,gCAAgC,CAC9C,IAAoB,EACpB,IAA+B;IAE/B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,8BAA8B,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAC1E,CAAC;AAeD,iGAAiG;AACjG,MAAM,OAAO,4BAA4B;IACtB,WAAW,GAAG,IAAI,GAAG,EAAoC,CAAC;IAC1D,YAAY,GAAG,IAAI,GAAG,EAAoD,CAAC;IAC3E,OAAO,CAA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,KAAK,EAAE,EAAE,CAAC;YAC1D,IAAI,CAAC,OAAO,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,eAAe,EAAE,GAAG,EAAC,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;CACF"}
|
|
@@ -31,9 +31,15 @@ class ScenegraphNode {
|
|
|
31
31
|
id;
|
|
32
32
|
matrix = new import_core.Matrix4();
|
|
33
33
|
display = true;
|
|
34
|
+
/** Local selection eligibility, independent of visibility. */
|
|
35
|
+
selectable = true;
|
|
36
|
+
/** Local hover eligibility, independent of visibility. */
|
|
37
|
+
hoverable = true;
|
|
34
38
|
position = new import_core.Vector3();
|
|
35
39
|
rotation = new import_core.Vector3();
|
|
36
40
|
scale = new import_core.Vector3(1, 1, 1);
|
|
41
|
+
/** Structured metadata associated with this scene node. */
|
|
42
|
+
metadata = {};
|
|
37
43
|
userData = {};
|
|
38
44
|
props = {};
|
|
39
45
|
constructor(props = {}) {
|
|
@@ -157,6 +163,10 @@ class ScenegraphNode {
|
|
|
157
163
|
}
|
|
158
164
|
*/
|
|
159
165
|
_setScenegraphNodeProps(props) {
|
|
166
|
+
if (props.selectable !== void 0)
|
|
167
|
+
this.selectable = props.selectable;
|
|
168
|
+
if (props.hoverable !== void 0)
|
|
169
|
+
this.hoverable = props.hoverable;
|
|
160
170
|
if (props.display !== void 0) {
|
|
161
171
|
this.display = props.display;
|
|
162
172
|
}
|
|
@@ -2,6 +2,10 @@ import { Vector3, Matrix4, NumericArray } from '@math.gl/core';
|
|
|
2
2
|
/** Properties for creating a new Scenegraph */
|
|
3
3
|
export type ScenegraphNodeProps = {
|
|
4
4
|
id?: string;
|
|
5
|
+
/** Local selection eligibility; ancestors can disable their entire subtree. */
|
|
6
|
+
selectable?: boolean;
|
|
7
|
+
/** Local hover eligibility; ancestors can disable their entire subtree. */
|
|
8
|
+
hoverable?: boolean;
|
|
5
9
|
/** whether to display the object at all */
|
|
6
10
|
display?: boolean;
|
|
7
11
|
matrix?: NumericArray;
|
|
@@ -14,9 +18,15 @@ export declare class ScenegraphNode {
|
|
|
14
18
|
readonly id: string;
|
|
15
19
|
matrix: Matrix4;
|
|
16
20
|
display: boolean;
|
|
21
|
+
/** Local selection eligibility, independent of visibility. */
|
|
22
|
+
selectable: boolean;
|
|
23
|
+
/** Local hover eligibility, independent of visibility. */
|
|
24
|
+
hoverable: boolean;
|
|
17
25
|
position: Vector3;
|
|
18
26
|
rotation: Vector3;
|
|
19
27
|
scale: Vector3;
|
|
28
|
+
/** Structured metadata associated with this scene node. */
|
|
29
|
+
metadata: Record<string, unknown>;
|
|
20
30
|
userData: Record<string, unknown>;
|
|
21
31
|
props: ScenegraphNodeProps;
|
|
22
32
|
constructor(props?: ScenegraphNodeProps);
|