@woosh/meep-engine 2.168.1 → 2.169.1

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 (624) hide show
  1. package/README.md +2 -2
  2. package/build/bundle-worker-image-decoder.js +1 -1
  3. package/editor/process/symbolic/make3DSymbolicDisplay.js +1 -1
  4. package/editor/view/ecs/EntityList.js +1 -1
  5. package/editor/view/ecs/components/particles/ParticleLayerController.js +1 -1
  6. package/editor/view/makeEntityDecorators.js +1 -1
  7. package/package.json +1 -1
  8. package/src/REVIEW_2026_08_06/adv-core.md +511 -0
  9. package/src/REVIEW_2026_08_06/adv-gfx.md +480 -0
  10. package/src/REVIEW_2026_08_06/adv-view.md +446 -0
  11. package/src/REVIEW_2026_08_06/api-core.md +296 -0
  12. package/src/REVIEW_2026_08_06/api-engine.md +195 -0
  13. package/src/REVIEW_2026_08_06/bvh-phys-sound-net.md +507 -0
  14. package/src/REVIEW_2026_08_06/core-binary.md +348 -0
  15. package/src/REVIEW_2026_08_06/core-collection.md +376 -0
  16. package/src/REVIEW_2026_08_06/core-math.md +221 -0
  17. package/src/REVIEW_2026_08_06/core-process.md +266 -0
  18. package/src/REVIEW_2026_08_06/core-science.md +223 -0
  19. package/src/REVIEW_2026_08_06/engine-ai-nav.md +279 -0
  20. package/src/REVIEW_2026_08_06/engine-animation.md +167 -0
  21. package/src/REVIEW_2026_08_06/engine-asset.md +166 -0
  22. package/src/REVIEW_2026_08_06/engine-ecs.md +920 -0
  23. package/src/REVIEW_2026_08_06/engine-input.md +197 -0
  24. package/src/REVIEW_2026_08_06/engine-misc.md +248 -0
  25. package/src/REVIEW_2026_08_06/engine-terrain.md +52 -0
  26. package/src/REVIEW_2026_08_06/generation.md +176 -0
  27. package/src/REVIEW_2026_08_06/geom-2d.md +434 -0
  28. package/src/REVIEW_2026_08_06/geom-3d.md +117 -0
  29. package/src/REVIEW_2026_08_06/gfx-gi.md +143 -0
  30. package/src/REVIEW_2026_08_06/gfx-render.md +740 -0
  31. package/src/REVIEW_2026_08_06/gfx-texture.md +690 -0
  32. package/src/REVIEW_2026_08_06/prior-criticals.md +49 -0
  33. package/src/REVIEW_2026_08_06/prior-highs.md +138 -0
  34. package/src/REVIEW_2026_08_06/test-gaps.md +364 -0
  35. package/src/REVIEW_2026_08_06/view.md +667 -0
  36. package/src/REVIEW_2026_08_06.md +610 -0
  37. package/src/core/IdPool.d.ts +2 -2
  38. package/src/core/IdPool.d.ts.map +1 -1
  39. package/src/core/IdPool.js +1 -1
  40. package/src/core/binary/32BitEncoder.d.ts +2 -3
  41. package/src/core/binary/32BitEncoder.d.ts.map +1 -1
  42. package/src/core/binary/32BitEncoder.js +1 -1
  43. package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
  44. package/src/core/binary/BinaryBuffer.js +12 -1
  45. package/src/core/binary/BitImage2.d.ts +5 -1
  46. package/src/core/binary/BitImage2.d.ts.map +1 -1
  47. package/src/core/binary/BitImage2.js +5 -1
  48. package/src/core/bvh2/bvh3/BVH.d.ts +2 -2
  49. package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
  50. package/src/core/bvh2/bvh3/BVH.js +1 -1
  51. package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point_filtered.d.ts +2 -2
  52. package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point_filtered.d.ts.map +1 -1
  53. package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point_filtered.js +86 -86
  54. package/src/core/bvh2/traversal/aabb3_detailed_volume_intersection_callback_based.d.ts +2 -2
  55. package/src/core/bvh2/traversal/aabb3_detailed_volume_intersection_callback_based.d.ts.map +1 -1
  56. package/src/core/bvh2/traversal/aabb3_detailed_volume_intersection_callback_based.js +1 -1
  57. package/src/core/bvh8/build/NodeProxy.d.ts.map +1 -1
  58. package/src/core/bvh8/build/NodeProxy.js +314 -308
  59. package/src/core/cache/Cache.d.ts +4 -4
  60. package/src/core/cache/Cache.d.ts.map +1 -1
  61. package/src/core/cache/Cache.js +3 -3
  62. package/src/core/cache/LoadingCache.d.ts +1 -1
  63. package/src/core/cache/LoadingCache.js +2 -2
  64. package/src/core/cache/wtinylfu/CacheWTinylfu.d.ts +2 -2
  65. package/src/core/cache/wtinylfu/CacheWTinylfu.js +2 -2
  66. package/src/core/collection/array/array_index_by_equality.d.ts +2 -2
  67. package/src/core/collection/array/array_index_by_equality.d.ts.map +1 -1
  68. package/src/core/collection/array/array_index_by_equality.js +1 -1
  69. package/src/core/collection/array/array_pick_best_element.d.ts +2 -2
  70. package/src/core/collection/array/array_pick_best_element.d.ts.map +1 -1
  71. package/src/core/collection/array/array_pick_best_element.js +1 -1
  72. package/src/core/collection/array/array_pick_best_elements.d.ts +2 -2
  73. package/src/core/collection/array/array_pick_best_elements.d.ts.map +1 -1
  74. package/src/core/collection/array/array_pick_best_elements.js +1 -1
  75. package/src/core/collection/array/array_set_diff.d.ts +2 -3
  76. package/src/core/collection/array/array_set_diff.d.ts.map +1 -1
  77. package/src/core/collection/array/array_set_diff.js +1 -1
  78. package/src/core/collection/array/array_set_diff_sorting.d.ts +2 -2
  79. package/src/core/collection/array/array_set_diff_sorting.d.ts.map +1 -1
  80. package/src/core/collection/array/array_set_diff_sorting.js +1 -1
  81. package/src/core/collection/array/iterator/ArrayIteratorRandom.d.ts +2 -1
  82. package/src/core/collection/array/iterator/ArrayIteratorRandom.d.ts.map +1 -1
  83. package/src/core/collection/heap/BinaryHeap.d.ts +2 -2
  84. package/src/core/collection/heap/BinaryHeap.d.ts.map +1 -1
  85. package/src/core/collection/heap/BinaryHeap.js +1 -1
  86. package/src/core/collection/list/List.d.ts +32 -17
  87. package/src/core/collection/list/List.d.ts.map +1 -1
  88. package/src/core/collection/list/List.js +43 -9
  89. package/src/core/collection/list/SortedListProjection.d.ts.map +1 -1
  90. package/src/core/collection/list/SortedListProjection.js +4 -1
  91. package/src/core/collection/map/BiMap.d.ts +25 -2
  92. package/src/core/collection/map/BiMap.d.ts.map +1 -1
  93. package/src/core/collection/map/BiMap.js +57 -3
  94. package/src/core/collection/map/HashMap.d.ts +2 -2
  95. package/src/core/collection/map/HashMap.d.ts.map +1 -1
  96. package/src/core/collection/map/HashMap.js +1 -1
  97. package/src/core/collection/set/ArraySet.d.ts +2 -2
  98. package/src/core/collection/set/ArraySet.d.ts.map +1 -1
  99. package/src/core/collection/set/ArraySet.js +1 -1
  100. package/src/core/collection/table/RowFirstTable.d.ts +2 -2
  101. package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
  102. package/src/core/collection/table/RowFirstTable.js +1 -1
  103. package/src/core/collection/table/RowFirstTableSpec.js +4 -4
  104. package/src/core/debug/matchers/IsAnything.d.ts.map +1 -1
  105. package/src/core/debug/matchers/IsAnything.js +5 -1
  106. package/src/core/events/signal/Signal.d.ts.map +1 -1
  107. package/src/core/events/signal/Signal.js +3 -1
  108. package/src/core/fsm/simple/SimpleStateMachineDescription.d.ts +2 -2
  109. package/src/core/fsm/simple/SimpleStateMachineDescription.d.ts.map +1 -1
  110. package/src/core/fsm/simple/SimpleStateMachineDescription.js +1 -1
  111. package/src/core/geom/2d/bvh/BVH2D.d.ts +2 -2
  112. package/src/core/geom/2d/bvh/BVH2D.d.ts.map +1 -1
  113. package/src/core/geom/2d/bvh/BVH2D.js +1 -1
  114. package/src/core/geom/2d/polygon/TRIANGULATION_DESIGN.md +433 -0
  115. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.d.ts +31 -0
  116. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.d.ts.map +1 -0
  117. package/src/core/geom/2d/polygon/polygon2_is_counter_clockwise.js +84 -0
  118. package/src/core/geom/2d/polygon/polygon2_signed_area.d.ts +24 -2
  119. package/src/core/geom/2d/polygon/polygon2_signed_area.d.ts.map +1 -1
  120. package/src/core/geom/2d/polygon/polygon2_signed_area.js +52 -34
  121. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts +28 -0
  122. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.d.ts.map +1 -0
  123. package/src/core/geom/2d/polygon/polygon2_triangulate.corpus.js +86 -0
  124. package/src/core/geom/2d/polygon/polygon2_triangulate.d.ts +40 -0
  125. package/src/core/geom/2d/polygon/polygon2_triangulate.d.ts.map +1 -0
  126. package/src/core/geom/2d/polygon/polygon2_triangulate.js +1280 -0
  127. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.d.ts +28 -0
  128. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.d.ts.map +1 -0
  129. package/src/core/geom/2d/polygon/polygon2_triangulation_deviation.js +77 -0
  130. package/src/core/geom/2d/quad-tree/qt_match_data_by_circle.d.ts +2 -2
  131. package/src/core/geom/2d/quad-tree/qt_match_data_by_circle.d.ts.map +1 -1
  132. package/src/core/geom/2d/quad-tree/qt_match_data_by_circle.js +1 -1
  133. package/src/core/geom/2d/quad-tree/qt_query_data_raycast.d.ts +2 -2
  134. package/src/core/geom/2d/quad-tree/qt_query_data_raycast.d.ts.map +1 -1
  135. package/src/core/geom/2d/quad-tree/qt_query_data_raycast.js +1 -1
  136. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts +6 -3
  137. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts.map +1 -1
  138. package/src/core/geom/2d/triangle/tri2_rasterize_conservative.js +26 -13
  139. package/src/core/geom/2d/triangle/tri2_signed_area.d.ts +17 -1
  140. package/src/core/geom/2d/triangle/tri2_signed_area.d.ts.map +1 -1
  141. package/src/core/geom/2d/triangle/tri2_signed_area.js +35 -23
  142. package/src/core/geom/2d/v2_morton_encode.d.ts +20 -0
  143. package/src/core/geom/2d/v2_morton_encode.d.ts.map +1 -0
  144. package/src/core/geom/2d/v2_morton_encode.js +23 -0
  145. package/src/core/geom/3d/aabb/AABB3.d.ts +2 -2
  146. package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
  147. package/src/core/geom/3d/aabb/AABB3.js +1 -1
  148. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts.map +1 -1
  149. package/src/core/geom/3d/atlas/segment/atlas_merge_charts.js +4 -1
  150. package/src/core/geom/3d/polygon/polygon3_compute_normal.d.ts +27 -0
  151. package/src/core/geom/3d/polygon/polygon3_compute_normal.d.ts.map +1 -0
  152. package/src/core/geom/3d/polygon/polygon3_compute_normal.js +60 -0
  153. package/src/core/geom/3d/polygon/polygon3_triangulate.d.ts +34 -0
  154. package/src/core/geom/3d/polygon/polygon3_triangulate.d.ts.map +1 -0
  155. package/src/core/geom/3d/polygon/polygon3_triangulate.js +94 -0
  156. package/src/core/geom/3d/quaternion/quat3_multiply.d.ts +8 -2
  157. package/src/core/geom/3d/quaternion/quat3_multiply.d.ts.map +1 -1
  158. package/src/core/geom/3d/quaternion/quat3_multiply.js +8 -2
  159. package/src/core/geom/3d/shape/ConvexHullShape3D.d.ts.map +1 -1
  160. package/src/core/geom/3d/shape/ConvexHullShape3D.js +32 -2
  161. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts +2 -2
  162. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
  163. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +1 -1
  164. package/src/core/geom/3d/tetrahedra/delaunay/debug/push_boundary_with_validation.d.ts +2 -5
  165. package/src/core/geom/3d/tetrahedra/delaunay/debug/push_boundary_with_validation.d.ts.map +1 -1
  166. package/src/core/geom/3d/tetrahedra/delaunay/debug/push_boundary_with_validation.js +1 -1
  167. package/src/core/geom/3d/tetrahedra/delaunay/debug/validate_cavity_boundary.d.ts +2 -2
  168. package/src/core/geom/3d/tetrahedra/delaunay/debug/validate_cavity_boundary.d.ts.map +1 -1
  169. package/src/core/geom/3d/tetrahedra/delaunay/debug/validate_cavity_boundary.js +1 -1
  170. package/src/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.d.ts +2 -3
  171. package/src/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.d.ts.map +1 -1
  172. package/src/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.js +69 -69
  173. package/src/core/geom/3d/tetrahedra/validate_tetrahedron_neighbourhood.d.ts +2 -3
  174. package/src/core/geom/3d/tetrahedra/validate_tetrahedron_neighbourhood.d.ts.map +1 -1
  175. package/src/core/geom/3d/tetrahedra/validate_tetrahedron_neighbourhood.js +50 -50
  176. package/src/core/geom/3d/topology/struct/TopoEdge.d.ts +2 -2
  177. package/src/core/geom/3d/topology/struct/TopoEdge.d.ts.map +1 -1
  178. package/src/core/geom/3d/topology/struct/TopoEdge.js +1 -1
  179. package/src/core/geom/3d/topology/struct/TopoMesh.d.ts +2 -3
  180. package/src/core/geom/3d/topology/struct/TopoMesh.d.ts.map +1 -1
  181. package/src/core/geom/3d/topology/struct/TopoMesh.js +1 -1
  182. package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts +2 -2
  183. package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts.map +1 -1
  184. package/src/core/geom/3d/topology/struct/TopoTriangle.js +1 -1
  185. package/src/core/geom/3d/topology/struct/TopoVertex.d.ts +2 -2
  186. package/src/core/geom/3d/topology/struct/TopoVertex.d.ts.map +1 -1
  187. package/src/core/geom/3d/topology/struct/TopoVertex.js +1 -1
  188. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts +23 -6
  189. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.d.ts.map +1 -1
  190. package/src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.js +268 -124
  191. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.d.ts +17 -0
  192. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.d.ts.map +1 -0
  193. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.js +44 -0
  194. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.d.ts +20 -0
  195. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.d.ts.map +1 -0
  196. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.js +40 -0
  197. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.d.ts +19 -0
  198. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.d.ts.map +1 -0
  199. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_closed.js +34 -0
  200. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.d.ts +22 -0
  201. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.d.ts.map +1 -0
  202. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_is_manifold.js +37 -0
  203. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.d.ts +87 -0
  204. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.d.ts.map +1 -0
  205. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_validate.js +599 -0
  206. package/src/core/geom/3d/topology/util/mesh_flood_fill.d.ts +1 -1
  207. package/src/core/geom/3d/topology/util/mesh_flood_fill.js +1 -1
  208. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.d.ts +32 -0
  209. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.d.ts.map +1 -1
  210. package/src/core/geom/3d/triangle/tri3_compute_signed_volume.js +66 -7
  211. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.d.ts +22 -1
  212. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.d.ts.map +1 -1
  213. package/src/core/geom/3d/triangle/tri3_mesh_compute_signed_volume.js +83 -38
  214. package/src/core/geom/3d/util/aabb3_emit_point_grid.d.ts +2 -2
  215. package/src/core/geom/3d/util/aabb3_emit_point_grid.d.ts.map +1 -1
  216. package/src/core/geom/3d/util/aabb3_emit_point_grid.js +1 -1
  217. package/src/core/geom/MANIFOLD_COMPARISON_2026_08_01.md +554 -0
  218. package/src/core/geom/Quaternion.d.ts +2 -2
  219. package/src/core/geom/Quaternion.d.ts.map +1 -1
  220. package/src/core/geom/Quaternion.js +1 -1
  221. package/src/core/geom/Vector1.d.ts +2 -2
  222. package/src/core/geom/Vector1.d.ts.map +1 -1
  223. package/src/core/geom/Vector1.js +1 -1
  224. package/src/core/geom/packing/max-rect/find_best_container.d.ts +2 -2
  225. package/src/core/geom/packing/max-rect/find_best_container.d.ts.map +1 -1
  226. package/src/core/geom/packing/max-rect/find_best_container.js +1 -1
  227. package/src/core/geom/vec3/v3_cotangent.d.ts +6 -2
  228. package/src/core/geom/vec3/v3_cotangent.d.ts.map +1 -1
  229. package/src/core/geom/vec3/v3_cotangent.js +6 -2
  230. package/src/core/geom/vec3/v3_cross.d.ts +6 -2
  231. package/src/core/geom/vec3/v3_cross.d.ts.map +1 -1
  232. package/src/core/geom/vec3/v3_cross.js +6 -2
  233. package/src/core/geom/vec3/v3_lerp.d.ts +1 -1
  234. package/src/core/geom/vec3/v3_lerp.js +1 -1
  235. package/src/core/geom/vec3/v3_multiply.d.ts +6 -2
  236. package/src/core/geom/vec3/v3_multiply.d.ts.map +1 -1
  237. package/src/core/geom/vec3/v3_multiply.js +6 -2
  238. package/src/core/geom/vec3/v3_subtract.d.ts +6 -2
  239. package/src/core/geom/vec3/v3_subtract.d.ts.map +1 -1
  240. package/src/core/geom/vec3/v3_subtract.js +6 -2
  241. package/src/core/json/abstractJSONSerializer.d.ts +2 -2
  242. package/src/core/json/abstractJSONSerializer.d.ts.map +1 -1
  243. package/src/core/json/abstractJSONSerializer.js +1 -1
  244. package/src/core/lang/reactive/AbstractCachingParser.d.ts +2 -3
  245. package/src/core/lang/reactive/AbstractCachingParser.d.ts.map +1 -1
  246. package/src/core/lang/reactive/AbstractCachingParser.js +1 -1
  247. package/src/core/localization/Localization.d.ts +2 -2
  248. package/src/core/localization/Localization.d.ts.map +1 -1
  249. package/src/core/localization/Localization.js +2 -2
  250. package/src/core/math/noise/create_simplex_noise_2d.d.ts +2 -2
  251. package/src/core/math/noise/create_simplex_noise_2d.d.ts.map +1 -1
  252. package/src/core/math/noise/create_simplex_noise_2d.js +1 -1
  253. package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD.js +1 -1
  254. package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.d.ts +3 -3
  255. package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.d.ts.map +1 -1
  256. package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.js +2 -2
  257. package/src/core/math/random/randomSeed.d.ts +13 -0
  258. package/src/core/math/random/randomSeed.d.ts.map +1 -0
  259. package/src/core/math/random/randomSeed.js +16 -0
  260. package/src/core/math/random/seededRandom_Mulberry32.d.ts +3 -2
  261. package/src/core/math/random/seededRandom_Mulberry32.d.ts.map +1 -1
  262. package/src/core/math/random/seededRandom_Mulberry32.js +1 -1
  263. package/src/core/math/spline/spline3_hermite_apply_transform.d.ts +50 -0
  264. package/src/core/math/spline/spline3_hermite_apply_transform.d.ts.map +1 -0
  265. package/src/core/math/spline/spline3_hermite_apply_transform.js +107 -0
  266. package/src/core/math/spline/spline3_hermite_reverse.d.ts +34 -0
  267. package/src/core/math/spline/spline3_hermite_reverse.d.ts.map +1 -0
  268. package/src/core/math/spline/spline3_hermite_reverse.js +49 -0
  269. package/src/core/math/statistics/hammersley_sequence.d.ts +17 -4
  270. package/src/core/math/statistics/hammersley_sequence.d.ts.map +1 -1
  271. package/src/core/math/statistics/hammersley_sequence.js +25 -16
  272. package/src/core/model/ModuleRegistry.d.ts +2 -2
  273. package/src/core/model/ModuleRegistry.d.ts.map +1 -1
  274. package/src/core/model/ModuleRegistry.js +1 -1
  275. package/src/core/model/node-graph/json/serializeNodeGraphToJSON.d.ts +1 -1
  276. package/src/core/model/node-graph/json/serializeNodeGraphToJSON.js +2 -2
  277. package/src/core/model/object/objectDeepEquals.d.ts +2 -2
  278. package/src/core/model/object/objectDeepEquals.d.ts.map +1 -1
  279. package/src/core/model/object/objectDeepEquals.js +1 -1
  280. package/src/core/model/reactive/model/ReactiveExpression.d.ts +2 -2
  281. package/src/core/model/reactive/model/ReactiveExpression.d.ts.map +1 -1
  282. package/src/core/model/reactive/model/ReactiveExpression.js +1 -1
  283. package/src/core/model/validate_enum_schema.d.ts +2 -3
  284. package/src/core/model/validate_enum_schema.d.ts.map +1 -1
  285. package/src/core/model/validate_enum_schema.js +1 -1
  286. package/src/core/process/Future.d.ts +3 -3
  287. package/src/core/process/Future.d.ts.map +1 -1
  288. package/src/core/process/Future.js +13 -1
  289. package/src/core/process/PromiseWatcher.d.ts.map +1 -1
  290. package/src/core/process/PromiseWatcher.js +9 -2
  291. package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
  292. package/src/core/process/executor/ConcurrentExecutor.js +12 -2
  293. package/src/core/process/task/Task.d.ts +3 -3
  294. package/src/core/process/task/Task.d.ts.map +1 -1
  295. package/src/core/process/task/Task.js +2 -2
  296. package/src/core/process/task/util/countTask.d.ts +2 -2
  297. package/src/core/process/task/util/countTask.d.ts.map +1 -1
  298. package/src/core/process/task/util/countTask.js +1 -1
  299. package/src/core/process/task/util/randomCountTask.d.ts +2 -2
  300. package/src/core/process/task/util/randomCountTask.d.ts.map +1 -1
  301. package/src/core/process/task/util/randomCountTask.js +1 -1
  302. package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
  303. package/src/core/process/worker/WorkerProxy.js +5 -2
  304. package/src/core/process/worker/extractTransferables.d.ts.map +1 -1
  305. package/src/core/process/worker/extractTransferables.js +4 -1
  306. package/src/engine/Engine.d.ts +12 -12
  307. package/src/engine/Engine.d.ts.map +1 -1
  308. package/src/engine/Engine.js +149 -10
  309. package/src/engine/animation/Animations.d.ts +4 -4
  310. package/src/engine/animation/Animations.d.ts.map +1 -1
  311. package/src/engine/animation/Animations.js +2 -2
  312. package/src/engine/animation/EntityAnimation.d.ts +5 -5
  313. package/src/engine/animation/EntityAnimation.d.ts.map +1 -1
  314. package/src/engine/animation/EntityAnimation.js +2 -2
  315. package/src/engine/animation/TransitionFunctions.d.ts +1 -4
  316. package/src/engine/animation/TransitionFunctions.d.ts.map +1 -1
  317. package/src/engine/animation/TransitionFunctions.js +1 -1
  318. package/src/engine/animation/Tween.d.ts +4 -4
  319. package/src/engine/animation/Tween.d.ts.map +1 -1
  320. package/src/engine/animation/Tween.js +2 -2
  321. package/src/engine/asset/AssetManager.d.ts +6 -6
  322. package/src/engine/asset/AssetManager.d.ts.map +1 -1
  323. package/src/engine/asset/AssetManager.js +1411 -1411
  324. package/src/engine/asset/AssetRequest.d.ts +4 -4
  325. package/src/engine/asset/AssetRequest.d.ts.map +1 -1
  326. package/src/engine/asset/AssetRequest.js +3 -3
  327. package/src/engine/asset/loaders/ArrayBufferLoader.d.ts.map +1 -1
  328. package/src/engine/asset/loaders/ArrayBufferLoader.js +7 -0
  329. package/src/engine/asset/loaders/AssetLoader.d.ts +3 -3
  330. package/src/engine/asset/loaders/AssetLoader.d.ts.map +1 -1
  331. package/src/engine/asset/loaders/AssetLoader.js +2 -2
  332. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +0 -10
  333. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
  334. package/src/engine/ecs/EntityComponentDataset.d.ts +6 -6
  335. package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
  336. package/src/engine/ecs/EntityComponentDataset.js +3 -3
  337. package/src/engine/ecs/EntityManager.d.ts +4 -4
  338. package/src/engine/ecs/EntityManager.js +4 -4
  339. package/src/engine/ecs/EntityObserver.d.ts +3 -3
  340. package/src/engine/ecs/EntityObserver.d.ts.map +1 -1
  341. package/src/engine/ecs/EntityObserver.js +2 -2
  342. package/src/engine/ecs/System.d.ts +4 -4
  343. package/src/engine/ecs/System.d.ts.map +1 -1
  344. package/src/engine/ecs/System.js +2 -2
  345. package/src/engine/ecs/dynamic_actions/DynamicActorSystem.d.ts +2 -3
  346. package/src/engine/ecs/dynamic_actions/DynamicActorSystem.d.ts.map +1 -1
  347. package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +1 -1
  348. package/src/engine/ecs/grid/pick.d.ts +4 -2
  349. package/src/engine/ecs/grid/pick.d.ts.map +1 -1
  350. package/src/engine/ecs/grid/pick.js +1 -1
  351. package/src/engine/ecs/parent/EntityNode.d.ts +4 -4
  352. package/src/engine/ecs/parent/EntityNode.d.ts.map +1 -1
  353. package/src/engine/ecs/parent/EntityNode.js +2 -2
  354. package/src/engine/ecs/speaker/lines/sets/LineSetDescription.d.ts.map +1 -1
  355. package/src/engine/ecs/speaker/lines/sets/LineSetDescription.js +3 -1
  356. package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.d.ts +2 -2
  357. package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.d.ts.map +1 -1
  358. package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js +1 -1
  359. package/src/engine/ecs/storage/binary/collection/BinaryCollectionHeaderCodec.d.ts +1 -2
  360. package/src/engine/ecs/storage/binary/collection/BinaryCollectionHeaderCodec.d.ts.map +1 -1
  361. package/src/engine/ecs/systems/AnimationSystem.d.ts +0 -5
  362. package/src/engine/ecs/systems/AnimationSystem.d.ts.map +1 -1
  363. package/src/engine/ecs/terrain/ecs/TerrainSystem.d.ts +2 -2
  364. package/src/engine/ecs/terrain/ecs/TerrainSystem.d.ts.map +1 -1
  365. package/src/engine/ecs/terrain/ecs/TerrainSystem.js +5 -2
  366. package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts +34 -5
  367. package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
  368. package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +87 -26
  369. package/src/engine/ecs/terrain/util/obtainTerrain.d.ts +2 -3
  370. package/src/engine/ecs/terrain/util/obtainTerrain.d.ts.map +1 -1
  371. package/src/engine/ecs/terrain/util/obtainTerrain.js +1 -1
  372. package/src/engine/ecs/util/hideEntityGracefully.js +2 -2
  373. package/src/engine/graphics/CONTEXT_LOSS_RECOVERY_PLAN.md +446 -0
  374. package/src/engine/graphics/FrameRunner.d.ts +2 -2
  375. package/src/engine/graphics/FrameRunner.d.ts.map +1 -1
  376. package/src/engine/graphics/FrameRunner.js +1 -1
  377. package/src/engine/graphics/GraphicsEngine.d.ts +60 -9
  378. package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
  379. package/src/engine/graphics/GraphicsEngine.js +197 -25
  380. package/src/engine/graphics/camera/CameraShake.d.ts +6 -6
  381. package/src/engine/graphics/camera/CameraShake.d.ts.map +1 -1
  382. package/src/engine/graphics/context/WebGLContextFailureReason.d.ts +9 -0
  383. package/src/engine/graphics/context/WebGLContextFailureReason.d.ts.map +1 -0
  384. package/src/engine/graphics/context/WebGLContextFailureReason.js +17 -0
  385. package/src/engine/graphics/context/WebGLContextMonitor.d.ts +106 -0
  386. package/src/engine/graphics/context/WebGLContextMonitor.d.ts.map +1 -0
  387. package/src/engine/graphics/context/WebGLContextMonitor.js +341 -0
  388. package/src/engine/graphics/context/WebGLContextState.d.ts +14 -0
  389. package/src/engine/graphics/context/WebGLContextState.d.ts.map +1 -0
  390. package/src/engine/graphics/context/WebGLContextState.js +24 -0
  391. package/src/engine/graphics/context/testWebGLContextLoss.d.ts +2 -0
  392. package/src/engine/graphics/context/testWebGLContextLoss.d.ts.map +1 -0
  393. package/src/engine/graphics/context/testWebGLContextLoss.js +696 -0
  394. package/src/engine/graphics/ecs/camera/CameraSystem.d.ts +2 -2
  395. package/src/engine/graphics/ecs/camera/CameraSystem.d.ts.map +1 -1
  396. package/src/engine/graphics/ecs/camera/CameraSystem.js +1 -1
  397. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.d.ts.map +1 -1
  398. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.js +68 -32
  399. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.d.ts +14 -0
  400. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.d.ts.map +1 -0
  401. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationUpgrader_0_1.js +41 -0
  402. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.d.ts +2 -3
  403. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.d.ts.map +1 -1
  404. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +2 -2
  405. package/src/engine/graphics/ecs/light/three/ThreeLightCache.d.ts +1 -1
  406. package/src/engine/graphics/ecs/light/three/ThreeLightCache.js +1 -1
  407. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +4 -5
  408. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
  409. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +7 -2
  410. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +1 -1
  411. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts.map +1 -1
  412. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +2 -1
  413. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts +1 -1
  414. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts.map +1 -1
  415. package/src/engine/graphics/ecs/trail3d/Trail3DSystem.js +3 -5
  416. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.d.ts.map +1 -1
  417. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +3 -2
  418. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
  419. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +3 -1
  420. package/src/engine/graphics/geometry/computeBoundingSphereFromVertexData.d.ts +2 -2
  421. package/src/engine/graphics/geometry/computeBoundingSphereFromVertexData.js +1 -1
  422. package/src/engine/graphics/geometry/computeMeshSurfaceArea.js +1 -1
  423. package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.d.ts +2 -2
  424. package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.d.ts.map +1 -1
  425. package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +1 -1
  426. package/src/engine/graphics/geometry/ribbon/Ribbon.d.ts +2 -2
  427. package/src/engine/graphics/geometry/ribbon/Ribbon.d.ts.map +1 -1
  428. package/src/engine/graphics/geometry/ribbon/Ribbon.js +1 -1
  429. package/src/engine/graphics/load_and_set_cubemap_v0.d.ts +5 -0
  430. package/src/engine/graphics/load_and_set_cubemap_v0.d.ts.map +1 -1
  431. package/src/engine/graphics/load_and_set_cubemap_v0.js +26 -21
  432. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts +2 -2
  433. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts.map +1 -1
  434. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +1 -1
  435. package/src/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.d.ts +2 -2
  436. package/src/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.d.ts.map +1 -1
  437. package/src/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +1 -1
  438. package/src/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.d.ts +2 -2
  439. package/src/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.d.ts.map +1 -1
  440. package/src/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.js +1 -1
  441. package/src/engine/graphics/particles/particular/group/ParticleGroup.d.ts.map +1 -1
  442. package/src/engine/graphics/particles/particular/group/ParticleGroup.js +19 -8
  443. package/src/engine/graphics/particles/particular/group/optimizeCommandQueue.js +1 -1
  444. package/src/engine/graphics/render/RendererPool.d.ts +4 -4
  445. package/src/engine/graphics/render/RendererPool.d.ts.map +1 -1
  446. package/src/engine/graphics/render/RendererPool.js +2 -2
  447. package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts +5 -4
  448. package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts.map +1 -1
  449. package/src/engine/graphics/render/frame_graph/FrameGraph.js +2 -2
  450. package/src/engine/graphics/render/layers/RenderLayer.d.ts +2 -2
  451. package/src/engine/graphics/render/layers/RenderLayer.d.ts.map +1 -1
  452. package/src/engine/graphics/render/layers/RenderLayer.js +1 -1
  453. package/src/engine/graphics/render/layers/RenderLayerUtils.js +1 -1
  454. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts +3 -1
  455. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts.map +1 -1
  456. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.js +681 -681
  457. package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts +2 -2
  458. package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts.map +1 -1
  459. package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.js +145 -145
  460. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +2 -1
  461. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
  462. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.d.ts.map +1 -1
  463. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.js +10 -3
  464. package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
  465. package/src/engine/graphics/texture/atlas/TextureAtlas.js +4 -1
  466. package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.d.ts.map +1 -1
  467. package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.js +11 -0
  468. package/src/engine/graphics/texture/cubemap/load_environment_map.d.ts.map +1 -1
  469. package/src/engine/graphics/texture/cubemap/load_environment_map.js +5 -2
  470. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts +2 -2
  471. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
  472. package/src/engine/graphics/texture/sampler/Sampler2D.js +1 -1
  473. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.d.ts.map +1 -1
  474. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.js +26 -18
  475. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts +15 -2
  476. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts.map +1 -1
  477. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js +29 -3
  478. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.d.ts +14 -1
  479. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.d.ts.map +1 -1
  480. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js +148 -171
  481. package/src/engine/graphics/texture/sampler/sampler2d_combine.d.ts +2 -2
  482. package/src/engine/graphics/texture/sampler/sampler2d_combine.d.ts.map +1 -1
  483. package/src/engine/graphics/texture/sampler/sampler2d_combine.js +1 -1
  484. package/src/engine/graphics/texture/sampler/sampler2d_paint.js +1 -1
  485. package/src/engine/graphics/texture/sampler/util/bitSet2Sampler2D.js +2 -2
  486. package/src/engine/graphics/texture/virtual/VirtualTextureTileLoader.d.ts +1 -1
  487. package/src/engine/graphics/texture/virtual/VirtualTextureTileLoader.js +2 -2
  488. package/src/engine/grid/obstacle/GridObstacle.d.ts +2 -2
  489. package/src/engine/grid/obstacle/GridObstacle.d.ts.map +1 -1
  490. package/src/engine/grid/obstacle/GridObstacle.js +1 -1
  491. package/src/engine/input/ecs/util/TopDownCameraControllerHelper.d.ts.map +1 -1
  492. package/src/engine/input/ecs/util/TopDownCameraControllerHelper.js +10 -3
  493. package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts +2 -2
  494. package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts.map +1 -1
  495. package/src/engine/intelligence/behavior/ecs/BehaviorComponent.js +1 -1
  496. package/src/engine/intelligence/behavior/primitive/ActionBehavior.d.ts +3 -3
  497. package/src/engine/intelligence/behavior/primitive/ActionBehavior.d.ts.map +1 -1
  498. package/src/engine/intelligence/behavior/primitive/ActionBehavior.js +1 -1
  499. package/src/engine/intelligence/behavior/util/RandomDelayBehavior.d.ts +2 -1
  500. package/src/engine/intelligence/behavior/util/RandomDelayBehavior.d.ts.map +1 -1
  501. package/src/engine/intelligence/blackboard/Blackboard.d.ts +4 -4
  502. package/src/engine/intelligence/blackboard/Blackboard.d.ts.map +1 -1
  503. package/src/engine/intelligence/blackboard/Blackboard.js +2 -2
  504. package/src/engine/intelligence/mcts/MonteCarlo.d.ts +17 -15
  505. package/src/engine/intelligence/mcts/MonteCarlo.d.ts.map +1 -1
  506. package/src/engine/intelligence/mcts/MonteCarlo.js +345 -345
  507. package/src/engine/intelligence/mcts/StateNode.d.ts +2 -2
  508. package/src/engine/intelligence/mcts/StateNode.d.ts.map +1 -1
  509. package/src/engine/intelligence/mcts/StateNode.js +364 -364
  510. package/src/engine/intelligence/optimization/RandomOptimizer.d.ts +3 -3
  511. package/src/engine/intelligence/optimization/RandomOptimizer.d.ts.map +1 -1
  512. package/src/engine/intelligence/optimization/RandomOptimizer.js +2 -2
  513. package/src/engine/intelligence/optimization/optimize_cyclic_sequence_pairwise.d.ts +2 -2
  514. package/src/engine/intelligence/optimization/optimize_cyclic_sequence_pairwise.d.ts.map +1 -1
  515. package/src/engine/intelligence/optimization/optimize_cyclic_sequence_pairwise.js +1 -1
  516. package/src/engine/knowledge/database/StaticKnowledgeDataTable.d.ts +4 -5
  517. package/src/engine/knowledge/database/StaticKnowledgeDataTable.d.ts.map +1 -1
  518. package/src/engine/knowledge/database/StaticKnowledgeDataTable.js +2 -2
  519. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.d.ts +14 -0
  520. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.d.ts.map +1 -0
  521. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_2_3.js +38 -0
  522. package/src/engine/navigation/ecs/path_following/PathFollowingSystem.d.ts +0 -5
  523. package/src/engine/navigation/ecs/path_following/PathFollowingSystem.d.ts.map +1 -1
  524. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
  525. package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +433 -425
  526. package/src/engine/physics/constraint/solve_constraints.d.ts +4 -1
  527. package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
  528. package/src/engine/physics/constraint/solve_constraints.js +38 -13
  529. package/src/engine/physics/contact/ManifoldStore.d.ts +15 -3
  530. package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
  531. package/src/engine/physics/contact/ManifoldStore.js +15 -3
  532. package/src/engine/physics/ecs/Joint.d.ts +7 -4
  533. package/src/engine/physics/ecs/Joint.d.ts.map +1 -1
  534. package/src/engine/physics/ecs/Joint.js +7 -4
  535. package/src/engine/physics/ecs/PhysicsSystem.d.ts +14 -0
  536. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  537. package/src/engine/physics/ecs/PhysicsSystem.js +16 -0
  538. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -8
  539. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts.map +1 -1
  540. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -7
  541. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts.map +1 -1
  542. package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts +15 -7
  543. package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts.map +1 -1
  544. package/src/engine/physics/narrowphase/convex_convex_manifold.js +33 -10
  545. package/src/engine/physics/narrowphase/refine_ray_concave.d.ts +6 -2
  546. package/src/engine/physics/narrowphase/refine_ray_concave.d.ts.map +1 -1
  547. package/src/engine/physics/narrowphase/refine_ray_concave.js +6 -2
  548. package/src/engine/physics/narrowphase/refine_ray_hit.d.ts +6 -2
  549. package/src/engine/physics/narrowphase/refine_ray_hit.d.ts.map +1 -1
  550. package/src/engine/physics/narrowphase/refine_ray_hit.js +6 -2
  551. package/src/engine/physics/queries/raycast.d.ts.map +1 -1
  552. package/src/engine/physics/queries/raycast.js +11 -4
  553. package/src/engine/save/GameStateLoader.d.ts +2 -2
  554. package/src/engine/save/GameStateLoader.d.ts.map +1 -1
  555. package/src/engine/save/GameStateLoader.js +1 -1
  556. package/src/engine/save/Storage.d.ts +4 -4
  557. package/src/engine/save/Storage.d.ts.map +1 -1
  558. package/src/engine/save/Storage.js +2 -2
  559. package/src/engine/save/storage/IndexedDBStorage.d.ts.map +1 -1
  560. package/src/engine/save/storage/IndexedDBStorage.js +24 -5
  561. package/src/engine/simulation/Ticker.d.ts +12 -0
  562. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  563. package/src/engine/simulation/Ticker.js +18 -0
  564. package/src/engine/sound/simulation/AcousticSimulator.d.ts.map +1 -1
  565. package/src/engine/sound/simulation/AcousticSimulator.js +9 -1
  566. package/src/engine/sound/simulation/core/VolumeField.d.ts +6 -2
  567. package/src/engine/sound/simulation/core/VolumeField.d.ts.map +1 -1
  568. package/src/engine/sound/simulation/core/VolumeField.js +6 -2
  569. package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts +6 -2
  570. package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts.map +1 -1
  571. package/src/engine/sound/simulation/probe/AcousticProbeField.js +6 -2
  572. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts +6 -2
  573. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts.map +1 -1
  574. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.js +6 -2
  575. package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts +3 -1
  576. package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts.map +1 -1
  577. package/src/engine/sound/simulation/probe/bakeProbeReflectors.js +3 -1
  578. package/src/engine/sound/simulation/prototypeAcousticSolver.js +1652 -1652
  579. package/src/engine/sound/sopra/util/buildAttenuationCurve.d.ts +2 -2
  580. package/src/engine/sound/sopra/util/buildAttenuationCurve.d.ts.map +1 -1
  581. package/src/engine/sound/sopra/util/buildAttenuationCurve.js +40 -40
  582. package/src/engine/ui/GUIEngine.d.ts.map +1 -1
  583. package/src/engine/ui/GUIEngine.js +8 -1
  584. package/src/engine/ui/notification/NotificationManager.d.ts +5 -5
  585. package/src/engine/ui/notification/NotificationManager.d.ts.map +1 -1
  586. package/src/engine/ui/notification/NotificationManager.js +4 -4
  587. package/src/engine/ui/tiles2d/TileGrid.d.ts +2 -2
  588. package/src/engine/ui/tiles2d/TileGrid.d.ts.map +1 -1
  589. package/src/engine/ui/tiles2d/TileGrid.js +1 -1
  590. package/src/generation/filtering/numeric/complex/CellFilterSimplexNoise.d.ts +1 -1
  591. package/src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js +1 -1
  592. package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +2 -2
  593. package/src/generation/grid/generation/util/buildPathFromDistanceMap.d.ts +1 -1
  594. package/src/generation/grid/generation/util/buildPathFromDistanceMap.js +1 -1
  595. package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorRandomRotation.d.ts +2 -1
  596. package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorRandomRotation.d.ts.map +1 -1
  597. package/src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.d.ts +2 -1
  598. package/src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.d.ts.map +1 -1
  599. package/src/generation/markers/transform/MarkerNodeTransformRotateRandom.d.ts +2 -1
  600. package/src/generation/markers/transform/MarkerNodeTransformRotateRandom.d.ts.map +1 -1
  601. package/src/generation/markers/transform/MarkerNodeTransformerRecordPropertyClosure.d.ts +4 -3
  602. package/src/generation/markers/transform/MarkerNodeTransformerRecordPropertyClosure.d.ts.map +1 -1
  603. package/src/generation/markers/transform/MarkerNodeTransformerRecordPropertyClosure.js +1 -1
  604. package/src/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.d.ts +2 -1
  605. package/src/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.d.ts.map +1 -1
  606. package/src/generation/theme/TerrainTheme.d.ts.map +1 -1
  607. package/src/generation/theme/TerrainTheme.js +2 -1
  608. package/src/generation/theme/ThemeEngine.d.ts.map +1 -1
  609. package/src/generation/theme/ThemeEngine.js +6 -5
  610. package/src/view/ViewGroup.d.ts.map +1 -1
  611. package/src/view/ViewGroup.js +9 -7
  612. package/src/view/common/VirtualListView.d.ts +1 -1
  613. package/src/view/common/VirtualListView.js +1 -1
  614. package/src/view/graphics/WebGLContextFailureView.d.ts +19 -0
  615. package/src/view/graphics/WebGLContextFailureView.d.ts.map +1 -0
  616. package/src/view/graphics/WebGLContextFailureView.js +76 -0
  617. package/src/view/minimap/Minimap.d.ts +8 -0
  618. package/src/view/minimap/Minimap.d.ts.map +1 -1
  619. package/src/view/minimap/Minimap.js +16 -3
  620. package/src/view/minimap/dom/MinimapMarkerView.d.ts.map +1 -1
  621. package/src/view/minimap/dom/MinimapMarkerView.js +3 -1
  622. package/src/view/tooltip/gml/compiler/GMLReferenceCompiler.d.ts +2 -2
  623. package/src/view/tooltip/gml/compiler/GMLReferenceCompiler.d.ts.map +1 -1
  624. package/src/view/tooltip/gml/compiler/GMLReferenceCompiler.js +1 -1
@@ -42,10 +42,10 @@ export class TopoTriangle {
42
42
  clone(): TopoTriangle;
43
43
  /**
44
44
  *
45
- * @param {function(reason:string)} error_consumer
45
+ * @param {(reason: string) => void} error_consumer
46
46
  * @return {boolean}
47
47
  */
48
- validate(error_consumer: any): boolean;
48
+ validate(error_consumer: (reason: string) => void): boolean;
49
49
  /**
50
50
  *
51
51
  * @return {boolean}
@@ -1 +1 @@
1
- {"version":3,"file":"TopoTriangle.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/struct/TopoTriangle.js"],"names":[],"mappings":"AAWA;IAmRI;;;;;;;;;;;;OAYG;IACH,sBAXW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACL,YAAY,CA4CvB;IAzUD;;;OAGG;IACH,OAFU,MAAM,CAEQ;IACxB;;;OAGG;IACH,UAFU,UAAU,EAAE,CAER;IACd;;;OAGG;IACH,OAFU,QAAQ,EAAE,CAET;IAEX;;;OAGG;IACH,QAFU,MAAM,EAAE,OAAK,CAEJ;IAEnB,uBAEC;IAED;;;OAGG;IACH,YAFW,YAAY,QAQtB;IAED,sBAMC;IAED;;;;OAIG;IACH,+BAFY,OAAO,CA0ClB;IAED;;;OAGG;IACH,YAFY,OAAO,CAKlB;IAED;;;;OAIG;IACH,sBAHW,QAAQ,eACR,QAAQ,QAIlB;IAED;;;;OAIG;IACH,wBAHW,UAAU,eACV,UAAU,QAMpB;IAED;;OAEG;IACH,gCASC;IAED;;OAEG;IACH,eAmBC;IAED;;;OAGG;IACH,WAFW,QAAQ,QAMlB;IAED;;;;OAIG;IACH,iBAHW,QAAQ,GACP,OAAO,CAIlB;IAED;;;OAGG;IACH,cAFW,QAAQ,QAQlB;IAED;;;;OAIG;IACH,mBAHW,QAAQ,GACN,OAAO,CAKnB;IAED,sBAaC;IAGD;;;;OAIG;IACH,mBAHW,MAAM,UACN,UAAU,QAOpB;IAED;;;;OAIG;IACH,uBAHW,UAAU,GACT,OAAO,CAIlB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,EAAE,iBACd,MAAM,GACJ,MAAM,CA8BlB;IA4DL;;;OAGG;IACH,qBAFU,OAAO,CAEgB;CANhC;2BA/U0B,iBAAiB;yBADnB,eAAe"}
1
+ {"version":3,"file":"TopoTriangle.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/struct/TopoTriangle.js"],"names":[],"mappings":"AAWA;IAmRI;;;;;;;;;;;;OAYG;IACH,sBAXW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACL,YAAY,CA4CvB;IAzUD;;;OAGG;IACH,OAFU,MAAM,CAEQ;IACxB;;;OAGG;IACH,UAFU,UAAU,EAAE,CAER;IACd;;;OAGG;IACH,OAFU,QAAQ,EAAE,CAET;IAEX;;;OAGG;IACH,QAFU,MAAM,EAAE,OAAK,CAEJ;IAEnB,uBAEC;IAED;;;OAGG;IACH,YAFW,YAAY,QAQtB;IAED,sBAMC;IAED;;;;OAIG;IACH,kCAHoB,MAAM,KAAK,IAAI,GACvB,OAAO,CA0ClB;IAED;;;OAGG;IACH,YAFY,OAAO,CAKlB;IAED;;;;OAIG;IACH,sBAHW,QAAQ,eACR,QAAQ,QAIlB;IAED;;;;OAIG;IACH,wBAHW,UAAU,eACV,UAAU,QAMpB;IAED;;OAEG;IACH,gCASC;IAED;;OAEG;IACH,eAmBC;IAED;;;OAGG;IACH,WAFW,QAAQ,QAMlB;IAED;;;;OAIG;IACH,iBAHW,QAAQ,GACP,OAAO,CAIlB;IAED;;;OAGG;IACH,cAFW,QAAQ,QAQlB;IAED;;;;OAIG;IACH,mBAHW,QAAQ,GACN,OAAO,CAKnB;IAED,sBAaC;IAGD;;;;OAIG;IACH,mBAHW,MAAM,UACN,UAAU,QAOpB;IAED;;;;OAIG;IACH,uBAHW,UAAU,GACT,OAAO,CAIlB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,EAAE,iBACd,MAAM,GACJ,MAAM,CA8BlB;IA4DL;;;OAGG;IACH,qBAFU,OAAO,CAEgB;CANhC;2BA/U0B,iBAAiB;yBADnB,eAAe"}
@@ -58,7 +58,7 @@ export class TopoTriangle {
58
58
 
59
59
  /**
60
60
  *
61
- * @param {function(reason:string)} error_consumer
61
+ * @param {(reason: string) => void} error_consumer
62
62
  * @return {boolean}
63
63
  */
64
64
  validate(error_consumer) {
@@ -56,10 +56,10 @@ export class TopoVertex {
56
56
  clone(): TopoVertex;
57
57
  /**
58
58
  *
59
- * @param {function(reason:string)} error_consumer
59
+ * @param {(reason: string) => void} error_consumer
60
60
  * @return {boolean}
61
61
  */
62
- validate(error_consumer: any): boolean;
62
+ validate(error_consumer: (reason: string) => void): boolean;
63
63
  /**
64
64
  *
65
65
  * @param {TopoVertex} other
@@ -1 +1 @@
1
- {"version":3,"file":"TopoVertex.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/struct/TopoVertex.js"],"names":[],"mappings":"AAQA;IAkRI;;;;;;OAMG;IACH,eALW,MAAM,KACN,MAAM,KACN,MAAM,GACL,UAAU,CAYrB;IAjSD;;;OAGG;IACH,OAFU,MAAM,CAEe;IAE/B;;;OAGG;IACH,OAFU,UAAU,CAET;IAEX;;;OAGG;IACH,OAFU,cAAc,CAEb;IAEX;;;OAGG;IACH,GAFU,MAAM,CAEV;IACN;;;OAGG;IACH,GAFU,MAAM,CAEV;IACN;;;OAGG;IACH,GAFU,MAAM,CAEV;IAEN,gBAEC;IAED,gBAEC;IAED,gBAEC;IAED;;;OAGG;IACH,uBAEC;IAED;;;OAGG;IACH,YAFW,UAAU,QAYpB;IAED;;OAEG;IACH,SAFa,UAAU,CAQtB;IAED;;;;OAIG;IACH,+BAFY,OAAO,CA8BlB;IAED;;;;OAIG;IACH,kBAHW,UAAU,GACT,MAAM,CAWjB;IAED;;;OAGG;IACH,+BAKC;IAED;;;;OAIG;IACH,gCAFY,OAAO,CAMlB;IAED;;;;OAIG;IACH,kCAFY,OAAO,CAKlB;IAED;;;OAGG;IACH,kCAKC;IAED;;;OAGG;IACH,2BAMC;IAED;;;;OAIG;IACH,4BAFY,OAAO,CAOlB;IAED;;;;OAIG;IACH,2DAaC;IAED;;;;OAIG;IACH,8BAFa,OAAO,CAMnB;IAED;;;;OAIG;IACH,yBAFa,OAAO,CAWnB;IAED;;;;;OAKG;IACH,iCAJW,UAAU,EAAE,iBACZ,MAAM,GACJ,MAAM,CAoBlB;IAsBL;;;OAGG;IACH,uBAFU,OAAO,CAEgB;CANhC"}
1
+ {"version":3,"file":"TopoVertex.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/struct/TopoVertex.js"],"names":[],"mappings":"AAQA;IAkRI;;;;;;OAMG;IACH,eALW,MAAM,KACN,MAAM,KACN,MAAM,GACL,UAAU,CAYrB;IAjSD;;;OAGG;IACH,OAFU,MAAM,CAEe;IAE/B;;;OAGG;IACH,OAFU,UAAU,CAET;IAEX;;;OAGG;IACH,OAFU,cAAc,CAEb;IAEX;;;OAGG;IACH,GAFU,MAAM,CAEV;IACN;;;OAGG;IACH,GAFU,MAAM,CAEV;IACN;;;OAGG;IACH,GAFU,MAAM,CAEV;IAEN,gBAEC;IAED,gBAEC;IAED,gBAEC;IAED;;;OAGG;IACH,uBAEC;IAED;;;OAGG;IACH,YAFW,UAAU,QAYpB;IAED;;OAEG;IACH,SAFa,UAAU,CAQtB;IAED;;;;OAIG;IACH,kCAHoB,MAAM,KAAK,IAAI,GACvB,OAAO,CA8BlB;IAED;;;;OAIG;IACH,kBAHW,UAAU,GACT,MAAM,CAWjB;IAED;;;OAGG;IACH,+BAKC;IAED;;;;OAIG;IACH,gCAFY,OAAO,CAMlB;IAED;;;;OAIG;IACH,kCAFY,OAAO,CAKlB;IAED;;;OAGG;IACH,kCAKC;IAED;;;OAGG;IACH,2BAMC;IAED;;;;OAIG;IACH,4BAFY,OAAO,CAOlB;IAED;;;;OAIG;IACH,2DAaC;IAED;;;;OAIG;IACH,8BAFa,OAAO,CAMnB;IAED;;;;OAIG;IACH,yBAFa,OAAO,CAWnB;IAED;;;;;OAKG;IACH,iCAJW,UAAU,EAAE,iBACZ,MAAM,GACJ,MAAM,CAoBlB;IAsBL;;;OAGG;IACH,uBAFU,OAAO,CAEgB;CANhC"}
@@ -91,7 +91,7 @@ export class TopoVertex {
91
91
 
92
92
  /**
93
93
  *
94
- * @param {function(reason:string)} error_consumer
94
+ * @param {(reason: string) => void} error_consumer
95
95
  * @return {boolean}
96
96
  */
97
97
  validate(error_consumer) {
@@ -1,13 +1,30 @@
1
1
  /**
2
- * Triangulate a face in a binary topology mesh.
2
+ * Split one face of a {@link BinaryTopology} into triangles, in place.
3
3
  *
4
- * Assumes that each face is a convex polygon.
4
+ * Handles any simple polygon, convex or not: the corner order is projected onto
5
+ * the plane of the face's own Newell normal and triangulated by
6
+ * {@link polygon3_triangulate}, whose decisions are exact. The resulting ear
7
+ * sequence is then replayed as topology surgery, so existing corners keep their
8
+ * identity (and any per-loop data) and only the diagonals are new. Each new face
9
+ * inherits the original's stored normal.
5
10
  *
6
- * If the face is already a triangle, no action is taken.
11
+ * Superseded the previous fan-from-the-first-corner implementation, which was
12
+ * correct only for convex faces and produced silently overlapping triangles for
13
+ * anything else.
14
+ *
15
+ * Nothing is changed, and `1` is returned, when the face is already a triangle,
16
+ * has no area (so no plane to project onto), or projects to a self-intersecting
17
+ * outline -- which is a non-planar or otherwise malformed face, and cannot be cut
18
+ * into ears at all. Leaving it whole is the honest outcome; half-cutting it would
19
+ * corrupt the mesh.
7
20
  *
8
21
  * @param {BinaryTopology} mesh
9
- * @param {number} face Face ID
10
- * @return {boolean} True if the face was triangulated, false if it was already a triangle.
22
+ * @param {number} face
23
+ * @returns {number} how many faces the input face became: `1` when it was left
24
+ * untouched, otherwise the number of triangles it was split into
25
+ *
26
+ * @author Alex Goldring
27
+ * @copyright Company Named Limited (c) 2026
11
28
  */
12
- export function bt_face_triangulate(mesh: BinaryTopology, face: number): boolean;
29
+ export function bt_face_triangulate(mesh: BinaryTopology, face: number): number;
13
30
  //# sourceMappingURL=bt_face_triangulate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bt_face_triangulate.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.js"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,gEAHW,MAAM,GACL,OAAO,CA8GlB"}
1
+ {"version":3,"file":"bt_face_triangulate.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/core/geom/3d/topology/struct/binary/io/face/bt_face_triangulate.js"],"names":[],"mappings":"AAqKA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,gEAPW,MAAM,GACJ,MAAM,CAgFlB"}
@@ -1,124 +1,268 @@
1
- import { NULL_POINTER } from "../../BinaryTopology.js";
2
- import { bt_radial_loop_add } from "../bt_radial_loop_add.js";
3
- import { bt_edge_create } from "../edge/bt_edge_create.js";
4
-
5
- /**
6
- * Triangulate a face in a binary topology mesh.
7
- *
8
- * Assumes that each face is a convex polygon.
9
- *
10
- * If the face is already a triangle, no action is taken.
11
- *
12
- * @param {BinaryTopology} mesh
13
- * @param {number} face Face ID
14
- * @return {boolean} True if the face was triangulated, false if it was already a triangle.
15
- */
16
- export function bt_face_triangulate(
17
- mesh,
18
- face
19
- ) {
20
- // 1. Validate Face and Count Loops
21
- const first_loop = mesh.face_read_loop(face);
22
- if (first_loop === NULL_POINTER){
23
- // should never happen, but just in case
24
- return false;
25
- }
26
-
27
- let count = 0;
28
- let iter = first_loop;
29
- do {
30
- count++;
31
- iter = mesh.loop_read_next(iter);
32
- } while (iter !== first_loop);
33
-
34
- if (count < 4) {
35
- // looks like a triangle
36
- return false;
37
- }
38
-
39
- // 2. Prepare for Triangulation (Fan method at first vertex)
40
- let l_prev = first_loop; // Vertex 0 (Anchor)
41
- let l_curr = mesh.loop_read_next(l_prev); // Vertex 1
42
- let l_next = mesh.loop_read_next(l_curr); // Vertex 2
43
-
44
- const cuts = count - 3;
45
-
46
- // Cache normal to apply to new faces
47
- const normal = new Float32Array(3);
48
- mesh.face_read_normal(normal, 0, face);
49
-
50
- for (let i = 0; i < cuts; i++) {
51
- // We cut the triangle (l_prev, l_curr, l_next) out of 'face'.
52
- // New Edge connects V(l_prev) <-> V(l_next).
53
-
54
- const v_anchor = mesh.loop_read_vertex(l_prev);
55
- const v_target = mesh.loop_read_vertex(l_next);
56
-
57
- // --- A. Create Topology Elements ---
58
- // Reuse: Handles allocation and Vertex Disk Cycle linking
59
- const e_new = bt_edge_create(mesh, v_anchor, v_target);
60
-
61
- const f_new = mesh.faces.allocate();
62
- const l_tri = mesh.loop_create(); // Loop at v_target (for the Triangle)
63
- const l_poly = mesh.loop_create(); // Loop at v_anchor (for the Polygon)
64
-
65
- // --- B. Setup Loops & Radial Cycles ---
66
-
67
- // 1. Setup l_tri properties
68
- mesh.loop_write_vertex(l_tri, v_target);
69
- mesh.loop_write_face(l_tri, f_new);
70
-
71
- // 2. Setup l_poly properties
72
- mesh.loop_write_vertex(l_poly, v_anchor);
73
- mesh.loop_write_face(l_poly, face); // Stays part of the shrinking polygon
74
-
75
- // 3. Reuse: Link loops to the edge's Radial Cycle
76
- bt_radial_loop_add(mesh, l_tri, e_new);
77
- bt_radial_loop_add(mesh, l_poly, e_new);
78
-
79
- // --- C. Re-link Face Loop Topology (Next/Prev) ---
80
-
81
- // 1. Get the loop entering the anchor from the polygon side
82
- const l_prev_prev = mesh.loop_read_prev(l_prev);
83
-
84
- // 2. Assign l_prev and l_curr to the new Triangle Face
85
- mesh.loop_write_face(l_prev, f_new);
86
- mesh.loop_write_face(l_curr, f_new);
87
-
88
- // 3. Close the New Triangle (l_prev -> l_curr -> l_tri)
89
- mesh.loop_write_next(l_prev, l_curr);
90
- mesh.loop_write_prev(l_prev, l_tri);
91
-
92
- mesh.loop_write_next(l_curr, l_tri);
93
- mesh.loop_write_prev(l_curr, l_prev);
94
-
95
- mesh.loop_write_next(l_tri, l_prev);
96
- mesh.loop_write_prev(l_tri, l_curr);
97
-
98
- // Set properties for the new face
99
- mesh.face_write_loop(f_new, l_prev);
100
- mesh.face_write_normal(f_new, normal, 0);
101
-
102
- // 4. Close the Remaining Polygon (l_prev_prev -> l_poly -> l_next)
103
- mesh.loop_write_next(l_prev_prev, l_poly);
104
- // l_prev_prev's prev pointer remains unchanged
105
-
106
- mesh.loop_write_prev(l_poly, l_prev_prev);
107
- mesh.loop_write_next(l_poly, l_next);
108
-
109
- mesh.loop_write_prev(l_next, l_poly);
110
- // l_next's next pointer remains unchanged
111
-
112
- // Update Polygon Face pointer (ensure it points to a valid loop in the poly)
113
- mesh.face_write_loop(face, l_poly);
114
-
115
- // --- D. Advance Fan ---
116
- // The polygon now starts at l_poly (at v0).
117
- // The next triangle will use l_poly as its "prev", l_next as "curr".
118
- l_prev = l_poly;
119
- l_curr = l_next;
120
- l_next = mesh.loop_read_next(l_next);
121
- }
122
-
123
- return true;
124
- }
1
+ import { polygon3_compute_normal } from "../../../../../polygon/polygon3_compute_normal.js";
2
+ import { polygon3_triangulate } from "../../../../../polygon/polygon3_triangulate.js";
3
+ import { NULL_POINTER } from "../../BinaryTopology.js";
4
+ import { bt_radial_loop_add } from "../bt_radial_loop_add.js";
5
+ import { bt_edge_create } from "../edge/bt_edge_create.js";
6
+
7
+ // Per-call scratch, grown on demand. Faces are small, so these stay tiny in
8
+ // practice; module-static so triangulating a whole mesh allocates nothing.
9
+ let _loops = new Uint32Array(0);
10
+ let _positions = new Float64Array(0);
11
+ let _triangles = new Uint32Array(0);
12
+ let _ring_next = new Uint32Array(0);
13
+ let _ring_prev = new Uint32Array(0);
14
+
15
+ const _contour_ends = new Uint32Array(1);
16
+ const _normal = new Float64Array(3);
17
+ const _stored_normal = new Float32Array(3);
18
+ const _coordinate = new Float32Array(3);
19
+
20
+ /**
21
+ * @param {number} corner_count
22
+ */
23
+ function ensure_capacity(corner_count) {
24
+ if (_loops.length >= corner_count) {
25
+ return;
26
+ }
27
+
28
+ _loops = new Uint32Array(corner_count);
29
+ _positions = new Float64Array(corner_count * 3);
30
+ _triangles = new Uint32Array(Math.max(0, corner_count - 2) * 3);
31
+ _ring_next = new Uint32Array(corner_count);
32
+ _ring_prev = new Uint32Array(corner_count);
33
+ }
34
+
35
+ /**
36
+ * Cut the triangle `(prev(l_ear), l_ear, next(l_ear))` off `face` as a new face,
37
+ * leaving `face` one corner smaller.
38
+ *
39
+ * The two existing corners move to the new face and two fresh loops are created:
40
+ * one closing the triangle at the far vertex, one continuing the shrunken polygon
41
+ * at the near vertex. Both are attached to the new diagonal edge's radial cycle.
42
+ *
43
+ * @param {BinaryTopology} mesh
44
+ * @param {number} face
45
+ * @param {number} l_ear the corner being cut away
46
+ * @param {Float32Array} normal applied to the new face
47
+ * @returns {number} the replacement corner the shrunken polygon now has at the
48
+ * ear's predecessor vertex -- the old one moved to the new triangle, so any
49
+ * caller holding it must swap in this one
50
+ */
51
+ function cut_ear(mesh, face, l_ear, normal) {
52
+ const l_prev = mesh.loop_read_prev(l_ear);
53
+ const l_next = mesh.loop_read_next(l_ear);
54
+
55
+ const v_anchor = mesh.loop_read_vertex(l_prev);
56
+ const v_target = mesh.loop_read_vertex(l_next);
57
+
58
+ // handles allocation and vertex-disk linking for the diagonal
59
+ const e_new = bt_edge_create(mesh, v_anchor, v_target);
60
+
61
+ const f_new = mesh.faces.allocate();
62
+ const l_tri = mesh.loop_create(); // closes the triangle, at v_target
63
+ const l_poly = mesh.loop_create(); // continues the polygon, at v_anchor
64
+
65
+ mesh.loop_write_vertex(l_tri, v_target);
66
+ mesh.loop_write_face(l_tri, f_new);
67
+
68
+ mesh.loop_write_vertex(l_poly, v_anchor);
69
+ mesh.loop_write_face(l_poly, face);
70
+
71
+ bt_radial_loop_add(mesh, l_tri, e_new);
72
+ bt_radial_loop_add(mesh, l_poly, e_new);
73
+
74
+ const l_prev_prev = mesh.loop_read_prev(l_prev);
75
+
76
+ mesh.loop_write_face(l_prev, f_new);
77
+ mesh.loop_write_face(l_ear, f_new);
78
+
79
+ // triangle: l_prev -> l_ear -> l_tri
80
+ mesh.loop_write_next(l_prev, l_ear);
81
+ mesh.loop_write_prev(l_prev, l_tri);
82
+
83
+ mesh.loop_write_next(l_ear, l_tri);
84
+ mesh.loop_write_prev(l_ear, l_prev);
85
+
86
+ mesh.loop_write_next(l_tri, l_prev);
87
+ mesh.loop_write_prev(l_tri, l_ear);
88
+
89
+ mesh.face_write_loop(f_new, l_prev);
90
+ mesh.face_write_normal(f_new, normal, 0);
91
+
92
+ // remaining polygon: l_prev_prev -> l_poly -> l_next
93
+ mesh.loop_write_next(l_prev_prev, l_poly);
94
+
95
+ mesh.loop_write_prev(l_poly, l_prev_prev);
96
+ mesh.loop_write_next(l_poly, l_next);
97
+
98
+ mesh.loop_write_prev(l_next, l_poly);
99
+
100
+ mesh.face_write_loop(face, l_poly);
101
+
102
+ return l_poly;
103
+ }
104
+
105
+ /**
106
+ * Reset the corner index ring to `0 -> 1 -> ... -> corner_count - 1 -> 0`, the
107
+ * order the corners were collected in.
108
+ *
109
+ * @param {number} corner_count
110
+ */
111
+ function reset_ring(corner_count) {
112
+ for (let i = 0; i < corner_count; i++) {
113
+ _ring_next[i] = (i + 1) % corner_count;
114
+ _ring_prev[i] = (i + corner_count - 1) % corner_count;
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Remove index `i` from the corner ring.
120
+ *
121
+ * @param {number} i
122
+ */
123
+ function unlink_ring(i) {
124
+ _ring_next[_ring_prev[i]] = _ring_next[i];
125
+ _ring_prev[_ring_next[i]] = _ring_prev[i];
126
+ }
127
+
128
+ /**
129
+ * Replay the emitted triangle list against a plain index ring without touching the
130
+ * mesh, checking that every triple is an ear of the ring at the moment it is
131
+ * reached. Only then is it safe to perform the same sequence as topology surgery.
132
+ *
133
+ * Ear clipping emits exactly this sequence for a simple polygon. Its recovery
134
+ * passes, which run for a self-intersecting projection, do not -- and half-applying
135
+ * those would leave the mesh structurally broken rather than merely untriangulated.
136
+ *
137
+ * @param {number} corner_count
138
+ * @param {number} triangle_count
139
+ * @returns {boolean}
140
+ */
141
+ function is_ear_sequence(corner_count, triangle_count) {
142
+ if (triangle_count !== corner_count - 2) {
143
+ return false;
144
+ }
145
+
146
+ reset_ring(corner_count);
147
+
148
+ for (let t = 0; t < triangle_count; t++) {
149
+ const a = _triangles[t * 3];
150
+ const b = _triangles[t * 3 + 1];
151
+ const c = _triangles[t * 3 + 2];
152
+
153
+ const forward = _ring_prev[b] === a && _ring_next[b] === c;
154
+ const backward = _ring_prev[b] === c && _ring_next[b] === a;
155
+
156
+ if (!forward && !backward) {
157
+ return false;
158
+ }
159
+
160
+ unlink_ring(b);
161
+ }
162
+
163
+ return true;
164
+ }
165
+
166
+ /**
167
+ * Split one face of a {@link BinaryTopology} into triangles, in place.
168
+ *
169
+ * Handles any simple polygon, convex or not: the corner order is projected onto
170
+ * the plane of the face's own Newell normal and triangulated by
171
+ * {@link polygon3_triangulate}, whose decisions are exact. The resulting ear
172
+ * sequence is then replayed as topology surgery, so existing corners keep their
173
+ * identity (and any per-loop data) and only the diagonals are new. Each new face
174
+ * inherits the original's stored normal.
175
+ *
176
+ * Superseded the previous fan-from-the-first-corner implementation, which was
177
+ * correct only for convex faces and produced silently overlapping triangles for
178
+ * anything else.
179
+ *
180
+ * Nothing is changed, and `1` is returned, when the face is already a triangle,
181
+ * has no area (so no plane to project onto), or projects to a self-intersecting
182
+ * outline -- which is a non-planar or otherwise malformed face, and cannot be cut
183
+ * into ears at all. Leaving it whole is the honest outcome; half-cutting it would
184
+ * corrupt the mesh.
185
+ *
186
+ * @param {BinaryTopology} mesh
187
+ * @param {number} face
188
+ * @returns {number} how many faces the input face became: `1` when it was left
189
+ * untouched, otherwise the number of triangles it was split into
190
+ *
191
+ * @author Alex Goldring
192
+ * @copyright Company Named Limited (c) 2026
193
+ */
194
+ export function bt_face_triangulate(mesh, face) {
195
+ const first_loop = mesh.face_read_loop(face);
196
+
197
+ if (first_loop === NULL_POINTER) {
198
+ return 1;
199
+ }
200
+
201
+ let corner_count = 0;
202
+ let iter = first_loop;
203
+
204
+ do {
205
+ corner_count++;
206
+ iter = mesh.loop_read_next(iter);
207
+ } while (iter !== first_loop);
208
+
209
+ if (corner_count < 4) {
210
+ return 1;
211
+ }
212
+
213
+ ensure_capacity(corner_count);
214
+
215
+ iter = first_loop;
216
+
217
+ for (let i = 0; i < corner_count; i++) {
218
+ _loops[i] = iter;
219
+
220
+ mesh.vertex_read_coordinate(_coordinate, 0, mesh.loop_read_vertex(iter));
221
+
222
+ _positions[i * 3] = _coordinate[0];
223
+ _positions[i * 3 + 1] = _coordinate[1];
224
+ _positions[i * 3 + 2] = _coordinate[2];
225
+
226
+ iter = mesh.loop_read_next(iter);
227
+ }
228
+
229
+ polygon3_compute_normal(_normal, 0, _positions, 0, corner_count);
230
+
231
+ if (_normal[0] === 0 && _normal[1] === 0 && _normal[2] === 0) {
232
+ // no area, so no plane to project onto
233
+ return 1;
234
+ }
235
+
236
+ _contour_ends[0] = corner_count;
237
+
238
+ const triangle_count = polygon3_triangulate(
239
+ _triangles, 0,
240
+ _positions, _contour_ends, 1,
241
+ _normal[0], _normal[1], _normal[2]
242
+ );
243
+
244
+ if (!is_ear_sequence(corner_count, triangle_count)) {
245
+ return 1;
246
+ }
247
+
248
+ mesh.face_read_normal(_stored_normal, 0, face);
249
+
250
+ // The last triple is the residual triangle, which is what `face` itself
251
+ // becomes; the other n-3 are cut off it one at a time.
252
+ //
253
+ // The ring is re-walked alongside the cuts because each cut hands the shrunken
254
+ // polygon a NEW corner in place of the ear's predecessor -- `_loops` has to
255
+ // follow that swap or the next cut would reach into the triangle just made.
256
+ reset_ring(corner_count);
257
+
258
+ for (let t = 0; t < triangle_count - 1; t++) {
259
+ const ear = _triangles[t * 3 + 1];
260
+ const predecessor = _ring_prev[ear];
261
+
262
+ _loops[predecessor] = cut_ear(mesh, face, _loops[ear], _stored_normal);
263
+
264
+ unlink_ring(ear);
265
+ }
266
+
267
+ return triangle_count;
268
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Run {@link bt_mesh_validate} and throw if the mesh is structurally broken.
3
+ *
4
+ * Uses a real `throw` rather than `assert.*` on purpose: `assert.*` is stripped
5
+ * from production bundles, and this is the check a spec relies on to fail. A
6
+ * caller that wants the free-in-production behaviour should call
7
+ * {@link bt_mesh_validate} inside its own `assert.ok(...)`.
8
+ *
9
+ * @param {BinaryTopology} mesh
10
+ * @param {string} [context] prepended to the message, e.g. the operation under test
11
+ * @throws {Error} when any structural invariant is broken
12
+ *
13
+ * @author Alex Goldring
14
+ * @copyright Company Named Limited (c) 2026
15
+ */
16
+ export function bt_mesh_assert_valid(mesh: BinaryTopology, context?: string): void;
17
+ //# sourceMappingURL=bt_mesh_assert_valid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bt_mesh_assert_valid.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/geom/3d/topology/struct/binary/query/bt_mesh_assert_valid.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;GAcG;AACH,qEANW,MAAM,QAwBhB"}
@@ -0,0 +1,44 @@
1
+ import { bt_mesh_validate } from "./bt_mesh_validate.js";
2
+
3
+ /**
4
+ * Maximum number of defects quoted in the thrown message. A corrupted cycle
5
+ * typically reports one defect per element on it, and a 10k-element dump helps
6
+ * nobody read the first one.
7
+ * @type {number}
8
+ */
9
+ const REPORTED_DEFECT_LIMIT = 20;
10
+
11
+ /**
12
+ * Run {@link bt_mesh_validate} and throw if the mesh is structurally broken.
13
+ *
14
+ * Uses a real `throw` rather than `assert.*` on purpose: `assert.*` is stripped
15
+ * from production bundles, and this is the check a spec relies on to fail. A
16
+ * caller that wants the free-in-production behaviour should call
17
+ * {@link bt_mesh_validate} inside its own `assert.ok(...)`.
18
+ *
19
+ * @param {BinaryTopology} mesh
20
+ * @param {string} [context] prepended to the message, e.g. the operation under test
21
+ * @throws {Error} when any structural invariant is broken
22
+ *
23
+ * @author Alex Goldring
24
+ * @copyright Company Named Limited (c) 2026
25
+ */
26
+ export function bt_mesh_assert_valid(mesh, context = "") {
27
+ const defects = bt_mesh_validate(mesh);
28
+
29
+ if (defects.length === 0) {
30
+ return;
31
+ }
32
+
33
+ const quoted = defects.slice(0, REPORTED_DEFECT_LIMIT);
34
+
35
+ const lines = quoted.map(d => ` [code ${d.code}] ${d.detail}`);
36
+
37
+ if (defects.length > quoted.length) {
38
+ lines.push(` ... and ${defects.length - quoted.length} more`);
39
+ }
40
+
41
+ const prefix = context === "" ? "" : `${context}: `;
42
+
43
+ throw new Error(`${prefix}mesh has ${defects.length} structural defect(s)\n${lines.join("\n")}`);
44
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Number of loops on an edge's radial cycle, i.e. how many faces use that edge.
3
+ *
4
+ * `0` is a wire edge, `1` a boundary edge, `2` a manifold interior edge, and `3`
5
+ * or more a non-manifold edge. {@link bt_edge_is_boundary} answers the `1` case
6
+ * on its own; this is the counting version the manifoldness queries need.
7
+ *
8
+ * The walk is bounded by the loop pool's size so a corrupted radial cycle cannot
9
+ * hang the caller. A cycle that long is itself broken -- run
10
+ * {@link bt_mesh_validate} to find out where.
11
+ *
12
+ * @param {BinaryTopology} mesh
13
+ * @param {number} edge_id
14
+ * @returns {number}
15
+ *
16
+ * @author Alex Goldring
17
+ * @copyright Company Named Limited (c) 2026
18
+ */
19
+ export function bt_mesh_count_edge_faces(mesh: BinaryTopology, edge_id: number): number;
20
+ //# sourceMappingURL=bt_mesh_count_edge_faces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bt_mesh_count_edge_faces.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/geom/3d/topology/struct/binary/query/bt_mesh_count_edge_faces.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,wEANW,MAAM,GACJ,MAAM,CAwBlB"}
@@ -0,0 +1,40 @@
1
+ import { NULL_POINTER } from "../BinaryTopology.js";
2
+
3
+ /**
4
+ * Number of loops on an edge's radial cycle, i.e. how many faces use that edge.
5
+ *
6
+ * `0` is a wire edge, `1` a boundary edge, `2` a manifold interior edge, and `3`
7
+ * or more a non-manifold edge. {@link bt_edge_is_boundary} answers the `1` case
8
+ * on its own; this is the counting version the manifoldness queries need.
9
+ *
10
+ * The walk is bounded by the loop pool's size so a corrupted radial cycle cannot
11
+ * hang the caller. A cycle that long is itself broken -- run
12
+ * {@link bt_mesh_validate} to find out where.
13
+ *
14
+ * @param {BinaryTopology} mesh
15
+ * @param {number} edge_id
16
+ * @returns {number}
17
+ *
18
+ * @author Alex Goldring
19
+ * @copyright Company Named Limited (c) 2026
20
+ */
21
+ export function bt_mesh_count_edge_faces(mesh, edge_id) {
22
+ const start = mesh.edge_read_loop(edge_id);
23
+
24
+ if (start === NULL_POINTER) {
25
+ return 0;
26
+ }
27
+
28
+ const limit = mesh.loops.size;
29
+
30
+ let l = start;
31
+ let count = 0;
32
+
33
+ do {
34
+ count++;
35
+
36
+ l = mesh.loop_read_radial_next(l);
37
+ } while (l !== start && l !== NULL_POINTER && count <= limit);
38
+
39
+ return count;
40
+ }