@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
package/dist/dist.dev.js
CHANGED
|
@@ -104,8 +104,11 @@ var __exports__ = (() => {
|
|
|
104
104
|
PickingManager: () => PickingManager,
|
|
105
105
|
PlaneGeometry: () => PlaneGeometry2,
|
|
106
106
|
PointLightModel: () => PointLightModel,
|
|
107
|
+
PunctualLightController: () => PunctualLightController,
|
|
107
108
|
RingGeometry: () => RingGeometry,
|
|
109
|
+
SceneMetadata: () => SceneMetadata,
|
|
108
110
|
ScenegraphAnimator: () => ScenegraphAnimator,
|
|
111
|
+
ScenegraphInteractionManager: () => ScenegraphInteractionManager,
|
|
109
112
|
ScenegraphNode: () => ScenegraphNode,
|
|
110
113
|
ShaderInputs: () => ShaderInputs,
|
|
111
114
|
ShaderPassRenderer: () => ShaderPassRenderer,
|
|
@@ -131,6 +134,7 @@ var __exports__ = (() => {
|
|
|
131
134
|
decomposePhysicsTransform: () => decomposePhysicsTransform,
|
|
132
135
|
deformPositions: () => deformPositions,
|
|
133
136
|
evaluateAnimationSampler: () => evaluateAnimationSampler,
|
|
137
|
+
getFirstScenegraphInteractionHit: () => getFirstScenegraphInteractionHit,
|
|
134
138
|
getGPUVectorModelBatches: () => getGPUVectorModelBatches,
|
|
135
139
|
getIndexPickingModule: () => getIndexPickingModule,
|
|
136
140
|
getPlatformInfo: () => getPlatformInfo,
|
|
@@ -138,6 +142,7 @@ var __exports__ = (() => {
|
|
|
138
142
|
getTextureTransformMatrix: () => getTextureTransformMatrix,
|
|
139
143
|
indexColorPicking: () => picking2,
|
|
140
144
|
indexPicking: () => picking3,
|
|
145
|
+
isScenegraphInteractionEnabled: () => isScenegraphInteractionEnabled,
|
|
141
146
|
legacyColorPicking: () => legacyColorPicking,
|
|
142
147
|
loadImage: () => loadImage,
|
|
143
148
|
loadImageBitmap: () => loadImageBitmap,
|
|
@@ -2502,6 +2507,35 @@ var __exports__ = (() => {
|
|
|
2502
2507
|
out[15] = 1;
|
|
2503
2508
|
return out;
|
|
2504
2509
|
}
|
|
2510
|
+
function affineComponents(matrix) {
|
|
2511
|
+
if (matrix.length !== 16 || Array.from(matrix).some((x) => !Number.isFinite(x)) || matrix[3] !== 0 || matrix[7] !== 0 || matrix[11] !== 0 || matrix[15] !== 1) {
|
|
2512
|
+
throw new RangeError("Expected a finite affine matrix");
|
|
2513
|
+
}
|
|
2514
|
+
const scale5 = [
|
|
2515
|
+
Math.hypot(matrix[0], matrix[1], matrix[2]),
|
|
2516
|
+
Math.hypot(matrix[4], matrix[5], matrix[6]),
|
|
2517
|
+
Math.hypot(matrix[8], matrix[9], matrix[10])
|
|
2518
|
+
];
|
|
2519
|
+
if (scale5.some((x) => x === 0 || !Number.isFinite(x)))
|
|
2520
|
+
throw new RangeError("Singular transform");
|
|
2521
|
+
const rotation = Array.from({ length: 9 }, (_, i) => matrix[Math.floor(i / 3) * 4 + i % 3] / scale5[Math.floor(i / 3)]);
|
|
2522
|
+
for (const [a, b] of [
|
|
2523
|
+
[0, 3],
|
|
2524
|
+
[0, 6],
|
|
2525
|
+
[3, 6]
|
|
2526
|
+
]) {
|
|
2527
|
+
if (Math.abs(rotation[a] * rotation[b] + rotation[a + 1] * rotation[b + 1] + rotation[a + 2] * rotation[b + 2]) > 1e-7) {
|
|
2528
|
+
throw new RangeError("Sheared transforms do not have a TRS decomposition");
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
const determinant3 = rotation[0] * (rotation[4] * rotation[8] - rotation[5] * rotation[7]) - rotation[3] * (rotation[1] * rotation[8] - rotation[2] * rotation[7]) + rotation[6] * (rotation[1] * rotation[5] - rotation[2] * rotation[4]);
|
|
2532
|
+
if (determinant3 < 0) {
|
|
2533
|
+
scale5[0] = -scale5[0];
|
|
2534
|
+
for (let i = 0; i < 3; i++)
|
|
2535
|
+
rotation[i] = -rotation[i];
|
|
2536
|
+
}
|
|
2537
|
+
return { rotation, scale: scale5, translation: [matrix[12], matrix[13], matrix[14]] };
|
|
2538
|
+
}
|
|
2505
2539
|
|
|
2506
2540
|
// ../../node_modules/@math.gl/core/dist/gl-matrix/vec4.js
|
|
2507
2541
|
function add(out, a, b) {
|
|
@@ -2853,27 +2887,15 @@ var __exports__ = (() => {
|
|
|
2853
2887
|
* @returns self
|
|
2854
2888
|
*/
|
|
2855
2889
|
getRotation(result, scaleResult) {
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
result[3] = 0;
|
|
2866
|
-
result[4] = this[4] * inverseScale0;
|
|
2867
|
-
result[5] = this[5] * inverseScale1;
|
|
2868
|
-
result[6] = this[6] * inverseScale2;
|
|
2869
|
-
result[7] = 0;
|
|
2870
|
-
result[8] = this[8] * inverseScale0;
|
|
2871
|
-
result[9] = this[9] * inverseScale1;
|
|
2872
|
-
result[10] = this[10] * inverseScale2;
|
|
2873
|
-
result[11] = 0;
|
|
2874
|
-
result[12] = 0;
|
|
2875
|
-
result[13] = 0;
|
|
2876
|
-
result[14] = 0;
|
|
2890
|
+
const { rotation, scale: scale5 } = affineComponents(this);
|
|
2891
|
+
result = result || new Array(16);
|
|
2892
|
+
if (scaleResult)
|
|
2893
|
+
for (let i = 0; i < 3; i++)
|
|
2894
|
+
scaleResult[i] = scale5[i];
|
|
2895
|
+
for (let i = 0; i < 16; i++)
|
|
2896
|
+
result[i] = 0;
|
|
2897
|
+
for (let i = 0; i < 9; i++)
|
|
2898
|
+
result[Math.floor(i / 3) * 4 + i % 3] = rotation[i];
|
|
2877
2899
|
result[15] = 1;
|
|
2878
2900
|
return result;
|
|
2879
2901
|
}
|
|
@@ -2884,21 +2906,13 @@ var __exports__ = (() => {
|
|
|
2884
2906
|
* @returns self
|
|
2885
2907
|
*/
|
|
2886
2908
|
getRotationMatrix3(result, scaleResult) {
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
result[1] = this[1] * inverseScale1;
|
|
2895
|
-
result[2] = this[2] * inverseScale2;
|
|
2896
|
-
result[3] = this[4] * inverseScale0;
|
|
2897
|
-
result[4] = this[5] * inverseScale1;
|
|
2898
|
-
result[5] = this[6] * inverseScale2;
|
|
2899
|
-
result[6] = this[8] * inverseScale0;
|
|
2900
|
-
result[7] = this[9] * inverseScale1;
|
|
2901
|
-
result[8] = this[10] * inverseScale2;
|
|
2909
|
+
const { rotation, scale: scale5 } = affineComponents(this);
|
|
2910
|
+
result = result || new Array(9);
|
|
2911
|
+
if (scaleResult)
|
|
2912
|
+
for (let i = 0; i < 3; i++)
|
|
2913
|
+
scaleResult[i] = scale5[i];
|
|
2914
|
+
for (let i = 0; i < 9; i++)
|
|
2915
|
+
result[i] = rotation[i];
|
|
2902
2916
|
return result;
|
|
2903
2917
|
}
|
|
2904
2918
|
// Modifiers
|
|
@@ -3291,6 +3305,28 @@ var __exports__ = (() => {
|
|
|
3291
3305
|
return normalize3(out, out);
|
|
3292
3306
|
};
|
|
3293
3307
|
})();
|
|
3308
|
+
function rotateTowards(out, a, b, step) {
|
|
3309
|
+
if (a.length !== 4 || b.length !== 4 || [...Array.from(a), ...Array.from(b), step].some((x) => !Number.isFinite(x))) {
|
|
3310
|
+
throw new RangeError("Expected finite quaternions and step");
|
|
3311
|
+
}
|
|
3312
|
+
if (a.length !== 4 || step < 0)
|
|
3313
|
+
throw new RangeError("Expected quaternions and a nonnegative step");
|
|
3314
|
+
const aScale = Math.max(...Array.from(a, Math.abs)), bScale = Math.max(...Array.from(b, Math.abs));
|
|
3315
|
+
if (!aScale || !bScale)
|
|
3316
|
+
throw new RangeError("Zero quaternion");
|
|
3317
|
+
const an = Array.from(a, (x) => x / aScale), bn = Array.from(b, (x) => x / bScale);
|
|
3318
|
+
const al = Math.hypot(...an), bl = Math.hypot(...bn);
|
|
3319
|
+
for (let i = 0; i < 4; i++) {
|
|
3320
|
+
an[i] /= al;
|
|
3321
|
+
bn[i] /= bl;
|
|
3322
|
+
}
|
|
3323
|
+
const dot4 = an.reduce((sum, x, i) => sum + x * bn[i], 0);
|
|
3324
|
+
const angle2 = 2 * Math.acos(Math.min(1, Math.abs(dot4)));
|
|
3325
|
+
if (out.length < 4)
|
|
3326
|
+
throw new RangeError("Result buffer is too short");
|
|
3327
|
+
slerp(out, an, bn, angle2 === 0 ? 0 : Math.min(1, step / angle2));
|
|
3328
|
+
return out;
|
|
3329
|
+
}
|
|
3294
3330
|
|
|
3295
3331
|
// ../../node_modules/@math.gl/core/dist/classes/quaternion.js
|
|
3296
3332
|
var Quaternion = class extends MathArray {
|
|
@@ -3363,6 +3399,9 @@ var __exports__ = (() => {
|
|
|
3363
3399
|
return this.check();
|
|
3364
3400
|
}
|
|
3365
3401
|
/** Set a quat to the identity quaternion */
|
|
3402
|
+
rotateTowards(target, step) {
|
|
3403
|
+
return rotateTowards(this, this, target, step);
|
|
3404
|
+
}
|
|
3366
3405
|
identity() {
|
|
3367
3406
|
identity2(this);
|
|
3368
3407
|
return this.check();
|
|
@@ -13896,10 +13935,20 @@ ${declarations.join("\n")}`).match(
|
|
|
13896
13935
|
*/
|
|
13897
13936
|
draw(renderPass, options) {
|
|
13898
13937
|
if (options?.parameters) {
|
|
13899
|
-
return
|
|
13938
|
+
return this._withDrawParameters(renderPass, options.parameters, () => this._draw(renderPass));
|
|
13900
13939
|
}
|
|
13901
13940
|
return this._draw(renderPass);
|
|
13902
13941
|
}
|
|
13942
|
+
/** Applies draw overrides around the complete model batch, including failure paths. */
|
|
13943
|
+
_withDrawParameters(renderPass, parameters, draw) {
|
|
13944
|
+
const state = renderPass.getParameters();
|
|
13945
|
+
try {
|
|
13946
|
+
renderPass.setParameters(parameters);
|
|
13947
|
+
return draw();
|
|
13948
|
+
} finally {
|
|
13949
|
+
renderPass.setParameters(state);
|
|
13950
|
+
}
|
|
13951
|
+
}
|
|
13903
13952
|
_draw(renderPass) {
|
|
13904
13953
|
if (this.indexVector?.length === 0) {
|
|
13905
13954
|
this._lastDrawTimestamp = this.device.timestamp;
|
|
@@ -15231,6 +15280,8 @@ ${declarations.join("\n")}`).match(
|
|
|
15231
15280
|
var Material = class {
|
|
15232
15281
|
/** Application-provided identifier. */
|
|
15233
15282
|
id;
|
|
15283
|
+
/** Structured metadata associated with this material. */
|
|
15284
|
+
metadata = {};
|
|
15234
15285
|
/** Device that owns the material resources. */
|
|
15235
15286
|
device;
|
|
15236
15287
|
/** Factory that defines the material schema. */
|
|
@@ -15287,6 +15338,7 @@ ${declarations.join("\n")}`).match(
|
|
|
15287
15338
|
if (props.moduleProps) {
|
|
15288
15339
|
material.setProps(props.moduleProps);
|
|
15289
15340
|
}
|
|
15341
|
+
material.metadata = { ...this.metadata };
|
|
15290
15342
|
material.updateShaderInputs();
|
|
15291
15343
|
return material;
|
|
15292
15344
|
}
|
|
@@ -16502,9 +16554,15 @@ void main(void) {
|
|
|
16502
16554
|
id;
|
|
16503
16555
|
matrix = new Matrix4();
|
|
16504
16556
|
display = true;
|
|
16557
|
+
/** Local selection eligibility, independent of visibility. */
|
|
16558
|
+
selectable = true;
|
|
16559
|
+
/** Local hover eligibility, independent of visibility. */
|
|
16560
|
+
hoverable = true;
|
|
16505
16561
|
position = new Vector3();
|
|
16506
16562
|
rotation = new Vector3();
|
|
16507
16563
|
scale = new Vector3(1, 1, 1);
|
|
16564
|
+
/** Structured metadata associated with this scene node. */
|
|
16565
|
+
metadata = {};
|
|
16508
16566
|
userData = {};
|
|
16509
16567
|
props = {};
|
|
16510
16568
|
constructor(props = {}) {
|
|
@@ -16628,6 +16686,8 @@ void main(void) {
|
|
|
16628
16686
|
}
|
|
16629
16687
|
*/
|
|
16630
16688
|
_setScenegraphNodeProps(props) {
|
|
16689
|
+
if (props.selectable !== void 0) this.selectable = props.selectable;
|
|
16690
|
+
if (props.hoverable !== void 0) this.hoverable = props.hoverable;
|
|
16631
16691
|
if (props.display !== void 0) {
|
|
16632
16692
|
this.display = props.display;
|
|
16633
16693
|
}
|
|
@@ -16648,6 +16708,90 @@ void main(void) {
|
|
|
16648
16708
|
}
|
|
16649
16709
|
};
|
|
16650
16710
|
|
|
16711
|
+
// src/scenegraph/scenegraph-interaction.ts
|
|
16712
|
+
function isScenegraphInteractionEnabled(path, kind) {
|
|
16713
|
+
return path.length > 0 && path.every((node) => kind === "select" ? node.selectable : node.hoverable);
|
|
16714
|
+
}
|
|
16715
|
+
function getFirstScenegraphInteractionHit(hits, kind) {
|
|
16716
|
+
return hits.find((hit) => isScenegraphInteractionEnabled(hit.path, kind));
|
|
16717
|
+
}
|
|
16718
|
+
var ScenegraphInteractionManager = class {
|
|
16719
|
+
hoveredHits = /* @__PURE__ */ new Map();
|
|
16720
|
+
pendingHover = /* @__PURE__ */ new Map();
|
|
16721
|
+
onEvent;
|
|
16722
|
+
/** Creates a controller that reports bubbled selection and hover events. */
|
|
16723
|
+
constructor(onEvent) {
|
|
16724
|
+
this.onEvent = onEvent;
|
|
16725
|
+
}
|
|
16726
|
+
/** Selects the first eligible nearest-first hit and bubbles from target to root. */
|
|
16727
|
+
select(hits, controllerIndex = 0) {
|
|
16728
|
+
const hit = getFirstScenegraphInteractionHit(hits, "select");
|
|
16729
|
+
if (!hit) return void 0;
|
|
16730
|
+
this.emitPath("select", hit, 0, controllerIndex);
|
|
16731
|
+
return hit;
|
|
16732
|
+
}
|
|
16733
|
+
/** Updates hover from current hits; call after pointer, camera, object, or flag changes. */
|
|
16734
|
+
updateHover(hits, controllerIndex = 0) {
|
|
16735
|
+
const hit = getFirstScenegraphInteractionHit(hits, "hover");
|
|
16736
|
+
const queuedHit = hit ? { ...hit, path: [...hit.path] } : void 0;
|
|
16737
|
+
const activeQueue = this.pendingHover.get(controllerIndex);
|
|
16738
|
+
if (activeQueue) {
|
|
16739
|
+
activeQueue.push(queuedHit);
|
|
16740
|
+
return hit;
|
|
16741
|
+
}
|
|
16742
|
+
const queue = [queuedHit];
|
|
16743
|
+
this.pendingHover.set(controllerIndex, queue);
|
|
16744
|
+
try {
|
|
16745
|
+
while (queue.length) {
|
|
16746
|
+
const next = queue.shift();
|
|
16747
|
+
const previous = this.hoveredHits.get(controllerIndex);
|
|
16748
|
+
const previousPath = previous?.path || [];
|
|
16749
|
+
const nextPath = next?.path || [];
|
|
16750
|
+
let shared = 0;
|
|
16751
|
+
while (shared < previousPath.length && shared < nextPath.length && previousPath[shared] === nextPath[shared])
|
|
16752
|
+
shared++;
|
|
16753
|
+
if (next) this.hoveredHits.set(controllerIndex, next);
|
|
16754
|
+
else this.hoveredHits.delete(controllerIndex);
|
|
16755
|
+
if (previous) this.emitPath("hover-out", previous, shared, controllerIndex);
|
|
16756
|
+
if (next) this.emitPath("hover-in", next, shared, controllerIndex);
|
|
16757
|
+
}
|
|
16758
|
+
} finally {
|
|
16759
|
+
this.pendingHover.delete(controllerIndex);
|
|
16760
|
+
}
|
|
16761
|
+
return hit;
|
|
16762
|
+
}
|
|
16763
|
+
/** Emits exits for one controller and drops its tracked hover path. */
|
|
16764
|
+
clearHover(controllerIndex = 0) {
|
|
16765
|
+
this.updateHover([], controllerIndex);
|
|
16766
|
+
}
|
|
16767
|
+
/** Emits events from the target towards the first ancestor outside the shared subtree. */
|
|
16768
|
+
emitPath(type, hit, first, controllerIndex) {
|
|
16769
|
+
const { path } = hit;
|
|
16770
|
+
const target = path[path.length - 1];
|
|
16771
|
+
for (let index = path.length - 1; index >= first; index--) {
|
|
16772
|
+
this.onEvent({ type, target, currentTarget: path[index], controllerIndex, hit });
|
|
16773
|
+
}
|
|
16774
|
+
}
|
|
16775
|
+
};
|
|
16776
|
+
|
|
16777
|
+
// src/scenegraph/scene-metadata.ts
|
|
16778
|
+
var SceneMetadata = class {
|
|
16779
|
+
entries = /* @__PURE__ */ new Map();
|
|
16780
|
+
/** Associates metadata with a resource category and its source index. */
|
|
16781
|
+
set(category, index, metadata) {
|
|
16782
|
+
let categoryEntries = this.entries.get(category);
|
|
16783
|
+
if (!categoryEntries) {
|
|
16784
|
+
categoryEntries = /* @__PURE__ */ new Map();
|
|
16785
|
+
this.entries.set(category, categoryEntries);
|
|
16786
|
+
}
|
|
16787
|
+
categoryEntries.set(index, metadata);
|
|
16788
|
+
}
|
|
16789
|
+
/** Returns metadata for a resource, or undefined when none was supplied. */
|
|
16790
|
+
get(category, index = 0) {
|
|
16791
|
+
return this.entries.get(category)?.get(index);
|
|
16792
|
+
}
|
|
16793
|
+
};
|
|
16794
|
+
|
|
16651
16795
|
// src/scenegraph/group-node.ts
|
|
16652
16796
|
var import_core23 = __toESM(require_core(), 1);
|
|
16653
16797
|
|
|
@@ -20477,8 +20621,99 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20477
20621
|
]);
|
|
20478
20622
|
}
|
|
20479
20623
|
|
|
20624
|
+
// src/scenegraph/controllers/punctual-light-controller.ts
|
|
20625
|
+
var import_shaders8 = __toESM(require_shaders(), 1);
|
|
20626
|
+
var PunctualLightController = class {
|
|
20627
|
+
constructor(bindings, useByteColors = true) {
|
|
20628
|
+
this.bindings = bindings;
|
|
20629
|
+
this.useByteColors = useByteColors;
|
|
20630
|
+
this.update();
|
|
20631
|
+
}
|
|
20632
|
+
bindings;
|
|
20633
|
+
useByteColors;
|
|
20634
|
+
lights = [];
|
|
20635
|
+
/** Refreshes the stable light array after node or light properties change. */
|
|
20636
|
+
update() {
|
|
20637
|
+
this.lights.length = 0;
|
|
20638
|
+
for (const { path, definition } of this.bindings) {
|
|
20639
|
+
if (!path.length || path.some((node) => !node.display)) continue;
|
|
20640
|
+
const worldMatrix = new Matrix4();
|
|
20641
|
+
for (const node of path) worldMatrix.multiplyRight(node.matrix);
|
|
20642
|
+
const light = makePunctualLight(definition, worldMatrix, this.useByteColors);
|
|
20643
|
+
if (light) this.lights.push(light);
|
|
20644
|
+
}
|
|
20645
|
+
}
|
|
20646
|
+
};
|
|
20647
|
+
function makePunctualLight(definition, worldMatrix, useByteColors) {
|
|
20648
|
+
const color = normalizePunctualLightColor(definition.color || [1, 1, 1], useByteColors);
|
|
20649
|
+
const intensity = definition.intensity ?? 1;
|
|
20650
|
+
switch (definition.type) {
|
|
20651
|
+
case "directional":
|
|
20652
|
+
return makeDirectionalLight(worldMatrix, color, intensity);
|
|
20653
|
+
case "point":
|
|
20654
|
+
return makePointLight(worldMatrix, color, intensity, definition.range);
|
|
20655
|
+
case "spot":
|
|
20656
|
+
return makeSpotLight(worldMatrix, color, intensity, definition.range, definition.spot);
|
|
20657
|
+
default:
|
|
20658
|
+
return void 0;
|
|
20659
|
+
}
|
|
20660
|
+
}
|
|
20661
|
+
function normalizePunctualLightColor(color, useByteColors) {
|
|
20662
|
+
if (useByteColors) {
|
|
20663
|
+
return color.map((component) => component * 255);
|
|
20664
|
+
}
|
|
20665
|
+
return (0, import_shaders8.normalizeByteColor3)(color, false);
|
|
20666
|
+
}
|
|
20667
|
+
function makePointLight(worldMatrix, color, intensity, range) {
|
|
20668
|
+
const position = getLightPosition(worldMatrix);
|
|
20669
|
+
let attenuation = [1, 0, 0];
|
|
20670
|
+
if (range !== void 0 && range > 0) {
|
|
20671
|
+
attenuation = [1, 0, 1 / (range * range)];
|
|
20672
|
+
}
|
|
20673
|
+
return {
|
|
20674
|
+
type: "point",
|
|
20675
|
+
position,
|
|
20676
|
+
color,
|
|
20677
|
+
intensity,
|
|
20678
|
+
attenuation
|
|
20679
|
+
};
|
|
20680
|
+
}
|
|
20681
|
+
function makeDirectionalLight(worldMatrix, color, intensity) {
|
|
20682
|
+
const direction = getLightDirection(worldMatrix);
|
|
20683
|
+
return {
|
|
20684
|
+
type: "directional",
|
|
20685
|
+
direction,
|
|
20686
|
+
color,
|
|
20687
|
+
intensity
|
|
20688
|
+
};
|
|
20689
|
+
}
|
|
20690
|
+
function makeSpotLight(worldMatrix, color, intensity, range, spot = {}) {
|
|
20691
|
+
const position = getLightPosition(worldMatrix);
|
|
20692
|
+
const direction = getLightDirection(worldMatrix);
|
|
20693
|
+
let attenuation = [1, 0, 0];
|
|
20694
|
+
if (range !== void 0 && range > 0) {
|
|
20695
|
+
attenuation = [1, 0, 1 / (range * range)];
|
|
20696
|
+
}
|
|
20697
|
+
return {
|
|
20698
|
+
type: "spot",
|
|
20699
|
+
position,
|
|
20700
|
+
direction,
|
|
20701
|
+
color,
|
|
20702
|
+
intensity,
|
|
20703
|
+
attenuation,
|
|
20704
|
+
innerConeAngle: spot.innerConeAngle ?? 0,
|
|
20705
|
+
outerConeAngle: spot.outerConeAngle ?? Math.PI / 4
|
|
20706
|
+
};
|
|
20707
|
+
}
|
|
20708
|
+
function getLightPosition(worldMatrix) {
|
|
20709
|
+
return worldMatrix.transformAsPoint([0, 0, 0]);
|
|
20710
|
+
}
|
|
20711
|
+
function getLightDirection(worldMatrix) {
|
|
20712
|
+
return worldMatrix.transformAsVector([0, 0, -1]);
|
|
20713
|
+
}
|
|
20714
|
+
|
|
20480
20715
|
// src/scenegraph/controllers/area-light-controller.ts
|
|
20481
|
-
var
|
|
20716
|
+
var import_core37 = __toESM(require_core(), 1);
|
|
20482
20717
|
var AreaLightController = class {
|
|
20483
20718
|
scenes;
|
|
20484
20719
|
matrixAuthoredNodes = /* @__PURE__ */ new Set();
|
|
@@ -20488,11 +20723,11 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20488
20723
|
for (const node of matrixNodes) this.matrixAuthoredNodes.add(node);
|
|
20489
20724
|
for (const { node, definition, matrixAuthored } of bindings) {
|
|
20490
20725
|
if (matrixAuthored) this.matrixAuthoredNodes.add(node);
|
|
20491
|
-
(0,
|
|
20492
|
-
(0,
|
|
20493
|
-
(0,
|
|
20494
|
-
(0,
|
|
20495
|
-
(0,
|
|
20726
|
+
(0, import_core37.assert)(definition && (definition.type === "rect" || definition.type === "disk"));
|
|
20727
|
+
(0, import_core37.assert)(Number.isFinite(definition.height ?? 1) && (definition.height ?? 1) > 0);
|
|
20728
|
+
(0, import_core37.assert)(Number.isFinite(definition.intensity ?? 1e3) && (definition.intensity ?? 1e3) > 0);
|
|
20729
|
+
(0, import_core37.assert)(Number.isFinite(definition.width ?? 1) && (definition.width ?? 1) > 0);
|
|
20730
|
+
(0, import_core37.assert)(
|
|
20496
20731
|
(definition.color || [1, 1, 1]).every(
|
|
20497
20732
|
(component) => Number.isFinite(component) && component >= 0
|
|
20498
20733
|
)
|
|
@@ -20558,17 +20793,17 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
20558
20793
|
function getMatrixRotation(matrix) {
|
|
20559
20794
|
const horizontal = new Vector3(matrix[0], matrix[1], matrix[2]);
|
|
20560
20795
|
const vertical = new Vector3(matrix[4], matrix[5], matrix[6]);
|
|
20561
|
-
(0,
|
|
20796
|
+
(0, import_core37.assert)(horizontal.magnitude() > 0 && vertical.magnitude() > 0);
|
|
20562
20797
|
horizontal.normalize();
|
|
20563
20798
|
vertical.normalize();
|
|
20564
20799
|
vertical.subtract(new Vector3(horizontal).scale(vertical.dot(horizontal)));
|
|
20565
|
-
(0,
|
|
20800
|
+
(0, import_core37.assert)(vertical.magnitude() > 1e-8);
|
|
20566
20801
|
vertical.normalize();
|
|
20567
20802
|
const forward = new Vector3(horizontal).cross(vertical).normalize();
|
|
20568
20803
|
const authoredForward = new Vector3(matrix[8], matrix[9], matrix[10]);
|
|
20569
|
-
(0,
|
|
20804
|
+
(0, import_core37.assert)(authoredForward.magnitude() > 0);
|
|
20570
20805
|
authoredForward.normalize();
|
|
20571
|
-
(0,
|
|
20806
|
+
(0, import_core37.assert)(Math.abs(forward.dot(authoredForward)) > 1e-8);
|
|
20572
20807
|
if (forward.dot(authoredForward) < 0) forward.negate();
|
|
20573
20808
|
return new Matrix4([
|
|
20574
20809
|
horizontal[0],
|
|
@@ -21126,15 +21361,15 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21126
21361
|
};
|
|
21127
21362
|
|
|
21128
21363
|
// src/audio/audio-graph.ts
|
|
21129
|
-
var
|
|
21364
|
+
var import_core39 = __toESM(require_core(), 1);
|
|
21130
21365
|
var AudioGraph = class {
|
|
21131
21366
|
constructor(definition, context, destination, getEmitterInputs) {
|
|
21132
21367
|
this.definition = definition;
|
|
21133
21368
|
for (const node of definition.nodes)
|
|
21134
|
-
(0,
|
|
21369
|
+
(0, import_core39.assert)(!node.bypass || node.kind !== "splitter" && node.kind !== "channelmerger");
|
|
21135
21370
|
const validateEndpoint = (index, port = 0) => {
|
|
21136
|
-
(0,
|
|
21137
|
-
(0,
|
|
21371
|
+
(0, import_core39.assert)(Number.isInteger(index) && Boolean(definition.nodes[index]));
|
|
21372
|
+
(0, import_core39.assert)(Number.isInteger(port) && port >= 0);
|
|
21138
21373
|
};
|
|
21139
21374
|
for (const edge of definition.connections) {
|
|
21140
21375
|
validateEndpoint(edge.from.node, edge.from.output);
|
|
@@ -21142,16 +21377,16 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21142
21377
|
}
|
|
21143
21378
|
for (const input of definition.inputs || []) {
|
|
21144
21379
|
validateEndpoint(input.node, input.input);
|
|
21145
|
-
(0,
|
|
21380
|
+
(0, import_core39.assert)(Number.isInteger(input.source) && input.source >= 0);
|
|
21146
21381
|
}
|
|
21147
21382
|
for (const output of definition.outputs || []) {
|
|
21148
21383
|
validateEndpoint(output.node, output.output);
|
|
21149
|
-
(0,
|
|
21384
|
+
(0, import_core39.assert)(Number.isInteger(output.emitter) && output.emitter >= 0);
|
|
21150
21385
|
}
|
|
21151
21386
|
const visiting = /* @__PURE__ */ new Set();
|
|
21152
21387
|
const visited = /* @__PURE__ */ new Set();
|
|
21153
21388
|
const visit = (index) => {
|
|
21154
|
-
(0,
|
|
21389
|
+
(0, import_core39.assert)(definition.nodes[index] && !visiting.has(index));
|
|
21155
21390
|
if (visited.has(index)) return;
|
|
21156
21391
|
visiting.add(index);
|
|
21157
21392
|
for (const edge of definition.connections) if (edge.from.node === index) visit(edge.to.node);
|
|
@@ -21212,7 +21447,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21212
21447
|
/** Apply a scene-driven gain change using the authored transition shape. */
|
|
21213
21448
|
setGain(index, gain, time = this.nodes[index].context.currentTime) {
|
|
21214
21449
|
const definition = this.definition.nodes[index];
|
|
21215
|
-
(0,
|
|
21450
|
+
(0, import_core39.assert)(definition.kind === "gain" && !definition.bypass && gain >= 0);
|
|
21216
21451
|
const parameter = this.nodes[index].gain;
|
|
21217
21452
|
const duration = definition.params.duration ?? 0;
|
|
21218
21453
|
const initialGain = parameter.value;
|
|
@@ -21222,7 +21457,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21222
21457
|
parameter.setValueAtTime(gain, time);
|
|
21223
21458
|
} else if (definition.params.interpolation === "custom") {
|
|
21224
21459
|
const curve = definition.params.curve;
|
|
21225
|
-
(0,
|
|
21460
|
+
(0, import_core39.assert)(curve && curve.length >= 2 && curve.every((value) => value >= 0 && value <= 1));
|
|
21226
21461
|
parameter.setValueCurveAtTime(
|
|
21227
21462
|
Float32Array.from(curve, (value) => value * gain),
|
|
21228
21463
|
time,
|
|
@@ -21307,7 +21542,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21307
21542
|
}
|
|
21308
21543
|
|
|
21309
21544
|
// src/audio/audio-environment.ts
|
|
21310
|
-
var
|
|
21545
|
+
var import_core41 = __toESM(require_core(), 1);
|
|
21311
21546
|
function selectAudioEnvironmentZone(zones, position) {
|
|
21312
21547
|
let selected;
|
|
21313
21548
|
for (const zone of zones) {
|
|
@@ -21400,7 +21635,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21400
21635
|
}
|
|
21401
21636
|
};
|
|
21402
21637
|
function createParametricAudioResponse(context, parameters) {
|
|
21403
|
-
(0,
|
|
21638
|
+
(0, import_core41.assert)((parameters.density ?? 1) === 1 && (parameters.diffusion ?? 1) === 1);
|
|
21404
21639
|
const presets = {
|
|
21405
21640
|
generic: [1.49, 0.83, 7e-3, 0.011],
|
|
21406
21641
|
smallRoom: [0.4, 0.83, 2e-3, 3e-3],
|
|
@@ -21417,12 +21652,12 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21417
21652
|
underwater: [1.49, 0.1, 7e-3, 0.011]
|
|
21418
21653
|
};
|
|
21419
21654
|
const preset = parameters.preset ? presets[parameters.preset] : void 0;
|
|
21420
|
-
(0,
|
|
21655
|
+
(0, import_core41.assert)(!parameters.preset || preset);
|
|
21421
21656
|
const decay = parameters.decayTime ?? preset?.[0] ?? 1.5;
|
|
21422
21657
|
const highFrequencyDecay = decay * (parameters.decayHFRatio ?? preset?.[1] ?? 0.83);
|
|
21423
21658
|
const earlyDelay = parameters.reflectionsDelay ?? preset?.[2] ?? 0.02;
|
|
21424
21659
|
const tailDelay = earlyDelay + (parameters.reverbDelay ?? preset?.[3] ?? 0.04);
|
|
21425
|
-
(0,
|
|
21660
|
+
(0, import_core41.assert)(decay > 0 && highFrequencyDecay > 0 && earlyDelay >= 0 && tailDelay >= earlyDelay);
|
|
21426
21661
|
const response = context.createBuffer(
|
|
21427
21662
|
2,
|
|
21428
21663
|
Math.ceil((tailDelay + Math.max(decay, highFrequencyDecay)) * context.sampleRate),
|
|
@@ -21446,7 +21681,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21446
21681
|
}
|
|
21447
21682
|
|
|
21448
21683
|
// src/audio/audio-controller.ts
|
|
21449
|
-
var
|
|
21684
|
+
var import_core42 = __toESM(require_core(), 1);
|
|
21450
21685
|
var AudioController = class {
|
|
21451
21686
|
gain;
|
|
21452
21687
|
definition;
|
|
@@ -21556,25 +21791,25 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21556
21791
|
/** Change a graph gain using its authored interpolation and duration. */
|
|
21557
21792
|
setGraphGain(graphIndex, nodeIndex, gain) {
|
|
21558
21793
|
const graph = this.graphs.get(graphIndex);
|
|
21559
|
-
(0,
|
|
21794
|
+
(0, import_core42.assert)(!this.destroyed && graph);
|
|
21560
21795
|
graph.setGain(nodeIndex, gain);
|
|
21561
21796
|
}
|
|
21562
21797
|
startSource(sourceIndex, startTime, autoplayOnly, connect) {
|
|
21563
21798
|
const definition = this.definition.sources[sourceIndex];
|
|
21564
|
-
(0,
|
|
21799
|
+
(0, import_core42.assert)(definition);
|
|
21565
21800
|
if (autoplayOnly && !definition.autoPlay) return;
|
|
21566
21801
|
const context = this.options.audioContext;
|
|
21567
21802
|
const extended = definition.graph;
|
|
21568
21803
|
const oscillator = extended?.oscillator;
|
|
21569
|
-
(0,
|
|
21804
|
+
(0, import_core42.assert)(!(definition.audio !== void 0 && oscillator));
|
|
21570
21805
|
let source4;
|
|
21571
21806
|
if (oscillator) {
|
|
21572
21807
|
const node = context.createOscillator();
|
|
21573
21808
|
node.frequency.value = oscillator.frequency ?? 440;
|
|
21574
21809
|
node.detune.value = oscillator.detune ?? 0;
|
|
21575
|
-
(0,
|
|
21810
|
+
(0, import_core42.assert)(oscillator.pulseWidth === void 0 || oscillator.pulseWidth === 0.5);
|
|
21576
21811
|
if (oscillator.type === "custom") {
|
|
21577
|
-
(0,
|
|
21812
|
+
(0, import_core42.assert)(oscillator.periodicWave);
|
|
21578
21813
|
node.setPeriodicWave(
|
|
21579
21814
|
context.createPeriodicWave(
|
|
21580
21815
|
new Float32Array(oscillator.periodicWave.real),
|
|
@@ -21585,7 +21820,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21585
21820
|
source4 = node;
|
|
21586
21821
|
} else {
|
|
21587
21822
|
const node = context.createBufferSource();
|
|
21588
|
-
(0,
|
|
21823
|
+
(0, import_core42.assert)(definition.audio !== void 0);
|
|
21589
21824
|
node.buffer = this.buffers.get(definition.audio);
|
|
21590
21825
|
node.loop = definition.loop ?? false;
|
|
21591
21826
|
node.loopStart = extended?.loopStart ?? 0;
|
|
@@ -21730,15 +21965,15 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21730
21965
|
}
|
|
21731
21966
|
addEmitter(index, node) {
|
|
21732
21967
|
const definition = this.definition.emitters[index];
|
|
21733
|
-
(0,
|
|
21968
|
+
(0, import_core42.assert)(
|
|
21734
21969
|
definition && (definition.type === "global" || definition.type === "positional" && node)
|
|
21735
21970
|
);
|
|
21736
|
-
(0,
|
|
21971
|
+
(0, import_core42.assert)(
|
|
21737
21972
|
!definition.positional?.shapeType || ["cone", "omnidirectional"].includes(definition.positional.shapeType)
|
|
21738
21973
|
);
|
|
21739
21974
|
for (const sourceIndex of this.graphEmitters.has(index) ? [] : definition.sources || []) {
|
|
21740
21975
|
const source4 = this.definition.sources[sourceIndex];
|
|
21741
|
-
(0,
|
|
21976
|
+
(0, import_core42.assert)(
|
|
21742
21977
|
source4 && (source4.audio !== void 0 ? this.definition.audio[source4.audio] : source4.graph?.oscillator)
|
|
21743
21978
|
);
|
|
21744
21979
|
}
|
|
@@ -21783,7 +22018,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21783
22018
|
const audioIndices = new Set(
|
|
21784
22019
|
[...sourceIndices].map((index) => {
|
|
21785
22020
|
const source4 = this.definition.sources[index];
|
|
21786
|
-
(0,
|
|
22021
|
+
(0, import_core42.assert)(
|
|
21787
22022
|
source4 && (source4.audio !== void 0 ? this.definition.audio[source4.audio] : source4.graph?.oscillator)
|
|
21788
22023
|
);
|
|
21789
22024
|
return source4.audio;
|
|
@@ -21820,7 +22055,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21820
22055
|
const reverb = environment.reverb;
|
|
21821
22056
|
if (!reverb) return;
|
|
21822
22057
|
const response = reverb.type === "impulseResponse" ? this.buffers.get(reverb.audio) : createParametricAudioResponse(audioContext, reverb);
|
|
21823
|
-
(0,
|
|
22058
|
+
(0, import_core42.assert)(response);
|
|
21824
22059
|
const bus = new AudioReverbBus(audioContext, response, this.gain, {
|
|
21825
22060
|
...reverb,
|
|
21826
22061
|
normalize: reverb.type === "impulseResponse" ? reverb.normalize : false
|
|
@@ -21925,11 +22160,11 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21925
22160
|
};
|
|
21926
22161
|
|
|
21927
22162
|
// src/modules/picking/legacy-color-picking.ts
|
|
21928
|
-
var
|
|
21929
|
-
var legacyColorPicking =
|
|
22163
|
+
var import_shaders9 = __toESM(require_shaders(), 1);
|
|
22164
|
+
var legacyColorPicking = import_shaders9.picking;
|
|
21930
22165
|
|
|
21931
22166
|
// src/geometry/ring-geometry.ts
|
|
21932
|
-
var
|
|
22167
|
+
var import_core44 = __toESM(require_core(), 1);
|
|
21933
22168
|
var RingGeometry = class extends Geometry2 {
|
|
21934
22169
|
constructor(props = {}) {
|
|
21935
22170
|
const {
|
|
@@ -21940,7 +22175,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
21940
22175
|
startAngle = 0,
|
|
21941
22176
|
angle: angle2 = Math.PI * 2
|
|
21942
22177
|
} = props;
|
|
21943
|
-
(0,
|
|
22178
|
+
(0, import_core44.assert)(
|
|
21944
22179
|
Number.isFinite(innerRadius) && innerRadius >= 0 && Number.isFinite(outerRadius) && outerRadius > innerRadius && Number.isFinite(height) && height > 0 && Number.isFinite(startAngle) && Number.isFinite(angle2) && angle2 > 0 && angle2 <= Math.PI * 2 && Number.isInteger(segments) && segments >= 3
|
|
21945
22180
|
);
|
|
21946
22181
|
const halfHeight = height / 2;
|
|
@@ -22124,7 +22359,7 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
|
|
|
22124
22359
|
};
|
|
22125
22360
|
|
|
22126
22361
|
// src/scenegraph/controllers/morph-controller.ts
|
|
22127
|
-
var
|
|
22362
|
+
var import_core47 = __toESM(require_core(), 1);
|
|
22128
22363
|
function setMorphWeights(node, weights) {
|
|
22129
22364
|
node.userData["morphWeights"] = [...weights];
|
|
22130
22365
|
const meshes = node.userData["morphMeshes"] || [];
|
|
@@ -22151,7 +22386,7 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
|
|
|
22151
22386
|
function updateMorphWeights(state, weights) {
|
|
22152
22387
|
state.values.fill(0);
|
|
22153
22388
|
state.values.set(weights.slice(0, state.values.length));
|
|
22154
|
-
if (state.data instanceof
|
|
22389
|
+
if (state.data instanceof import_core47.Buffer) {
|
|
22155
22390
|
state.data.write(state.values);
|
|
22156
22391
|
} else {
|
|
22157
22392
|
state.data.writeData(state.values, { width: state.packedTargetCount, height: 1 });
|
|
@@ -22174,6 +22409,10 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
|
|
|
22174
22409
|
return Array.from(node.userData["morphWeights"] ?? []);
|
|
22175
22410
|
case "visibility":
|
|
22176
22411
|
return [node.display ? 1 : 0];
|
|
22412
|
+
case "selectable":
|
|
22413
|
+
return [node.selectable ? 1 : 0];
|
|
22414
|
+
case "hoverable":
|
|
22415
|
+
return [node.hoverable ? 1 : 0];
|
|
22177
22416
|
}
|
|
22178
22417
|
},
|
|
22179
22418
|
setValue: (value) => {
|
|
@@ -22190,6 +22429,12 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
|
|
|
22190
22429
|
case "weights":
|
|
22191
22430
|
setMorphWeights(node, value);
|
|
22192
22431
|
break;
|
|
22432
|
+
case "selectable":
|
|
22433
|
+
node.setProps({ selectable: value[0] !== 0 });
|
|
22434
|
+
break;
|
|
22435
|
+
case "hoverable":
|
|
22436
|
+
node.setProps({ hoverable: value[0] !== 0 });
|
|
22437
|
+
break;
|
|
22193
22438
|
case "visibility":
|
|
22194
22439
|
node.setProps({ display: value[0] !== 0 });
|
|
22195
22440
|
options.onVisibilityChange?.();
|
|
@@ -22507,7 +22752,7 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
|
|
|
22507
22752
|
}
|
|
22508
22753
|
|
|
22509
22754
|
// src/lighting/ltc-textures.ts
|
|
22510
|
-
var
|
|
22755
|
+
var import_shaders10 = __toESM(require_shaders(), 1);
|
|
22511
22756
|
|
|
22512
22757
|
// src/lighting/ltc-data.ts
|
|
22513
22758
|
var LTC_MATRIX_DATA = [
|
|
@@ -55290,7 +55535,7 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
|
|
|
55290
55535
|
width: 64,
|
|
55291
55536
|
height: 64,
|
|
55292
55537
|
format: "rgba16float",
|
|
55293
|
-
data: Uint16Array.from(data,
|
|
55538
|
+
data: Uint16Array.from(data, import_shaders10.toHalfFloat),
|
|
55294
55539
|
mipLevels: 1,
|
|
55295
55540
|
sampler: { minFilter: "nearest", magFilter: "nearest" }
|
|
55296
55541
|
});
|