@woosh/meep-engine 3.46.0 → 3.47.0

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 (230) hide show
  1. package/editor/actions/concrete/TransformModifyAction.d.ts.map +1 -1
  2. package/editor/actions/concrete/TransformModifyAction.js +10 -2
  3. package/editor/ecs/component/FieldDescriptor.js +15 -0
  4. package/editor/ecs/component/createObjectEditor.js +41 -12
  5. package/editor/ecs/component/editors/ecs/Transform64Editor.d.ts.map +1 -1
  6. package/editor/ecs/component/editors/ecs/Transform64Editor.js +77 -70
  7. package/editor/tools/TransformToolV2.d.ts.map +1 -1
  8. package/editor/tools/TransformToolV2.js +4 -0
  9. package/editor/tools/v2/TransformControls.d.ts.map +1 -1
  10. package/editor/tools/v2/TransformControls.js +7 -0
  11. package/editor/view/ecs/EntityEditor.d.ts.map +1 -1
  12. package/editor/view/ecs/EntityEditor.js +4 -2
  13. package/package.json +1 -1
  14. package/src/core/collection/array/array_insert_at.d.ts +16 -0
  15. package/src/core/collection/array/array_insert_at.d.ts.map +1 -0
  16. package/src/core/collection/array/array_insert_at.js +32 -0
  17. package/src/core/collection/array/array_remove_at.d.ts +15 -0
  18. package/src/core/collection/array/array_remove_at.d.ts.map +1 -0
  19. package/src/core/collection/array/array_remove_at.js +30 -0
  20. package/src/core/geom/3d/quaternion/quat3_look_rotation.d.ts +37 -0
  21. package/src/core/geom/3d/quaternion/quat3_look_rotation.d.ts.map +1 -0
  22. package/src/core/geom/3d/quaternion/quat3_look_rotation.js +172 -0
  23. package/src/core/geom/Quaternion.d.ts +1 -0
  24. package/src/core/geom/Quaternion.d.ts.map +1 -1
  25. package/src/core/geom/Quaternion.js +12 -48
  26. package/src/engine/Engine.d.ts.map +1 -1
  27. package/src/engine/Engine.js +9 -4
  28. package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
  29. package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +10 -0
  30. package/src/engine/ecs/transform/t64_look_rotation.d.ts +4 -4
  31. package/src/engine/ecs/transform/t64_look_rotation.d.ts.map +1 -1
  32. package/src/engine/ecs/transform/t64_look_rotation.js +7 -18
  33. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.d.ts.map +1 -1
  34. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js +30 -1
  35. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +6 -0
  36. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
  37. package/src/engine/graphics3/GPUParticleEmitterSystem.js +72 -29
  38. package/src/engine/input/devices/KeyboardDevice.d.ts +1 -0
  39. package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
  40. package/src/engine/input/devices/KeyboardDevice.js +7 -6
  41. package/src/engine/navigation/ecs/path_following/PathFollowingSystem.d.ts.map +1 -1
  42. package/src/engine/navigation/ecs/path_following/PathFollowingSystem.js +15 -2
  43. package/src/engine/network/CONGESTION_CONTROL.md +9 -9
  44. package/src/engine/network/MESSAGE_TRANSPORT.md +364 -0
  45. package/src/engine/network/NetworkSession.d.ts +31 -11
  46. package/src/engine/network/NetworkSession.d.ts.map +1 -1
  47. package/src/engine/network/NetworkSession.js +453 -286
  48. package/src/engine/network/README.md +77 -27
  49. package/src/engine/network/SMOOTHNESS_DESIGN.md +13 -5
  50. package/src/engine/network/diagnostics/BandwidthMeter.d.ts +1 -1
  51. package/src/engine/network/diagnostics/BandwidthMeter.js +1 -1
  52. package/src/engine/network/orchestrator/HostJoin.d.ts +111 -0
  53. package/src/engine/network/orchestrator/HostJoin.d.ts.map +1 -0
  54. package/src/engine/network/orchestrator/HostJoin.js +271 -0
  55. package/src/engine/network/orchestrator/NetworkPeer.d.ts +151 -112
  56. package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
  57. package/src/engine/network/orchestrator/NetworkPeer.js +450 -499
  58. package/src/engine/network/orchestrator/PendingSlices.d.ts +30 -0
  59. package/src/engine/network/orchestrator/PendingSlices.d.ts.map +1 -0
  60. package/src/engine/network/orchestrator/PendingSlices.js +83 -0
  61. package/src/engine/network/orchestrator/ReliableFrames.d.ts +34 -0
  62. package/src/engine/network/orchestrator/ReliableFrames.d.ts.map +1 -0
  63. package/src/engine/network/orchestrator/ReliableFrames.js +96 -0
  64. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts +77 -10
  65. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
  66. package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +236 -61
  67. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +20 -6
  68. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
  69. package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +33 -8
  70. package/src/engine/network/replication/Replicator.d.ts.map +1 -1
  71. package/src/engine/network/replication/Replicator.js +7 -1
  72. package/src/engine/network/sim/ActionLog.d.ts +32 -5
  73. package/src/engine/network/sim/ActionLog.d.ts.map +1 -1
  74. package/src/engine/network/sim/ActionLog.js +47 -5
  75. package/src/engine/network/sim/SimActionExecutor.d.ts +42 -2
  76. package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
  77. package/src/engine/network/sim/SimActionExecutor.js +100 -4
  78. package/src/engine/network/sim/Snapshotter.d.ts +12 -0
  79. package/src/engine/network/sim/Snapshotter.d.ts.map +1 -1
  80. package/src/engine/network/sim/Snapshotter.js +43 -0
  81. package/src/engine/network/state/Baseline.d.ts +1 -1
  82. package/src/engine/network/state/Baseline.js +1 -1
  83. package/src/engine/network/state/FrameBufferRing.d.ts +25 -6
  84. package/src/engine/network/state/FrameBufferRing.d.ts.map +1 -1
  85. package/src/engine/network/state/FrameBufferRing.js +51 -6
  86. package/src/engine/network/state/InputRing.d.ts +4 -0
  87. package/src/engine/network/state/InputRing.d.ts.map +1 -1
  88. package/src/engine/network/state/InputRing.js +7 -0
  89. package/src/engine/network/transport/DeferredTransport.d.ts.map +1 -1
  90. package/src/engine/network/transport/DeferredTransport.js +1 -0
  91. package/src/engine/network/transport/LoopbackTransport.d.ts.map +1 -1
  92. package/src/engine/network/transport/LoopbackTransport.js +4 -2
  93. package/src/engine/network/transport/Transport.d.ts +7 -0
  94. package/src/engine/network/transport/Transport.d.ts.map +1 -1
  95. package/src/engine/network/transport/Transport.js +8 -0
  96. package/src/engine/network/transport/adapters/NodeUDPTransport.d.ts.map +1 -1
  97. package/src/engine/network/transport/adapters/NodeUDPTransport.js +20 -5
  98. package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.d.ts.map +1 -1
  99. package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.js +8 -0
  100. package/src/engine/network/transport/adapters/WebTransportTransport.d.ts.map +1 -1
  101. package/src/engine/network/transport/adapters/WebTransportTransport.js +6 -0
  102. package/src/engine/network/transport/connection/Connection.d.ts +191 -0
  103. package/src/engine/network/transport/connection/Connection.d.ts.map +1 -0
  104. package/src/engine/network/transport/connection/Connection.js +1262 -0
  105. package/src/engine/network/transport/connection/RangeSet.d.ts +94 -0
  106. package/src/engine/network/transport/connection/RangeSet.d.ts.map +1 -0
  107. package/src/engine/network/transport/connection/RangeSet.js +260 -0
  108. package/src/engine/network/transport/connection/RxStream.d.ts +48 -0
  109. package/src/engine/network/transport/connection/RxStream.d.ts.map +1 -0
  110. package/src/engine/network/transport/connection/RxStream.js +211 -0
  111. package/src/engine/network/transport/connection/TxStream.d.ts +90 -0
  112. package/src/engine/network/transport/connection/TxStream.d.ts.map +1 -0
  113. package/src/engine/network/transport/connection/TxStream.js +243 -0
  114. package/src/engine/network/transport/connection/bytes_copy.d.ts +17 -0
  115. package/src/engine/network/transport/connection/bytes_copy.d.ts.map +1 -0
  116. package/src/engine/network/transport/connection/bytes_copy.js +34 -0
  117. package/src/engine/network/transport/connection/varint.d.ts +46 -0
  118. package/src/engine/network/transport/connection/varint.d.ts.map +1 -0
  119. package/src/engine/network/transport/connection/varint.js +107 -0
  120. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  121. package/src/engine/sound/ecs/audio/AudioEmitter.d.ts +38 -7
  122. package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -1
  123. package/src/engine/sound/ecs/audio/AudioEmitter.js +35 -7
  124. package/src/engine/sound/ecs/audio/AudioEmitterSerializationAdapter.d.ts.map +1 -1
  125. package/src/engine/sound/ecs/audio/AudioEmitterSerializationAdapter.js +5 -1
  126. package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.d.ts +18 -0
  127. package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.d.ts.map +1 -0
  128. package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.js +48 -0
  129. package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts +12 -2
  130. package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -1
  131. package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +173 -9
  132. package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts +9 -3
  133. package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -1
  134. package/src/engine/sound/ecs/audio/LiveEmitterSet.js +28 -8
  135. package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts +8 -0
  136. package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts.map +1 -1
  137. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationAdapter.d.ts.map +1 -1
  138. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationAdapter.js +5 -1
  139. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.d.ts +18 -0
  140. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.d.ts.map +1 -0
  141. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.js +51 -0
  142. package/src/engine/sound/ecs/trigger/AudioEventTriggerSystem.d.ts.map +1 -1
  143. package/src/engine/sound/ecs/trigger/AudioEventTriggerSystem.js +15 -1
  144. package/src/engine/sound/sopra/README.md +768 -644
  145. package/src/engine/sound/sopra/SopraEngine.d.ts +104 -8
  146. package/src/engine/sound/sopra/SopraEngine.d.ts.map +1 -1
  147. package/src/engine/sound/sopra/SopraEngine.js +327 -12
  148. package/src/engine/sound/sopra/definition/EventDescription.d.ts +28 -2
  149. package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -1
  150. package/src/engine/sound/sopra/definition/EventDescription.js +55 -5
  151. package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts +10 -0
  152. package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts.map +1 -1
  153. package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.js +77 -55
  154. package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.d.ts +31 -0
  155. package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.d.ts.map +1 -0
  156. package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.js +75 -0
  157. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts +38 -9
  158. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts.map +1 -1
  159. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js +34 -5
  160. package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts +7 -2
  161. package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -1
  162. package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +137 -122
  163. package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts +3 -1
  164. package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -1
  165. package/src/engine/sound/sopra/definition/effect/EqEffect.js +146 -131
  166. package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts +1 -0
  167. package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts.map +1 -1
  168. package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +6 -1
  169. package/src/engine/sound/sopra/runtime/BusGraph.d.ts +44 -2
  170. package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -1
  171. package/src/engine/sound/sopra/runtime/BusGraph.js +83 -43
  172. package/src/engine/sound/sopra/runtime/EffectChain.d.ts +96 -0
  173. package/src/engine/sound/sopra/runtime/EffectChain.d.ts.map +1 -0
  174. package/src/engine/sound/sopra/runtime/EffectChain.js +286 -0
  175. package/src/engine/sound/sopra/runtime/EffectParamOverrides.d.ts +123 -0
  176. package/src/engine/sound/sopra/runtime/EffectParamOverrides.d.ts.map +1 -0
  177. package/src/engine/sound/sopra/runtime/EffectParamOverrides.js +320 -0
  178. package/src/engine/sound/sopra/runtime/EventInstance.d.ts +55 -5
  179. package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
  180. package/src/engine/sound/sopra/runtime/EventInstance.js +201 -26
  181. package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts +2 -1
  182. package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts.map +1 -1
  183. package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js +6 -1
  184. package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts +15 -0
  185. package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts.map +1 -1
  186. package/src/engine/sound/sopra/serialization/sopraSerializationHarness.js +32 -0
  187. package/src/engine/sound/sopra/util/MockAudioContext.d.ts.map +1 -1
  188. package/src/engine/sound/sopra/util/MockAudioContext.js +3 -0
  189. package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts +13 -3
  190. package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts.map +1 -1
  191. package/src/engine/sound/sopra/util/fadeOutAndStop.js +25 -13
  192. package/src/shade/RENDERER_CONTRACT.md +6 -3
  193. package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts +24 -0
  194. package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts.map +1 -0
  195. package/src/shade/device/SHADE_DEVICE_FLOOR.js +34 -0
  196. package/src/shade/device/ShadeDeviceFailure.d.ts +12 -5
  197. package/src/shade/device/ShadeDeviceFailure.d.ts.map +1 -1
  198. package/src/shade/device/ShadeDeviceFailure.js +17 -8
  199. package/src/shade/device/ShadeDeviceFailureReason.d.ts +1 -1
  200. package/src/shade/device/ShadeDeviceFailureReason.js +2 -2
  201. package/src/shade/device/shade_device_floor_unmet.d.ts +13 -0
  202. package/src/shade/device/shade_device_floor_unmet.d.ts.map +1 -0
  203. package/src/shade/device/shade_device_floor_unmet.js +32 -0
  204. package/src/shade/renderer/Renderer.d.ts +2 -0
  205. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  206. package/src/shade/renderer/Renderer.js +29 -55
  207. package/src/shade/renderer/buffer/GPUBufferAllocator.d.ts.map +1 -1
  208. package/src/shade/renderer/buffer/GPUBufferAllocator.js +9 -0
  209. package/src/shade/renderer/buffer/buffer_pool_ops.d.ts +21 -12
  210. package/src/shade/renderer/buffer/buffer_pool_ops.d.ts.map +1 -1
  211. package/src/shade/renderer/buffer/buffer_pool_ops.js +18 -19
  212. package/src/shade/renderer/gpu_primitive/test/gpu_test.d.ts.map +1 -1
  213. package/src/shade/renderer/gpu_primitive/test/gpu_test.js +8 -11
  214. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  215. package/src/shade/renderer/pool/TransientResourcePool.d.ts +24 -0
  216. package/src/shade/renderer/pool/TransientResourcePool.d.ts.map +1 -1
  217. package/src/shade/renderer/pool/TransientResourcePool.js +41 -10
  218. package/src/shade/renderer/shader/ComputeShader.d.ts.map +1 -1
  219. package/src/shade/renderer/shader/ComputeShader.js +18 -2
  220. package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
  221. package/src/shade/renderer/shader/ImageShader.js +230 -218
  222. package/src/view/graphics/GraphicsContextFailureView.d.ts +1 -2
  223. package/src/view/graphics/GraphicsContextFailureView.d.ts.map +1 -1
  224. package/src/view/graphics/GraphicsContextFailureView.js +1 -2
  225. package/src/engine/network/transport/Channel.js +0 -336
  226. package/src/engine/network/transport/ReliableCommandPipeline.js +0 -335
  227. package/src/engine/network/transport/fragments/FragmentAssembler.js +0 -350
  228. package/src/engine/network/transport/fragments/FragmentRetention.js +0 -191
  229. package/src/engine/network/transport/fragments/fragment_send.js +0 -157
  230. package/src/engine/network/transport/fragments/packet_size.js +0 -107
@@ -1 +1 @@
1
- {"version":3,"file":"TransformModifyAction.d.ts","sourceRoot":"","sources":["../../../../editor/actions/concrete/TransformModifyAction.js"],"names":[],"mappings":";AAGA;IAGI;;;;;OAKG;IACH,mCAHW,WAAW,EAQrB;IAbD,cAAgB;IAWZ,sBAAwB;IACxB,YAAoB;IAOxB,8CAEC;IAiBD,mCAIC;CACJ;uBA9CsB,0CAA0C;4BADrC,kDAAkD"}
1
+ {"version":3,"file":"TransformModifyAction.d.ts","sourceRoot":"","sources":["../../../../editor/actions/concrete/TransformModifyAction.js"],"names":[],"mappings":";AAIA;IAGI;;;;;OAKG;IACH,mCAHW,WAAW,EAQrB;IAbD,cAAgB;IAWZ,sBAAwB;IACxB,YAAoB;IAOxB,8CAEC;IAqBD,mCAOC;CACJ;uBArDsB,0CAA0C;4BADrC,kDAAkD"}
@@ -1,3 +1,4 @@
1
+ import { t64_announce_change } from "../../../src/engine/ecs/transform/t64_announce_change.js";
1
2
  import { Transform64 } from "../../../src/engine/ecs/transform/Transform64.js";
2
3
  import { Action } from "../../../src/core/process/undo/Action.js";
3
4
 
@@ -30,7 +31,8 @@ class TransformModifyAction extends Action {
30
31
  * @param {Editor} editor
31
32
  */
32
33
  async apply(editor) {
33
- const component = editor.engine.entityManager.dataset.getComponent(this.entity, Transform64);
34
+ const dataset = editor.engine.entityManager.dataset;
35
+ const component = dataset.getComponent(this.entity, Transform64);
34
36
 
35
37
  if (this.oldState === null) {
36
38
  // captured on first application only; redo must restore the original pre-modification state
@@ -38,12 +40,18 @@ class TransformModifyAction extends Action {
38
40
  }
39
41
 
40
42
  component.copy(this.modified);
43
+
44
+ // a Transform64 cannot say it was written, so the writer does, on redo as on the first apply
45
+ t64_announce_change(dataset, this.entity);
41
46
  }
42
47
 
43
48
  async revert(editor) {
44
- const component = editor.engine.entityManager.dataset.getComponent(this.entity, Transform64);
49
+ const dataset = editor.engine.entityManager.dataset;
50
+ const component = dataset.getComponent(this.entity, Transform64);
45
51
 
46
52
  component.copy(this.oldState);
53
+
54
+ t64_announce_change(dataset, this.entity);
47
55
  }
48
56
  }
49
57
 
@@ -26,6 +26,21 @@ export class FieldDescriptor {
26
26
  */
27
27
  schema = undefined;
28
28
 
29
+ /**
30
+ * When the value is an entity's component, the dataset holding that entity; null otherwise.
31
+ *
32
+ * For a component with no change signal of its own, which an editor writing it has to announce on
33
+ * the entity: a `Transform64` (`TRANSFORM64_EVENT_CHANGE`). Set by {@link buildComponentEditorFromRegistry}.
34
+ * @type {EntityComponentDataset|null}
35
+ */
36
+ owner_dataset = null;
37
+
38
+ /**
39
+ * The entity whose component the value is, in {@link owner_dataset}; -1 when it is not one.
40
+ * @type {number}
41
+ */
42
+ owner_entity = -1;
43
+
29
44
  toString() {
30
45
  return `FieldDescriptor[name='${this.name}']`;
31
46
  }
@@ -277,27 +277,56 @@ export function buildObjectEditorFromRegistry(object, registry, field_descriptor
277
277
 
278
278
  const editor = findNearestRegisteredType(registry, object);
279
279
 
280
- let fd;
280
+ const fd = field_descriptor === undefined
281
+ ? root_field_descriptor(object, editor)
282
+ : field_descriptor;
281
283
 
282
- if (field_descriptor === undefined) {
284
+ return editor.build(null, fd, registry);
285
+ }
283
286
 
284
- fd = new FieldDescriptor();
285
- fd.adapter = new FieldValueAdapter();
287
+ /**
288
+ * {@link buildObjectEditorFromRegistry} for an entity's component, which the editor is told is one: the
289
+ * field descriptor carries the entity and its dataset, so an editor writing a component with no change
290
+ * signal of its own can announce the write on the entity.
291
+ *
292
+ * @param {Object} component
293
+ * @param {EntityComponentDataset} dataset
294
+ * @param {number} entity
295
+ * @param {Map<*, TypeEditor>} registry
296
+ */
297
+ export function buildComponentEditorFromRegistry(component, dataset, entity, registry) {
286
298
 
287
- fd.adapter.read = () => object;
288
- fd.adapter.writable = false;
299
+ const editor = findNearestRegisteredType(registry, component);
289
300
 
290
- if (editor.schema) {
291
- fd.schema = editor.schema;
292
- }
301
+ const fd = root_field_descriptor(component, editor);
293
302
 
294
- } else {
295
- fd = field_descriptor;
296
- }
303
+ fd.owner_dataset = dataset;
304
+ fd.owner_entity = entity;
297
305
 
298
306
  return editor.build(null, fd, registry);
299
307
  }
300
308
 
309
+ /**
310
+ * The descriptor of a value edited as a whole, rather than as a field of something.
311
+ *
312
+ * @param {Object} object
313
+ * @param {TypeEditor} editor
314
+ * @returns {FieldDescriptor}
315
+ */
316
+ function root_field_descriptor(object, editor) {
317
+ const fd = new FieldDescriptor();
318
+ fd.adapter = new FieldValueAdapter();
319
+
320
+ fd.adapter.read = () => object;
321
+ fd.adapter.writable = false;
322
+
323
+ if (editor.schema) {
324
+ fd.schema = editor.schema;
325
+ }
326
+
327
+ return fd;
328
+ }
329
+
301
330
  const MAX_DEPTH = 7;
302
331
 
303
332
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Transform64Editor.d.ts","sourceRoot":"","sources":["../../../../../../editor/ecs/component/editors/ecs/Transform64Editor.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AACH;;IACI,+GA+CC;CACJ;2BAlE0B,qBAAqB"}
1
+ {"version":3,"file":"Transform64Editor.d.ts","sourceRoot":"","sources":["../../../../../../editor/ecs/component/editors/ecs/Transform64Editor.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH;;IACI,+GAqDC;CACJ;2BAxE0B,qBAAqB"}
@@ -1,70 +1,77 @@
1
- import Quaternion from "../../../../../src/core/geom/Quaternion.js";
2
- import Vector3 from "../../../../../src/core/geom/Vector3.js";
3
- import { createObjectEditor } from "../../createObjectEditor.js";
4
- import { TypeEditor } from "../../TypeEditor.js";
5
- import { two_way_sync } from "../common/two_way_sync.js";
6
-
7
- /**
8
- * Inspector for a {@link Transform64}.
9
- *
10
- * The component is 23 numbers in one array, with no sub-objects and no signals, so the inspector
11
- * cannot bind to it the way {@link TransformEditor} binds to a {@link Transform} - there is nothing
12
- * on it to bind to. Instead the editor keeps a mirror: a live {@link Vector3} / {@link Quaternion} /
13
- * {@link Vector3} triple that the ordinary field editors know how to draw and edit, bridged to the
14
- * component in both directions.
15
- *
16
- * The one thing the mirror cannot do is notice a change made elsewhere. A signalling transform woke
17
- * its editor when physics moved it; this one refreshes when the view links and whenever the user
18
- * touches it. That is the cost of the component having no change channel of its own, and it is the
19
- * same cost every other reader of a Transform64 pays.
20
- */
21
- export class Transform64Editor extends TypeEditor {
22
- build(parent, field, registry) {
23
- /**
24
- * @type {Transform64}
25
- */
26
- const transform = field.adapter.read(parent, field.name);
27
-
28
- const mirror = {
29
- translation: new Vector3(),
30
- rotation: new Quaternion(),
31
- scale: new Vector3()
32
- };
33
-
34
- const { sync_up, sync_down } = two_way_sync(
35
- () => {
36
- mirror.translation.set(
37
- transform.translation_x, transform.translation_y, transform.translation_z
38
- );
39
- mirror.rotation.set(
40
- transform.rotation_x, transform.rotation_y,
41
- transform.rotation_z, transform.rotation_w
42
- );
43
- mirror.scale.set(transform.scale_x, transform.scale_y, transform.scale_z);
44
- },
45
- () => {
46
- const { translation, rotation, scale } = mirror;
47
-
48
- transform.setTranslation(translation.x, translation.y, translation.z);
49
- transform.setRotation(rotation.x, rotation.y, rotation.z, rotation.w);
50
- transform.setScale(scale.x, scale.y, scale.z);
51
-
52
- // a rotation or a scale write leaves the matrix describing the previous pose
53
- transform.updateMatrix();
54
- }
55
- );
56
-
57
- // the mirror has to hold the current pose before the field editors read it
58
- sync_up();
59
-
60
- const view = createObjectEditor(mirror, registry);
61
-
62
- view.bindSignal(mirror.translation.onChanged, sync_down);
63
- view.bindSignal(mirror.rotation.onChanged, sync_down);
64
- view.bindSignal(mirror.scale.onChanged, sync_down);
65
-
66
- view.on.linked.add(sync_up);
67
-
68
- return view;
69
- }
70
- }
1
+ import Quaternion from "../../../../../src/core/geom/Quaternion.js";
2
+ import Vector3 from "../../../../../src/core/geom/Vector3.js";
3
+ import { t64_announce_change } from "../../../../../src/engine/ecs/transform/t64_announce_change.js";
4
+ import { createObjectEditor } from "../../createObjectEditor.js";
5
+ import { TypeEditor } from "../../TypeEditor.js";
6
+ import { two_way_sync } from "../common/two_way_sync.js";
7
+
8
+ /**
9
+ * Inspector for a {@link Transform64}.
10
+ *
11
+ * The component is 23 numbers in one array, with no sub-objects and no signals, so the inspector
12
+ * cannot bind to it the way {@link TransformEditor} binds to a {@link Transform} - there is nothing
13
+ * on it to bind to. Instead the editor keeps a mirror: a live {@link Vector3} / {@link Quaternion} /
14
+ * {@link Vector3} triple that the ordinary field editors know how to draw and edit, bridged to the
15
+ * component in both directions.
16
+ *
17
+ * The one thing the mirror cannot do is notice a change made elsewhere. A signalling transform woke
18
+ * its editor when physics moved it; this one refreshes when the view links and whenever the user
19
+ * touches it. That is the cost of the component having no change channel of its own, and it is the
20
+ * same cost every other reader of a Transform64 pays.
21
+ */
22
+ export class Transform64Editor extends TypeEditor {
23
+ build(parent, field, registry) {
24
+ /**
25
+ * @type {Transform64}
26
+ */
27
+ const transform = field.adapter.read(parent, field.name);
28
+
29
+ const mirror = {
30
+ translation: new Vector3(),
31
+ rotation: new Quaternion(),
32
+ scale: new Vector3()
33
+ };
34
+
35
+ const { sync_up, sync_down } = two_way_sync(
36
+ () => {
37
+ mirror.translation.set(
38
+ transform.translation_x, transform.translation_y, transform.translation_z
39
+ );
40
+ mirror.rotation.set(
41
+ transform.rotation_x, transform.rotation_y,
42
+ transform.rotation_z, transform.rotation_w
43
+ );
44
+ mirror.scale.set(transform.scale_x, transform.scale_y, transform.scale_z);
45
+ },
46
+ () => {
47
+ const { translation, rotation, scale } = mirror;
48
+
49
+ transform.setTranslation(translation.x, translation.y, translation.z);
50
+ transform.setRotation(rotation.x, rotation.y, rotation.z, rotation.w);
51
+ transform.setScale(scale.x, scale.y, scale.z);
52
+
53
+ // a rotation or a scale write leaves the matrix describing the previous pose
54
+ transform.updateMatrix();
55
+
56
+ // A Transform64 cannot say it was written, so the writer does. Only an entity's own
57
+ // transform has anyone to tell: a transform edited as a field of something has no owner.
58
+ if (field.owner_dataset !== null) {
59
+ t64_announce_change(field.owner_dataset, field.owner_entity);
60
+ }
61
+ }
62
+ );
63
+
64
+ // the mirror has to hold the current pose before the field editors read it
65
+ sync_up();
66
+
67
+ const view = createObjectEditor(mirror, registry);
68
+
69
+ view.bindSignal(mirror.translation.onChanged, sync_down);
70
+ view.bindSignal(mirror.rotation.onChanged, sync_down);
71
+ view.bindSignal(mirror.scale.onChanged, sync_down);
72
+
73
+ view.on.linked.add(sync_up);
74
+
75
+ return view;
76
+ }
77
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"TransformToolV2.d.ts","sourceRoot":"","sources":["../../../editor/tools/TransformToolV2.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;GAWG;AACH;IACI,aAA2B;IAE3B;;OAEG;IACH,MAFU,cAAc,MAAM,CAAC,CAEmB;IAElD;;OAEG;IACH,YAFU,iBAAiB,GAAC,IAAI,CAEd;IAElB;;;OAGG;IACH,gBAFU,OAAO,CAEM;IAuBnB;;;OAGG;IACH,kBAFU,IAAI,MAAM,EAAE,WAAW,CAAC,CAED;IAGrC;;;OAGG;IACH,kCAEC;IAED;;OAEG;IACH,wCAEC;IAED;;;OAGG;IACH,mBAFa,MAAM,CAclB;IAED,iCAUC;IAED,0BAkCC;IAED;;OAEG;IACH,6BAgFC;IAED;;OAEG;IACH,wBA+BC;IA2DD,6BAgCC;IAED,4BAEC;IAED,6BAEC;IAED,4BAQC;IAED;;;OAGG;IACH,2BAFW,aAAa,QAuBvB;CACJ;iBAzZgB,kBAAkB;0BAJT,uCAAuC;kCAK/B,2BAA2B;4BAJjC,+CAA+C"}
1
+ {"version":3,"file":"TransformToolV2.d.ts","sourceRoot":"","sources":["../../../editor/tools/TransformToolV2.js"],"names":[],"mappings":"AAqBA;;;;;;;;;;;GAWG;AACH;IACI,aAA2B;IAE3B;;OAEG;IACH,MAFU,cAAc,MAAM,CAAC,CAEmB;IAElD;;OAEG;IACH,YAFU,iBAAiB,GAAC,IAAI,CAEd;IAElB;;;OAGG;IACH,gBAFU,OAAO,CAEM;IAuBnB;;;OAGG;IACH,kBAFU,IAAI,MAAM,EAAE,WAAW,CAAC,CAED;IAGrC;;;OAGG;IACH,kCAEC;IAED;;OAEG;IACH,wCAEC;IAED;;;OAGG;IACH,mBAFa,MAAM,CAclB;IAED,iCAUC;IAED,0BAkCC;IAED;;OAEG;IACH,6BAmFC;IAED;;OAEG;IACH,wBA+BC;IA2DD,6BAgCC;IAED,4BAEC;IAED,6BAEC;IAED,4BAQC;IAED;;;OAGG;IACH,2BAFW,aAAa,QAuBvB;CACJ;iBA5ZgB,kBAAkB;0BALT,uCAAuC;kCAM/B,2BAA2B;4BAJjC,+CAA+C"}
@@ -2,6 +2,7 @@ import Quaternion from "../../src/core/geom/Quaternion.js";
2
2
  import Vector1 from "../../src/core/geom/Vector1.js";
3
3
  import Vector3 from "../../src/core/geom/Vector3.js";
4
4
  import ObservedValue from "../../src/core/model/ObservedValue.js";
5
+ import { t64_announce_change } from "../../src/engine/ecs/transform/t64_announce_change.js";
5
6
  import { Transform64 } from "../../src/engine/ecs/transform/Transform64.js";
6
7
  import { KeyCodes } from "../../src/engine/input/devices/KeyCodes.js";
7
8
  import TransformModifyAction from "../actions/concrete/TransformModifyAction.js";
@@ -240,6 +241,9 @@ export class TransformToolV2 extends Tool {
240
241
 
241
242
  transform.updateMatrix();
242
243
  }
244
+
245
+ // the controls announce the primary they move; the entities carried along are this tool's
246
+ t64_announce_change(ecd, entity);
243
247
  }
244
248
  }
245
249
 
@@ -1 +1 @@
1
- {"version":3,"file":"TransformControls.d.ts","sourceRoot":"","sources":["../../../../editor/tools/v2/TransformControls.js"],"names":[],"mappings":"AA4EA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;IAsNI;;;;;OAKG;IACH,sBALW,+BAA6B,cAE7B,WAAW,eACX,OAAO,EAgCjB;IAzPD;;;OAGG;IACH,QAFU,MAAM,CAEJ;IAEZ,6BAA2B;IAE3B;;OAEG;IACH,SAFU,OAAO,CAEF;IAEf;;;;;OAKG;IACH,MAFU,MAAM,GAAC,IAAI,CAET;IAEZ;;OAEG;IACH,MAFU,MAAM,CAEe;IAE/B;;OAEG;IACH,OAFU,MAAM,CAEA;IAEhB;;;;OAIG;IACH,MAFU,MAAM,CAEP;IAET;;OAEG;IACH,UAFU,OAAO,CAEA;IAEjB;;;;OAIG;IACH,iBAFU,MAAM,GAAC,IAAI,CAEE;IAEvB;;;;OAIG;IACH,cAFU,MAAM,GAAC,IAAI,CAED;IAEpB;;OAEG;IACH,WAFU,MAAM,GAAC,IAAI,CAEJ;IAEjB;;OAEG;IACH,eAFU,OAAO,CAEa;IAE9B;;OAEG;IACH,iBAFU,UAAU,CAEe;IAEnC;;;;;OAKG;IACH,oBAFU,OAAO,CAEkB;IAEnC;;OAEG;IACH,sBAFU,UAAU,CAEoB;IAExC;;OAEG;IACH,kBAFU,OAAO,CAEuB;IAExC;;OAEG;IACH,aAFU,OAAO,CAEkB;IAEnC;;OAEG;IACH,qBAFU,UAAU,CAEmB;IAEvC;;OAEG;IACH,gBAFU,OAAO,CAEc;IAE/B;;OAEG;IACH,kBAFU,UAAU,CAEgB;IAEpC;;OAEG;IACH,aAFU,OAAO,CAEkB;IAEnC;;;;OAIG;IACH,YAFU,OAAO,CAEU;IAE3B;;OAEG;IACH,UAFU,OAAO,CAEQ;IAEzB;;OAEG;IACH,SAFU,OAAO,CAEO;IAExB;;OAEG;IACH,YAFU,OAAO,CAEU;IAE3B;;OAEG;IACH,UAFU,OAAO,CAEQ;IAEzB;;OAEG;IACH,cAFU,OAAO,CAEY;IAE7B;;OAEG;IACH,eAFU,MAAM,CAEE;IAElB;;;;OAIG;IACH,gBAFU,OAAO,CAEc;IAE/B;;OAEG;IACH,KAFU,OAAO,CAEU;IA+DvB,cAAwB;IACxB,wBAA4B;IAM5B,iBAAwC;IACxC,oBAA8C;IAC9C,qBAAgD;IAChD,oBAA8C;IAC9C,kBAA0C;IAe9C;;OAEG;IACH,yCAIC;IAmGD,iCAYC;IAED,gCAuCC;IAED;;;OAGG;IACH,qBAFW;QAAC,IAAI,EAAC,MAAM,CAAA;KAAC,QAIvB;IAED,gCAsPC;IAED,8BAcC;IAED,gBASC;IAED;;;;OAIG;IACH,eAHW,MAAM,GACJ,iBAAiB,CAW7B;IAED;;;OAGG;IACH,oCAIC;IAGD,eAYC;IAED,cAuBC;IAID,kBAIC;IAED,yBAIC;IAED,+CAIC;IAED,yCAIC;IAED,mCAIC;IAED,yBAIC;IAED,2BAIC;;CAEJ;0BAx4ByB,gBAAgB;oBAHtB,mCAAmC;uBADhC,sCAAsC;4BAEjC,kDAAkD"}
1
+ {"version":3,"file":"TransformControls.d.ts","sourceRoot":"","sources":["../../../../editor/tools/v2/TransformControls.js"],"names":[],"mappings":"AA6EA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;IAsNI;;;;;OAKG;IACH,sBALW,+BAA6B,cAE7B,WAAW,eACX,OAAO,EAgCjB;IAzPD;;;OAGG;IACH,QAFU,MAAM,CAEJ;IAEZ,6BAA2B;IAE3B;;OAEG;IACH,SAFU,OAAO,CAEF;IAEf;;;;;OAKG;IACH,MAFU,MAAM,GAAC,IAAI,CAET;IAEZ;;OAEG;IACH,MAFU,MAAM,CAEe;IAE/B;;OAEG;IACH,OAFU,MAAM,CAEA;IAEhB;;;;OAIG;IACH,MAFU,MAAM,CAEP;IAET;;OAEG;IACH,UAFU,OAAO,CAEA;IAEjB;;;;OAIG;IACH,iBAFU,MAAM,GAAC,IAAI,CAEE;IAEvB;;;;OAIG;IACH,cAFU,MAAM,GAAC,IAAI,CAED;IAEpB;;OAEG;IACH,WAFU,MAAM,GAAC,IAAI,CAEJ;IAEjB;;OAEG;IACH,eAFU,OAAO,CAEa;IAE9B;;OAEG;IACH,iBAFU,UAAU,CAEe;IAEnC;;;;;OAKG;IACH,oBAFU,OAAO,CAEkB;IAEnC;;OAEG;IACH,sBAFU,UAAU,CAEoB;IAExC;;OAEG;IACH,kBAFU,OAAO,CAEuB;IAExC;;OAEG;IACH,aAFU,OAAO,CAEkB;IAEnC;;OAEG;IACH,qBAFU,UAAU,CAEmB;IAEvC;;OAEG;IACH,gBAFU,OAAO,CAEc;IAE/B;;OAEG;IACH,kBAFU,UAAU,CAEgB;IAEpC;;OAEG;IACH,aAFU,OAAO,CAEkB;IAEnC;;;;OAIG;IACH,YAFU,OAAO,CAEU;IAE3B;;OAEG;IACH,UAFU,OAAO,CAEQ;IAEzB;;OAEG;IACH,SAFU,OAAO,CAEO;IAExB;;OAEG;IACH,YAFU,OAAO,CAEU;IAE3B;;OAEG;IACH,UAFU,OAAO,CAEQ;IAEzB;;OAEG;IACH,cAFU,OAAO,CAEY;IAE7B;;OAEG;IACH,eAFU,MAAM,CAEE;IAElB;;;;OAIG;IACH,gBAFU,OAAO,CAEc;IAE/B;;OAEG;IACH,KAFU,OAAO,CAEU;IA+DvB,cAAwB;IACxB,wBAA4B;IAM5B,iBAAwC;IACxC,oBAA8C;IAC9C,qBAAgD;IAChD,oBAA8C;IAC9C,kBAA0C;IAe9C;;OAEG;IACH,yCAIC;IAmGD,iCAYC;IAED,gCAuCC;IAED;;;OAGG;IACH,qBAFW;QAAC,IAAI,EAAC,MAAM,CAAA;KAAC,QAIvB;IAED,gCA0PC;IAED,8BAcC;IAED,gBASC;IAED;;;;OAIG;IACH,eAHW,MAAM,GACJ,iBAAiB,CAW7B;IAED;;;OAGG;IACH,oCAIC;IAGD,eAYC;IAED,cAyBC;IAID,kBAIC;IAED,yBAIC;IAED,+CAIC;IAED,yCAIC;IAED,mCAIC;IAED,yBAIC;IAED,2BAIC;;CAEJ;0BA94ByB,gBAAgB;oBAJtB,mCAAmC;uBADhC,sCAAsC;4BAGjC,kDAAkD"}
@@ -1,6 +1,7 @@
1
1
  import { assert } from "../../../src/core/assert.js";
2
2
  import Quaternion from "../../../src/core/geom/Quaternion.js";
3
3
  import Vector3 from "../../../src/core/geom/Vector3.js";
4
+ import { t64_announce_change } from "../../../src/engine/ecs/transform/t64_announce_change.js";
4
5
  import { Transform64 } from "../../../src/engine/ecs/transform/Transform64.js";
5
6
  import { FrameRunner } from "../../../src/engine/graphics/FrameRunner.js";
6
7
  import { GizmoNode } from "./GizmoNode.js";
@@ -765,6 +766,10 @@ class TransformControls extends GizmoNode {
765
766
  object_transform.updateMatrix();
766
767
  }
767
768
 
769
+ // a Transform64 cannot say it was written, so the writer does: this is what moves the entity's
770
+ // rendered row, its sound, and whatever else follows it by its transform
771
+ t64_announce_change(this.entity.dataset, object);
772
+
768
773
  this.dispatchEvent(_changeEvent);
769
774
  this.dispatchEvent(_objectChangeEvent);
770
775
 
@@ -854,6 +859,8 @@ class TransformControls extends GizmoNode {
854
859
  );
855
860
  this.object_transform.updateMatrix();
856
861
 
862
+ t64_announce_change(this.entity.dataset, this.object);
863
+
857
864
  this.dispatchEvent(_changeEvent);
858
865
  this.dispatchEvent(_objectChangeEvent);
859
866
 
@@ -1 +1 @@
1
- {"version":3,"file":"EntityEditor.d.ts","sourceRoot":"","sources":["../../../../editor/view/ecs/EntityEditor.js"],"names":[],"mappings":";AAkBA;IAYI,yBA2OC;IAlOG,YAAkB;IAGlB,0BAAoC;IACpC;;OAEG;IACH,eAFU,cAAc,aAAa,CAAC,CAEM;IAC5C,sBAA4B;IAU5B;;;OAGG;IACH,sBAFU,mCAAiC,CAEN;IAwGrC,wBAEE;IAiGF,aAAkB;;CAazB;iBA3QgB,2BAA2B;0BATlB,0CAA0C;8BAEtC,0CAA0C;iBAHvD,2CAA2C;qCAcvB,2BAA2B;sBAT1C,uCAAuC"}
1
+ {"version":3,"file":"EntityEditor.d.ts","sourceRoot":"","sources":["../../../../editor/view/ecs/EntityEditor.js"],"names":[],"mappings":";AAkBA;IAYI,yBA6OC;IApOG,YAAkB;IAGlB,0BAAoC;IACpC;;OAEG;IACH,eAFU,cAAc,aAAa,CAAC,CAEM;IAC5C,sBAA4B;IAU5B;;;OAGG;IACH,sBAFU,mCAAiC,CAEN;IAwGrC,wBAEE;IAmGF,aAAkB;;CAazB;iBA7QgB,2BAA2B;0BATlB,0CAA0C;8BAEtC,0CAA0C;iBAHvD,2CAA2C;qCAcvB,2BAA2B;sBAT1C,uCAAuC"}
@@ -11,7 +11,7 @@ import EmptyView from "../../../src/view/elements/EmptyView.js";
11
11
  import View from "../../../src/view/View.js";
12
12
  import ComponentAddAction from "../../actions/concrete/ComponentAddAction.js";
13
13
  import ComponentRemoveAction from "../../actions/concrete/ComponentRemoveAction.js";
14
- import { buildObjectEditorFromRegistry } from "../../ecs/component/createObjectEditor.js";
14
+ import { buildComponentEditorFromRegistry } from "../../ecs/component/createObjectEditor.js";
15
15
  import { ComponentControlView } from "./ComponentControlView.js";
16
16
  import { LineView } from "./components/common/LineView.js";
17
17
 
@@ -180,7 +180,9 @@ class EntityEditor extends View {
180
180
  let view;
181
181
 
182
182
  try {
183
- view = buildObjectEditorFromRegistry(component, registry);
183
+ // told whose component it is, so an edit to one with no change signal of its own (a
184
+ // Transform64) can be announced on the entity
185
+ view = buildComponentEditorFromRegistry(component, get_dataset(), self.model.getValue(), registry);
184
186
  } catch (e) {
185
187
  view = new LabelView(`ERROR: ${e.message}\n${e.stack}`);
186
188
 
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Advanced 3D game engine",
7
7
  "type": "module",
8
8
  "author": "Alexander Goldring",
9
- "version": "3.46.0",
9
+ "version": "3.47.0",
10
10
  "exports": {
11
11
  "./build/*": "./build/*",
12
12
  "./src/*": "./src/*",
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Insert `value` at `index`, keeping the order of the rest: what `array.splice(index, 0, value)` does to
3
+ * the array, in place, without the empty array `splice` builds and returns every call.
4
+ *
5
+ * The elements from `index` on move up one slot each, and the array ends one longer.
6
+ *
7
+ * @template T
8
+ * @param {T[]} array
9
+ * @param {number} index where `value` lands, `0 <= index <= array.length`
10
+ * @param {T} value
11
+ *
12
+ * @author Alex Goldring
13
+ * @copyright Company Named Limited (c) 2026
14
+ */
15
+ export function array_insert_at<T>(array: T[], index: number, value: T): void;
16
+ //# sourceMappingURL=array_insert_at.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_insert_at.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_insert_at.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,sDANW,MAAM,kBAqBhB"}
@@ -0,0 +1,32 @@
1
+ import { assert } from "../../assert.js";
2
+
3
+ /**
4
+ * Insert `value` at `index`, keeping the order of the rest: what `array.splice(index, 0, value)` does to
5
+ * the array, in place, without the empty array `splice` builds and returns every call.
6
+ *
7
+ * The elements from `index` on move up one slot each, and the array ends one longer.
8
+ *
9
+ * @template T
10
+ * @param {T[]} array
11
+ * @param {number} index where `value` lands, `0 <= index <= array.length`
12
+ * @param {T} value
13
+ *
14
+ * @author Alex Goldring
15
+ * @copyright Company Named Limited (c) 2026
16
+ */
17
+ export function array_insert_at(array, index, value) {
18
+ // past the end, splice appends, and this would leave a hole; below 0 it writes a "-1" property
19
+ assert.isNonNegativeInteger(index, 'index');
20
+ assert.lessThanOrEqual(index, array.length, 'index');
21
+
22
+ let i = array.length;
23
+
24
+ // grow by one first, through push, so the store grows the way an append grows it
25
+ array.push(value);
26
+
27
+ for (; i > index; i--) {
28
+ array[i] = array[i - 1];
29
+ }
30
+
31
+ array[index] = value;
32
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Remove the element at `index`, keeping the order of the rest: what `array.splice(index, 1)` does to
3
+ * the array, in place, without the array of removed elements `splice` builds and returns every call.
4
+ *
5
+ * The elements after `index` move down one slot each, and the array ends one shorter.
6
+ *
7
+ * @template T
8
+ * @param {T[]} array
9
+ * @param {number} index an index into `array`, `0 <= index < array.length`
10
+ *
11
+ * @author Alex Goldring
12
+ * @copyright Company Named Limited (c) 2026
13
+ */
14
+ export function array_remove_at<T>(array: T[], index: number): void;
15
+ //# sourceMappingURL=array_remove_at.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_remove_at.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_remove_at.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,sDALW,MAAM,QAmBhB"}
@@ -0,0 +1,30 @@
1
+ import { assert } from "../../assert.js";
2
+
3
+ /**
4
+ * Remove the element at `index`, keeping the order of the rest: what `array.splice(index, 1)` does to
5
+ * the array, in place, without the array of removed elements `splice` builds and returns every call.
6
+ *
7
+ * The elements after `index` move down one slot each, and the array ends one shorter.
8
+ *
9
+ * @template T
10
+ * @param {T[]} array
11
+ * @param {number} index an index into `array`, `0 <= index < array.length`
12
+ *
13
+ * @author Alex Goldring
14
+ * @copyright Company Named Limited (c) 2026
15
+ */
16
+ export function array_remove_at(array, index) {
17
+ // outside the array, splice removes nothing, and this would drop the last element instead
18
+ assert.isNonNegativeInteger(index, 'index');
19
+ assert.lessThan(index, array.length, 'index');
20
+
21
+ const last = array.length - 1;
22
+
23
+ for (let i = index; i < last; i++) {
24
+ array[i] = array[i + 1];
25
+ }
26
+
27
+ // pop rather than `length = last`: setting the length lets V8 trim the store, which a pool removing and
28
+ // inserting every frame would only grow back
29
+ array.pop();
30
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The rotation that points local +Z along `forward`, with local +Y turned as close to `up` as it can be:
3
+ * the orientation of a camera, a turret or a walking body told where to face.
4
+ *
5
+ * Neither vector has to be unit length, within what their squares can hold: lanes from about 1e-154
6
+ * to 1e154. Below that a square is 0 and the vector reads as zero, above it Infinity. The frame is built
7
+ * from them the usual way — `right = up × forward` and `up' = forward × right`, each normalised — and the
8
+ * rotation is read off that matrix, so it maps +X to `right`, +Y to `up'` and +Z to `forward`.
9
+ *
10
+ * **When `up` is parallel to `forward` there is no frame to build**: their cross product is the zero
11
+ * vector, and any roll about `forward` would do. The forward direction is then nudged by 0.001 along X
12
+ * when `up` is ±Z, and along Z otherwise, and renormalised. For a unit `up` the answer is then a unit
13
+ * rotation within about a milliradian of `forward`, rolled however the nudge leaves it; do not rely on
14
+ * the roll there. The ±Z test reads `|uz| === 1`, so a longer `up` along Z is nudged along Z, stays
15
+ * parallel, and gets a rotation that is not unit length. Pass a unit `up` where it can be parallel.
16
+ *
17
+ * Sign convention: `(x, y, z, w)` — `w` last, matching {@link Quaternion} and the rest of the
18
+ * `core/geom/3d/quaternion/` family.
19
+ *
20
+ * Everything is worked in locals and only the result is written, so it allocates nothing, and a caller
21
+ * that hands its own parameters straight on boxes nothing either. {@link Quaternion#_lookRotation} and
22
+ * `t64_look_rotation` both answer through this.
23
+ *
24
+ * @param {number[]|Float32Array|Float64Array} out
25
+ * @param {number} out_offset offset into `out`; receives 4 floats (x, y, z, w)
26
+ * @param {number} fx forward, any length
27
+ * @param {number} fy
28
+ * @param {number} fz
29
+ * @param {number} ux up, any length
30
+ * @param {number} uy
31
+ * @param {number} uz
32
+ *
33
+ * @author Alex Goldring
34
+ * @copyright Company Named Limited (c) 2026
35
+ */
36
+ export function quat3_look_rotation(out: number[] | Float32Array | Float64Array, out_offset: number, fx: number, fy: number, fz: number, ux: number, uy: number, uz: number): void;
37
+ //# sourceMappingURL=quat3_look_rotation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quat3_look_rotation.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/quaternion/quat3_look_rotation.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,yCAZW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,cAClC,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAkIhB"}