@woosh/meep-engine 2.168.0 → 2.169.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 (295) hide show
  1. package/README.md +2 -2
  2. package/build/bundle-worker-image-decoder.js +1 -1
  3. package/package.json +1 -1
  4. package/src/REVIEW_2026_08_06/adv-core.md +511 -0
  5. package/src/REVIEW_2026_08_06/adv-gfx.md +480 -0
  6. package/src/REVIEW_2026_08_06/adv-view.md +446 -0
  7. package/src/REVIEW_2026_08_06/api-core.md +296 -0
  8. package/src/REVIEW_2026_08_06/api-engine.md +195 -0
  9. package/src/REVIEW_2026_08_06/bvh-phys-sound-net.md +507 -0
  10. package/src/REVIEW_2026_08_06/core-binary.md +348 -0
  11. package/src/REVIEW_2026_08_06/core-collection.md +376 -0
  12. package/src/REVIEW_2026_08_06/core-math.md +221 -0
  13. package/src/REVIEW_2026_08_06/core-process.md +266 -0
  14. package/src/REVIEW_2026_08_06/core-science.md +223 -0
  15. package/src/REVIEW_2026_08_06/engine-ai-nav.md +279 -0
  16. package/src/REVIEW_2026_08_06/engine-animation.md +167 -0
  17. package/src/REVIEW_2026_08_06/engine-asset.md +166 -0
  18. package/src/REVIEW_2026_08_06/engine-ecs.md +920 -0
  19. package/src/REVIEW_2026_08_06/engine-input.md +197 -0
  20. package/src/REVIEW_2026_08_06/engine-misc.md +248 -0
  21. package/src/REVIEW_2026_08_06/engine-terrain.md +52 -0
  22. package/src/REVIEW_2026_08_06/generation.md +176 -0
  23. package/src/REVIEW_2026_08_06/geom-2d.md +434 -0
  24. package/src/REVIEW_2026_08_06/geom-3d.md +117 -0
  25. package/src/REVIEW_2026_08_06/gfx-gi.md +143 -0
  26. package/src/REVIEW_2026_08_06/gfx-render.md +740 -0
  27. package/src/REVIEW_2026_08_06/gfx-texture.md +690 -0
  28. package/src/REVIEW_2026_08_06/prior-criticals.md +49 -0
  29. package/src/REVIEW_2026_08_06/prior-highs.md +138 -0
  30. package/src/REVIEW_2026_08_06/test-gaps.md +364 -0
  31. package/src/REVIEW_2026_08_06/view.md +667 -0
  32. package/src/REVIEW_2026_08_06.md +571 -0
  33. package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
  34. package/src/core/binary/BinaryBuffer.js +12 -1
  35. package/src/core/binary/BitImage2.d.ts +5 -1
  36. package/src/core/binary/BitImage2.d.ts.map +1 -1
  37. package/src/core/binary/BitImage2.js +5 -1
  38. package/src/core/bvh8/build/NodeProxy.d.ts.map +1 -1
  39. package/src/core/bvh8/build/NodeProxy.js +314 -308
  40. package/src/core/collection/list/List.d.ts +15 -0
  41. package/src/core/collection/list/List.d.ts.map +1 -1
  42. package/src/core/collection/list/List.js +34 -0
  43. package/src/core/collection/list/SortedListProjection.d.ts.map +1 -1
  44. package/src/core/collection/list/SortedListProjection.js +4 -1
  45. package/src/core/collection/map/BiMap.d.ts +25 -2
  46. package/src/core/collection/map/BiMap.d.ts.map +1 -1
  47. package/src/core/collection/map/BiMap.js +57 -3
  48. package/src/core/debug/matchers/IsAnything.d.ts.map +1 -1
  49. package/src/core/debug/matchers/IsAnything.js +5 -1
  50. package/src/core/events/signal/Signal.d.ts.map +1 -1
  51. package/src/core/events/signal/Signal.js +3 -1
  52. package/src/core/geom/2d/polygon/TRIANGULATION_DESIGN.md +433 -0
  53. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.d.ts +31 -0
  54. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.d.ts.map +1 -0
  55. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.js +84 -0
  56. package/src/core/geom/2d/polygon/polygon2_signed_area.d.ts +24 -2
  57. package/src/core/geom/2d/polygon/polygon2_signed_area.d.ts.map +1 -1
  58. package/src/core/geom/2d/polygon/polygon2_signed_area.js +52 -34
  59. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts +28 -0
  60. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts.map +1 -0
  61. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.js +86 -0
  62. package/src/core/geom/2d/polygon/polygon2_triangulate.d.ts +40 -0
  63. package/src/core/geom/2d/polygon/polygon2_triangulate.d.ts.map +1 -0
  64. package/src/core/geom/2d/polygon/polygon2_triangulate.js +1280 -0
  65. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.d.ts +28 -0
  66. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.d.ts.map +1 -0
  67. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.js +77 -0
  68. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts +6 -3
  69. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts.map +1 -1
  70. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.js +26 -13
  71. package/src/core/geom/2d/triangle/tri2_signed_area.d.ts +17 -1
  72. package/src/core/geom/2d/triangle/tri2_signed_area.d.ts.map +1 -1
  73. package/src/core/geom/2d/triangle/tri2_signed_area.js +35 -23
  74. package/src/core/geom/2d/v2_morton_encode.d.ts +20 -0
  75. package/src/core/geom/2d/v2_morton_encode.d.ts.map +1 -0
  76. package/src/core/geom/2d/v2_morton_encode.js +23 -0
  77. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts.map +1 -1
  78. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.js +4 -1
  79. package/src/core/geom/3d/polygon/polygon3_compute_normal.d.ts +27 -0
  80. package/src/core/geom/3d/polygon/polygon3_compute_normal.d.ts.map +1 -0
  81. package/src/core/geom/3d/polygon/polygon3_compute_normal.js +60 -0
  82. package/src/core/geom/3d/polygon/polygon3_triangulate.d.ts +34 -0
  83. package/src/core/geom/3d/polygon/polygon3_triangulate.d.ts.map +1 -0
  84. package/src/core/geom/3d/polygon/polygon3_triangulate.js +94 -0
  85. package/src/core/geom/3d/quaternion/quat3_multiply.d.ts +8 -2
  86. package/src/core/geom/3d/quaternion/quat3_multiply.d.ts.map +1 -1
  87. package/src/core/geom/3d/quaternion/quat3_multiply.js +8 -2
  88. package/src/core/geom/3d/shape/ConvexHullShape3D.d.ts.map +1 -1
  89. package/src/core/geom/3d/shape/ConvexHullShape3D.js +32 -2
  90. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts +23 -6
  91. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts.map +1 -1
  92. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.js +268 -124
  93. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.d.ts +17 -0
  94. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.d.ts.map +1 -0
  95. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.js +44 -0
  96. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.d.ts +20 -0
  97. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.d.ts.map +1 -0
  98. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.js +40 -0
  99. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.d.ts +19 -0
  100. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.d.ts.map +1 -0
  101. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.js +34 -0
  102. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.d.ts +22 -0
  103. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.d.ts.map +1 -0
  104. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.js +37 -0
  105. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.d.ts +87 -0
  106. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.d.ts.map +1 -0
  107. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.js +599 -0
  108. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.d.ts +32 -0
  109. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.d.ts.map +1 -1
  110. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.js +66 -7
  111. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.d.ts +22 -1
  112. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.d.ts.map +1 -1
  113. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.js +83 -38
  114. package/src/core/geom/MANIFOLD_COMPARISON_2026_08_01.md +554 -0
  115. package/src/core/geom/vec3/v3_cotangent.d.ts +6 -2
  116. package/src/core/geom/vec3/v3_cotangent.d.ts.map +1 -1
  117. package/src/core/geom/vec3/v3_cotangent.js +6 -2
  118. package/src/core/geom/vec3/v3_cross.d.ts +6 -2
  119. package/src/core/geom/vec3/v3_cross.d.ts.map +1 -1
  120. package/src/core/geom/vec3/v3_cross.js +6 -2
  121. package/src/core/geom/vec3/v3_multiply.d.ts +6 -2
  122. package/src/core/geom/vec3/v3_multiply.d.ts.map +1 -1
  123. package/src/core/geom/vec3/v3_multiply.js +6 -2
  124. package/src/core/geom/vec3/v3_subtract.d.ts +6 -2
  125. package/src/core/geom/vec3/v3_subtract.d.ts.map +1 -1
  126. package/src/core/geom/vec3/v3_subtract.js +6 -2
  127. package/src/core/localization/Localization.js +1 -1
  128. package/src/core/math/random/randomSeed.d.ts +13 -0
  129. package/src/core/math/random/randomSeed.d.ts.map +1 -0
  130. package/src/core/math/random/randomSeed.js +16 -0
  131. package/src/core/math/spline/spline3_hermite_apply_transform.d.ts +50 -0
  132. package/src/core/math/spline/spline3_hermite_apply_transform.d.ts.map +1 -0
  133. package/src/core/math/spline/spline3_hermite_apply_transform.js +107 -0
  134. package/src/core/math/spline/spline3_hermite_reverse.d.ts +34 -0
  135. package/src/core/math/spline/spline3_hermite_reverse.d.ts.map +1 -0
  136. package/src/core/math/spline/spline3_hermite_reverse.js +49 -0
  137. package/src/core/math/statistics/hammersley_sequence.d.ts +17 -4
  138. package/src/core/math/statistics/hammersley_sequence.d.ts.map +1 -1
  139. package/src/core/math/statistics/hammersley_sequence.js +25 -16
  140. package/src/core/process/Future.d.ts.map +1 -1
  141. package/src/core/process/Future.js +12 -0
  142. package/src/core/process/PromiseWatcher.d.ts.map +1 -1
  143. package/src/core/process/PromiseWatcher.js +9 -2
  144. package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
  145. package/src/core/process/executor/ConcurrentExecutor.js +12 -2
  146. package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
  147. package/src/core/process/worker/WorkerProxy.js +5 -2
  148. package/src/core/process/worker/extractTransferables.d.ts.map +1 -1
  149. package/src/core/process/worker/extractTransferables.js +4 -1
  150. package/src/engine/Engine.d.ts +12 -12
  151. package/src/engine/Engine.d.ts.map +1 -1
  152. package/src/engine/Engine.js +149 -10
  153. package/src/engine/EngineHarness.d.ts.map +1 -1
  154. package/src/engine/EngineHarness.js +4 -1
  155. package/src/engine/asset/loaders/ArrayBufferLoader.d.ts.map +1 -1
  156. package/src/engine/asset/loaders/ArrayBufferLoader.js +7 -0
  157. package/src/engine/ecs/speaker/lines/sets/LineSetDescription.d.ts.map +1 -1
  158. package/src/engine/ecs/speaker/lines/sets/LineSetDescription.js +3 -1
  159. package/src/engine/ecs/terrain/ecs/TerrainSystem.d.ts.map +1 -1
  160. package/src/engine/ecs/terrain/ecs/TerrainSystem.js +4 -1
  161. package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts +29 -0
  162. package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
  163. package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +84 -23
  164. package/src/engine/graphics/CONTEXT_LOSS_RECOVERY_PLAN.md +446 -0
  165. package/src/engine/graphics/GraphicsEngine.d.ts +56 -7
  166. package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
  167. package/src/engine/graphics/GraphicsEngine.js +196 -24
  168. package/src/engine/graphics/context/WebGLContextFailureReason.d.ts +9 -0
  169. package/src/engine/graphics/context/WebGLContextFailureReason.d.ts.map +1 -0
  170. package/src/engine/graphics/context/WebGLContextFailureReason.js +17 -0
  171. package/src/engine/graphics/context/WebGLContextMonitor.d.ts +106 -0
  172. package/src/engine/graphics/context/WebGLContextMonitor.d.ts.map +1 -0
  173. package/src/engine/graphics/context/WebGLContextMonitor.js +341 -0
  174. package/src/engine/graphics/context/WebGLContextState.d.ts +14 -0
  175. package/src/engine/graphics/context/WebGLContextState.d.ts.map +1 -0
  176. package/src/engine/graphics/context/WebGLContextState.js +24 -0
  177. package/src/engine/graphics/context/testWebGLContextLoss.d.ts +2 -0
  178. package/src/engine/graphics/context/testWebGLContextLoss.d.ts.map +1 -0
  179. package/src/engine/graphics/context/testWebGLContextLoss.js +696 -0
  180. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.d.ts.map +1 -1
  181. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.js +68 -32
  182. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.d.ts +14 -0
  183. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.d.ts.map +1 -0
  184. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.js +41 -0
  185. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +1 -1
  186. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
  187. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +5 -0
  188. package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts +5 -1
  189. package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts.map +1 -1
  190. package/src/engine/graphics/ecs/trail2d/Trail2D.js +15 -0
  191. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +1 -1
  192. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts.map +1 -1
  193. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +2 -1
  194. package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts +4 -1
  195. package/src/engine/graphics/ecs/trail3d/Trail3D.d.ts.map +1 -1
  196. package/src/engine/graphics/ecs/trail3d/Trail3D.js +488 -476
  197. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts +1 -1
  198. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts.map +1 -1
  199. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.js +280 -253
  200. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.d.ts.map +1 -1
  201. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +3 -2
  202. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
  203. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +3 -1
  204. package/src/engine/graphics/geometry/computeMeshSurfaceArea.js +1 -1
  205. package/src/engine/graphics/load_and_set_cubemap_v0.d.ts +5 -0
  206. package/src/engine/graphics/load_and_set_cubemap_v0.d.ts.map +1 -1
  207. package/src/engine/graphics/load_and_set_cubemap_v0.js +26 -21
  208. package/src/engine/graphics/particles/particular/group/ParticleGroup.d.ts.map +1 -1
  209. package/src/engine/graphics/particles/particular/group/ParticleGroup.js +19 -8
  210. package/src/engine/graphics/particles/particular/group/optimizeCommandQueue.js +1 -1
  211. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.d.ts.map +1 -1
  212. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.js +10 -3
  213. package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
  214. package/src/engine/graphics/texture/atlas/TextureAtlas.js +4 -1
  215. package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.d.ts.map +1 -1
  216. package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.js +11 -0
  217. package/src/engine/graphics/texture/cubemap/load_environment_map.d.ts.map +1 -1
  218. package/src/engine/graphics/texture/cubemap/load_environment_map.js +5 -2
  219. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.d.ts.map +1 -1
  220. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.js +26 -18
  221. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts +15 -2
  222. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts.map +1 -1
  223. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js +29 -3
  224. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.d.ts +11 -1
  225. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.d.ts.map +1 -1
  226. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js +158 -171
  227. package/src/engine/graphics/texture/sampler/sampler2d_paint.js +1 -1
  228. package/src/engine/graphics/texture/sampler/util/bitSet2Sampler2D.js +2 -2
  229. package/src/engine/input/ecs/util/TopDownCameraControllerHelper.d.ts.map +1 -1
  230. package/src/engine/input/ecs/util/TopDownCameraControllerHelper.js +10 -3
  231. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.d.ts +14 -0
  232. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.d.ts.map +1 -0
  233. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.js +38 -0
  234. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
  235. package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +433 -425
  236. package/src/engine/physics/constraint/solve_constraints.d.ts +4 -1
  237. package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
  238. package/src/engine/physics/constraint/solve_constraints.js +38 -13
  239. package/src/engine/physics/contact/ManifoldStore.d.ts +15 -3
  240. package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
  241. package/src/engine/physics/contact/ManifoldStore.js +15 -3
  242. package/src/engine/physics/ecs/Joint.d.ts +7 -4
  243. package/src/engine/physics/ecs/Joint.d.ts.map +1 -1
  244. package/src/engine/physics/ecs/Joint.js +7 -4
  245. package/src/engine/physics/ecs/PhysicsSystem.d.ts +14 -0
  246. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  247. package/src/engine/physics/ecs/PhysicsSystem.js +16 -0
  248. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  249. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
  250. package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts +15 -7
  251. package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts.map +1 -1
  252. package/src/engine/physics/narrowphase/convex_convex_manifold.js +33 -10
  253. package/src/engine/physics/narrowphase/refine_ray_concave.d.ts +6 -2
  254. package/src/engine/physics/narrowphase/refine_ray_concave.d.ts.map +1 -1
  255. package/src/engine/physics/narrowphase/refine_ray_concave.js +6 -2
  256. package/src/engine/physics/narrowphase/refine_ray_hit.d.ts +6 -2
  257. package/src/engine/physics/narrowphase/refine_ray_hit.d.ts.map +1 -1
  258. package/src/engine/physics/narrowphase/refine_ray_hit.js +6 -2
  259. package/src/engine/physics/queries/raycast.d.ts.map +1 -1
  260. package/src/engine/physics/queries/raycast.js +11 -4
  261. package/src/engine/save/storage/IndexedDBStorage.d.ts.map +1 -1
  262. package/src/engine/save/storage/IndexedDBStorage.js +21 -3
  263. package/src/engine/simulation/Ticker.d.ts +12 -0
  264. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  265. package/src/engine/simulation/Ticker.js +18 -0
  266. package/src/engine/sound/simulation/AcousticSimulator.d.ts.map +1 -1
  267. package/src/engine/sound/simulation/AcousticSimulator.js +9 -1
  268. package/src/engine/sound/simulation/core/VolumeField.d.ts +6 -2
  269. package/src/engine/sound/simulation/core/VolumeField.d.ts.map +1 -1
  270. package/src/engine/sound/simulation/core/VolumeField.js +6 -2
  271. package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts +6 -2
  272. package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts.map +1 -1
  273. package/src/engine/sound/simulation/probe/AcousticProbeField.js +6 -2
  274. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts +6 -2
  275. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts.map +1 -1
  276. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.js +6 -2
  277. package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts +3 -1
  278. package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts.map +1 -1
  279. package/src/engine/sound/simulation/probe/bakeProbeReflectors.js +3 -1
  280. package/src/engine/ui/GUIEngine.d.ts.map +1 -1
  281. package/src/engine/ui/GUIEngine.js +8 -1
  282. package/src/generation/theme/TerrainTheme.d.ts.map +1 -1
  283. package/src/generation/theme/TerrainTheme.js +2 -1
  284. package/src/generation/theme/ThemeEngine.d.ts.map +1 -1
  285. package/src/generation/theme/ThemeEngine.js +6 -5
  286. package/src/view/ViewGroup.d.ts.map +1 -1
  287. package/src/view/ViewGroup.js +9 -7
  288. package/src/view/graphics/WebGLContextFailureView.d.ts +19 -0
  289. package/src/view/graphics/WebGLContextFailureView.d.ts.map +1 -0
  290. package/src/view/graphics/WebGLContextFailureView.js +76 -0
  291. package/src/view/minimap/Minimap.d.ts +8 -0
  292. package/src/view/minimap/Minimap.d.ts.map +1 -1
  293. package/src/view/minimap/Minimap.js +16 -3
  294. package/src/view/minimap/dom/MinimapMarkerView.d.ts.map +1 -1
  295. package/src/view/minimap/dom/MinimapMarkerView.js +3 -1
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Exact winding test for a 2D contour: `true` when it is wound counter-clockwise.
3
+ *
4
+ * Decided by one exact orientation predicate at the contour's lexicographically
5
+ * smallest vertex. That vertex is necessarily on the convex hull, so the turn
6
+ * taken there is the contour's own turn direction -- no summation, no
7
+ * cancellation, and the answer does not depend on how far the contour sits from
8
+ * the origin.
9
+ *
10
+ * This is what {@link polygon2_signed_area} cannot give you. Its shoelace sum is
11
+ * a difference of terms of magnitude `O(|p|^2)` where the answer is the area, so
12
+ * for a small polygon far from the origin -- or a small polygon whose vertices are
13
+ * close together -- the computed sign is rounding noise. A 1e-9-sided square at
14
+ * (1, 1) already has a true area of 1e-18 against per-term rounding of ~1e-16: the
15
+ * sum's sign is then meaningless. Use the signed area when you want the area, and
16
+ * this when you want the winding.
17
+ *
18
+ * Coincident neighbours of the extreme vertex are stepped over, so a contour with
19
+ * duplicated points still answers correctly. A contour with no area at all (every
20
+ * vertex collinear, or all coincident) has no winding; it reports `false`.
21
+ *
22
+ * @param {ArrayLike<number>} points flat (x, y) pairs, stride 2
23
+ * @param {number} from first vertex index of the contour
24
+ * @param {number} count number of vertices in the contour
25
+ * @returns {boolean}
26
+ *
27
+ * @author Alex Goldring
28
+ * @copyright Company Named Limited (c) 2026
29
+ */
30
+ export function polygon2_is_counter_clockwise(points: ArrayLike<number>, from: number, count: number): boolean;
31
+ //# sourceMappingURL=polygon2_is_counter_clockwise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon2_is_counter_clockwise.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/polygon/polygon2_is_counter_clockwise.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,sDARW,UAAU,MAAM,CAAC,QACjB,MAAM,SACN,MAAM,GACJ,OAAO,CAyDnB"}
@@ -0,0 +1,84 @@
1
+ import { orient2d_indexed } from "../convex-hull/orient2d_indexed.js";
2
+
3
+ /**
4
+ * Exact winding test for a 2D contour: `true` when it is wound counter-clockwise.
5
+ *
6
+ * Decided by one exact orientation predicate at the contour's lexicographically
7
+ * smallest vertex. That vertex is necessarily on the convex hull, so the turn
8
+ * taken there is the contour's own turn direction -- no summation, no
9
+ * cancellation, and the answer does not depend on how far the contour sits from
10
+ * the origin.
11
+ *
12
+ * This is what {@link polygon2_signed_area} cannot give you. Its shoelace sum is
13
+ * a difference of terms of magnitude `O(|p|^2)` where the answer is the area, so
14
+ * for a small polygon far from the origin -- or a small polygon whose vertices are
15
+ * close together -- the computed sign is rounding noise. A 1e-9-sided square at
16
+ * (1, 1) already has a true area of 1e-18 against per-term rounding of ~1e-16: the
17
+ * sum's sign is then meaningless. Use the signed area when you want the area, and
18
+ * this when you want the winding.
19
+ *
20
+ * Coincident neighbours of the extreme vertex are stepped over, so a contour with
21
+ * duplicated points still answers correctly. A contour with no area at all (every
22
+ * vertex collinear, or all coincident) has no winding; it reports `false`.
23
+ *
24
+ * @param {ArrayLike<number>} points flat (x, y) pairs, stride 2
25
+ * @param {number} from first vertex index of the contour
26
+ * @param {number} count number of vertices in the contour
27
+ * @returns {boolean}
28
+ *
29
+ * @author Alex Goldring
30
+ * @copyright Company Named Limited (c) 2026
31
+ */
32
+ export function polygon2_is_counter_clockwise(points, from, count) {
33
+ if (count < 3) {
34
+ return false;
35
+ }
36
+
37
+ const to = from + count;
38
+
39
+ // Lexicographically smallest vertex -- guaranteed to be a hull vertex.
40
+ let extreme = from;
41
+ let ex = points[from * 2];
42
+ let ey = points[from * 2 + 1];
43
+
44
+ for (let i = from + 1; i < to; i++) {
45
+ const x = points[i * 2];
46
+ const y = points[i * 2 + 1];
47
+
48
+ if (x < ex || (x === ex && y < ey)) {
49
+ extreme = i;
50
+ ex = x;
51
+ ey = y;
52
+ }
53
+ }
54
+
55
+ // Step over neighbours that sit exactly on the extreme vertex; a zero-length
56
+ // edge carries no direction.
57
+ let prev = extreme;
58
+ for (let steps = 1; steps < count; steps++) {
59
+ const candidate = from + ((extreme - from - steps + count) % count);
60
+
61
+ if (points[candidate * 2] !== ex || points[candidate * 2 + 1] !== ey) {
62
+ prev = candidate;
63
+ break;
64
+ }
65
+ }
66
+
67
+ let next = extreme;
68
+ for (let steps = 1; steps < count; steps++) {
69
+ const candidate = from + ((extreme - from + steps) % count);
70
+
71
+ if (points[candidate * 2] !== ex || points[candidate * 2 + 1] !== ey) {
72
+ next = candidate;
73
+ break;
74
+ }
75
+ }
76
+
77
+ if (prev === extreme || next === extreme) {
78
+ // every vertex is coincident with the extreme one
79
+ return false;
80
+ }
81
+
82
+ // orient2d is negative for a counter-clockwise triple (see polygon2_triangulate)
83
+ return orient2d_indexed(points, prev, extreme, next) < 0;
84
+ }
@@ -1,6 +1,28 @@
1
1
  /**
2
- * Uses Green's Theorem to compute area of a 2d polygon
3
- * @param {number[]|Float32Array|Float64Array} points
2
+ * Signed area of a 2D polygon by the shoelace formula. Positive for
3
+ * counter-clockwise winding, negative for clockwise.
4
+ *
5
+ * The contour is implicitly closed: a repeated first-as-last point is handled,
6
+ * and so is an open list.
7
+ *
8
+ * Every vertex is taken RELATIVE TO THE FIRST before it is crossed. The
9
+ * absolute-coordinate form -- `sum += x0*y1 - y0*x1` over the raw points, which
10
+ * this used to compute -- accumulates terms of magnitude `O(|p|^2)` to reach an
11
+ * answer that is only the area, so the significant digits cancel away for any
12
+ * polygon that is small relative to its distance from the origin. A unit square
13
+ * at (1e6, 1e6) already loses most of its precision that way, and a
14
+ * 1e-9-sided square at (1, 1) comes back as exactly 0.
15
+ *
16
+ * Translating to the first vertex costs one subtraction per term and makes the
17
+ * result translation-invariant, which is what the formula claims to be
18
+ * mathematically. Both edges incident to that first vertex then contribute
19
+ * nothing, which is why the loop starts at 1 and no separate closing term is
20
+ * needed.
21
+ *
22
+ * This is still floating point. When only the *winding* matters, prefer
23
+ * {@link polygon2_is_counter_clockwise}, which is exact at any scale.
24
+ *
25
+ * @param {number[]|Float32Array|Float64Array} points flat (x, y) pairs, stride 2
4
26
  * @param {number} point_count
5
27
  * @returns {number}
6
28
  */
@@ -1 +1 @@
1
- {"version":3,"file":"polygon2_signed_area.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/polygon/polygon2_signed_area.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,6CAJW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,eAClC,MAAM,GACJ,MAAM,CA6BlB"}
1
+ {"version":3,"file":"polygon2_signed_area.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/polygon/polygon2_signed_area.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,6CAJW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,eAClC,MAAM,GACJ,MAAM,CAyBlB"}
@@ -1,34 +1,52 @@
1
- /**
2
- * Uses Green's Theorem to compute area of a 2d polygon
3
- * @param {number[]|Float32Array|Float64Array} points
4
- * @param {number} point_count
5
- * @returns {number}
6
- */
7
- export function polygon2_signed_area(points, point_count) {
8
- let sum = 0;
9
-
10
- for (let i = 0; i < point_count - 1; i++) {
11
- const i2 = i * 2;
12
-
13
- const x0 = points[i2];
14
- const y0 = points[i2 + 1];
15
-
16
- const x1 = points[i2 + 2];
17
- const y1 = points[i2 + 3];
18
-
19
- sum += x0 * y1 - y0 * x1;
20
- }
21
-
22
- const first_x = points[0];
23
- const first_y = points[1];
24
-
25
- const last_x = points[point_count * 2 - 2];
26
- const last_y = points[point_count * 2 - 1];
27
-
28
- if (first_x !== last_x || first_y !== last_y) {
29
- // doesn't wrap around, let's close the loop ourselves
30
- sum += last_x * first_y - last_y * first_x;
31
- }
32
-
33
- return sum * 0.5;
34
- }
1
+ /**
2
+ * Signed area of a 2D polygon by the shoelace formula. Positive for
3
+ * counter-clockwise winding, negative for clockwise.
4
+ *
5
+ * The contour is implicitly closed: a repeated first-as-last point is handled,
6
+ * and so is an open list.
7
+ *
8
+ * Every vertex is taken RELATIVE TO THE FIRST before it is crossed. The
9
+ * absolute-coordinate form -- `sum += x0*y1 - y0*x1` over the raw points, which
10
+ * this used to compute -- accumulates terms of magnitude `O(|p|^2)` to reach an
11
+ * answer that is only the area, so the significant digits cancel away for any
12
+ * polygon that is small relative to its distance from the origin. A unit square
13
+ * at (1e6, 1e6) already loses most of its precision that way, and a
14
+ * 1e-9-sided square at (1, 1) comes back as exactly 0.
15
+ *
16
+ * Translating to the first vertex costs one subtraction per term and makes the
17
+ * result translation-invariant, which is what the formula claims to be
18
+ * mathematically. Both edges incident to that first vertex then contribute
19
+ * nothing, which is why the loop starts at 1 and no separate closing term is
20
+ * needed.
21
+ *
22
+ * This is still floating point. When only the *winding* matters, prefer
23
+ * {@link polygon2_is_counter_clockwise}, which is exact at any scale.
24
+ *
25
+ * @param {number[]|Float32Array|Float64Array} points flat (x, y) pairs, stride 2
26
+ * @param {number} point_count
27
+ * @returns {number}
28
+ */
29
+ export function polygon2_signed_area(points, point_count) {
30
+ if (point_count < 3) {
31
+ return 0;
32
+ }
33
+
34
+ const origin_x = points[0];
35
+ const origin_y = points[1];
36
+
37
+ let sum = 0;
38
+
39
+ for (let i = 1; i < point_count - 1; i++) {
40
+ const i2 = i * 2;
41
+
42
+ const x0 = points[i2] - origin_x;
43
+ const y0 = points[i2 + 1] - origin_y;
44
+
45
+ const x1 = points[i2 + 2] - origin_x;
46
+ const y1 = points[i2 + 3] - origin_y;
47
+
48
+ sum += x0 * y1 - y0 * x1;
49
+ }
50
+
51
+ return sum * 0.5;
52
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Inputs that have actually broken {@link polygon2_triangulate}, kept so they can
3
+ * never break it again.
4
+ *
5
+ * This file only ever grows, and only from real failures -- a case someone
6
+ * *imagines* might be hard belongs in the ordinary spec, not here. Every entry
7
+ * records what went wrong when it was added, because that is the part that stops
8
+ * a future change from quietly reintroducing the same class of bug. The practice
9
+ * is borrowed from manifold, whose triangulator carries ~3 MB of recorded failing
10
+ * polygons replayed as tests.
11
+ *
12
+ * `expect_full` says whether the polygon is well-formed enough that the whole of
13
+ * its area must be covered. `false` means the input is genuinely invalid
14
+ * (self-intersecting) and the only requirements are the universal ones: no throw,
15
+ * no hang, no out-of-range index.
16
+ *
17
+ * @author Alex Goldring
18
+ * @copyright Company Named Limited (c) 2026
19
+ */
20
+ export const POLYGON2_TRIANGULATE_CORPUS: {
21
+ name: string;
22
+ why: string;
23
+ points: number[];
24
+ contour_ends: number[];
25
+ contour_count: number;
26
+ expect_full: boolean;
27
+ }[];
28
+ //# sourceMappingURL=polygon2_triangulate.corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon2_triangulate.corpus.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/polygon/polygon2_triangulate.corpus.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH;;;;;;;IAkEE"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Inputs that have actually broken {@link polygon2_triangulate}, kept so they can
3
+ * never break it again.
4
+ *
5
+ * This file only ever grows, and only from real failures -- a case someone
6
+ * *imagines* might be hard belongs in the ordinary spec, not here. Every entry
7
+ * records what went wrong when it was added, because that is the part that stops
8
+ * a future change from quietly reintroducing the same class of bug. The practice
9
+ * is borrowed from manifold, whose triangulator carries ~3 MB of recorded failing
10
+ * polygons replayed as tests.
11
+ *
12
+ * `expect_full` says whether the polygon is well-formed enough that the whole of
13
+ * its area must be covered. `false` means the input is genuinely invalid
14
+ * (self-intersecting) and the only requirements are the universal ones: no throw,
15
+ * no hang, no out-of-range index.
16
+ *
17
+ * @author Alex Goldring
18
+ * @copyright Company Named Limited (c) 2026
19
+ */
20
+ export const POLYGON2_TRIANGULATE_CORPUS = [
21
+ {
22
+ name: "unit-offset micro square",
23
+ why: "Winding was decided by the shoelace sum, whose sign here is pure "
24
+ + "rounding noise: the true area is 1e-18 against ~1e-16 per-term error. "
25
+ + "The ring came out backwards, every corner looked reflex, and the "
26
+ + "result was zero triangles. Fixed by deciding winding with one exact "
27
+ + "orientation predicate at a hull vertex (polygon2_is_counter_clockwise).",
28
+ points: [
29
+ 1, 1,
30
+ 1 + 1e-9, 1,
31
+ 1 + 1e-9, 1 + 1e-9,
32
+ 1, 1 + 1e-9,
33
+ ],
34
+ contour_ends: [4],
35
+ contour_count: 1,
36
+ expect_full: true,
37
+ },
38
+ {
39
+ name: "coarse-grid point soup (fuzz seed 24)",
40
+ why: "Twenty points on a 7x7 integer grid, with duplicates and collinear "
41
+ + "runs. The ear search exhausted itself, fell through to the "
42
+ + "cure-local-intersections pass, and that pass walked the "
43
+ + "collapsed-ring sentinel as if it were a node -- an infinite loop. "
44
+ + "Fixed by making the recovery pass accept and propagate the sentinel, "
45
+ + "and by stopping it once the ring holds fewer than three nodes.",
46
+ points: [
47
+ 2, 3, 3, 6, 1, 5, 0, 4, 5, 0,
48
+ 4, 2, 3, 3, 3, 6, 2, 3, 6, 1,
49
+ 4, 4, 2, 6, 3, 2, 6, 4, 1, 1,
50
+ 3, 0, 5, 0, 3, 2, 6, 4, 3, 3,
51
+ ],
52
+ contour_ends: [20],
53
+ contour_count: 1,
54
+ expect_full: false,
55
+ },
56
+ {
57
+ name: "two rectangular holes bridged through a shared edge",
58
+ why: "Produced 12 triangles where the Euler bound allows 14, which looked "
59
+ + "like dropped geometry. It was not: the bridges left collinear corners "
60
+ + "that were correctly absorbed rather than emitted as zero-area "
61
+ + "triangles. Kept as the standing reminder that V + 2H - 2 is an upper "
62
+ + "bound, not an equality -- area conservation is the real invariant.",
63
+ points: [
64
+ 0, 0, 20, 0, 20, 10, 0, 10,
65
+ 2, 8, 6, 8, 6, 2, 2, 2,
66
+ 12, 8, 18, 8, 18, 2, 12, 2,
67
+ ],
68
+ contour_ends: [4, 8, 12],
69
+ contour_count: 3,
70
+ expect_full: true,
71
+ },
72
+ {
73
+ name: "hole touching the outer boundary at a vertex",
74
+ why: "Same class as above -- 6 triangles against a bound of 7. The hole's "
75
+ + "corner lands exactly on the outer edge, so the bridge is degenerate "
76
+ + "and one corner becomes collinear. Area is still exact and every input "
77
+ + "vertex is still used.",
78
+ points: [
79
+ 0, 0, 10, 0, 10, 10, 0, 10,
80
+ 4, 7, 4, 3, 0, 5,
81
+ ],
82
+ contour_ends: [4, 7],
83
+ contour_count: 2,
84
+ expect_full: true,
85
+ },
86
+ ];
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Triangulate a 2D polygon with holes.
3
+ *
4
+ * Ear clipping over a doubly-linked vertex ring, with every combinatorial
5
+ * decision made by the exact `orient2d` predicate already used elsewhere in
6
+ * `core/geom` -- so the result does not depend on coordinate magnitude, and
7
+ * collinear or coincident input is decided rather than guessed. Above
8
+ * {@link HASH_THRESHOLD} vertices the point-in-ear test is restricted to a
9
+ * Morton-code range, which is what keeps large rings off the quadratic path.
10
+ *
11
+ * Contour `i` spans `points[(i === 0 ? 0 : contour_ends[i - 1]) .. contour_ends[i])`
12
+ * in vertex units. Contour 0 is the outer boundary and the rest are holes.
13
+ * Winding is normalised internally, so callers cannot get it subtly wrong.
14
+ *
15
+ * Output is triples of indices into `points`, in ear-cut order, each triangle
16
+ * counter-clockwise.
17
+ *
18
+ * A well-formed polygon yields exactly `V + 2H - 2` triangles, where `V` is the
19
+ * total vertex count and `H` the hole count. **A smaller return value is how this
20
+ * function reports that the input could not be fully triangulated** -- it is
21
+ * self-intersecting, or partly degenerate. It never throws for that: a partial
22
+ * triangulation is still the best available answer, and the caller is told how
23
+ * much of one it got. {@link polygon2_triangulation_deviation} measures the
24
+ * shortfall in area terms.
25
+ *
26
+ * Not re-entrant: the vertex ring lives in module-static buffers so a call
27
+ * allocates nothing in the steady state.
28
+ *
29
+ * @param {Uint32Array} result receives 3 point indices per triangle
30
+ * @param {number} result_offset first index written in `result`
31
+ * @param {ArrayLike<number>} points flat (x, y) pairs, stride 2
32
+ * @param {ArrayLike<number>} contour_ends exclusive end vertex index per contour, non-decreasing
33
+ * @param {number} contour_count number of contours, at least 1
34
+ * @returns {number} number of triangles written
35
+ *
36
+ * @author Alex Goldring
37
+ * @copyright Company Named Limited (c) 2026
38
+ */
39
+ export function polygon2_triangulate(result: Uint32Array, result_offset: number, points: ArrayLike<number>, contour_ends: ArrayLike<number>, contour_count: number): number;
40
+ //# sourceMappingURL=polygon2_triangulate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon2_triangulate.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/polygon/polygon2_triangulate.js"],"names":[],"mappings":"AAkpCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,6CAVW,WAAW,iBACX,MAAM,UACN,UAAU,MAAM,CAAC,gBACjB,UAAU,MAAM,CAAC,iBACjB,MAAM,GACJ,MAAM,CA4ElB"}