@woosh/meep-engine 3.16.0 → 3.17.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 (410) hide show
  1. package/editor/particles/effect/ParticleEffectDocument.d.ts +21 -6
  2. package/editor/particles/effect/ParticleEffectDocument.d.ts.map +1 -1
  3. package/editor/particles/effect/ParticleEffectDocument.js +38 -17
  4. package/editor/view/node-graph/NodeGraphClipboard.d.ts +186 -0
  5. package/editor/view/node-graph/NodeGraphClipboard.d.ts.map +1 -0
  6. package/editor/view/node-graph/NodeGraphClipboard.js +231 -0
  7. package/editor/view/node-graph/NodeGraphEditorView.d.ts +59 -1
  8. package/editor/view/node-graph/NodeGraphEditorView.d.ts.map +1 -1
  9. package/editor/view/node-graph/NodeGraphEditorView.js +248 -5
  10. package/editor/view/node-graph/NodeGraphView.d.ts.map +1 -1
  11. package/editor/view/node-graph/NodeGraphView.js +84 -8
  12. package/editor/view/node-graph/actions/connection_bind_actions.d.ts +23 -0
  13. package/editor/view/node-graph/actions/connection_bind_actions.d.ts.map +1 -0
  14. package/editor/view/node-graph/actions/connection_bind_actions.js +39 -0
  15. package/editor/view/particles/effect/ParticleCodeEditorView.d.ts.map +1 -1
  16. package/editor/view/particles/effect/ParticleCodeEditorView.js +4 -3
  17. package/editor/view/particles/effect/ParticleCurveEditorView.d.ts +20 -0
  18. package/editor/view/particles/effect/ParticleCurveEditorView.d.ts.map +1 -0
  19. package/editor/view/particles/effect/ParticleCurveEditorView.js +574 -0
  20. package/editor/view/particles/effect/ParticleEmitterInspectorView.d.ts.map +1 -1
  21. package/editor/view/particles/effect/ParticleEmitterInspectorView.js +27 -1
  22. package/editor/view/particles/effect/ParticleGradientEditorView.d.ts +24 -0
  23. package/editor/view/particles/effect/ParticleGradientEditorView.d.ts.map +1 -0
  24. package/editor/view/particles/effect/ParticleGradientEditorView.js +472 -0
  25. package/editor/view/particles/effect/ParticleGraphEditorView.d.ts +5 -0
  26. package/editor/view/particles/effect/ParticleGraphEditorView.d.ts.map +1 -1
  27. package/editor/view/particles/effect/ParticleGraphEditorView.js +61 -31
  28. package/editor/view/particles/effect/ParticleNodeParametersView.d.ts.map +1 -1
  29. package/editor/view/particles/effect/ParticleNodeParametersView.js +33 -0
  30. package/editor/view/particles/effect/particle-editor.css +123 -35
  31. package/package.json +1 -1
  32. package/src/core/binary/allocator/OffsetAllocator.d.ts +25 -16
  33. package/src/core/binary/allocator/OffsetAllocator.d.ts.map +1 -1
  34. package/src/core/binary/allocator/OffsetAllocator.js +10 -1
  35. package/src/core/collection/array/typed/float32_array_hash.d.ts +21 -0
  36. package/src/core/collection/array/typed/float32_array_hash.d.ts.map +1 -0
  37. package/src/core/collection/array/typed/float32_array_hash.js +38 -0
  38. package/src/core/graph/csr/CSRGraph.d.ts +8 -1
  39. package/src/core/graph/csr/CSRGraph.d.ts.map +1 -1
  40. package/src/core/graph/csr/CSRGraph.js +14 -6
  41. package/src/core/model/node-graph/visual/layout/LayoutProblem.d.ts +24 -0
  42. package/src/core/model/node-graph/visual/layout/LayoutProblem.d.ts.map +1 -1
  43. package/src/core/model/node-graph/visual/layout/LayoutProblem.js +27 -0
  44. package/src/core/model/node-graph/visual/layout/NodeGraphLayoutOptions.d.ts +26 -0
  45. package/src/core/model/node-graph/visual/layout/NodeGraphLayoutOptions.d.ts.map +1 -1
  46. package/src/core/model/node-graph/visual/layout/NodeGraphLayoutOptions.js +28 -0
  47. package/src/core/model/node-graph/visual/layout/RouteGrid.d.ts +92 -3
  48. package/src/core/model/node-graph/visual/layout/RouteGrid.d.ts.map +1 -1
  49. package/src/core/model/node-graph/visual/layout/RouteGrid.js +405 -242
  50. package/src/core/model/node-graph/visual/layout/RouteSearch.d.ts +50 -5
  51. package/src/core/model/node-graph/visual/layout/RouteSearch.d.ts.map +1 -1
  52. package/src/core/model/node-graph/visual/layout/RouteSearch.js +160 -24
  53. package/src/core/model/node-graph/visual/layout/RouteSet.d.ts +7 -0
  54. package/src/core/model/node-graph/visual/layout/RouteSet.d.ts.map +1 -1
  55. package/src/core/model/node-graph/visual/layout/RouteSet.js +8 -0
  56. package/src/core/model/node-graph/visual/layout/layout_assign_coordinates.js +9 -3
  57. package/src/core/model/node-graph/visual/layout/layout_build_problem.d.ts.map +1 -1
  58. package/src/core/model/node-graph/visual/layout/layout_build_problem.js +7 -0
  59. package/src/core/model/node-graph/visual/layout/layout_insert_lanes.d.ts +9 -3
  60. package/src/core/model/node-graph/visual/layout/layout_insert_lanes.d.ts.map +1 -1
  61. package/src/core/model/node-graph/visual/layout/layout_insert_lanes.js +17 -3
  62. package/src/core/model/node-graph/visual/layout/layout_node_graph.d.ts +9 -6
  63. package/src/core/model/node-graph/visual/layout/layout_node_graph.d.ts.map +1 -1
  64. package/src/core/model/node-graph/visual/layout/layout_node_graph.js +49 -7
  65. package/src/core/model/node-graph/visual/layout/layout_order_layers.d.ts +11 -1
  66. package/src/core/model/node-graph/visual/layout/layout_order_layers.d.ts.map +1 -1
  67. package/src/core/model/node-graph/visual/layout/layout_order_layers.js +135 -16
  68. package/src/core/model/node-graph/visual/layout/route_connections.d.ts +29 -0
  69. package/src/core/model/node-graph/visual/layout/route_connections.d.ts.map +1 -1
  70. package/src/core/model/node-graph/visual/layout/route_connections.js +716 -309
  71. package/src/core/model/node-graph/visual/layout/route_grid_build.d.ts +3 -2
  72. package/src/core/model/node-graph/visual/layout/route_grid_build.d.ts.map +1 -1
  73. package/src/core/model/node-graph/visual/layout/route_grid_build.js +7 -15
  74. package/src/core/model/node-graph/visual/layout/route_nudge.d.ts +6 -0
  75. package/src/core/model/node-graph/visual/layout/route_nudge.d.ts.map +1 -1
  76. package/src/core/model/node-graph/visual/layout/route_nudge.js +42 -13
  77. package/src/engine/animation/AnimationUtils.js +246 -246
  78. package/src/engine/animation/Animations.js +74 -74
  79. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +2078 -2078
  80. package/src/engine/ecs/EventType.d.ts +0 -1
  81. package/src/engine/ecs/EventType.js +1 -26
  82. package/src/engine/ecs/ik/ik_write_local_rotation.d.ts +1 -1
  83. package/src/engine/ecs/ik/ik_write_local_rotation.d.ts.map +1 -1
  84. package/src/engine/ecs/ik/ik_write_local_rotation.js +3 -7
  85. package/src/engine/ecs/parent/EntityNode.d.ts.map +1 -1
  86. package/src/engine/ecs/parent/EntityNode.js +4 -9
  87. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts.map +1 -1
  88. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js +360 -364
  89. package/src/engine/ecs/transform/TRANSFORM64_EVENT_CHANGE.d.ts +41 -0
  90. package/src/engine/ecs/transform/TRANSFORM64_EVENT_CHANGE.d.ts.map +1 -0
  91. package/src/engine/ecs/transform/TRANSFORM64_EVENT_CHANGE.js +40 -0
  92. package/src/engine/ecs/transform/TRANSFORM64_MIGRATION_PLAN_2026_09_04.md +8 -0
  93. package/src/engine/ecs/transform/t64_announce_change.d.ts +10 -7
  94. package/src/engine/ecs/transform/t64_announce_change.d.ts.map +1 -1
  95. package/src/engine/ecs/transform/t64_announce_change.js +12 -12
  96. package/src/engine/ecs/transform-attachment/TRANSFORM_ATTACHMENT_EVENT_CHANGE.d.ts +30 -0
  97. package/src/engine/ecs/transform-attachment/TRANSFORM_ATTACHMENT_EVENT_CHANGE.d.ts.map +1 -0
  98. package/src/engine/ecs/transform-attachment/TRANSFORM_ATTACHMENT_EVENT_CHANGE.js +29 -0
  99. package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.d.ts.map +1 -1
  100. package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.js +13 -21
  101. package/src/engine/graphics/ecs/sprite/SpriteSystemPE.d.ts.map +1 -1
  102. package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +4 -8
  103. package/src/engine/graphics3/LightSystem.d.ts.map +1 -1
  104. package/src/engine/graphics3/LightSystem.js +4 -8
  105. package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
  106. package/src/engine/graphics3/MeshSystem.js +9 -19
  107. package/src/engine/graphics3/ParticleEmitterSystem.d.ts.map +1 -1
  108. package/src/engine/graphics3/ParticleEmitterSystem.js +4 -8
  109. package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
  110. package/src/engine/graphics3/ShadedGeometrySystem.js +4 -10
  111. package/src/engine/grid/transform2grid/Transform2GridPositionSystem.d.ts +1 -1
  112. package/src/engine/grid/transform2grid/Transform2GridPositionSystem.d.ts.map +1 -1
  113. package/src/engine/grid/transform2grid/Transform2GridPositionSystem.js +4 -8
  114. package/src/engine/intelligence/behavior/ecs/OrbitingBehavior.js +218 -218
  115. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  116. package/src/engine/physics/ecs/PhysicsSystem.js +2 -5
  117. package/src/engine/sound/ecs/SoundListenerSystem.d.ts.map +1 -1
  118. package/src/engine/sound/ecs/SoundListenerSystem.js +6 -8
  119. package/src/engine/sound/simulation/ecs/AcousticSimulationSystem.d.ts +0 -4
  120. package/src/engine/sound/simulation/ecs/AcousticSimulationSystem.d.ts.map +1 -1
  121. package/src/engine/sound/simulation/ecs/AcousticSimulationSystem.js +5 -11
  122. package/src/shade/playground/particle_editor/README.md +43 -2
  123. package/src/shade/playground/particle_system/particle_prototype.d.ts.map +1 -1
  124. package/src/shade/playground/particle_system/particle_prototype.js +4 -5
  125. package/src/shade/playground/particle_system/particle_scene.js +4 -4
  126. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  127. package/src/shade/renderer/Renderer.js +13 -1
  128. package/src/shade/renderer/particles/DESIGN.md +104 -19
  129. package/src/shade/renderer/particles/GPUParticleSystem.d.ts +64 -50
  130. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  131. package/src/shade/renderer/particles/GPUParticleSystem.js +176 -78
  132. package/src/shade/renderer/particles/ParticleConstants.d.ts +59 -23
  133. package/src/shade/renderer/particles/ParticleConstants.d.ts.map +1 -1
  134. package/src/shade/renderer/particles/ParticleConstants.js +66 -23
  135. package/src/shade/renderer/particles/ParticleRenderMode.d.ts +19 -0
  136. package/src/shade/renderer/particles/ParticleRenderMode.d.ts.map +1 -0
  137. package/src/shade/renderer/particles/ParticleRenderMode.js +33 -0
  138. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.d.ts.map +1 -1
  139. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.js +167 -166
  140. package/src/shade/renderer/particles/data/particle_emitter_record.d.ts +37 -0
  141. package/src/shade/renderer/particles/data/particle_emitter_record.d.ts.map +1 -0
  142. package/src/shade/renderer/particles/data/particle_emitter_record.js +109 -0
  143. package/src/shade/renderer/particles/graph/ParticleGroupBuilder.d.ts +3 -3
  144. package/src/shade/renderer/particles/graph/ParticleGroupBuilder.js +303 -303
  145. package/src/shade/renderer/particles/graph/ParticleNodeDescription.d.ts +18 -0
  146. package/src/shade/renderer/particles/graph/ParticleNodeDescription.d.ts.map +1 -1
  147. package/src/shade/renderer/particles/graph/ParticleNodeDescription.js +152 -133
  148. package/src/shade/renderer/particles/graph/ParticleNodeRegistry.d.ts +0 -11
  149. package/src/shade/renderer/particles/graph/ParticleNodeRegistry.d.ts.map +1 -1
  150. package/src/shade/renderer/particles/graph/ParticleNodeRegistry.js +720 -621
  151. package/src/shade/renderer/particles/graph/compile_particle_graph.d.ts.map +1 -1
  152. package/src/shade/renderer/particles/graph/compile_particle_graph.js +8 -3
  153. package/src/shade/renderer/particles/graph/flatten_particle_graph.d.ts.map +1 -1
  154. package/src/shade/renderer/particles/graph/flatten_particle_graph.js +244 -213
  155. package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.d.ts.map +1 -1
  156. package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.js +6 -0
  157. package/src/shade/renderer/particles/graph/groups/particle_groups_geometry.d.ts.map +1 -1
  158. package/src/shade/renderer/particles/graph/groups/particle_groups_geometry.js +294 -319
  159. package/src/shade/renderer/particles/graph/groups/particle_groups_noise.d.ts.map +1 -1
  160. package/src/shade/renderer/particles/graph/groups/particle_groups_noise.js +524 -517
  161. package/src/shade/renderer/particles/graph/groups/particle_groups_psrdnoise.d.ts +22 -0
  162. package/src/shade/renderer/particles/graph/groups/particle_groups_psrdnoise.d.ts.map +1 -0
  163. package/src/shade/renderer/particles/graph/groups/particle_groups_psrdnoise.js +517 -0
  164. package/src/shade/renderer/particles/graph/groups/simplex_reference.d.ts.map +1 -1
  165. package/src/shade/renderer/particles/graph/groups/simplex_reference.js +185 -159
  166. package/src/shade/renderer/particles/graph/make_particle_group.d.ts.map +1 -1
  167. package/src/shade/renderer/particles/graph/make_particle_group.js +2 -20
  168. package/src/shade/renderer/particles/graph/particle_compare_ops.d.ts +17 -0
  169. package/src/shade/renderer/particles/graph/particle_compare_ops.d.ts.map +1 -0
  170. package/src/shade/renderer/particles/graph/particle_compare_ops.js +22 -0
  171. package/src/shade/renderer/particles/graph/particle_graph_diagnostic.d.ts +28 -8
  172. package/src/shade/renderer/particles/graph/particle_graph_diagnostic.d.ts.map +1 -1
  173. package/src/shade/renderer/particles/graph/particle_graph_diagnostic.js +49 -25
  174. package/src/shade/renderer/particles/graph/particle_node_parameters.d.ts +40 -0
  175. package/src/shade/renderer/particles/graph/particle_node_parameters.d.ts.map +1 -1
  176. package/src/shade/renderer/particles/graph/particle_node_parameters.js +312 -234
  177. package/src/shade/renderer/particles/graph/particle_node_presentation.d.ts.map +1 -1
  178. package/src/shade/renderer/particles/graph/particle_node_presentation.js +59 -3
  179. package/src/shade/renderer/particles/graph/particle_ramp.d.ts +230 -0
  180. package/src/shade/renderer/particles/graph/particle_ramp.d.ts.map +1 -0
  181. package/src/shade/renderer/particles/graph/particle_ramp.js +403 -0
  182. package/src/shade/renderer/particles/graph/validate_particle_graph.d.ts +7 -1
  183. package/src/shade/renderer/particles/graph/validate_particle_graph.d.ts.map +1 -1
  184. package/src/shade/renderer/particles/graph/validate_particle_graph.js +66 -10
  185. package/src/shade/renderer/particles/graph_particles.d.ts +23 -69
  186. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  187. package/src/shade/renderer/particles/graph_particles.js +105 -262
  188. package/src/shade/renderer/particles/graph_particles_avboit.d.ts.map +1 -1
  189. package/src/shade/renderer/particles/graph_particles_avboit.js +3 -2
  190. package/src/shade/renderer/particles/graph_particles_billboard.d.ts +37 -0
  191. package/src/shade/renderer/particles/graph_particles_billboard.d.ts.map +1 -0
  192. package/src/shade/renderer/particles/graph_particles_billboard.js +93 -0
  193. package/src/shade/renderer/particles/isa/InstructionStream.d.ts +51 -22
  194. package/src/shade/renderer/particles/isa/InstructionStream.d.ts.map +1 -1
  195. package/src/shade/renderer/particles/isa/InstructionStream.js +98 -38
  196. package/src/shade/renderer/particles/isa/ParticleProgram.d.ts +49 -8
  197. package/src/shade/renderer/particles/isa/ParticleProgram.d.ts.map +1 -1
  198. package/src/shade/renderer/particles/isa/ParticleProgram.js +95 -150
  199. package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts +306 -64
  200. package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts.map +1 -1
  201. package/src/shade/renderer/particles/isa/ParticleVMISA.js +505 -136
  202. package/src/shade/renderer/particles/isa/particle_assembly.d.ts +36 -12
  203. package/src/shade/renderer/particles/isa/particle_assembly.d.ts.map +1 -1
  204. package/src/shade/renderer/particles/isa/particle_assembly.js +354 -139
  205. package/src/shade/renderer/particles/isa/validate_particle_program.d.ts +9 -0
  206. package/src/shade/renderer/particles/isa/validate_particle_program.d.ts.map +1 -0
  207. package/src/shade/renderer/particles/isa/validate_particle_program.js +128 -0
  208. package/src/shade/renderer/particles/layout/ParticleLayout.d.ts +23 -0
  209. package/src/shade/renderer/particles/layout/ParticleLayout.d.ts.map +1 -1
  210. package/src/shade/renderer/particles/layout/ParticleLayout.js +68 -0
  211. package/src/shade/renderer/particles/optimizer/dag/optimize_particle_program_vector.d.ts +77 -0
  212. package/src/shade/renderer/particles/optimizer/dag/optimize_particle_program_vector.d.ts.map +1 -0
  213. package/src/shade/renderer/particles/optimizer/dag/optimize_particle_program_vector.js +219 -0
  214. package/src/shade/renderer/particles/optimizer/dag/particle_vector_extract.d.ts +83 -0
  215. package/src/shade/renderer/particles/optimizer/dag/particle_vector_extract.d.ts.map +1 -0
  216. package/src/shade/renderer/particles/optimizer/dag/particle_vector_extract.js +283 -0
  217. package/src/shade/renderer/particles/optimizer/dag/particle_vector_graph.d.ts +133 -0
  218. package/src/shade/renderer/particles/optimizer/dag/particle_vector_graph.d.ts.map +1 -0
  219. package/src/shade/renderer/particles/optimizer/dag/particle_vector_graph.js +334 -0
  220. package/src/shade/renderer/particles/optimizer/dag/particle_vector_groups.d.ts +117 -0
  221. package/src/shade/renderer/particles/optimizer/dag/particle_vector_groups.d.ts.map +1 -0
  222. package/src/shade/renderer/particles/optimizer/dag/particle_vector_groups.js +70 -0
  223. package/src/shade/renderer/particles/optimizer/dag/particle_vector_lift.d.ts +97 -0
  224. package/src/shade/renderer/particles/optimizer/dag/particle_vector_lift.d.ts.map +1 -0
  225. package/src/shade/renderer/particles/optimizer/dag/particle_vector_lift.js +462 -0
  226. package/src/shade/renderer/particles/optimizer/dag/particle_vector_lower.d.ts +116 -0
  227. package/src/shade/renderer/particles/optimizer/dag/particle_vector_lower.d.ts.map +1 -0
  228. package/src/shade/renderer/particles/optimizer/dag/particle_vector_lower.js +687 -0
  229. package/src/shade/renderer/particles/optimizer/dag/particle_vector_pack.d.ts +57 -0
  230. package/src/shade/renderer/particles/optimizer/dag/particle_vector_pack.d.ts.map +1 -0
  231. package/src/shade/renderer/particles/optimizer/dag/particle_vector_pack.js +860 -0
  232. package/src/shade/renderer/particles/optimizer/dag/particle_vector_rules.d.ts +115 -0
  233. package/src/shade/renderer/particles/optimizer/dag/particle_vector_rules.d.ts.map +1 -0
  234. package/src/shade/renderer/particles/optimizer/dag/particle_vector_rules.js +264 -0
  235. package/src/shade/renderer/particles/optimizer/optimize_particle_program.d.ts +81 -42
  236. package/src/shade/renderer/particles/optimizer/optimize_particle_program.d.ts.map +1 -1
  237. package/src/shade/renderer/particles/optimizer/optimize_particle_program.js +477 -478
  238. package/src/shade/renderer/particles/optimizer/particle_integer_bounds.d.ts +100 -0
  239. package/src/shade/renderer/particles/optimizer/particle_integer_bounds.d.ts.map +1 -0
  240. package/src/shade/renderer/particles/optimizer/particle_integer_bounds.js +236 -0
  241. package/src/shade/renderer/particles/optimizer/particle_program_analysis.d.ts +139 -59
  242. package/src/shade/renderer/particles/optimizer/particle_program_analysis.d.ts.map +1 -1
  243. package/src/shade/renderer/particles/optimizer/particle_program_analysis.js +764 -647
  244. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts +40 -7
  245. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts.map +1 -1
  246. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.js +376 -213
  247. package/src/shade/renderer/particles/optimizer/particle_program_fuzz.d.ts +30 -3
  248. package/src/shade/renderer/particles/optimizer/particle_program_fuzz.d.ts.map +1 -1
  249. package/src/shade/renderer/particles/optimizer/particle_program_fuzz.js +337 -223
  250. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts +24 -38
  251. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts.map +1 -1
  252. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.js +166 -206
  253. package/src/shade/renderer/particles/optimizer/pass_allocate_registers.d.ts +99 -0
  254. package/src/shade/renderer/particles/optimizer/pass_allocate_registers.d.ts.map +1 -0
  255. package/src/shade/renderer/particles/optimizer/pass_allocate_registers.js +313 -0
  256. package/src/shade/renderer/particles/optimizer/pass_dedup_constants.d.ts +3 -2
  257. package/src/shade/renderer/particles/optimizer/pass_dedup_constants.d.ts.map +1 -1
  258. package/src/shade/renderer/particles/optimizer/pass_dedup_constants.js +198 -197
  259. package/src/shade/renderer/particles/optimizer/pass_eliminate_dead_code.d.ts.map +1 -1
  260. package/src/shade/renderer/particles/optimizer/pass_fold_constants.d.ts +19 -0
  261. package/src/shade/renderer/particles/optimizer/pass_fold_constants.d.ts.map +1 -1
  262. package/src/shade/renderer/particles/optimizer/pass_fold_constants.js +678 -561
  263. package/src/shade/renderer/particles/optimizer/pass_inline_constants.d.ts +22 -0
  264. package/src/shade/renderer/particles/optimizer/pass_inline_constants.d.ts.map +1 -0
  265. package/src/shade/renderer/particles/optimizer/pass_inline_constants.js +221 -0
  266. package/src/shade/renderer/particles/optimizer/pass_narrow_widths.d.ts.map +1 -1
  267. package/src/shade/renderer/particles/optimizer/pass_narrow_widths.js +63 -72
  268. package/src/shade/renderer/particles/optimizer/pass_pack_registers.d.ts.map +1 -1
  269. package/src/shade/renderer/particles/optimizer/pass_pack_registers.js +87 -86
  270. package/src/shade/renderer/particles/optimizer/pass_peephole.d.ts.map +1 -1
  271. package/src/shade/renderer/particles/optimizer/pass_peephole.js +392 -271
  272. package/src/shade/renderer/particles/optimizer/pass_propagate_copies.d.ts.map +1 -1
  273. package/src/shade/renderer/particles/optimizer/pass_propagate_copies.js +361 -268
  274. package/src/shade/renderer/particles/optimizer/pass_schedule.d.ts +4 -0
  275. package/src/shade/renderer/particles/optimizer/pass_schedule.d.ts.map +1 -0
  276. package/src/shade/renderer/particles/optimizer/pass_schedule.js +244 -0
  277. package/src/shade/renderer/particles/optimizer/pass_share_subexpressions.d.ts.map +1 -1
  278. package/src/shade/renderer/particles/optimizer/pass_share_subexpressions.js +154 -151
  279. package/src/shade/renderer/particles/particle_test_fixtures.d.ts +20 -0
  280. package/src/shade/renderer/particles/particle_test_fixtures.d.ts.map +1 -1
  281. package/src/shade/renderer/particles/particle_test_fixtures.js +229 -203
  282. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +99 -25
  283. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
  284. package/src/shade/renderer/particles/runtime/EmitterRegistry.js +438 -286
  285. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts +109 -0
  286. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts.map +1 -0
  287. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.js +127 -0
  288. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +87 -102
  289. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
  290. package/src/shade/renderer/particles/runtime/ParticleEmitter.js +184 -163
  291. package/src/shade/renderer/particles/runtime/ProgramArena.d.ts +26 -0
  292. package/src/shade/renderer/particles/runtime/ProgramArena.d.ts.map +1 -1
  293. package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts +130 -0
  294. package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts.map +1 -0
  295. package/src/shade/renderer/particles/runtime/ProgramHeap.js +595 -0
  296. package/src/shade/renderer/particles/runtime/ProgramPlacement.d.ts +91 -0
  297. package/src/shade/renderer/particles/runtime/ProgramPlacement.d.ts.map +1 -0
  298. package/src/shade/renderer/particles/runtime/ProgramPlacement.js +106 -0
  299. package/src/shade/renderer/particles/runtime/create_particle_effect.d.ts +5 -2
  300. package/src/shade/renderer/particles/runtime/create_particle_effect.d.ts.map +1 -1
  301. package/src/shade/renderer/particles/runtime/create_particle_effect.js +22 -19
  302. package/src/shade/renderer/particles/shaders/chunk_particle_emit_step.d.ts +28 -0
  303. package/src/shade/renderer/particles/shaders/chunk_particle_emit_step.d.ts.map +1 -0
  304. package/src/shade/renderer/particles/shaders/chunk_particle_emit_step.js +136 -0
  305. package/src/shade/renderer/particles/shaders/chunk_particle_simulate_step.d.ts +35 -0
  306. package/src/shade/renderer/particles/shaders/chunk_particle_simulate_step.d.ts.map +1 -0
  307. package/src/shade/renderer/particles/shaders/chunk_particle_simulate_step.js +133 -0
  308. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts +18 -9
  309. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
  310. package/src/shade/renderer/particles/shaders/shader_particle_emit.js +20 -80
  311. package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.d.ts +33 -0
  312. package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.d.ts.map +1 -0
  313. package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.js +114 -0
  314. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts +8 -0
  315. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
  316. package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +33 -101
  317. package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.d.ts +45 -0
  318. package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.d.ts.map +1 -0
  319. package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.js +123 -0
  320. package/src/shade/renderer/particles/sort/graph_particle_sort.d.ts +51 -0
  321. package/src/shade/renderer/particles/sort/graph_particle_sort.d.ts.map +1 -0
  322. package/src/shade/renderer/particles/sort/graph_particle_sort.js +120 -0
  323. package/src/shade/renderer/particles/vm/PARTICLE_VM_CONTEXT_STRUCT.d.ts +6 -0
  324. package/src/shade/renderer/particles/vm/PARTICLE_VM_CONTEXT_STRUCT.d.ts.map +1 -0
  325. package/src/shade/renderer/particles/vm/PARTICLE_VM_CONTEXT_STRUCT.js +16 -0
  326. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts +4 -1
  327. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts.map +1 -1
  328. package/src/shade/renderer/particles/vm/ParticleVMReference.js +261 -140
  329. package/src/shade/renderer/particles/vm/chunk_particle_vm.d.ts.map +1 -1
  330. package/src/shade/renderer/particles/vm/chunk_particle_vm.js +217 -255
  331. package/src/shade/renderer/particles/vm/chunk_particle_vm_registers_fast.d.ts +43 -0
  332. package/src/shade/renderer/particles/vm/chunk_particle_vm_registers_fast.d.ts.map +1 -0
  333. package/src/shade/renderer/particles/vm/chunk_particle_vm_registers_fast.js +55 -0
  334. package/src/shade/renderer/particles/vm/chunk_particle_vm_registers_wide.d.ts +62 -0
  335. package/src/shade/renderer/particles/vm/chunk_particle_vm_registers_wide.d.ts.map +1 -0
  336. package/src/shade/renderer/particles/vm/chunk_particle_vm_registers_wide.js +86 -0
  337. package/src/shade/renderer/shader/chunk/math/chunk_mod_v3f.d.ts +22 -0
  338. package/src/shade/renderer/shader/chunk/math/chunk_mod_v3f.d.ts.map +1 -0
  339. package/src/shade/renderer/shader/chunk/math/chunk_mod_v3f.js +32 -0
  340. package/src/shade/renderer/shader/chunk/math/chunk_mod_v4f.d.ts +9 -0
  341. package/src/shade/renderer/shader/chunk/math/chunk_mod_v4f.d.ts.map +1 -0
  342. package/src/shade/renderer/shader/chunk/math/chunk_mod_v4f.js +19 -0
  343. package/src/shade/renderer/shader/chunk/noise/psrdnoise/README.md +65 -0
  344. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise2.d.ts +24 -0
  345. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise2.d.ts.map +1 -0
  346. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise2.js +83 -0
  347. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise2_hash.d.ts +25 -0
  348. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise2_hash.d.ts.map +1 -0
  349. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise2_hash.js +42 -0
  350. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise2_kernel.d.ts +31 -0
  351. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise2_kernel.d.ts.map +1 -0
  352. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise2_kernel.js +80 -0
  353. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3.d.ts +26 -0
  354. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3.d.ts.map +1 -0
  355. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3.js +109 -0
  356. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_kernel.d.ts +38 -0
  357. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_kernel.d.ts.map +1 -0
  358. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_kernel.js +129 -0
  359. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_permute.d.ts +21 -0
  360. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_permute.d.ts.map +1 -0
  361. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_permute.js +35 -0
  362. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_skew.d.ts +19 -0
  363. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_skew.d.ts.map +1 -0
  364. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_skew.js +28 -0
  365. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_unskew.d.ts +13 -0
  366. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_unskew.d.ts.map +1 -0
  367. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_psrdnoise3_unskew.js +22 -0
  368. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_srdnoise2.d.ts +22 -0
  369. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_srdnoise2.d.ts.map +1 -0
  370. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_srdnoise2.js +59 -0
  371. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_srdnoise3.d.ts +23 -0
  372. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_srdnoise3.d.ts.map +1 -0
  373. package/src/shade/renderer/shader/chunk/noise/psrdnoise/chunk_srdnoise3.js +74 -0
  374. package/src/shade/wgsl/emulator/ComputeShaderEmulator.d.ts +34 -1
  375. package/src/shade/wgsl/emulator/ComputeShaderEmulator.d.ts.map +1 -1
  376. package/src/shade/wgsl/emulator/ComputeShaderEmulator.js +41 -1
  377. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.d.ts +3 -2
  378. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.d.ts.map +1 -1
  379. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +49 -10
  380. package/src/view/minimap/dom/MinimapCameraView.d.ts.map +1 -1
  381. package/src/view/minimap/dom/MinimapCameraView.js +4 -9
  382. package/src/core/model/node-graph/visual/layout/BoxLayoutSpec.d.ts +0 -15
  383. package/src/core/model/node-graph/visual/layout/BoxLayoutSpec.d.ts.map +0 -1
  384. package/src/core/model/node-graph/visual/layout/ConnectedBoxLayouter.d.ts +0 -45
  385. package/src/core/model/node-graph/visual/layout/ConnectedBoxLayouter.d.ts.map +0 -1
  386. package/src/core/model/node-graph/visual/layout/ConnectionEndpointLayoutSpec.d.ts +0 -24
  387. package/src/core/model/node-graph/visual/layout/ConnectionEndpointLayoutSpec.d.ts.map +0 -1
  388. package/src/core/model/node-graph/visual/layout/ConnectionLayoutSpec.d.ts +0 -19
  389. package/src/core/model/node-graph/visual/layout/ConnectionLayoutSpec.d.ts.map +0 -1
  390. package/src/engine/ecs/transform/__probe.d.ts +0 -4
  391. package/src/engine/ecs/transform/__probe.d.ts.map +0 -1
  392. package/src/engine/ecs/util/hideEntityGracefully.d.ts +0 -9
  393. package/src/engine/ecs/util/hideEntityGracefully.d.ts.map +0 -1
  394. package/src/shade/renderer/buffer/table/gpu_database_emulator_image.d.ts +0 -27
  395. package/src/shade/renderer/buffer/table/gpu_database_emulator_image.d.ts.map +0 -1
  396. package/src/shade/renderer/particles/cull/chunk_particle_cull.d.ts +0 -14
  397. package/src/shade/renderer/particles/cull/chunk_particle_cull.d.ts.map +0 -1
  398. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_LAYOUT.d.ts +0 -156
  399. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_LAYOUT.d.ts.map +0 -1
  400. package/src/shade/renderer/particles/runtime/Emitter.d.ts +0 -219
  401. package/src/shade/renderer/particles/runtime/Emitter.d.ts.map +0 -1
  402. package/src/shade/renderer/particles/runtime/ParticleSpawnScheduler.d.ts +0 -77
  403. package/src/shade/renderer/particles/runtime/ParticleSpawnScheduler.d.ts.map +0 -1
  404. package/src/shade/renderer/particles/runtime/ProgramArena.js +0 -155
  405. package/src/shade/renderer/particles/runtime/emitter_database_image.d.ts +0 -15
  406. package/src/shade/renderer/particles/runtime/emitter_database_image.d.ts.map +0 -1
  407. package/src/shade/renderer/particles/runtime/spawn_request_encoding.d.ts +0 -34
  408. package/src/shade/renderer/particles/runtime/spawn_request_encoding.d.ts.map +0 -1
  409. package/src/shade/renderer/particles/shaders/chunk_particle_context.d.ts +0 -32
  410. package/src/shade/renderer/particles/shaders/chunk_particle_context.d.ts.map +0 -1
@@ -68,13 +68,29 @@ export class RouteSearch {
68
68
  * @type {number}
69
69
  */
70
70
  path_length: number;
71
+ /**
72
+ * What the route just found costs, under the grid as it stood when it was found. This is the
73
+ * same number {@link cost_of} gives for it, and is what a route it replaces is compared with.
74
+ * @type {number}
75
+ */
76
+ cost: number;
77
+ /**
78
+ * States the last search took off the queue before it found the goal or gave up. What the
79
+ * search cost, for anybody tuning it.
80
+ * @type {number}
81
+ */
82
+ expansions: number;
71
83
  /**
72
84
  * Find a wire's way from one vertex to another.
73
85
  *
74
- * The cost being minimised is length, plus a fixed price per turn, plus what the grid charges
75
- * for lines other wires are already on. The estimate driving the search is the straight
76
- * rectilinear distance remaining, which never exceeds what the route will actually cost — turns
77
- * and congestion only ever add — so the first route found is the cheapest one.
86
+ * The cost being minimised is length, plus a fixed price per turn, plus a fixed price for every
87
+ * wire crossed, plus what the grid charges for lines other wires are already on. The estimate
88
+ * driving the search is the straight rectilinear distance remaining, which never exceeds what
89
+ * the route will actually cost — turns, crossings and congestion only ever add — so the first
90
+ * route found is the cheapest one.
91
+ *
92
+ * A crossing is charged where it happens: on going straight through a vertex, for every wire
93
+ * already going straight through it the other way. See {@link RouteGrid#through_h}.
78
94
  *
79
95
  * @param {number} start vertex
80
96
  * @param {number} start_axis the axis the wire is already travelling on as it arrives here,
@@ -82,9 +98,14 @@ export class RouteSearch {
82
98
  * @param {number} goal vertex
83
99
  * @param {number} goal_axis the axis the wire must be on to meet the port it is heading for
84
100
  * @param {NodeGraphLayoutOptions} options
101
+ * @param {boolean} [through_goal] whether arriving at the goal along its axis is going straight
102
+ * through it. True at a port, where the wire carries on into its stub; false at a
103
+ * waypoint the wire will leave by another search, which charges for the leaving.
104
+ * @param {number} [net] the net the wire belongs to, whose other wires it may share a line
105
+ * with for nothing — see {@link RouteGrid#owner_h}. -1 for a wire of no net.
85
106
  * @returns {boolean} whether a route was found. The route is left in {@link path}.
86
107
  */
87
- find(start: number, start_axis: number, goal: number, goal_axis: number, options: NodeGraphLayoutOptions): boolean;
108
+ find(start: number, start_axis: number, goal: number, goal_axis: number, options: NodeGraphLayoutOptions, through_goal?: boolean, net?: number): boolean;
88
109
  /**
89
110
  * @param {number} from state
90
111
  * @param {number} from_cost
@@ -93,6 +114,7 @@ export class RouteSearch {
93
114
  * @param {number} axis being moved along
94
115
  * @param {number} goal
95
116
  * @param {number} goal_axis
117
+ * @param {boolean} through_goal
96
118
  * @param {number} bend
97
119
  * @param {NodeGraphLayoutOptions} options
98
120
  * @param {number} step what the move itself costs
@@ -102,6 +124,29 @@ export class RouteSearch {
102
124
  * @private
103
125
  */
104
126
  private __relax;
127
+ /**
128
+ * What a route costs under the grid as it stands now.
129
+ *
130
+ * The same sum {@link find} minimises, added up along a route that already exists: length, a
131
+ * turn wherever the axis changes — counting the stubs at either end, which fix the axis the
132
+ * route starts and finishes on — a crossing wherever it goes straight through a vertex some
133
+ * other wire goes straight through the other way, and the grid's charge for every line it
134
+ * shares. The route's own occupancy must have been taken off the grid first, or it is charged
135
+ * for sharing lines with itself.
136
+ *
137
+ * Kept exactly in step with {@link find}, because it exists to be compared with it: a route
138
+ * found now is worth taking over the one it replaces only if this says the old one costs more.
139
+ *
140
+ * @param {Int32Array} path grid vertices, start to goal
141
+ * @param {number} length how many of `path` to read
142
+ * @param {number} start_axis
143
+ * @param {number} goal_axis
144
+ * @param {NodeGraphLayoutOptions} options
145
+ * @param {boolean} [through_goal] as for {@link find}
146
+ * @param {number} [net] as for {@link find}
147
+ * @returns {number}
148
+ */
149
+ cost_of(path: Int32Array, length: number, start_axis: number, goal_axis: number, options: NodeGraphLayoutOptions, through_goal?: boolean, net?: number): number;
105
150
  /**
106
151
  * @param {number} state the goal, reached
107
152
  * @returns {boolean}
@@ -1 +1 @@
1
- {"version":3,"file":"RouteSearch.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/node-graph/visual/layout/RouteSearch.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,2BAFU,MAAM,CAEc;AAE9B;;;GAGG;AACH,2BAFU,MAAM,CAEc;AAE9B;;;;;;;;;;;;;;;;GAgBG;AACH;IAiDI;;OAEG;IACH,6BAeC;IAjED;;OAEG;IACH,gBAAY;IAEZ;;OAEG;IACH,MAFU,UAAU,CAEQ;IAE5B;;OAEG;IACH,QAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,OAFU,YAAY,CAEhB;IAEN;;OAEG;IACH,OAFU,UAAU,CAEd;IAEN;;OAEG;IACH,WAFU,UAAU,CAEV;IAEV;;OAEG;IACH,YAFU,MAAM,CAED;IAEf;;;OAGG;IACH,MAFU,UAAU,CAEf;IAEL;;OAEG;IACH,aAFU,MAAM,CAEA;IAsBhB;;;;;;;;;;;;;;;OAeG;IACH,YARW,MAAM,cACN,MAAM,QAEN,MAAM,aACN,MAAM,oCAEJ,OAAO,CAyGnB;IAED;;;;;;;;;;;;;;;OAeG;IACH,gBA8BC;IAED;;;;OAIG;IACH,iBAuBC;CACJ;2BA1S0B,2CAA2C;uBAD/C,8BAA8B"}
1
+ {"version":3,"file":"RouteSearch.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/node-graph/visual/layout/RouteSearch.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,2BAFU,MAAM,CAEc;AAE9B;;;GAGG;AACH,2BAFU,MAAM,CAEc;AAE9B;;;;;;;;;;;;;;;;GAgBG;AACH;IA+DI;;OAEG;IACH,6BAeC;IA/ED;;OAEG;IACH,gBAAY;IAEZ;;OAEG;IACH,MAFU,UAAU,CAEQ;IAE5B;;OAEG;IACH,QAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,OAFU,YAAY,CAEhB;IAEN;;OAEG;IACH,OAFU,UAAU,CAEd;IAEN;;OAEG;IACH,WAFU,UAAU,CAEV;IAEV;;OAEG;IACH,YAFU,MAAM,CAED;IAEf;;;OAGG;IACH,MAFU,UAAU,CAEf;IAEL;;OAEG;IACH,aAFU,MAAM,CAEA;IAEhB;;;;OAIG;IACH,MAFU,MAAM,CAEP;IAET;;;;OAIG;IACH,YAFU,MAAM,CAED;IAsBf;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,YAbW,MAAM,cACN,MAAM,QAEN,MAAM,aACN,MAAM,kDAEN,OAAO,QAGP,MAAM,GAEJ,OAAO,CAiHnB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,gBAkDC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,cATW,UAAU,UACV,MAAM,cACN,MAAM,aACN,MAAM,kDAEN,OAAO,QACP,MAAM,GACJ,MAAM,CA4DlB;IAED;;;;OAIG;IACH,iBAyBC;CACJ;2BAlb0B,2CAA2C;uBAD/C,8BAA8B"}
@@ -79,6 +79,20 @@ export class RouteSearch {
79
79
  */
80
80
  path_length = 0;
81
81
 
82
+ /**
83
+ * What the route just found costs, under the grid as it stood when it was found. This is the
84
+ * same number {@link cost_of} gives for it, and is what a route it replaces is compared with.
85
+ * @type {number}
86
+ */
87
+ cost = 0;
88
+
89
+ /**
90
+ * States the last search took off the queue before it found the goal or gave up. What the
91
+ * search cost, for anybody tuning it.
92
+ * @type {number}
93
+ */
94
+ expansions = 0;
95
+
82
96
  /**
83
97
  * @param {RouteGrid} grid
84
98
  */
@@ -102,10 +116,14 @@ export class RouteSearch {
102
116
  /**
103
117
  * Find a wire's way from one vertex to another.
104
118
  *
105
- * The cost being minimised is length, plus a fixed price per turn, plus what the grid charges
106
- * for lines other wires are already on. The estimate driving the search is the straight
107
- * rectilinear distance remaining, which never exceeds what the route will actually cost — turns
108
- * and congestion only ever add — so the first route found is the cheapest one.
119
+ * The cost being minimised is length, plus a fixed price per turn, plus a fixed price for every
120
+ * wire crossed, plus what the grid charges for lines other wires are already on. The estimate
121
+ * driving the search is the straight rectilinear distance remaining, which never exceeds what
122
+ * the route will actually cost — turns, crossings and congestion only ever add — so the first
123
+ * route found is the cheapest one.
124
+ *
125
+ * A crossing is charged where it happens: on going straight through a vertex, for every wire
126
+ * already going straight through it the other way. See {@link RouteGrid#through_h}.
109
127
  *
110
128
  * @param {number} start vertex
111
129
  * @param {number} start_axis the axis the wire is already travelling on as it arrives here,
@@ -113,9 +131,14 @@ export class RouteSearch {
113
131
  * @param {number} goal vertex
114
132
  * @param {number} goal_axis the axis the wire must be on to meet the port it is heading for
115
133
  * @param {NodeGraphLayoutOptions} options
134
+ * @param {boolean} [through_goal] whether arriving at the goal along its axis is going straight
135
+ * through it. True at a port, where the wire carries on into its stub; false at a
136
+ * waypoint the wire will leave by another search, which charges for the leaving.
137
+ * @param {number} [net] the net the wire belongs to, whose other wires it may share a line
138
+ * with for nothing — see {@link RouteGrid#owner_h}. -1 for a wire of no net.
116
139
  * @returns {boolean} whether a route was found. The route is left in {@link path}.
117
140
  */
118
- find(start, start_axis, goal, goal_axis, options) {
141
+ find(start, start_axis, goal, goal_axis, options, through_goal = true, net = -1) {
119
142
  const grid = this.grid;
120
143
 
121
144
  const nx = grid.nx;
@@ -125,6 +148,7 @@ export class RouteSearch {
125
148
  const ys = grid.ys;
126
149
 
127
150
  this.path_length = 0;
151
+ this.cost = 0;
128
152
 
129
153
  if (start === goal) {
130
154
  this.path[0] = start;
@@ -151,7 +175,7 @@ export class RouteSearch {
151
175
 
152
176
  this.open.insert(start_state, Math.abs(xs[start % nx] - goal_x) + Math.abs(ys[(start / nx) | 0] - goal_y));
153
177
 
154
- let expansions = 0;
178
+ this.expansions = 0;
155
179
 
156
180
  while (!this.open.is_empty()) {
157
181
  const state = this.open.pop_min();
@@ -169,7 +193,7 @@ export class RouteSearch {
169
193
 
170
194
  this.closed.set(state, true);
171
195
 
172
- if (++expansions > options.max_route_expansions) {
196
+ if (++this.expansions > options.max_route_expansions) {
173
197
  break;
174
198
  }
175
199
 
@@ -180,37 +204,44 @@ export class RouteSearch {
180
204
 
181
205
  const cost = this.score[state];
182
206
 
183
- if (i + 1 < nx && !grid.blocked_h.get(vertex)) {
207
+ // A wire never doubles back along the line it arrived by. The axis alone would allow
208
+ // it — out along a line and straight back is two moves on one axis, with no turn to
209
+ // pay for — and a wire could then dodge the charge for crossing another at a vertex by
210
+ // arriving at it along a different axis, having made a spike out of the side and
211
+ // back. The spike is no less a crossing; it is merely one the count cannot see.
212
+ const previous = this.came_from[state] === -1 ? -1 : this.came_from[state] >> 1;
213
+
214
+ if (i + 1 < nx && vertex + 1 !== previous && !grid.blocked_h.get(vertex)) {
184
215
  this.__relax(
185
- state, cost, axis, vertex + 1, ROUTE_AXIS_H, goal, goal_axis, bend, options,
186
- xs[i + 1] - xs[i] + grid.use_h[vertex] * options.present_cost + grid.history_h[vertex],
216
+ state, cost, axis, vertex + 1, ROUTE_AXIS_H, goal, goal_axis, through_goal, bend, options,
217
+ xs[i + 1] - xs[i] + grid.foreign_h(vertex, net) * options.present_cost + grid.history_h[vertex],
187
218
  Math.abs(xs[i + 1] - goal_x) + Math.abs(ys[j] - goal_y),
188
219
  generation
189
220
  );
190
221
  }
191
222
 
192
- if (i > 0 && !grid.blocked_h.get(vertex - 1)) {
223
+ if (i > 0 && vertex - 1 !== previous && !grid.blocked_h.get(vertex - 1)) {
193
224
  this.__relax(
194
- state, cost, axis, vertex - 1, ROUTE_AXIS_H, goal, goal_axis, bend, options,
195
- xs[i] - xs[i - 1] + grid.use_h[vertex - 1] * options.present_cost + grid.history_h[vertex - 1],
225
+ state, cost, axis, vertex - 1, ROUTE_AXIS_H, goal, goal_axis, through_goal, bend, options,
226
+ xs[i] - xs[i - 1] + grid.foreign_h(vertex - 1, net) * options.present_cost + grid.history_h[vertex - 1],
196
227
  Math.abs(xs[i - 1] - goal_x) + Math.abs(ys[j] - goal_y),
197
228
  generation
198
229
  );
199
230
  }
200
231
 
201
- if (j + 1 < ny && !grid.blocked_v.get(vertex)) {
232
+ if (j + 1 < ny && vertex + nx !== previous && !grid.blocked_v.get(vertex)) {
202
233
  this.__relax(
203
- state, cost, axis, vertex + nx, ROUTE_AXIS_V, goal, goal_axis, bend, options,
204
- ys[j + 1] - ys[j] + grid.use_v[vertex] * options.present_cost + grid.history_v[vertex],
234
+ state, cost, axis, vertex + nx, ROUTE_AXIS_V, goal, goal_axis, through_goal, bend, options,
235
+ ys[j + 1] - ys[j] + grid.foreign_v(vertex, net) * options.present_cost + grid.history_v[vertex],
205
236
  Math.abs(xs[i] - goal_x) + Math.abs(ys[j + 1] - goal_y),
206
237
  generation
207
238
  );
208
239
  }
209
240
 
210
- if (j > 0 && !grid.blocked_v.get(vertex - nx)) {
241
+ if (j > 0 && vertex - nx !== previous && !grid.blocked_v.get(vertex - nx)) {
211
242
  this.__relax(
212
- state, cost, axis, vertex - nx, ROUTE_AXIS_V, goal, goal_axis, bend, options,
213
- ys[j] - ys[j - 1] + grid.use_v[vertex - nx] * options.present_cost + grid.history_v[vertex - nx],
243
+ state, cost, axis, vertex - nx, ROUTE_AXIS_V, goal, goal_axis, through_goal, bend, options,
244
+ ys[j] - ys[j - 1] + grid.foreign_v(vertex - nx, net) * options.present_cost + grid.history_v[vertex - nx],
214
245
  Math.abs(xs[i] - goal_x) + Math.abs(ys[j - 1] - goal_y),
215
246
  generation
216
247
  );
@@ -228,6 +259,7 @@ export class RouteSearch {
228
259
  * @param {number} axis being moved along
229
260
  * @param {number} goal
230
261
  * @param {number} goal_axis
262
+ * @param {boolean} through_goal
231
263
  * @param {number} bend
232
264
  * @param {NodeGraphLayoutOptions} options
233
265
  * @param {number} step what the move itself costs
@@ -236,7 +268,7 @@ export class RouteSearch {
236
268
  * @returns {void}
237
269
  * @private
238
270
  */
239
- __relax(from, from_cost, from_axis, vertex, axis, goal, goal_axis, bend, options, step, remaining, generation) {
271
+ __relax(from, from_cost, from_axis, vertex, axis, goal, goal_axis, through_goal, bend, options, step, remaining, generation) {
240
272
  const state = vertex * 2 + axis;
241
273
 
242
274
  if (this.closed.get(state)) {
@@ -245,14 +277,34 @@ export class RouteSearch {
245
277
 
246
278
  let cost = from_cost + step;
247
279
 
280
+ const grid = this.grid;
281
+
248
282
  if (axis !== from_axis) {
249
283
  cost += bend;
284
+ } else {
285
+ // carrying straight on through the vertex being left crosses every wire going straight
286
+ // through it the other way
287
+ const through = axis === ROUTE_AXIS_H ? grid.through_v[from >> 1] : grid.through_h[from >> 1];
288
+
289
+ if (through > 0) {
290
+ cost += through * options.crossing_penalty;
291
+ }
250
292
  }
251
293
 
252
- if (vertex === goal && axis !== goal_axis) {
253
- // meeting a port along the wrong axis means one more turn than the route shows, made
254
- // in the stub between the grid and the port itself
255
- cost += bend;
294
+ if (vertex === goal) {
295
+ if (axis !== goal_axis) {
296
+ // meeting a port along the wrong axis means one more turn than the route shows,
297
+ // made in the stub between the grid and the port itself
298
+ cost += bend;
299
+ } else if (through_goal) {
300
+ // and meeting it along the right one means going straight through the goal vertex
301
+ // into that stub
302
+ const through = axis === ROUTE_AXIS_H ? grid.through_v[goal] : grid.through_h[goal];
303
+
304
+ if (through > 0) {
305
+ cost += through * options.crossing_penalty;
306
+ }
307
+ }
256
308
  }
257
309
 
258
310
  if (this.stamp[state] === generation && this.score[state] <= cost) {
@@ -268,12 +320,96 @@ export class RouteSearch {
268
320
  this.open.insert(state, cost + remaining);
269
321
  }
270
322
 
323
+ /**
324
+ * What a route costs under the grid as it stands now.
325
+ *
326
+ * The same sum {@link find} minimises, added up along a route that already exists: length, a
327
+ * turn wherever the axis changes — counting the stubs at either end, which fix the axis the
328
+ * route starts and finishes on — a crossing wherever it goes straight through a vertex some
329
+ * other wire goes straight through the other way, and the grid's charge for every line it
330
+ * shares. The route's own occupancy must have been taken off the grid first, or it is charged
331
+ * for sharing lines with itself.
332
+ *
333
+ * Kept exactly in step with {@link find}, because it exists to be compared with it: a route
334
+ * found now is worth taking over the one it replaces only if this says the old one costs more.
335
+ *
336
+ * @param {Int32Array} path grid vertices, start to goal
337
+ * @param {number} length how many of `path` to read
338
+ * @param {number} start_axis
339
+ * @param {number} goal_axis
340
+ * @param {NodeGraphLayoutOptions} options
341
+ * @param {boolean} [through_goal] as for {@link find}
342
+ * @param {number} [net] as for {@link find}
343
+ * @returns {number}
344
+ */
345
+ cost_of(path, length, start_axis, goal_axis, options, through_goal = true, net = -1) {
346
+ if (length < 2) {
347
+ // a route that is one vertex is the two stubs meeting, which find() prices at nothing
348
+ return 0;
349
+ }
350
+
351
+ const grid = this.grid;
352
+
353
+ const nx = grid.nx;
354
+
355
+ const xs = grid.xs;
356
+ const ys = grid.ys;
357
+
358
+ const bend = options.bend_penalty;
359
+ const crossing = options.crossing_penalty;
360
+ const present = options.present_cost;
361
+
362
+ let cost = 0;
363
+ let axis = start_axis;
364
+
365
+ for (let k = 0; k + 1 < length; k++) {
366
+ const a = path[k];
367
+ const b = path[k + 1];
368
+
369
+ let step_axis;
370
+
371
+ if (b === a + 1) {
372
+ step_axis = ROUTE_AXIS_H;
373
+ cost += xs[b % nx] - xs[a % nx] + grid.foreign_h(a, net) * present + grid.history_h[a];
374
+ } else if (a === b + 1) {
375
+ step_axis = ROUTE_AXIS_H;
376
+ cost += xs[a % nx] - xs[b % nx] + grid.foreign_h(b, net) * present + grid.history_h[b];
377
+ } else if (b === a + nx) {
378
+ step_axis = ROUTE_AXIS_V;
379
+ cost += ys[(b / nx) | 0] - ys[(a / nx) | 0] + grid.foreign_v(a, net) * present + grid.history_v[a];
380
+ } else {
381
+ step_axis = ROUTE_AXIS_V;
382
+ cost += ys[(a / nx) | 0] - ys[(b / nx) | 0] + grid.foreign_v(b, net) * present + grid.history_v[b];
383
+ }
384
+
385
+ if (step_axis !== axis) {
386
+ cost += bend;
387
+ } else {
388
+ cost += (step_axis === ROUTE_AXIS_H ? grid.through_v[a] : grid.through_h[a]) * crossing;
389
+ }
390
+
391
+ axis = step_axis;
392
+ }
393
+
394
+ const goal = path[length - 1];
395
+
396
+ if (axis !== goal_axis) {
397
+ cost += bend;
398
+ } else if (through_goal) {
399
+ cost += (axis === ROUTE_AXIS_H ? grid.through_v[goal] : grid.through_h[goal]) * crossing;
400
+ }
401
+
402
+ return cost;
403
+ }
404
+
271
405
  /**
272
406
  * @param {number} state the goal, reached
273
407
  * @returns {boolean}
274
408
  * @private
275
409
  */
276
410
  __unwind(state) {
411
+ this.cost = this.score[state];
412
+
277
413
  let length = 0;
278
414
 
279
415
  for (let at = state; at !== -1; at = this.came_from[at]) {
@@ -35,6 +35,13 @@ export class RouteSet {
35
35
  * @type {Float64Array}
36
36
  */
37
37
  y: Float64Array;
38
+ /**
39
+ * Net of each route: routes leaving one port together share a number here, and a stage that
40
+ * pulls overlapping routes apart leaves those together — they are one line that forks. Null
41
+ * when nobody has said; every route is then its own net.
42
+ * @type {Int32Array|null}
43
+ */
44
+ net: Int32Array | null;
38
45
  /**
39
46
  * @type {number}
40
47
  * @private
@@ -1 +1 @@
1
- {"version":3,"file":"RouteSet.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/node-graph/visual/layout/RouteSet.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH;IAoCI;;;OAGG;IACH,mBAHW,MAAM,aACN,MAAM,EAShB;IA7CD;;OAEG;IACH,OAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,QAFU,UAAU,CAEb;IAEP;;OAEG;IACH,GAFU,YAAY,CAEpB;IAEF;;OAEG;IACH,GAFU,YAAY,CAEpB;IAEF;;;OAGG;IACH,iBAAa;IAEb;;;;OAIG;IACH,gBAAY;IAeZ;;;OAGG;IACH,SAFa,IAAI,CAOhB;IAED;;;;OAIG;IACH,aAHW,MAAM,GACJ,IAAI,CAMhB;IAED;;;;;;OAMG;IACH,QAJW,MAAM,KACN,MAAM,GACJ,IAAI,CAiChB;IAED;;;;OAIG;IACH,WAHW,MAAM,GACJ,IAAI,CAIhB;IAED;;;;OAIG;IACH,iBAmBC;IAED;;;OAGG;IACH,iBAHW,MAAM,GACJ,MAAM,CAIlB;CACJ"}
1
+ {"version":3,"file":"RouteSet.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/node-graph/visual/layout/RouteSet.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH;IA4CI;;;OAGG;IACH,mBAHW,MAAM,aACN,MAAM,EAShB;IArDD;;OAEG;IACH,OAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,QAFU,UAAU,CAEb;IAEP;;OAEG;IACH,GAFU,YAAY,CAEpB;IAEF;;OAEG;IACH,GAFU,YAAY,CAEpB;IAEF;;;;;OAKG;IACH,KAFU,UAAU,GAAC,IAAI,CAEd;IAEX;;;OAGG;IACH,iBAAa;IAEb;;;;OAIG;IACH,gBAAY;IAeZ;;;OAGG;IACH,SAFa,IAAI,CAOhB;IAED;;;;OAIG;IACH,aAHW,MAAM,GACJ,IAAI,CAMhB;IAED;;;;;;OAMG;IACH,QAJW,MAAM,KACN,MAAM,GACJ,IAAI,CAiChB;IAED;;;;OAIG;IACH,WAHW,MAAM,GACJ,IAAI,CAIhB;IAED;;;;OAIG;IACH,iBAmBC;IAED;;;OAGG;IACH,iBAHW,MAAM,GACJ,MAAM,CAIlB;CACJ"}
@@ -35,6 +35,14 @@ export class RouteSet {
35
35
  */
36
36
  y;
37
37
 
38
+ /**
39
+ * Net of each route: routes leaving one port together share a number here, and a stage that
40
+ * pulls overlapping routes apart leaves those together — they are one line that forks. Null
41
+ * when nobody has said; every route is then its own net.
42
+ * @type {Int32Array|null}
43
+ */
44
+ net = null;
45
+
38
46
  /**
39
47
  * @type {number}
40
48
  * @private
@@ -376,15 +376,21 @@ function compact(graph, order, rank, layer_start, block, options) {
376
376
  sink[box] = box;
377
377
  }
378
378
 
379
+ // A lane is a wire. Next to another wire it keeps a wire's gap; next to a box it keeps the
380
+ // clearance as well, because the line a clearance outside a box is the nearest a wire is ever
381
+ // drawn to it, and a lane closer than that is inside the space the router treats as the box.
382
+ const lane_to_box = Math.max(options.wire_gap, options.clearance);
383
+
379
384
  /**
380
385
  * @param {number} above
381
386
  * @param {number} below
382
387
  * @returns {number} smallest distance from the top of `above` to the top of `below`
383
388
  */
384
389
  function separation(above, below) {
385
- const gap = graph.box_kind[above] === LAYOUT_BOX_LANE || graph.box_kind[below] === LAYOUT_BOX_LANE
386
- ? options.wire_gap
387
- : options.node_gap;
390
+ const lanes = (graph.box_kind[above] === LAYOUT_BOX_LANE ? 1 : 0)
391
+ + (graph.box_kind[below] === LAYOUT_BOX_LANE ? 1 : 0);
392
+
393
+ const gap = lanes === 2 ? options.wire_gap : lanes === 1 ? lane_to_box : options.node_gap;
388
394
 
389
395
  return graph.box_h[above] + gap;
390
396
  }
@@ -1 +1 @@
1
- {"version":3,"file":"layout_build_problem.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/node-graph/visual/layout/layout_build_problem.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qFALa,aAAa,CA+GzB;8BAtI6C,oBAAoB"}
1
+ {"version":3,"file":"layout_build_problem.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/node-graph/visual/layout/layout_build_problem.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qFALa,aAAa,CAsHzB;8BA7I6C,oBAAoB"}
@@ -87,6 +87,11 @@ export function layout_build_problem(graph, visual) {
87
87
  problem.to_dy = new Float64Array(connection_count);
88
88
  problem.from_side = new Uint8Array(connection_count);
89
89
  problem.to_side = new Uint8Array(connection_count);
90
+ problem.link_of_connection = new Int32Array(connection_count).fill(-1);
91
+
92
+ // no lanes until placement decides them
93
+ problem.lane_start = new Int32Array(connection_count + 1);
94
+ problem.lane_box = new Int32Array(0);
90
95
 
91
96
  let link_count = 0;
92
97
 
@@ -127,6 +132,8 @@ export function layout_build_problem(graph, visual) {
127
132
  write_endpoint(problem, i, false, visual, node_ids[to_box], connection.target.port.id, boxes, to_box);
128
133
 
129
134
  if (from_box !== to_box) {
135
+ problem.link_of_connection[i] = link;
136
+
130
137
  boxes.set_link(link++, from_box, to_box, problem.from_dy[i], problem.to_dy[i]);
131
138
  }
132
139
  }
@@ -15,15 +15,21 @@
15
15
  * - **Straightness.** A chain of lane boxes is a chain of links the coordinate stage will try to
16
16
  * align, and aligning them is what makes a long wire straight rather than a slow diagonal.
17
17
  *
18
- * The router is never told which lane belongs to which wire. It does not need to be: the lanes put
19
- * empty horizontal space where wires want to go, and a router minimising length and bends finds it.
18
+ * The router is told which lanes belong to which wire, and routes the wire through them. That is
19
+ * the fourth job, and the one the other three exist for: the ordering stage decided where each
20
+ * long wire crosses each column so that as few wires cross as it could manage, and a wire routed
21
+ * through its lanes is that decision drawn. A router left to find the empty space on its own does
22
+ * so one wire at a time, and what it rediscovers is the order the wires happened to be routed in.
20
23
  *
21
24
  * @param {LayoutBoxGraph} graph mutated in place; adjacency is rebuilt. Layers must be assigned, and
22
25
  * every link must point forwards by at least one column.
26
+ * @param {Int32Array} [lane_offset] written when given, one entry per link as the graph stood on
27
+ * entry plus one: the lanes of link `i` are the boxes `lane_offset[i]` up to but not
28
+ * including `lane_offset[i + 1]`, in the order the wire passes through them
23
29
  * @returns {number} how many lane boxes were added
24
30
  *
25
31
  * @author Alex Goldring
26
32
  * @copyright Company Named Limited (c) 2026
27
33
  */
28
- export function layout_insert_lanes(graph: LayoutBoxGraph): number;
34
+ export function layout_insert_lanes(graph: LayoutBoxGraph, lane_offset?: Int32Array): number;
29
35
  //# sourceMappingURL=layout_insert_lanes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout_insert_lanes.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/node-graph/visual/layout/layout_insert_lanes.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,4DALa,MAAM,CAsElB"}
1
+ {"version":3,"file":"layout_insert_lanes.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/node-graph/visual/layout/layout_insert_lanes.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,yEARW,UAAU,GAGR,MAAM,CA8ElB"}
@@ -17,17 +17,23 @@ import { LAYOUT_BOX_LANE } from "./LayoutBoxGraph.js";
17
17
  * - **Straightness.** A chain of lane boxes is a chain of links the coordinate stage will try to
18
18
  * align, and aligning them is what makes a long wire straight rather than a slow diagonal.
19
19
  *
20
- * The router is never told which lane belongs to which wire. It does not need to be: the lanes put
21
- * empty horizontal space where wires want to go, and a router minimising length and bends finds it.
20
+ * The router is told which lanes belong to which wire, and routes the wire through them. That is
21
+ * the fourth job, and the one the other three exist for: the ordering stage decided where each
22
+ * long wire crosses each column so that as few wires cross as it could manage, and a wire routed
23
+ * through its lanes is that decision drawn. A router left to find the empty space on its own does
24
+ * so one wire at a time, and what it rediscovers is the order the wires happened to be routed in.
22
25
  *
23
26
  * @param {LayoutBoxGraph} graph mutated in place; adjacency is rebuilt. Layers must be assigned, and
24
27
  * every link must point forwards by at least one column.
28
+ * @param {Int32Array} [lane_offset] written when given, one entry per link as the graph stood on
29
+ * entry plus one: the lanes of link `i` are the boxes `lane_offset[i]` up to but not
30
+ * including `lane_offset[i + 1]`, in the order the wire passes through them
25
31
  * @returns {number} how many lane boxes were added
26
32
  *
27
33
  * @author Alex Goldring
28
34
  * @copyright Company Named Limited (c) 2026
29
35
  */
30
- export function layout_insert_lanes(graph) {
36
+ export function layout_insert_lanes(graph, lane_offset) {
31
37
  const old_link_count = graph.link_count;
32
38
 
33
39
  let extra_boxes = 0;
@@ -36,10 +42,18 @@ export function layout_insert_lanes(graph) {
36
42
  for (let i = 0; i < old_link_count; i++) {
37
43
  const span = graph.box_layer[graph.link_to[i]] - graph.box_layer[graph.link_from[i]];
38
44
 
45
+ if (lane_offset !== undefined) {
46
+ lane_offset[i] = graph.box_count + extra_boxes;
47
+ }
48
+
39
49
  extra_boxes += span - 1;
40
50
  new_link_count += span;
41
51
  }
42
52
 
53
+ if (lane_offset !== undefined) {
54
+ lane_offset[old_link_count] = graph.box_count + extra_boxes;
55
+ }
56
+
43
57
  if (extra_boxes === 0) {
44
58
  return 0;
45
59
  }
@@ -11,12 +11,15 @@
11
11
  * not because anything measured how related they are, but because being joined is what put them in
12
12
  * neighbouring columns and being joined to the same things is what put them next to each other.
13
13
  *
14
- * **Routing** decides where the wires go, which the placement has deliberately left open. Each wire
15
- * finds its own way through the space between the boxes, avoiding them and, as far as it can, each
16
- * other. This is where the drawing stops looking like a diagram of the algorithm and starts looking
17
- * like something somebody drew: wires that run alongside each other rather than through each other,
18
- * that go around a node instead of behind it, and that leave and arrive square to the ports they
19
- * belong to.
14
+ * **Routing** decides where the wires go, which the placement has left open within the columns it
15
+ * decided. A wire that crosses a column is taken through the lane the placement reserved for it
16
+ * there — which is how the placement's crossing-minimised order reaches the drawing — and between
17
+ * one lane and the next each wire finds its own way, avoiding the boxes and, as far as it can, the
18
+ * other wires: sharing a line with one costs it something, and so does crossing one. This is where
19
+ * the drawing stops looking like a diagram of the algorithm and starts looking like something
20
+ * somebody drew: wires that run alongside each other rather than through each other, that go
21
+ * around a node instead of behind it, that do not cross what they could as easily have gone round,
22
+ * and that leave and arrive square to the ports they belong to.
20
23
  *
21
24
  * The two halves are separate on purpose. Placement can be re-run without re-routing when only the
22
25
  * structure changed, and routing can be re-run without re-placing when somebody has dragged a node
@@ -1 +1 @@
1
- {"version":3,"file":"layout_node_graph.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/node-graph/visual/layout/layout_node_graph.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,2FANW,sBAAsB;WACZ,MAAM;YAAU,MAAM;eAAa,MAAM;EA+C7D;AAED;;;;;;;;;;;GAWG;AACH,sGAHW,sBAAsB,GACpB,IAAI,CA2BhB;uCA3HsC,6BAA6B"}
1
+ {"version":3,"file":"layout_node_graph.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/node-graph/visual/layout/layout_node_graph.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,2FANW,sBAAsB;WACZ,MAAM;YAAU,MAAM;eAAa,MAAM;EAmD7D;AAqCD;;;;;;;;;;;GAWG;AACH,sGAHW,sBAAsB,GACpB,IAAI,CA2BhB;uCArKsC,6BAA6B"}