@luma.gl/engine 10.0.0-alpha.10 → 10.0.0-alpha.12

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.
Files changed (226) hide show
  1. package/dist/animation/node-animation-binding.cjs +10 -0
  2. package/dist/animation/node-animation-binding.d.ts +1 -1
  3. package/dist/animation/node-animation-binding.d.ts.map +1 -1
  4. package/dist/animation/node-animation-binding.js +10 -0
  5. package/dist/animation/node-animation-binding.js.map +1 -1
  6. package/dist/dist.dev.js +457 -206
  7. package/dist/dist.min.js +58 -58
  8. package/dist/gltf/gltf/animations/animations.d.ts +1 -1
  9. package/dist/gltf/gltf/animations/animations.d.ts.map +1 -1
  10. package/dist/gltf/gltf/create-scenegraph-from-gltf.cjs +80 -12
  11. package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts +8 -1
  12. package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts.map +1 -1
  13. package/dist/gltf/gltf/create-scenegraph-from-gltf.js +82 -14
  14. package/dist/gltf/gltf/create-scenegraph-from-gltf.js.map +1 -1
  15. package/dist/gltf/gltf/gltf-billboard.cjs +6 -1
  16. package/dist/gltf/gltf/gltf-billboard.d.ts.map +1 -1
  17. package/dist/gltf/gltf/gltf-billboard.js +6 -1
  18. package/dist/gltf/gltf/gltf-billboard.js.map +1 -1
  19. package/dist/gltf/gltf/gltf-extension-support.cjs +2 -2
  20. package/dist/gltf/gltf/gltf-extension-support.js +2 -2
  21. package/dist/gltf/gltf/gltf-extension-support.js.map +1 -1
  22. package/dist/gltf/index.cjs +2 -0
  23. package/dist/gltf/index.cjs.map +3 -3
  24. package/dist/gltf/index.d.ts +1 -1
  25. package/dist/gltf/index.d.ts.map +1 -1
  26. package/dist/gltf/index.js +1 -1
  27. package/dist/gltf/index.js.map +1 -1
  28. package/dist/gltf/parsers/parse-gltf-animations.cjs +8 -5
  29. package/dist/gltf/parsers/parse-gltf-animations.js +20 -5
  30. package/dist/gltf/parsers/parse-gltf-animations.js.map +1 -1
  31. package/dist/gltf/parsers/parse-gltf-lights.cjs +36 -72
  32. package/dist/gltf/parsers/parse-gltf-lights.d.ts +6 -2
  33. package/dist/gltf/parsers/parse-gltf-lights.d.ts.map +1 -1
  34. package/dist/gltf/parsers/parse-gltf-lights.js +34 -91
  35. package/dist/gltf/parsers/parse-gltf-lights.js.map +1 -1
  36. package/dist/gltf/parsers/parse-gltf-metadata.cjs +60 -0
  37. package/dist/gltf/parsers/parse-gltf-metadata.d.ts +5 -0
  38. package/dist/gltf/parsers/parse-gltf-metadata.d.ts.map +1 -0
  39. package/dist/gltf/parsers/parse-gltf-metadata.js +39 -0
  40. package/dist/gltf/parsers/parse-gltf-metadata.js.map +1 -0
  41. package/dist/gltf/parsers/parse-gltf.cjs +4 -1
  42. package/dist/gltf/parsers/parse-gltf.d.ts +4 -0
  43. package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -1
  44. package/dist/gltf/parsers/parse-gltf.js +3 -0
  45. package/dist/gltf/parsers/parse-gltf.js.map +1 -1
  46. package/dist/gltf/pbr/pbr-environment.cjs +21 -3
  47. package/dist/gltf/pbr/pbr-environment.d.ts +3 -0
  48. package/dist/gltf/pbr/pbr-environment.d.ts.map +1 -1
  49. package/dist/gltf/pbr/pbr-environment.js +19 -1
  50. package/dist/gltf/pbr/pbr-environment.js.map +1 -1
  51. package/dist/graph/models/index.cjs.map +1 -1
  52. package/dist/graph/models/path/path-attribute-model.cjs +1 -1
  53. package/dist/graph/models/path/path-attribute-model.js +1 -1
  54. package/dist/graph/models/path/path-attribute-model.js.map +1 -1
  55. package/dist/graph/models/path/path-storage-model.cjs +1 -1
  56. package/dist/graph/models/path/path-storage-model.js +1 -1
  57. package/dist/graph/models/path/path-storage-model.js.map +1 -1
  58. package/dist/graph/physics/index.cjs.map +1 -1
  59. package/dist/graph/tables/index.cjs.map +1 -1
  60. package/dist/index.cjs +13 -0
  61. package/dist/index.cjs.map +3 -3
  62. package/dist/index.d.ts +4 -0
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +3 -0
  65. package/dist/index.js.map +1 -1
  66. package/dist/lighting/ambient-occlusion-pass.cjs +126 -0
  67. package/dist/lighting/ambient-occlusion-pass.d.ts +31 -0
  68. package/dist/lighting/ambient-occlusion-pass.d.ts.map +1 -0
  69. package/dist/lighting/ambient-occlusion-pass.js +108 -0
  70. package/dist/lighting/ambient-occlusion-pass.js.map +1 -0
  71. package/dist/lighting/clustered-light-grid.cjs +378 -0
  72. package/dist/lighting/clustered-light-grid.d.ts +94 -0
  73. package/dist/lighting/clustered-light-grid.d.ts.map +1 -0
  74. package/dist/lighting/clustered-light-grid.js +370 -0
  75. package/dist/lighting/clustered-light-grid.js.map +1 -0
  76. package/dist/lighting/contact-shadow-composite.cjs +80 -0
  77. package/dist/lighting/contact-shadow-composite.d.ts +6 -0
  78. package/dist/lighting/contact-shadow-composite.d.ts.map +1 -0
  79. package/dist/lighting/contact-shadow-composite.js +59 -0
  80. package/dist/lighting/contact-shadow-composite.js.map +1 -0
  81. package/dist/lighting/contact-shadow-pass.cjs +102 -0
  82. package/dist/lighting/contact-shadow-pass.d.ts +23 -0
  83. package/dist/lighting/contact-shadow-pass.d.ts.map +1 -0
  84. package/dist/lighting/contact-shadow-pass.js +85 -0
  85. package/dist/lighting/contact-shadow-pass.js.map +1 -0
  86. package/dist/lighting/index.cjs +118 -0
  87. package/dist/lighting/index.cjs.map +6 -0
  88. package/dist/lighting/index.d.ts +31 -0
  89. package/dist/lighting/index.d.ts.map +1 -0
  90. package/dist/lighting/index.js +20 -0
  91. package/dist/lighting/index.js.map +1 -0
  92. package/dist/lighting/lightmap-baker.cjs +238 -0
  93. package/dist/lighting/lightmap-baker.d.ts +62 -0
  94. package/dist/lighting/lightmap-baker.d.ts.map +1 -0
  95. package/dist/lighting/lightmap-baker.js +236 -0
  96. package/dist/lighting/lightmap-baker.js.map +1 -0
  97. package/dist/lighting/lightmap-data.cjs +117 -0
  98. package/dist/lighting/lightmap-data.d.ts +20 -0
  99. package/dist/lighting/lightmap-data.d.ts.map +1 -0
  100. package/dist/lighting/lightmap-data.js +110 -0
  101. package/dist/lighting/lightmap-data.js.map +1 -0
  102. package/dist/lighting/lightmap-environment.cjs +61 -0
  103. package/dist/lighting/lightmap-environment.d.ts +18 -0
  104. package/dist/lighting/lightmap-environment.d.ts.map +1 -0
  105. package/dist/lighting/lightmap-environment.js +46 -0
  106. package/dist/lighting/lightmap-environment.js.map +1 -0
  107. package/dist/lighting/pbr-environment.cjs +45 -0
  108. package/dist/lighting/pbr-environment.d.ts +25 -0
  109. package/dist/lighting/pbr-environment.d.ts.map +1 -0
  110. package/dist/lighting/pbr-environment.js +30 -0
  111. package/dist/lighting/pbr-environment.js.map +1 -0
  112. package/dist/lighting/pbr-material.cjs +75 -0
  113. package/dist/lighting/pbr-material.d.ts +33 -0
  114. package/dist/lighting/pbr-material.d.ts.map +1 -0
  115. package/dist/lighting/pbr-material.js +52 -0
  116. package/dist/lighting/pbr-material.js.map +1 -0
  117. package/dist/lighting/pbr-model.cjs +579 -0
  118. package/dist/lighting/pbr-model.d.ts +45 -0
  119. package/dist/lighting/pbr-model.d.ts.map +1 -0
  120. package/dist/lighting/pbr-model.js +545 -0
  121. package/dist/lighting/pbr-model.js.map +1 -0
  122. package/dist/lighting/pbr-surface-pass.cjs +116 -0
  123. package/dist/lighting/pbr-surface-pass.d.ts +35 -0
  124. package/dist/lighting/pbr-surface-pass.d.ts.map +1 -0
  125. package/dist/lighting/pbr-surface-pass.js +98 -0
  126. package/dist/lighting/pbr-surface-pass.js.map +1 -0
  127. package/dist/lighting/prefiltered-environment.cjs +275 -0
  128. package/dist/lighting/prefiltered-environment.d.ts +56 -0
  129. package/dist/lighting/prefiltered-environment.d.ts.map +1 -0
  130. package/dist/lighting/prefiltered-environment.js +264 -0
  131. package/dist/lighting/prefiltered-environment.js.map +1 -0
  132. package/dist/lighting/shadow-map-renderer.cjs +631 -0
  133. package/dist/lighting/shadow-map-renderer.d.ts +92 -0
  134. package/dist/lighting/shadow-map-renderer.d.ts.map +1 -0
  135. package/dist/lighting/shadow-map-renderer.js +622 -0
  136. package/dist/lighting/shadow-map-renderer.js.map +1 -0
  137. package/dist/lighting/shadow-quality.cjs +58 -0
  138. package/dist/lighting/shadow-quality.d.ts +13 -0
  139. package/dist/lighting/shadow-quality.d.ts.map +1 -0
  140. package/dist/lighting/shadow-quality.js +37 -0
  141. package/dist/lighting/shadow-quality.js.map +1 -0
  142. package/dist/material/material.cjs +3 -0
  143. package/dist/material/material.d.ts +2 -0
  144. package/dist/material/material.d.ts.map +1 -1
  145. package/dist/material/material.js +3 -0
  146. package/dist/material/material.js.map +1 -1
  147. package/dist/model/gpu-vector-model.cjs +11 -1
  148. package/dist/model/gpu-vector-model.d.ts +4 -2
  149. package/dist/model/gpu-vector-model.d.ts.map +1 -1
  150. package/dist/model/gpu-vector-model.js +12 -1
  151. package/dist/model/gpu-vector-model.js.map +1 -1
  152. package/dist/scenegraph/controllers/punctual-light-controller.cjs +121 -0
  153. package/dist/scenegraph/controllers/punctual-light-controller.d.ts +31 -0
  154. package/dist/scenegraph/controllers/punctual-light-controller.d.ts.map +1 -0
  155. package/dist/scenegraph/controllers/punctual-light-controller.js +117 -0
  156. package/dist/scenegraph/controllers/punctual-light-controller.js.map +1 -0
  157. package/dist/scenegraph/scene-metadata.cjs +43 -0
  158. package/dist/scenegraph/scene-metadata.d.ts +9 -0
  159. package/dist/scenegraph/scene-metadata.d.ts.map +1 -0
  160. package/dist/scenegraph/scene-metadata.js +21 -0
  161. package/dist/scenegraph/scene-metadata.js.map +1 -0
  162. package/dist/scenegraph/scenegraph-interaction.cjs +99 -0
  163. package/dist/scenegraph/scenegraph-interaction.d.ts +47 -0
  164. package/dist/scenegraph/scenegraph-interaction.d.ts.map +1 -0
  165. package/dist/scenegraph/scenegraph-interaction.js +79 -0
  166. package/dist/scenegraph/scenegraph-interaction.js.map +1 -0
  167. package/dist/scenegraph/scenegraph-node.cjs +10 -0
  168. package/dist/scenegraph/scenegraph-node.d.ts +10 -0
  169. package/dist/scenegraph/scenegraph-node.d.ts.map +1 -1
  170. package/dist/scenegraph/scenegraph-node.js +10 -0
  171. package/dist/scenegraph/scenegraph-node.js.map +1 -1
  172. package/dist/text/experimental.cjs.map +1 -1
  173. package/dist/text/fonts/atlas/text-utils.cjs +1 -1
  174. package/dist/text/fonts/atlas/text-utils.js +1 -1
  175. package/dist/text/fonts/atlas/text-utils.js.map +1 -1
  176. package/dist/text/fonts/index.cjs.map +1 -1
  177. package/dist/text/index.cjs.map +1 -1
  178. package/dist/text/text-2d/models/text-attribute-model.cjs +1 -1
  179. package/dist/text/text-2d/models/text-attribute-model.js +1 -1
  180. package/dist/text/text-2d/models/text-attribute-model.js.map +1 -1
  181. package/dist/text/text-2d/models/text-dictionary-model.cjs +1 -1
  182. package/dist/text/text-2d/models/text-dictionary-model.js +1 -1
  183. package/dist/text/text-2d/models/text-dictionary-model.js.map +1 -1
  184. package/dist/text/text-2d/models/text-storage-model.cjs +1 -1
  185. package/dist/text/text-2d/models/text-storage-model.js +1 -1
  186. package/dist/text/text-2d/models/text-storage-model.js.map +1 -1
  187. package/package.json +13 -8
  188. package/src/animation/node-animation-binding.ts +18 -1
  189. package/src/gltf/gltf/animations/animations.ts +8 -1
  190. package/src/gltf/gltf/create-scenegraph-from-gltf.ts +98 -17
  191. package/src/gltf/gltf/gltf-billboard.ts +6 -1
  192. package/src/gltf/gltf/gltf-extension-support.ts +2 -2
  193. package/src/gltf/index.ts +1 -0
  194. package/src/gltf/parsers/parse-gltf-animations.ts +22 -8
  195. package/src/gltf/parsers/parse-gltf-lights.ts +42 -130
  196. package/src/gltf/parsers/parse-gltf-metadata.ts +40 -0
  197. package/src/gltf/parsers/parse-gltf.ts +5 -0
  198. package/src/gltf/pbr/pbr-environment.ts +27 -1
  199. package/src/graph/models/path/path-attribute-model.ts +1 -1
  200. package/src/graph/models/path/path-storage-model.ts +1 -1
  201. package/src/index.ts +16 -0
  202. package/src/lighting/ambient-occlusion-pass.ts +130 -0
  203. package/src/lighting/clustered-light-grid.ts +481 -0
  204. package/src/lighting/contact-shadow-composite.ts +67 -0
  205. package/src/lighting/contact-shadow-pass.ts +107 -0
  206. package/src/lighting/index.ts +107 -0
  207. package/src/lighting/lightmap-baker.ts +306 -0
  208. package/src/lighting/lightmap-data.ts +138 -0
  209. package/src/lighting/lightmap-environment.ts +70 -0
  210. package/src/lighting/pbr-environment.ts +55 -0
  211. package/src/lighting/pbr-material.ts +85 -0
  212. package/src/lighting/pbr-model.ts +608 -0
  213. package/src/lighting/pbr-surface-pass.ts +122 -0
  214. package/src/lighting/prefiltered-environment.ts +354 -0
  215. package/src/lighting/shadow-map-renderer.ts +918 -0
  216. package/src/lighting/shadow-quality.ts +50 -0
  217. package/src/material/material.ts +3 -0
  218. package/src/model/gpu-vector-model.ts +18 -3
  219. package/src/scenegraph/controllers/punctual-light-controller.ts +172 -0
  220. package/src/scenegraph/scene-metadata.ts +23 -0
  221. package/src/scenegraph/scenegraph-interaction.ts +131 -0
  222. package/src/scenegraph/scenegraph-node.ts +12 -0
  223. package/src/text/fonts/atlas/text-utils.ts +1 -1
  224. package/src/text/text-2d/models/text-attribute-model.ts +1 -1
  225. package/src/text/text-2d/models/text-dictionary-model.ts +1 -1
  226. 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
- result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
2857
- scaleResult = scaleResult || [-0, -0, -0];
2858
- const scale5 = this.getScale(scaleResult);
2859
- const inverseScale0 = 1 / scale5[0];
2860
- const inverseScale1 = 1 / scale5[1];
2861
- const inverseScale2 = 1 / scale5[2];
2862
- result[0] = this[0] * inverseScale0;
2863
- result[1] = this[1] * inverseScale1;
2864
- result[2] = this[2] * inverseScale2;
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
- result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
2888
- scaleResult = scaleResult || [-0, -0, -0];
2889
- const scale5 = this.getScale(scaleResult);
2890
- const inverseScale0 = 1 / scale5[0];
2891
- const inverseScale1 = 1 / scale5[1];
2892
- const inverseScale2 = 1 / scale5[2];
2893
- result[0] = this[0] * inverseScale0;
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();
@@ -6573,8 +6612,13 @@ ${DECLARATION_INJECT_MARKER}
6573
6612
  }
6574
6613
  return decoded;
6575
6614
  }
6615
+ var attributeShaderTypeInfoCache = /* @__PURE__ */ new Map();
6576
6616
  function getAttributeShaderTypeInfo(attributeType) {
6577
6617
  const resolvedAttributeType = resolveAttributeShaderTypeAlias(attributeType);
6618
+ const cached = attributeShaderTypeInfoCache.get(resolvedAttributeType);
6619
+ if (cached) {
6620
+ return cached;
6621
+ }
6578
6622
  const decoded = TYPE_INFO[resolvedAttributeType];
6579
6623
  if (!decoded) {
6580
6624
  throw new Error(`Unsupported attribute shader type: ${attributeType}`);
@@ -6583,13 +6627,15 @@ ${DECLARATION_INJECT_MARKER}
6583
6627
  const integer = primitiveType === "i32" || primitiveType === "u32";
6584
6628
  const signed = primitiveType !== "u32";
6585
6629
  const byteLength = PRIMITIVE_TYPE_SIZES[primitiveType] * components2;
6586
- return {
6630
+ const result = Object.freeze({
6587
6631
  primitiveType,
6588
6632
  components: components2,
6589
6633
  byteLength,
6590
6634
  integer,
6591
6635
  signed
6592
- };
6636
+ });
6637
+ attributeShaderTypeInfoCache.set(resolvedAttributeType, result);
6638
+ return result;
6593
6639
  }
6594
6640
  var ShaderTypeDecoder = class {
6595
6641
  getVariableShaderTypeInfo(format) {
@@ -6698,6 +6744,9 @@ ${DECLARATION_INJECT_MARKER}
6698
6744
  "mat4x3<u32>": { type: "u32", components: 12 },
6699
6745
  "mat4x4<u32>": { type: "u32", components: 16 }
6700
6746
  };
6747
+ for (const info of Object.values(UNIFORM_FORMATS)) {
6748
+ Object.freeze(info);
6749
+ }
6701
6750
  var WGSL_ATTRIBUTE_TYPE_ALIAS_MAP = {
6702
6751
  vec2i: "vec2<i32>",
6703
6752
  vec3i: "vec3<i32>",
@@ -11445,7 +11494,19 @@ ${declarations.join("\n")}`).match(
11445
11494
  }
11446
11495
 
11447
11496
  // ../core/src/shadertypes/data-types/decode-data-types.ts
11497
+ var dataTypeInfoCache = /* @__PURE__ */ new Map();
11448
11498
  function getDataTypeInfo(type) {
11499
+ const cached = dataTypeInfoCache.get(type);
11500
+ if (cached) {
11501
+ return cached;
11502
+ }
11503
+ const decoded = Object.freeze(decodeDataTypeInfo(type));
11504
+ if (Object.hasOwn(NORMALIZED_TYPE_MAP, type)) {
11505
+ dataTypeInfoCache.set(type, decoded);
11506
+ }
11507
+ return decoded;
11508
+ }
11509
+ function decodeDataTypeInfo(type) {
11449
11510
  const normalized2 = type.includes("norm");
11450
11511
  const integer = !normalized2 && !type.startsWith("float");
11451
11512
  const signed = type.startsWith("s");
@@ -11786,40 +11847,33 @@ ${declarations.join("\n")}`).match(
11786
11847
  return this.isCompressed(format) && !format.endsWith("-webgl") ? WEBGPU_CREATE_FILTER2 : 0;
11787
11848
  }
11788
11849
  /** Computes the memory layout for a texture, in particular including row byte alignment */
11789
- computeMemoryLayout(opts) {
11790
- return computeTextureMemoryLayout(opts);
11850
+ computeMemoryLayout(opts, result) {
11851
+ return computeTextureMemoryLayout(opts, result);
11791
11852
  }
11792
11853
  };
11793
11854
  var textureFormatDecoder = new TextureFormatDecoder();
11794
- function computeTextureMemoryLayout({
11795
- format,
11796
- width,
11797
- height,
11798
- depth,
11799
- byteAlignment
11800
- }) {
11855
+ function computeTextureMemoryLayout({ format, width, height, depth, byteAlignment }, result = {}) {
11801
11856
  const formatInfo = textureFormatDecoder.getInfo(format);
11857
+ const { bytesPerPixel, blockHeight = 1, compressed = false } = formatInfo;
11858
+ const bytesPerRow = getTextureBytesPerRow(formatInfo, width, byteAlignment);
11859
+ const rowsPerImage = compressed ? Math.ceil(height / blockHeight) : height;
11860
+ result.bytesPerPixel = bytesPerPixel;
11861
+ result.bytesPerRow = bytesPerRow;
11862
+ result.rowsPerImage = rowsPerImage;
11863
+ result.depthOrArrayLayers = depth;
11864
+ result.bytesPerImage = bytesPerRow * rowsPerImage;
11865
+ result.byteLength = result.bytesPerImage * depth;
11866
+ return result;
11867
+ }
11868
+ function getTextureBytesPerRow(formatInfo, width, byteAlignment) {
11802
11869
  const {
11803
11870
  bytesPerPixel,
11804
11871
  bytesPerBlock = bytesPerPixel,
11805
11872
  blockWidth = 1,
11806
- blockHeight = 1,
11807
11873
  compressed = false
11808
11874
  } = formatInfo;
11809
11875
  const blockColumns = compressed ? Math.ceil(width / blockWidth) : width;
11810
- const blockRows = compressed ? Math.ceil(height / blockHeight) : height;
11811
- const unpaddedBytesPerRow = blockColumns * bytesPerBlock;
11812
- const bytesPerRow = Math.ceil(unpaddedBytesPerRow / byteAlignment) * byteAlignment;
11813
- const rowsPerImage = blockRows;
11814
- const byteLength = bytesPerRow * rowsPerImage * depth;
11815
- return {
11816
- bytesPerPixel,
11817
- bytesPerRow,
11818
- rowsPerImage,
11819
- depthOrArrayLayers: depth,
11820
- bytesPerImage: bytesPerRow * rowsPerImage,
11821
- byteLength
11822
- };
11876
+ return Math.ceil(blockColumns * bytesPerBlock / byteAlignment) * byteAlignment;
11823
11877
  }
11824
11878
  function getTextureFormatCapabilities(format) {
11825
11879
  const info = getTextureFormatDefinition(format);
@@ -11841,7 +11895,18 @@ ${declarations.join("\n")}`).match(
11841
11895
  formatCapabilities.filter &&= !isDepthStencil && !isSigned && !isInteger && !isWebGLSpecific;
11842
11896
  return formatCapabilities;
11843
11897
  }
11898
+ var textureFormatInfoCache = /* @__PURE__ */ new Map();
11844
11899
  function getTextureFormatInfo(format) {
11900
+ let formatInfo = textureFormatInfoCache.get(format);
11901
+ if (!formatInfo) {
11902
+ const decoded = decodeTextureFormatInfo(format);
11903
+ decoded.bitsPerChannel = Object.freeze([...decoded.bitsPerChannel]);
11904
+ formatInfo = Object.freeze(decoded);
11905
+ textureFormatInfoCache.set(format, formatInfo);
11906
+ }
11907
+ return formatInfo;
11908
+ }
11909
+ function decodeTextureFormatInfo(format) {
11845
11910
  let formatInfo = getTextureFormatInfoUsingTable(format);
11846
11911
  if (textureFormatDecoder.isCompressed(format)) {
11847
11912
  formatInfo.channels = "rgb";
@@ -12010,6 +12075,8 @@ ${declarations.join("\n")}`).match(
12010
12075
  };
12011
12076
 
12012
12077
  // ../core/src/api/adapter/resources/texture.ts
12078
+ var textureLayoutScratchPool = [];
12079
+ var emptyTextureReadOptions = Object.freeze({});
12013
12080
  var BASE_DIMENSIONS = {
12014
12081
  "1d": "1d",
12015
12082
  "2d": "2d",
@@ -12128,17 +12195,24 @@ ${declarations.join("\n")}`).match(
12128
12195
  * Calculates the memory layout of the texture, required when reading and writing data.
12129
12196
  * @return the backend-aligned linear layout, in particular bytesPerRow which includes any required padding for buffer copy/read paths
12130
12197
  */
12131
- computeMemoryLayout(options_ = {}) {
12132
- const options = this._normalizeTextureReadOptions(options_);
12133
- const { width = this.width, height = this.height, depthOrArrayLayers = this.depth } = options;
12134
- const { format, byteAlignment } = this;
12135
- return textureFormatDecoder.computeMemoryLayout({
12136
- format,
12137
- width,
12138
- height,
12139
- depth: depthOrArrayLayers,
12140
- byteAlignment
12141
- });
12198
+ /** The optional result is caller-owned; internal scratch never escapes this call. */
12199
+ computeMemoryLayout(options_ = emptyTextureReadOptions, result) {
12200
+ const scratch = textureLayoutScratchPool.pop() || {
12201
+ readOptions: {},
12202
+ layoutOptions: {}
12203
+ };
12204
+ try {
12205
+ const options = this._normalizeTextureReadOptions(options_, scratch.readOptions);
12206
+ const layoutOptions = scratch.layoutOptions;
12207
+ layoutOptions.format = this.format;
12208
+ layoutOptions.width = options.width;
12209
+ layoutOptions.height = options.height;
12210
+ layoutOptions.depth = options.depthOrArrayLayers;
12211
+ layoutOptions.byteAlignment = this.byteAlignment;
12212
+ return textureFormatDecoder.computeMemoryLayout(layoutOptions, result);
12213
+ } finally {
12214
+ textureLayoutScratchPool.push(scratch);
12215
+ }
12142
12216
  }
12143
12217
  /**
12144
12218
  * Read the contents of a texture into a GPU Buffer.
@@ -12247,59 +12321,57 @@ ${declarations.join("\n")}`).match(
12247
12321
  });
12248
12322
  }
12249
12323
  }
12250
- _normalizeCopyImageDataOptions(options_) {
12251
- const { data, depth, ...writeOptions } = options_;
12252
- const options = this._normalizeTextureWriteOptions({
12253
- ...writeOptions,
12254
- depthOrArrayLayers: writeOptions.depthOrArrayLayers ?? depth
12255
- });
12256
- return { data, depth: options.depthOrArrayLayers, ...options };
12324
+ /** The optional result is caller-owned scratch storage; every result field is overwritten. */
12325
+ _normalizeCopyImageDataOptions(options_, result = {}) {
12326
+ const { data, depth, depthOrArrayLayers } = options_;
12327
+ this._normalizeTextureWriteOptions(options_, result);
12328
+ if (depthOrArrayLayers === void 0 && depth !== void 0) {
12329
+ const mipDepth = this.dimension === "3d" ? Math.max(1, this.depth >> result.mipLevel) : this.depth;
12330
+ result.depthOrArrayLayers = Math.min(depth, mipDepth - result.z);
12331
+ }
12332
+ result.data = data;
12333
+ result.depth = result.depthOrArrayLayers;
12334
+ return result;
12257
12335
  }
12258
- _normalizeCopyExternalImageOptions(options_) {
12259
- const optionsWithoutUndefined = _Texture._omitUndefined(options_);
12260
- const mipLevel = optionsWithoutUndefined.mipLevel ?? 0;
12261
- const mipLevelSize = this._getMipLevelSize(mipLevel);
12336
+ _normalizeCopyExternalImageOptions(options_, result = {}) {
12337
+ const { width, height } = options_;
12262
12338
  const size = this.device.getExternalImageSize(options_.image);
12263
- const options = {
12264
- ..._Texture.defaultCopyExternalImageOptions,
12265
- ...mipLevelSize,
12266
- ...size,
12267
- ...optionsWithoutUndefined
12268
- };
12269
- options.width = Math.min(options.width, mipLevelSize.width - options.x);
12270
- options.height = Math.min(options.height, mipLevelSize.height - options.y);
12271
- options.depth = Math.min(options.depth, mipLevelSize.depthOrArrayLayers - options.z);
12339
+ const options = _Texture._normalizeOptions(
12340
+ options_,
12341
+ _Texture.defaultCopyExternalImageOptions,
12342
+ result
12343
+ );
12344
+ const mipWidth = Math.max(1, this.width >> options.mipLevel);
12345
+ const mipHeight = this.baseDimension === "1d" ? 1 : Math.max(1, this.height >> options.mipLevel);
12346
+ const mipDepth = this.dimension === "3d" ? Math.max(1, this.depth >> options.mipLevel) : this.depth;
12347
+ options.width = Math.min(width ?? size.width, mipWidth - options.x);
12348
+ options.height = Math.min(height ?? size.height, mipHeight - options.y);
12349
+ options.depth = Math.min(options.depth, mipDepth - options.z);
12272
12350
  return options;
12273
12351
  }
12274
- _normalizeCopyElementImageOptions(options_) {
12275
- const optionsWithoutUndefined = _Texture._omitUndefined(options_);
12276
- const mipLevel = optionsWithoutUndefined.mipLevel ?? 0;
12277
- const mipLevelSize = this._getMipLevelSize(mipLevel);
12278
- const options = {
12279
- ..._Texture.defaultCopyElementImageOptions,
12280
- ...mipLevelSize,
12281
- ...optionsWithoutUndefined
12282
- };
12283
- options.width = Math.min(options.width, mipLevelSize.width - options.x);
12284
- options.height = Math.min(options.height, mipLevelSize.height - options.y);
12285
- options.depth = Math.min(options.depth, mipLevelSize.depthOrArrayLayers - options.z);
12352
+ _normalizeCopyElementImageOptions(options_, result = {}) {
12353
+ const options = _Texture._normalizeOptions(
12354
+ options_,
12355
+ _Texture.defaultCopyElementImageOptions,
12356
+ result
12357
+ );
12358
+ const mipWidth = Math.max(1, this.width >> options.mipLevel);
12359
+ const mipHeight = this.baseDimension === "1d" ? 1 : Math.max(1, this.height >> options.mipLevel);
12360
+ const mipDepth = this.dimension === "3d" ? Math.max(1, this.depth >> options.mipLevel) : this.depth;
12361
+ options.width = Math.min(options.width ?? mipWidth, mipWidth - options.x);
12362
+ options.height = Math.min(options.height ?? mipHeight, mipHeight - options.y);
12363
+ options.depth = Math.min(options.depth, mipDepth - options.z);
12286
12364
  return options;
12287
12365
  }
12288
- _normalizeTextureReadOptions(options_) {
12289
- const optionsWithoutUndefined = _Texture._omitUndefined(options_);
12290
- const mipLevel = optionsWithoutUndefined.mipLevel ?? 0;
12291
- const mipLevelSize = this._getMipLevelSize(mipLevel);
12292
- const options = {
12293
- ..._Texture.defaultTextureReadOptions,
12294
- ...mipLevelSize,
12295
- ...optionsWithoutUndefined
12296
- };
12297
- options.width = Math.min(options.width, mipLevelSize.width - options.x);
12298
- options.height = Math.min(options.height, mipLevelSize.height - options.y);
12299
- options.depthOrArrayLayers = Math.min(
12300
- options.depthOrArrayLayers,
12301
- mipLevelSize.depthOrArrayLayers - options.z
12302
- );
12366
+ _normalizeTextureReadOptions(options_, result = {}) {
12367
+ const { depthOrArrayLayers } = options_;
12368
+ const options = _Texture._normalizeOptions(options_, _Texture.defaultTextureReadOptions, result);
12369
+ const mipWidth = Math.max(1, this.width >> options.mipLevel);
12370
+ const mipHeight = this.baseDimension === "1d" ? 1 : Math.max(1, this.height >> options.mipLevel);
12371
+ const mipDepth = this.dimension === "3d" ? Math.max(1, this.depth >> options.mipLevel) : this.depth;
12372
+ options.width = Math.min(options.width ?? mipWidth, mipWidth - options.x);
12373
+ options.height = Math.min(options.height ?? mipHeight, mipHeight - options.y);
12374
+ options.depthOrArrayLayers = Math.min(depthOrArrayLayers ?? mipDepth, mipDepth - options.z);
12303
12375
  return options;
12304
12376
  }
12305
12377
  /**
@@ -12354,31 +12426,15 @@ ${declarations.join("\n")}`).match(
12354
12426
  throw new Error(`${this} color readback does not support format ${this.format}`);
12355
12427
  }
12356
12428
  }
12357
- _normalizeTextureWriteOptions(options_) {
12358
- const optionsWithoutUndefined = _Texture._omitUndefined(options_);
12359
- const mipLevel = optionsWithoutUndefined.mipLevel ?? 0;
12360
- const mipLevelSize = this._getMipLevelSize(mipLevel);
12361
- const options = {
12362
- ..._Texture.defaultTextureWriteOptions,
12363
- ...mipLevelSize,
12364
- ...optionsWithoutUndefined
12365
- };
12366
- options.width = Math.min(options.width, mipLevelSize.width - options.x);
12367
- options.height = Math.min(options.height, mipLevelSize.height - options.y);
12368
- options.depthOrArrayLayers = Math.min(
12369
- options.depthOrArrayLayers,
12370
- mipLevelSize.depthOrArrayLayers - options.z
12371
- );
12372
- const layout = textureFormatDecoder.computeMemoryLayout({
12373
- format: this.format,
12374
- width: options.width,
12375
- height: options.height,
12376
- depth: options.depthOrArrayLayers,
12377
- byteAlignment: this.byteAlignment
12378
- });
12379
- const minimumBytesPerRow = layout.bytesPerPixel * options.width;
12380
- options.bytesPerRow = optionsWithoutUndefined.bytesPerRow ?? layout.bytesPerRow;
12381
- options.rowsPerImage = optionsWithoutUndefined.rowsPerImage ?? options.height;
12429
+ _normalizeTextureWriteOptions(options_, result = {}) {
12430
+ const { byteOffset = 0, bytesPerRow, rowsPerImage } = options_;
12431
+ this._normalizeTextureReadOptions(options_, result);
12432
+ const options = result;
12433
+ options.byteOffset = byteOffset;
12434
+ const formatInfo = this.device.getTextureFormatInfo(this.format);
12435
+ const minimumBytesPerRow = formatInfo.bytesPerPixel * options.width;
12436
+ options.bytesPerRow = bytesPerRow ?? getTextureBytesPerRow(formatInfo, options.width, this.byteAlignment);
12437
+ options.rowsPerImage = rowsPerImage ?? options.height;
12382
12438
  if (options.bytesPerRow < minimumBytesPerRow) {
12383
12439
  throw new Error(
12384
12440
  `bytesPerRow (${options.bytesPerRow}) must be at least ${minimumBytesPerRow} for ${this.format}`
@@ -12389,7 +12445,7 @@ ${declarations.join("\n")}`).match(
12389
12445
  `rowsPerImage (${options.rowsPerImage}) must be at least ${options.height} for ${this.format}`
12390
12446
  );
12391
12447
  }
12392
- const bytesPerPixel = this.device.getTextureFormatInfo(this.format).bytesPerPixel;
12448
+ const { bytesPerPixel } = formatInfo;
12393
12449
  if (bytesPerPixel && options.bytesPerRow % bytesPerPixel !== 0) {
12394
12450
  throw new Error(
12395
12451
  `bytesPerRow (${options.bytesPerRow}) must be a multiple of bytesPerPixel (${bytesPerPixel}) for ${this.format}`
@@ -12417,10 +12473,12 @@ ${declarations.join("\n")}`).match(
12417
12473
  }
12418
12474
  return allocatedByteLength * this.samples;
12419
12475
  }
12420
- static _omitUndefined(options) {
12421
- return Object.fromEntries(
12422
- Object.entries(options).filter(([, value]) => value !== void 0)
12423
- );
12476
+ /** Fill every declared field, resetting stale scratch values without allocating entries or spreads. */
12477
+ static _normalizeOptions(options, defaults, result) {
12478
+ for (const key in defaults) {
12479
+ result[key] = options[key] === void 0 ? defaults[key] : options[key];
12480
+ }
12481
+ return result;
12424
12482
  }
12425
12483
  static defaultProps = {
12426
12484
  ...Resource.defaultProps,
@@ -12497,19 +12555,6 @@ ${declarations.join("\n")}`).match(
12497
12555
  mipLevel: 0,
12498
12556
  aspect: "all"
12499
12557
  };
12500
- static defaultTextureWriteOptions = {
12501
- byteOffset: 0,
12502
- bytesPerRow: void 0,
12503
- rowsPerImage: void 0,
12504
- x: 0,
12505
- y: 0,
12506
- z: 0,
12507
- width: void 0,
12508
- height: void 0,
12509
- depthOrArrayLayers: 1,
12510
- mipLevel: 0,
12511
- aspect: "all"
12512
- };
12513
12558
  };
12514
12559
 
12515
12560
  // ../core/src/api/adapter-utils/bind-groups.ts
@@ -13896,10 +13941,20 @@ ${declarations.join("\n")}`).match(
13896
13941
  */
13897
13942
  draw(renderPass, options) {
13898
13943
  if (options?.parameters) {
13899
- return renderPass.withParameters(options.parameters, () => this._draw(renderPass));
13944
+ return this._withDrawParameters(renderPass, options.parameters, () => this._draw(renderPass));
13900
13945
  }
13901
13946
  return this._draw(renderPass);
13902
13947
  }
13948
+ /** Applies draw overrides around the complete model batch, including failure paths. */
13949
+ _withDrawParameters(renderPass, parameters, draw) {
13950
+ const state = renderPass.getParameters();
13951
+ try {
13952
+ renderPass.setParameters(parameters);
13953
+ return draw();
13954
+ } finally {
13955
+ renderPass.setParameters(state);
13956
+ }
13957
+ }
13903
13958
  _draw(renderPass) {
13904
13959
  if (this.indexVector?.length === 0) {
13905
13960
  this._lastDrawTimestamp = this.device.timestamp;
@@ -15231,6 +15286,8 @@ ${declarations.join("\n")}`).match(
15231
15286
  var Material = class {
15232
15287
  /** Application-provided identifier. */
15233
15288
  id;
15289
+ /** Structured metadata associated with this material. */
15290
+ metadata = {};
15234
15291
  /** Device that owns the material resources. */
15235
15292
  device;
15236
15293
  /** Factory that defines the material schema. */
@@ -15287,6 +15344,7 @@ ${declarations.join("\n")}`).match(
15287
15344
  if (props.moduleProps) {
15288
15345
  material.setProps(props.moduleProps);
15289
15346
  }
15347
+ material.metadata = { ...this.metadata };
15290
15348
  material.updateShaderInputs();
15291
15349
  return material;
15292
15350
  }
@@ -16502,9 +16560,15 @@ void main(void) {
16502
16560
  id;
16503
16561
  matrix = new Matrix4();
16504
16562
  display = true;
16563
+ /** Local selection eligibility, independent of visibility. */
16564
+ selectable = true;
16565
+ /** Local hover eligibility, independent of visibility. */
16566
+ hoverable = true;
16505
16567
  position = new Vector3();
16506
16568
  rotation = new Vector3();
16507
16569
  scale = new Vector3(1, 1, 1);
16570
+ /** Structured metadata associated with this scene node. */
16571
+ metadata = {};
16508
16572
  userData = {};
16509
16573
  props = {};
16510
16574
  constructor(props = {}) {
@@ -16628,6 +16692,8 @@ void main(void) {
16628
16692
  }
16629
16693
  */
16630
16694
  _setScenegraphNodeProps(props) {
16695
+ if (props.selectable !== void 0) this.selectable = props.selectable;
16696
+ if (props.hoverable !== void 0) this.hoverable = props.hoverable;
16631
16697
  if (props.display !== void 0) {
16632
16698
  this.display = props.display;
16633
16699
  }
@@ -16648,6 +16714,90 @@ void main(void) {
16648
16714
  }
16649
16715
  };
16650
16716
 
16717
+ // src/scenegraph/scenegraph-interaction.ts
16718
+ function isScenegraphInteractionEnabled(path, kind) {
16719
+ return path.length > 0 && path.every((node) => kind === "select" ? node.selectable : node.hoverable);
16720
+ }
16721
+ function getFirstScenegraphInteractionHit(hits, kind) {
16722
+ return hits.find((hit) => isScenegraphInteractionEnabled(hit.path, kind));
16723
+ }
16724
+ var ScenegraphInteractionManager = class {
16725
+ hoveredHits = /* @__PURE__ */ new Map();
16726
+ pendingHover = /* @__PURE__ */ new Map();
16727
+ onEvent;
16728
+ /** Creates a controller that reports bubbled selection and hover events. */
16729
+ constructor(onEvent) {
16730
+ this.onEvent = onEvent;
16731
+ }
16732
+ /** Selects the first eligible nearest-first hit and bubbles from target to root. */
16733
+ select(hits, controllerIndex = 0) {
16734
+ const hit = getFirstScenegraphInteractionHit(hits, "select");
16735
+ if (!hit) return void 0;
16736
+ this.emitPath("select", hit, 0, controllerIndex);
16737
+ return hit;
16738
+ }
16739
+ /** Updates hover from current hits; call after pointer, camera, object, or flag changes. */
16740
+ updateHover(hits, controllerIndex = 0) {
16741
+ const hit = getFirstScenegraphInteractionHit(hits, "hover");
16742
+ const queuedHit = hit ? { ...hit, path: [...hit.path] } : void 0;
16743
+ const activeQueue = this.pendingHover.get(controllerIndex);
16744
+ if (activeQueue) {
16745
+ activeQueue.push(queuedHit);
16746
+ return hit;
16747
+ }
16748
+ const queue = [queuedHit];
16749
+ this.pendingHover.set(controllerIndex, queue);
16750
+ try {
16751
+ while (queue.length) {
16752
+ const next = queue.shift();
16753
+ const previous = this.hoveredHits.get(controllerIndex);
16754
+ const previousPath = previous?.path || [];
16755
+ const nextPath = next?.path || [];
16756
+ let shared = 0;
16757
+ while (shared < previousPath.length && shared < nextPath.length && previousPath[shared] === nextPath[shared])
16758
+ shared++;
16759
+ if (next) this.hoveredHits.set(controllerIndex, next);
16760
+ else this.hoveredHits.delete(controllerIndex);
16761
+ if (previous) this.emitPath("hover-out", previous, shared, controllerIndex);
16762
+ if (next) this.emitPath("hover-in", next, shared, controllerIndex);
16763
+ }
16764
+ } finally {
16765
+ this.pendingHover.delete(controllerIndex);
16766
+ }
16767
+ return hit;
16768
+ }
16769
+ /** Emits exits for one controller and drops its tracked hover path. */
16770
+ clearHover(controllerIndex = 0) {
16771
+ this.updateHover([], controllerIndex);
16772
+ }
16773
+ /** Emits events from the target towards the first ancestor outside the shared subtree. */
16774
+ emitPath(type, hit, first, controllerIndex) {
16775
+ const { path } = hit;
16776
+ const target = path[path.length - 1];
16777
+ for (let index = path.length - 1; index >= first; index--) {
16778
+ this.onEvent({ type, target, currentTarget: path[index], controllerIndex, hit });
16779
+ }
16780
+ }
16781
+ };
16782
+
16783
+ // src/scenegraph/scene-metadata.ts
16784
+ var SceneMetadata = class {
16785
+ entries = /* @__PURE__ */ new Map();
16786
+ /** Associates metadata with a resource category and its source index. */
16787
+ set(category, index, metadata) {
16788
+ let categoryEntries = this.entries.get(category);
16789
+ if (!categoryEntries) {
16790
+ categoryEntries = /* @__PURE__ */ new Map();
16791
+ this.entries.set(category, categoryEntries);
16792
+ }
16793
+ categoryEntries.set(index, metadata);
16794
+ }
16795
+ /** Returns metadata for a resource, or undefined when none was supplied. */
16796
+ get(category, index = 0) {
16797
+ return this.entries.get(category)?.get(index);
16798
+ }
16799
+ };
16800
+
16651
16801
  // src/scenegraph/group-node.ts
16652
16802
  var import_core23 = __toESM(require_core(), 1);
16653
16803
 
@@ -20477,8 +20627,99 @@ vec4 picking_filterColor(vec4 color) {
20477
20627
  ]);
20478
20628
  }
20479
20629
 
20630
+ // src/scenegraph/controllers/punctual-light-controller.ts
20631
+ var import_shaders8 = __toESM(require_shaders(), 1);
20632
+ var PunctualLightController = class {
20633
+ constructor(bindings, useByteColors = true) {
20634
+ this.bindings = bindings;
20635
+ this.useByteColors = useByteColors;
20636
+ this.update();
20637
+ }
20638
+ bindings;
20639
+ useByteColors;
20640
+ lights = [];
20641
+ /** Refreshes the stable light array after node or light properties change. */
20642
+ update() {
20643
+ this.lights.length = 0;
20644
+ for (const { path, definition } of this.bindings) {
20645
+ if (!path.length || path.some((node) => !node.display)) continue;
20646
+ const worldMatrix = new Matrix4();
20647
+ for (const node of path) worldMatrix.multiplyRight(node.matrix);
20648
+ const light = makePunctualLight(definition, worldMatrix, this.useByteColors);
20649
+ if (light) this.lights.push(light);
20650
+ }
20651
+ }
20652
+ };
20653
+ function makePunctualLight(definition, worldMatrix, useByteColors) {
20654
+ const color = normalizePunctualLightColor(definition.color || [1, 1, 1], useByteColors);
20655
+ const intensity = definition.intensity ?? 1;
20656
+ switch (definition.type) {
20657
+ case "directional":
20658
+ return makeDirectionalLight(worldMatrix, color, intensity);
20659
+ case "point":
20660
+ return makePointLight(worldMatrix, color, intensity, definition.range);
20661
+ case "spot":
20662
+ return makeSpotLight(worldMatrix, color, intensity, definition.range, definition.spot);
20663
+ default:
20664
+ return void 0;
20665
+ }
20666
+ }
20667
+ function normalizePunctualLightColor(color, useByteColors) {
20668
+ if (useByteColors) {
20669
+ return color.map((component) => component * 255);
20670
+ }
20671
+ return (0, import_shaders8.normalizeByteColor3)(color, false);
20672
+ }
20673
+ function makePointLight(worldMatrix, color, intensity, range) {
20674
+ const position = getLightPosition(worldMatrix);
20675
+ let attenuation = [1, 0, 0];
20676
+ if (range !== void 0 && range > 0) {
20677
+ attenuation = [1, 0, 1 / (range * range)];
20678
+ }
20679
+ return {
20680
+ type: "point",
20681
+ position,
20682
+ color,
20683
+ intensity,
20684
+ attenuation
20685
+ };
20686
+ }
20687
+ function makeDirectionalLight(worldMatrix, color, intensity) {
20688
+ const direction = getLightDirection(worldMatrix);
20689
+ return {
20690
+ type: "directional",
20691
+ direction,
20692
+ color,
20693
+ intensity
20694
+ };
20695
+ }
20696
+ function makeSpotLight(worldMatrix, color, intensity, range, spot = {}) {
20697
+ const position = getLightPosition(worldMatrix);
20698
+ const direction = getLightDirection(worldMatrix);
20699
+ let attenuation = [1, 0, 0];
20700
+ if (range !== void 0 && range > 0) {
20701
+ attenuation = [1, 0, 1 / (range * range)];
20702
+ }
20703
+ return {
20704
+ type: "spot",
20705
+ position,
20706
+ direction,
20707
+ color,
20708
+ intensity,
20709
+ attenuation,
20710
+ innerConeAngle: spot.innerConeAngle ?? 0,
20711
+ outerConeAngle: spot.outerConeAngle ?? Math.PI / 4
20712
+ };
20713
+ }
20714
+ function getLightPosition(worldMatrix) {
20715
+ return worldMatrix.transformAsPoint([0, 0, 0]);
20716
+ }
20717
+ function getLightDirection(worldMatrix) {
20718
+ return worldMatrix.transformAsVector([0, 0, -1]);
20719
+ }
20720
+
20480
20721
  // src/scenegraph/controllers/area-light-controller.ts
20481
- var import_core36 = __toESM(require_core(), 1);
20722
+ var import_core37 = __toESM(require_core(), 1);
20482
20723
  var AreaLightController = class {
20483
20724
  scenes;
20484
20725
  matrixAuthoredNodes = /* @__PURE__ */ new Set();
@@ -20488,11 +20729,11 @@ vec4 picking_filterColor(vec4 color) {
20488
20729
  for (const node of matrixNodes) this.matrixAuthoredNodes.add(node);
20489
20730
  for (const { node, definition, matrixAuthored } of bindings) {
20490
20731
  if (matrixAuthored) this.matrixAuthoredNodes.add(node);
20491
- (0, import_core36.assert)(definition && (definition.type === "rect" || definition.type === "disk"));
20492
- (0, import_core36.assert)(Number.isFinite(definition.height ?? 1) && (definition.height ?? 1) > 0);
20493
- (0, import_core36.assert)(Number.isFinite(definition.intensity ?? 1e3) && (definition.intensity ?? 1e3) > 0);
20494
- (0, import_core36.assert)(Number.isFinite(definition.width ?? 1) && (definition.width ?? 1) > 0);
20495
- (0, import_core36.assert)(
20732
+ (0, import_core37.assert)(definition && (definition.type === "rect" || definition.type === "disk"));
20733
+ (0, import_core37.assert)(Number.isFinite(definition.height ?? 1) && (definition.height ?? 1) > 0);
20734
+ (0, import_core37.assert)(Number.isFinite(definition.intensity ?? 1e3) && (definition.intensity ?? 1e3) > 0);
20735
+ (0, import_core37.assert)(Number.isFinite(definition.width ?? 1) && (definition.width ?? 1) > 0);
20736
+ (0, import_core37.assert)(
20496
20737
  (definition.color || [1, 1, 1]).every(
20497
20738
  (component) => Number.isFinite(component) && component >= 0
20498
20739
  )
@@ -20558,17 +20799,17 @@ vec4 picking_filterColor(vec4 color) {
20558
20799
  function getMatrixRotation(matrix) {
20559
20800
  const horizontal = new Vector3(matrix[0], matrix[1], matrix[2]);
20560
20801
  const vertical = new Vector3(matrix[4], matrix[5], matrix[6]);
20561
- (0, import_core36.assert)(horizontal.magnitude() > 0 && vertical.magnitude() > 0);
20802
+ (0, import_core37.assert)(horizontal.magnitude() > 0 && vertical.magnitude() > 0);
20562
20803
  horizontal.normalize();
20563
20804
  vertical.normalize();
20564
20805
  vertical.subtract(new Vector3(horizontal).scale(vertical.dot(horizontal)));
20565
- (0, import_core36.assert)(vertical.magnitude() > 1e-8);
20806
+ (0, import_core37.assert)(vertical.magnitude() > 1e-8);
20566
20807
  vertical.normalize();
20567
20808
  const forward = new Vector3(horizontal).cross(vertical).normalize();
20568
20809
  const authoredForward = new Vector3(matrix[8], matrix[9], matrix[10]);
20569
- (0, import_core36.assert)(authoredForward.magnitude() > 0);
20810
+ (0, import_core37.assert)(authoredForward.magnitude() > 0);
20570
20811
  authoredForward.normalize();
20571
- (0, import_core36.assert)(Math.abs(forward.dot(authoredForward)) > 1e-8);
20812
+ (0, import_core37.assert)(Math.abs(forward.dot(authoredForward)) > 1e-8);
20572
20813
  if (forward.dot(authoredForward) < 0) forward.negate();
20573
20814
  return new Matrix4([
20574
20815
  horizontal[0],
@@ -21126,15 +21367,15 @@ vec4 picking_filterColor(vec4 color) {
21126
21367
  };
21127
21368
 
21128
21369
  // src/audio/audio-graph.ts
21129
- var import_core38 = __toESM(require_core(), 1);
21370
+ var import_core39 = __toESM(require_core(), 1);
21130
21371
  var AudioGraph = class {
21131
21372
  constructor(definition, context, destination, getEmitterInputs) {
21132
21373
  this.definition = definition;
21133
21374
  for (const node of definition.nodes)
21134
- (0, import_core38.assert)(!node.bypass || node.kind !== "splitter" && node.kind !== "channelmerger");
21375
+ (0, import_core39.assert)(!node.bypass || node.kind !== "splitter" && node.kind !== "channelmerger");
21135
21376
  const validateEndpoint = (index, port = 0) => {
21136
- (0, import_core38.assert)(Number.isInteger(index) && Boolean(definition.nodes[index]));
21137
- (0, import_core38.assert)(Number.isInteger(port) && port >= 0);
21377
+ (0, import_core39.assert)(Number.isInteger(index) && Boolean(definition.nodes[index]));
21378
+ (0, import_core39.assert)(Number.isInteger(port) && port >= 0);
21138
21379
  };
21139
21380
  for (const edge of definition.connections) {
21140
21381
  validateEndpoint(edge.from.node, edge.from.output);
@@ -21142,16 +21383,16 @@ vec4 picking_filterColor(vec4 color) {
21142
21383
  }
21143
21384
  for (const input of definition.inputs || []) {
21144
21385
  validateEndpoint(input.node, input.input);
21145
- (0, import_core38.assert)(Number.isInteger(input.source) && input.source >= 0);
21386
+ (0, import_core39.assert)(Number.isInteger(input.source) && input.source >= 0);
21146
21387
  }
21147
21388
  for (const output of definition.outputs || []) {
21148
21389
  validateEndpoint(output.node, output.output);
21149
- (0, import_core38.assert)(Number.isInteger(output.emitter) && output.emitter >= 0);
21390
+ (0, import_core39.assert)(Number.isInteger(output.emitter) && output.emitter >= 0);
21150
21391
  }
21151
21392
  const visiting = /* @__PURE__ */ new Set();
21152
21393
  const visited = /* @__PURE__ */ new Set();
21153
21394
  const visit = (index) => {
21154
- (0, import_core38.assert)(definition.nodes[index] && !visiting.has(index));
21395
+ (0, import_core39.assert)(definition.nodes[index] && !visiting.has(index));
21155
21396
  if (visited.has(index)) return;
21156
21397
  visiting.add(index);
21157
21398
  for (const edge of definition.connections) if (edge.from.node === index) visit(edge.to.node);
@@ -21212,7 +21453,7 @@ vec4 picking_filterColor(vec4 color) {
21212
21453
  /** Apply a scene-driven gain change using the authored transition shape. */
21213
21454
  setGain(index, gain, time = this.nodes[index].context.currentTime) {
21214
21455
  const definition = this.definition.nodes[index];
21215
- (0, import_core38.assert)(definition.kind === "gain" && !definition.bypass && gain >= 0);
21456
+ (0, import_core39.assert)(definition.kind === "gain" && !definition.bypass && gain >= 0);
21216
21457
  const parameter = this.nodes[index].gain;
21217
21458
  const duration = definition.params.duration ?? 0;
21218
21459
  const initialGain = parameter.value;
@@ -21222,7 +21463,7 @@ vec4 picking_filterColor(vec4 color) {
21222
21463
  parameter.setValueAtTime(gain, time);
21223
21464
  } else if (definition.params.interpolation === "custom") {
21224
21465
  const curve = definition.params.curve;
21225
- (0, import_core38.assert)(curve && curve.length >= 2 && curve.every((value) => value >= 0 && value <= 1));
21466
+ (0, import_core39.assert)(curve && curve.length >= 2 && curve.every((value) => value >= 0 && value <= 1));
21226
21467
  parameter.setValueCurveAtTime(
21227
21468
  Float32Array.from(curve, (value) => value * gain),
21228
21469
  time,
@@ -21307,7 +21548,7 @@ vec4 picking_filterColor(vec4 color) {
21307
21548
  }
21308
21549
 
21309
21550
  // src/audio/audio-environment.ts
21310
- var import_core40 = __toESM(require_core(), 1);
21551
+ var import_core41 = __toESM(require_core(), 1);
21311
21552
  function selectAudioEnvironmentZone(zones, position) {
21312
21553
  let selected;
21313
21554
  for (const zone of zones) {
@@ -21400,7 +21641,7 @@ vec4 picking_filterColor(vec4 color) {
21400
21641
  }
21401
21642
  };
21402
21643
  function createParametricAudioResponse(context, parameters) {
21403
- (0, import_core40.assert)((parameters.density ?? 1) === 1 && (parameters.diffusion ?? 1) === 1);
21644
+ (0, import_core41.assert)((parameters.density ?? 1) === 1 && (parameters.diffusion ?? 1) === 1);
21404
21645
  const presets = {
21405
21646
  generic: [1.49, 0.83, 7e-3, 0.011],
21406
21647
  smallRoom: [0.4, 0.83, 2e-3, 3e-3],
@@ -21417,12 +21658,12 @@ vec4 picking_filterColor(vec4 color) {
21417
21658
  underwater: [1.49, 0.1, 7e-3, 0.011]
21418
21659
  };
21419
21660
  const preset = parameters.preset ? presets[parameters.preset] : void 0;
21420
- (0, import_core40.assert)(!parameters.preset || preset);
21661
+ (0, import_core41.assert)(!parameters.preset || preset);
21421
21662
  const decay = parameters.decayTime ?? preset?.[0] ?? 1.5;
21422
21663
  const highFrequencyDecay = decay * (parameters.decayHFRatio ?? preset?.[1] ?? 0.83);
21423
21664
  const earlyDelay = parameters.reflectionsDelay ?? preset?.[2] ?? 0.02;
21424
21665
  const tailDelay = earlyDelay + (parameters.reverbDelay ?? preset?.[3] ?? 0.04);
21425
- (0, import_core40.assert)(decay > 0 && highFrequencyDecay > 0 && earlyDelay >= 0 && tailDelay >= earlyDelay);
21666
+ (0, import_core41.assert)(decay > 0 && highFrequencyDecay > 0 && earlyDelay >= 0 && tailDelay >= earlyDelay);
21426
21667
  const response = context.createBuffer(
21427
21668
  2,
21428
21669
  Math.ceil((tailDelay + Math.max(decay, highFrequencyDecay)) * context.sampleRate),
@@ -21446,7 +21687,7 @@ vec4 picking_filterColor(vec4 color) {
21446
21687
  }
21447
21688
 
21448
21689
  // src/audio/audio-controller.ts
21449
- var import_core41 = __toESM(require_core(), 1);
21690
+ var import_core42 = __toESM(require_core(), 1);
21450
21691
  var AudioController = class {
21451
21692
  gain;
21452
21693
  definition;
@@ -21556,25 +21797,25 @@ vec4 picking_filterColor(vec4 color) {
21556
21797
  /** Change a graph gain using its authored interpolation and duration. */
21557
21798
  setGraphGain(graphIndex, nodeIndex, gain) {
21558
21799
  const graph = this.graphs.get(graphIndex);
21559
- (0, import_core41.assert)(!this.destroyed && graph);
21800
+ (0, import_core42.assert)(!this.destroyed && graph);
21560
21801
  graph.setGain(nodeIndex, gain);
21561
21802
  }
21562
21803
  startSource(sourceIndex, startTime, autoplayOnly, connect) {
21563
21804
  const definition = this.definition.sources[sourceIndex];
21564
- (0, import_core41.assert)(definition);
21805
+ (0, import_core42.assert)(definition);
21565
21806
  if (autoplayOnly && !definition.autoPlay) return;
21566
21807
  const context = this.options.audioContext;
21567
21808
  const extended = definition.graph;
21568
21809
  const oscillator = extended?.oscillator;
21569
- (0, import_core41.assert)(!(definition.audio !== void 0 && oscillator));
21810
+ (0, import_core42.assert)(!(definition.audio !== void 0 && oscillator));
21570
21811
  let source4;
21571
21812
  if (oscillator) {
21572
21813
  const node = context.createOscillator();
21573
21814
  node.frequency.value = oscillator.frequency ?? 440;
21574
21815
  node.detune.value = oscillator.detune ?? 0;
21575
- (0, import_core41.assert)(oscillator.pulseWidth === void 0 || oscillator.pulseWidth === 0.5);
21816
+ (0, import_core42.assert)(oscillator.pulseWidth === void 0 || oscillator.pulseWidth === 0.5);
21576
21817
  if (oscillator.type === "custom") {
21577
- (0, import_core41.assert)(oscillator.periodicWave);
21818
+ (0, import_core42.assert)(oscillator.periodicWave);
21578
21819
  node.setPeriodicWave(
21579
21820
  context.createPeriodicWave(
21580
21821
  new Float32Array(oscillator.periodicWave.real),
@@ -21585,7 +21826,7 @@ vec4 picking_filterColor(vec4 color) {
21585
21826
  source4 = node;
21586
21827
  } else {
21587
21828
  const node = context.createBufferSource();
21588
- (0, import_core41.assert)(definition.audio !== void 0);
21829
+ (0, import_core42.assert)(definition.audio !== void 0);
21589
21830
  node.buffer = this.buffers.get(definition.audio);
21590
21831
  node.loop = definition.loop ?? false;
21591
21832
  node.loopStart = extended?.loopStart ?? 0;
@@ -21730,15 +21971,15 @@ vec4 picking_filterColor(vec4 color) {
21730
21971
  }
21731
21972
  addEmitter(index, node) {
21732
21973
  const definition = this.definition.emitters[index];
21733
- (0, import_core41.assert)(
21974
+ (0, import_core42.assert)(
21734
21975
  definition && (definition.type === "global" || definition.type === "positional" && node)
21735
21976
  );
21736
- (0, import_core41.assert)(
21977
+ (0, import_core42.assert)(
21737
21978
  !definition.positional?.shapeType || ["cone", "omnidirectional"].includes(definition.positional.shapeType)
21738
21979
  );
21739
21980
  for (const sourceIndex of this.graphEmitters.has(index) ? [] : definition.sources || []) {
21740
21981
  const source4 = this.definition.sources[sourceIndex];
21741
- (0, import_core41.assert)(
21982
+ (0, import_core42.assert)(
21742
21983
  source4 && (source4.audio !== void 0 ? this.definition.audio[source4.audio] : source4.graph?.oscillator)
21743
21984
  );
21744
21985
  }
@@ -21783,7 +22024,7 @@ vec4 picking_filterColor(vec4 color) {
21783
22024
  const audioIndices = new Set(
21784
22025
  [...sourceIndices].map((index) => {
21785
22026
  const source4 = this.definition.sources[index];
21786
- (0, import_core41.assert)(
22027
+ (0, import_core42.assert)(
21787
22028
  source4 && (source4.audio !== void 0 ? this.definition.audio[source4.audio] : source4.graph?.oscillator)
21788
22029
  );
21789
22030
  return source4.audio;
@@ -21820,7 +22061,7 @@ vec4 picking_filterColor(vec4 color) {
21820
22061
  const reverb = environment.reverb;
21821
22062
  if (!reverb) return;
21822
22063
  const response = reverb.type === "impulseResponse" ? this.buffers.get(reverb.audio) : createParametricAudioResponse(audioContext, reverb);
21823
- (0, import_core41.assert)(response);
22064
+ (0, import_core42.assert)(response);
21824
22065
  const bus = new AudioReverbBus(audioContext, response, this.gain, {
21825
22066
  ...reverb,
21826
22067
  normalize: reverb.type === "impulseResponse" ? reverb.normalize : false
@@ -21925,11 +22166,11 @@ vec4 picking_filterColor(vec4 color) {
21925
22166
  };
21926
22167
 
21927
22168
  // src/modules/picking/legacy-color-picking.ts
21928
- var import_shaders8 = __toESM(require_shaders(), 1);
21929
- var legacyColorPicking = import_shaders8.picking;
22169
+ var import_shaders9 = __toESM(require_shaders(), 1);
22170
+ var legacyColorPicking = import_shaders9.picking;
21930
22171
 
21931
22172
  // src/geometry/ring-geometry.ts
21932
- var import_core43 = __toESM(require_core(), 1);
22173
+ var import_core44 = __toESM(require_core(), 1);
21933
22174
  var RingGeometry = class extends Geometry2 {
21934
22175
  constructor(props = {}) {
21935
22176
  const {
@@ -21940,7 +22181,7 @@ vec4 picking_filterColor(vec4 color) {
21940
22181
  startAngle = 0,
21941
22182
  angle: angle2 = Math.PI * 2
21942
22183
  } = props;
21943
- (0, import_core43.assert)(
22184
+ (0, import_core44.assert)(
21944
22185
  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
22186
  );
21946
22187
  const halfHeight = height / 2;
@@ -22124,7 +22365,7 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
22124
22365
  };
22125
22366
 
22126
22367
  // src/scenegraph/controllers/morph-controller.ts
22127
- var import_core46 = __toESM(require_core(), 1);
22368
+ var import_core47 = __toESM(require_core(), 1);
22128
22369
  function setMorphWeights(node, weights) {
22129
22370
  node.userData["morphWeights"] = [...weights];
22130
22371
  const meshes = node.userData["morphMeshes"] || [];
@@ -22151,7 +22392,7 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
22151
22392
  function updateMorphWeights(state, weights) {
22152
22393
  state.values.fill(0);
22153
22394
  state.values.set(weights.slice(0, state.values.length));
22154
- if (state.data instanceof import_core46.Buffer) {
22395
+ if (state.data instanceof import_core47.Buffer) {
22155
22396
  state.data.write(state.values);
22156
22397
  } else {
22157
22398
  state.data.writeData(state.values, { width: state.packedTargetCount, height: 1 });
@@ -22174,6 +22415,10 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
22174
22415
  return Array.from(node.userData["morphWeights"] ?? []);
22175
22416
  case "visibility":
22176
22417
  return [node.display ? 1 : 0];
22418
+ case "selectable":
22419
+ return [node.selectable ? 1 : 0];
22420
+ case "hoverable":
22421
+ return [node.hoverable ? 1 : 0];
22177
22422
  }
22178
22423
  },
22179
22424
  setValue: (value) => {
@@ -22190,6 +22435,12 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
22190
22435
  case "weights":
22191
22436
  setMorphWeights(node, value);
22192
22437
  break;
22438
+ case "selectable":
22439
+ node.setProps({ selectable: value[0] !== 0 });
22440
+ break;
22441
+ case "hoverable":
22442
+ node.setProps({ hoverable: value[0] !== 0 });
22443
+ break;
22193
22444
  case "visibility":
22194
22445
  node.setProps({ display: value[0] !== 0 });
22195
22446
  options.onVisibilityChange?.();
@@ -22507,7 +22758,7 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
22507
22758
  }
22508
22759
 
22509
22760
  // src/lighting/ltc-textures.ts
22510
- var import_shaders9 = __toESM(require_shaders(), 1);
22761
+ var import_shaders10 = __toESM(require_shaders(), 1);
22511
22762
 
22512
22763
  // src/lighting/ltc-data.ts
22513
22764
  var LTC_MATRIX_DATA = [
@@ -55290,7 +55541,7 @@ struct PublishedTransforms {bodyIndex:i32,viewProjection:mat4x4f}
55290
55541
  width: 64,
55291
55542
  height: 64,
55292
55543
  format: "rgba16float",
55293
- data: Uint16Array.from(data, import_shaders9.toHalfFloat),
55544
+ data: Uint16Array.from(data, import_shaders10.toHalfFloat),
55294
55545
  mipLevels: 1,
55295
55546
  sampler: { minFilter: "nearest", magFilter: "nearest" }
55296
55547
  });