@woosh/meep-engine 3.29.0 → 3.30.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 (226) hide show
  1. package/build/bundle-worker-image-decoder.js +1 -1
  2. package/build/bundle-worker-terrain.js +1 -1
  3. package/package.json +1 -1
  4. package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
  5. package/src/core/binary/BinaryBuffer.js +14 -2
  6. package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
  7. package/src/core/bvh2/bvh3/BVH.js +14 -1
  8. package/src/core/cache/FrequencySketch.d.ts +3 -1
  9. package/src/core/cache/FrequencySketch.d.ts.map +1 -1
  10. package/src/core/cache/FrequencySketch.js +10 -4
  11. package/src/core/cache/wtinylfu/CacheWTinylfu.d.ts.map +1 -1
  12. package/src/core/cache/wtinylfu/CacheWTinylfu.js +24 -2
  13. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compute_vertex_quadrics.d.ts +20 -0
  14. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compute_vertex_quadrics.d.ts.map +1 -1
  15. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compute_vertex_quadrics.js +69 -4
  16. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.d.ts +48 -18
  17. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.d.ts.map +1 -1
  18. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.js +262 -70
  19. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_fold_limit.d.ts +25 -0
  20. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_fold_limit.d.ts.map +1 -0
  21. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_fold_limit.js +228 -0
  22. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_would_fold.d.ts +13 -0
  23. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_would_fold.d.ts.map +1 -1
  24. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_would_fold.js +10 -128
  25. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_build_face_bvh.d.ts.map +1 -1
  26. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_build_face_bvh.js +11 -1
  27. package/src/core/graph/mn_graph_collapse_weighted_edge.js +6 -6
  28. package/src/core/math/lookup/ParameterLookupTable.d.ts.map +1 -1
  29. package/src/core/math/lookup/ParameterLookupTable.js +10 -5
  30. package/src/core/math/noise/sdnoise.d.ts.map +1 -1
  31. package/src/core/math/noise/sdnoise.js +16 -10
  32. package/src/core/model/object/ImmutableObjectPool.d.ts.map +1 -1
  33. package/src/core/model/object/ImmutableObjectPool.js +17 -7
  34. package/src/core/process/executor/ConcurrentExecutor.d.ts +1 -5
  35. package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
  36. package/src/core/process/executor/ConcurrentExecutor.js +95 -1
  37. package/src/core/process/task/task_find_dependency_cycle.d.ts +17 -0
  38. package/src/core/process/task/task_find_dependency_cycle.d.ts.map +1 -0
  39. package/src/core/process/task/task_find_dependency_cycle.js +81 -0
  40. package/src/core/wfc/WFCCellChoice.d.ts +17 -0
  41. package/src/core/wfc/WFCCellChoice.d.ts.map +1 -0
  42. package/src/core/wfc/WFCCellChoice.js +36 -0
  43. package/src/core/wfc/WFCLattice.d.ts +105 -0
  44. package/src/core/wfc/WFCLattice.d.ts.map +1 -0
  45. package/src/core/wfc/WFCLattice.js +235 -0
  46. package/src/core/wfc/WFCRuleTable.d.ts +172 -0
  47. package/src/core/wfc/WFCRuleTable.d.ts.map +1 -0
  48. package/src/core/wfc/WFCRuleTable.js +334 -0
  49. package/src/core/wfc/WFCState.d.ts +273 -0
  50. package/src/core/wfc/WFCState.d.ts.map +1 -0
  51. package/src/core/wfc/WFCState.js +552 -0
  52. package/src/core/wfc/WFCStatus.d.ts +11 -0
  53. package/src/core/wfc/WFCStatus.d.ts.map +1 -0
  54. package/src/core/wfc/WFCStatus.js +28 -0
  55. package/src/core/wfc/WFCTileWeights.d.ts +48 -0
  56. package/src/core/wfc/WFCTileWeights.d.ts.map +1 -0
  57. package/src/core/wfc/WFCTileWeights.js +86 -0
  58. package/src/core/wfc/WFC_UNRESOLVED.d.ts +12 -0
  59. package/src/core/wfc/WFC_UNRESOLVED.d.ts.map +1 -0
  60. package/src/core/wfc/WFC_UNRESOLVED.js +11 -0
  61. package/src/core/wfc/wfc_estimate_bytes.d.ts +24 -0
  62. package/src/core/wfc/wfc_estimate_bytes.d.ts.map +1 -0
  63. package/src/core/wfc/wfc_estimate_bytes.js +47 -0
  64. package/src/core/wfc/wfc_rule_table_tile_components.d.ts +27 -0
  65. package/src/core/wfc/wfc_rule_table_tile_components.d.ts.map +1 -0
  66. package/src/core/wfc/wfc_rule_table_tile_components.js +80 -0
  67. package/src/core/wfc/wfc_solve.d.ts +21 -0
  68. package/src/core/wfc/wfc_solve.d.ts.map +1 -0
  69. package/src/core/wfc/wfc_solve.js +154 -0
  70. package/src/core/wfc/wfc_state_apply_boundary.d.ts +18 -0
  71. package/src/core/wfc/wfc_state_apply_boundary.d.ts.map +1 -0
  72. package/src/core/wfc/wfc_state_apply_boundary.js +61 -0
  73. package/src/core/wfc/wfc_state_assign.d.ts +11 -0
  74. package/src/core/wfc/wfc_state_assign.d.ts.map +1 -0
  75. package/src/core/wfc/wfc_state_assign.js +36 -0
  76. package/src/core/wfc/wfc_state_ban_bits.d.ts +17 -0
  77. package/src/core/wfc/wfc_state_ban_bits.d.ts.map +1 -0
  78. package/src/core/wfc/wfc_state_ban_bits.js +81 -0
  79. package/src/core/wfc/wfc_state_collapse.d.ts +12 -0
  80. package/src/core/wfc/wfc_state_collapse.d.ts.map +1 -0
  81. package/src/core/wfc/wfc_state_collapse.js +73 -0
  82. package/src/core/wfc/wfc_state_flush_dirty.d.ts +12 -0
  83. package/src/core/wfc/wfc_state_flush_dirty.d.ts.map +1 -0
  84. package/src/core/wfc/wfc_state_flush_dirty.js +39 -0
  85. package/src/core/wfc/wfc_state_propagate.d.ts +14 -0
  86. package/src/core/wfc/wfc_state_propagate.d.ts.map +1 -0
  87. package/src/core/wfc/wfc_state_propagate.js +155 -0
  88. package/src/core/wfc/wfc_state_read.d.ts +11 -0
  89. package/src/core/wfc/wfc_state_read.d.ts.map +1 -0
  90. package/src/core/wfc/wfc_state_read.js +38 -0
  91. package/src/core/wfc/wfc_state_restrict.d.ts +18 -0
  92. package/src/core/wfc/wfc_state_restrict.d.ts.map +1 -0
  93. package/src/core/wfc/wfc_state_restrict.js +39 -0
  94. package/src/core/wfc/wfc_state_set_eligible.d.ts +24 -0
  95. package/src/core/wfc/wfc_state_set_eligible.d.ts.map +1 -0
  96. package/src/core/wfc/wfc_state_set_eligible.js +49 -0
  97. package/src/core/wfc/wfc_state_undo_to.d.ts +13 -0
  98. package/src/core/wfc/wfc_state_undo_to.d.ts.map +1 -0
  99. package/src/core/wfc/wfc_state_undo_to.js +84 -0
  100. package/src/core/wfc/wfc_words_per_cell.d.ts +11 -0
  101. package/src/core/wfc/wfc_words_per_cell.d.ts.map +1 -0
  102. package/src/core/wfc/wfc_words_per_cell.js +16 -0
  103. package/src/engine/ecs/EntityComponentDataset.d.ts +8 -0
  104. package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
  105. package/src/engine/ecs/EntityComponentDataset.js +37 -14
  106. package/src/engine/ecs/fow/FogOfWarRevealerSystem.d.ts +8 -1
  107. package/src/engine/ecs/fow/FogOfWarRevealerSystem.d.ts.map +1 -1
  108. package/src/engine/ecs/fow/FogOfWarRevealerSystem.js +37 -2
  109. package/src/engine/ecs/guid/UUID.d.ts.map +1 -1
  110. package/src/engine/ecs/guid/UUID.js +45 -17
  111. package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.d.ts.map +1 -1
  112. package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +3 -1
  113. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts.map +1 -1
  114. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js +366 -360
  115. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_linear.d.ts.map +1 -1
  116. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_linear.js +24 -10
  117. package/src/engine/grid/grid2transform/GridPosition2TransformSystem.d.ts.map +1 -1
  118. package/src/engine/grid/grid2transform/GridPosition2TransformSystem.js +24 -5
  119. package/src/engine/interpolation/Interpoland.d.ts +7 -1
  120. package/src/engine/interpolation/Interpoland.d.ts.map +1 -1
  121. package/src/engine/interpolation/Interpoland.js +8 -1
  122. package/src/engine/interpolation/InterpolationSystem.d.ts.map +1 -1
  123. package/src/engine/interpolation/InterpolationSystem.js +3 -0
  124. package/src/engine/interpolation/TransformPoseSerializationAdapter.d.ts +5 -3
  125. package/src/engine/interpolation/TransformPoseSerializationAdapter.d.ts.map +1 -1
  126. package/src/engine/interpolation/TransformPoseSerializationAdapter.js +14 -3
  127. package/src/engine/interpolation/pose_interpoland.d.ts.map +1 -1
  128. package/src/engine/interpolation/pose_interpoland.js +2 -0
  129. package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
  130. package/src/engine/network/orchestrator/NetworkPeer.js +15 -10
  131. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
  132. package/src/engine/physics/cloth/ecs/ClothWorld.js +17 -0
  133. package/src/engine/physics/mls-mpm/MLS_MPM.d.ts.map +1 -1
  134. package/src/engine/physics/mls-mpm/MLS_MPM.js +14 -0
  135. package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts +2 -1
  136. package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts.map +1 -1
  137. package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +1 -1
  138. package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts +1 -0
  139. package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -1
  140. package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts +1 -0
  141. package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts.map +1 -1
  142. package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts +2 -1
  143. package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -1
  144. package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +12 -3
  145. package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts +1 -0
  146. package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts.map +1 -1
  147. package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +1 -0
  148. package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -1
  149. package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
  150. package/src/engine/sound/sopra/runtime/EventInstance.js +4 -1
  151. package/src/format/image/avif/av1/decode/decode_coefficients.d.ts.map +1 -1
  152. package/src/format/image/avif/av1/decode/decode_coefficients.js +248 -259
  153. package/src/format/image/avif/av1/decode/read_golomb.d.ts +21 -0
  154. package/src/format/image/avif/av1/decode/read_golomb.d.ts.map +1 -0
  155. package/src/format/image/avif/av1/decode/read_golomb.js +49 -0
  156. package/src/format/image/avif/av1/filter/loop_restoration.js +461 -451
  157. package/src/format/image/avif/av1/util/round2.d.ts +19 -2
  158. package/src/format/image/avif/av1/util/round2.d.ts.map +1 -1
  159. package/src/format/image/avif/av1/util/round2.js +51 -27
  160. package/src/format/image/avif/heif/parse_avif_file.js +24 -0
  161. package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts.map +1 -1
  162. package/src/shade/renderer/buffer/table/GPUTypedTable.js +14 -0
  163. package/src/shade/renderer/geometry/virtual/VIRTUAL_GEOMETRY_DESIGN.md +46 -3
  164. package/src/shade/renderer/geometry/virtual/WEDGE_PLAN_2026_09_18.md +91 -1
  165. package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.d.ts +0 -13
  166. package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.d.ts.map +1 -1
  167. package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.js +0 -15
  168. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js +5 -5
  169. package/src/shade/renderer/geometry/virtual/build/mesh/VGEO_DEFAULT_ATTRIBUTE_WEIGHT_RATIOS.d.ts +11 -1
  170. package/src/shade/renderer/geometry/virtual/build/mesh/VGEO_DEFAULT_ATTRIBUTE_WEIGHT_RATIOS.d.ts.map +1 -1
  171. package/src/shade/renderer/geometry/virtual/build/mesh/VGEO_DEFAULT_ATTRIBUTE_WEIGHT_RATIOS.js +11 -1
  172. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_compute_vertex_normals.d.ts +18 -9
  173. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_compute_vertex_normals.d.ts.map +1 -1
  174. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_compute_vertex_normals.js +20 -26
  175. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_normalize_source.d.ts +1 -3
  176. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_normalize_source.d.ts.map +1 -1
  177. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_normalize_source.js +2 -5
  178. package/src/shade/renderer/geometry/virtual/build/vgeo_build.js +1 -1
  179. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.d.ts.map +1 -1
  180. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.js +14 -1
  181. package/src/shade/renderer/global_illumination/probe/octahedral/GPUProbeAtlas.d.ts.map +1 -1
  182. package/src/shade/renderer/global_illumination/probe/octahedral/GPUProbeAtlas.js +12 -3
  183. package/src/shade/renderer/light/environment/rgbe/RGBE_ReadPixels_RLE.d.ts.map +1 -1
  184. package/src/shade/renderer/light/environment/rgbe/RGBE_ReadPixels_RLE.js +7 -1
  185. package/src/shade/renderer/lightmap/GPULightMap.d.ts.map +1 -1
  186. package/src/shade/renderer/lightmap/GPULightMap.js +349 -336
  187. package/src/shade/renderer/loader/gltf/load_gltf.d.ts.map +1 -1
  188. package/src/shade/renderer/loader/gltf/load_gltf.js +1137 -1128
  189. package/src/shade/renderer/particles/DESIGN.md +14 -5
  190. package/src/shade/renderer/particles/GPUParticleSystem.d.ts +25 -10
  191. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  192. package/src/shade/renderer/particles/GPUParticleSystem.js +182 -38
  193. package/src/shade/renderer/particles/graph/groups/simplex_reference.d.ts.map +1 -1
  194. package/src/shade/renderer/particles/graph/groups/simplex_reference.js +16 -10
  195. package/src/shade/renderer/particles/graph_particles.d.ts +4 -2
  196. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  197. package/src/shade/renderer/particles/graph_particles.js +8 -2
  198. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts.map +1 -1
  199. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.js +8 -2
  200. package/src/shade/renderer/particles/optimizer/pass_fold_constants.d.ts.map +1 -1
  201. package/src/shade/renderer/particles/optimizer/pass_fold_constants.js +10 -4
  202. package/src/shade/renderer/particles/shaders/shader_particle_init_free_list.d.ts +31 -0
  203. package/src/shade/renderer/particles/shaders/shader_particle_init_free_list.d.ts.map +1 -0
  204. package/src/shade/renderer/particles/shaders/shader_particle_init_free_list.js +62 -0
  205. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts +13 -0
  206. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts.map +1 -1
  207. package/src/shade/renderer/particles/vm/ParticleVMReference.js +95 -17
  208. package/src/shade/renderer/rasterize/bucket/rasterization_has_opaque_bucket.d.ts +21 -0
  209. package/src/shade/renderer/rasterize/bucket/rasterization_has_opaque_bucket.d.ts.map +1 -0
  210. package/src/shade/renderer/rasterize/bucket/rasterization_has_opaque_bucket.js +28 -0
  211. package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.d.ts.map +1 -1
  212. package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.js +19 -2
  213. package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.d.ts.map +1 -1
  214. package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.js +19 -2
  215. package/src/shade/renderer/shader/type/WebGPUStruct.d.ts.map +1 -1
  216. package/src/shade/renderer/shader/type/WebGPUStruct.js +12 -0
  217. package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.d.ts +8 -2
  218. package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.d.ts.map +1 -1
  219. package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +41 -6
  220. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +2383 -2356
  221. package/src/view/tooltip/DomTooltipManager.d.ts +7 -0
  222. package/src/view/tooltip/DomTooltipManager.d.ts.map +1 -1
  223. package/src/view/tooltip/DomTooltipManager.js +22 -0
  224. package/src/view/tooltip/DomTooltipObserver.d.ts.map +1 -1
  225. package/src/view/tooltip/DomTooltipObserver.js +13 -3
  226. package/src/shade/renderer/geometry/virtual/build/mesh/VGEO_CREASE_ANGLE.js +0 -45
@@ -0,0 +1,273 @@
1
+ /**
2
+ * Everything a solve mutates: the wave, the aggregates derived from it, the propagation queue, the
3
+ * undo trail and the decision stack.
4
+ *
5
+ * All of it lives in the object, which is what makes {@link wfc_solve} resumable — a call that
6
+ * runs out of budget mid-propagation leaves its work here and the next call continues from it.
7
+ *
8
+ * Build one per solve. The {@link WFCRuleTable}, {@link WFCLattice} and {@link WFCTileWeights} it
9
+ * is given are read-only to it and can be shared across many.
10
+ *
11
+ * @author Alex Goldring
12
+ * @copyright Company Named Limited (c) 2026
13
+ */
14
+ export class WFCState {
15
+ /**
16
+ * @param {WFCRuleTable} rules must be finalized
17
+ * @param {WFCLattice} lattice must have the same direction count as `rules`
18
+ * @param {WFCTileWeights} weights must have the same tile count as `rules`
19
+ * @param {function():number} random RNG returning values in `[0, 1)`. Consumed once here and
20
+ * once per collapse, so a seeded generator reproduces a solve exactly.
21
+ * @param {WFCCellChoice} [cell_choice] defaults to {@link WFCCellChoice.SCANLINE}
22
+ */
23
+ constructor(rules: WFCRuleTable, lattice: WFCLattice, weights: WFCTileWeights, random: () => number, cell_choice?: WFCCellChoice);
24
+ /** @type {WFCRuleTable} */
25
+ rules: WFCRuleTable;
26
+ /** @type {WFCLattice} */
27
+ lattice: WFCLattice;
28
+ /** @type {WFCTileWeights} */
29
+ weights: WFCTileWeights;
30
+ /** @type {function():number} */
31
+ random: () => number;
32
+ /** @type {WFCCellChoice} */
33
+ cell_choice: WFCCellChoice;
34
+ /** @type {number} */
35
+ cell_count: number;
36
+ /** @type {number} */
37
+ tile_count: number;
38
+ /** @type {number} */
39
+ words_per_cell: number;
40
+ /** @type {number} */
41
+ direction_count: number;
42
+ /**
43
+ * A domain with every tile in it, tail-masked.
44
+ * @type {Uint32Array}
45
+ */
46
+ full_mask: Uint32Array;
47
+ /**
48
+ * Seeds the per-cell tie-break that separates cells of equal score. Drawn from `random`,
49
+ * so a seeded generator reproduces the whole solve.
50
+ * @type {number}
51
+ * @private
52
+ */
53
+ private __noise_seed;
54
+ /**
55
+ * @type {number}
56
+ * @private
57
+ */
58
+ private __jitter_scale;
59
+ /**
60
+ * Single backing buffer for every per-cell array.
61
+ * @type {ArrayBuffer}
62
+ * @private
63
+ */
64
+ private __data_buffer;
65
+ /**
66
+ * Sum of the weights still possible in each cell.
67
+ *
68
+ * Maintained incrementally and therefore subject to drift; only the entropy heuristic
69
+ * reads it, and {@link wfc_state_collapse} recomputes the sum exactly rather than trusting
70
+ * it.
71
+ * @type {Float64Array}
72
+ */
73
+ weight_sum: Float64Array;
74
+ /**
75
+ * Sum of `w·ln(w)` over the weights still possible in each cell.
76
+ * @type {Float64Array}
77
+ */
78
+ weight_log_sum: Float64Array;
79
+ /**
80
+ * `words_per_cell` bits per cell: is tile `t` still possible here?
81
+ * @type {Uint32Array}
82
+ */
83
+ wave: Uint32Array;
84
+ /**
85
+ * Population count of each cell's domain, cached rather than recomputed.
86
+ * @type {Uint32Array}
87
+ */
88
+ possibility_count: Uint32Array;
89
+ /**
90
+ * Cells whose domain shrank and whose neighbours have not been relaxed against them yet.
91
+ * Bounded at `cell_count` because {@link in_queue} de-duplicates.
92
+ * @type {Uint32Array}
93
+ */
94
+ queue: Uint32Array;
95
+ /**
96
+ * Cells whose selection score changed during the current wave. Flushed to the heap once
97
+ * per wave rather than once per banned tile.
98
+ * @type {Uint32Array}
99
+ */
100
+ dirty_list: Uint32Array;
101
+ /** @type {Uint8Array} */
102
+ in_queue: Uint8Array;
103
+ /** @type {Uint8Array} */
104
+ dirty: Uint8Array;
105
+ /**
106
+ * May the solver choose to collapse this cell? Cells outside the eligible set still
107
+ * constrain their neighbours through propagation; they are simply never selected.
108
+ * @type {Uint8Array}
109
+ */
110
+ eligible: Uint8Array;
111
+ /** @type {number} */
112
+ queue_count: number;
113
+ /** @type {number} */
114
+ dirty_count: number;
115
+ /**
116
+ * `(address, removed_bits)` pairs, in the order they were applied.
117
+ * @type {Uint32Array}
118
+ * @private
119
+ */
120
+ private __trail;
121
+ /**
122
+ * Entries, not words.
123
+ * @type {number}
124
+ * @private
125
+ */
126
+ private __trail_length;
127
+ /**
128
+ * `(cell, trail_mark, tried_tile)` triples.
129
+ * @type {Uint32Array}
130
+ * @private
131
+ */
132
+ private __decisions;
133
+ /** @type {number} @private */
134
+ private __decision_count;
135
+ /**
136
+ * Scratch for the propagator: the target bits not yet known to be supported.
137
+ * Owned by the state rather than the module, so two solves can interleave.
138
+ * @type {Uint32Array}
139
+ * @private
140
+ */
141
+ private __uncovered;
142
+ /**
143
+ * Set by {@link wfc_state_ban_bits} when a cell's domain empties. Checked once per
144
+ * relaxation rather than returned through every call.
145
+ * @type {boolean}
146
+ */
147
+ contradiction: boolean;
148
+ /**
149
+ * Eligible cells that still have more than one possibility. The solve is finished when it
150
+ * reaches zero.
151
+ * @type {number}
152
+ */
153
+ undecided_eligible: number;
154
+ /** @type {number} */
155
+ backtrack_count: number;
156
+ /**
157
+ * High-water mark of {@link __trail_length}, in entries — what a pathological rule set
158
+ * costs in memory.
159
+ * @type {number}
160
+ */
161
+ trail_peak: number;
162
+ /**
163
+ * Where {@link WFCCellChoice.SCANLINE} has reached.
164
+ * @type {number}
165
+ * @private
166
+ */
167
+ private __scan_cursor;
168
+ /**
169
+ * Present only for the policies that need a priority queue.
170
+ * @type {IndexedFloatMinHeap|null}
171
+ */
172
+ heap: IndexedFloatMinHeap | null;
173
+ /**
174
+ * Bytes held by the per-cell arrays. The heap, trail and decision stack are separate and grow.
175
+ * @returns {number}
176
+ */
177
+ get byte_size(): number;
178
+ /**
179
+ * Trail entries currently recorded.
180
+ * @returns {number}
181
+ */
182
+ get trail_length(): number;
183
+ /**
184
+ * Decisions currently on the stack — the depth of the search.
185
+ * @returns {number}
186
+ */
187
+ get decision_count(): number;
188
+ /**
189
+ * Selection score of a cell under the current {@link WFCCellChoice}; lower is chosen sooner.
190
+ *
191
+ * @param {number} cell
192
+ * @returns {number}
193
+ */
194
+ score_of(cell: number): number;
195
+ /**
196
+ * Make everything decided so far permanent: drop the decision stack and the undo trail, so no
197
+ * later contradiction can rewind past this point.
198
+ *
199
+ * The wave is untouched — this is about what the *search* may reconsider, not what the grid
200
+ * holds. Afterwards a contradiction reports {@link WFCStatus.UNSATISFIABLE} rather than
201
+ * dismantling work already treated as finished.
202
+ */
203
+ commit(): void;
204
+ /**
205
+ * Rebuild the selection queue and the undecided count from the current wave.
206
+ *
207
+ * Called at construction, and by {@link wfc_state_set_eligible} when the eligible set changes.
208
+ *
209
+ * @param {Uint32Array|number[]} [cells] the eligible set when it is already known, which makes
210
+ * the rebuild proportional to it rather than to the whole grid. Must not repeat a cell;
211
+ * {@link wfc_state_set_eligible} asserts that.
212
+ */
213
+ reseed_selection(cells?: Uint32Array | number[]): void;
214
+ /**
215
+ * Record that `bits` were cleared at `address`, so backtracking can put them back.
216
+ *
217
+ * @param {number} address `cell * words_per_cell + word`
218
+ * @param {number} bits the bits that were actually cleared
219
+ */
220
+ trail_push(address: number, bits: number): void;
221
+ /**
222
+ * @param {number} entry
223
+ * @returns {number} the address written by that trail entry
224
+ */
225
+ trail_address(entry: number): number;
226
+ /**
227
+ * @param {number} entry
228
+ * @returns {number} the bits that entry cleared
229
+ */
230
+ trail_bits(entry: number): number;
231
+ /**
232
+ * Drop trail entries above `length`. The caller has already restored the wave from them.
233
+ * @param {number} length
234
+ */
235
+ trail_truncate(length: number): void;
236
+ /**
237
+ * Push a decision the search can return to.
238
+ *
239
+ * `trail_mark` is taken before the collapse and `tile` is only known after it, so the caller
240
+ * passes both rather than this reading the current trail length.
241
+ *
242
+ * @param {number} cell
243
+ * @param {number} trail_mark trail length immediately before the collapse
244
+ * @param {number} tile
245
+ */
246
+ decision_push(cell: number, trail_mark: number, tile: number): void;
247
+ /**
248
+ * Remove the newest decision and report it.
249
+ *
250
+ * @param {Uint32Array|number[]} out receives `[cell, trail_mark, tried_tile]`
251
+ * @returns {boolean} false when the stack was already empty
252
+ */
253
+ decision_pop(out: Uint32Array | number[]): boolean;
254
+ /**
255
+ * Scratch for {@link wfc_state_propagate}.
256
+ * @returns {Uint32Array}
257
+ */
258
+ get uncovered(): Uint32Array;
259
+ /**
260
+ * @param {number} v
261
+ */
262
+ set scan_cursor(v: number);
263
+ /**
264
+ * @returns {number}
265
+ */
266
+ get scan_cursor(): number;
267
+ }
268
+ import { WFCRuleTable } from "./WFCRuleTable.js";
269
+ import { WFCLattice } from "./WFCLattice.js";
270
+ import { WFCTileWeights } from "./WFCTileWeights.js";
271
+ import { WFCCellChoice } from "./WFCCellChoice.js";
272
+ import { IndexedFloatMinHeap } from "../collection/heap/IndexedFloatMinHeap.js";
273
+ //# sourceMappingURL=WFCState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WFCState.d.ts","sourceRoot":"","sources":["../../../../src/core/wfc/WFCState.js"],"names":[],"mappings":"AA0CA;;;;;;;;;;;;GA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