@woosh/meep-engine 2.138.20 → 2.140.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 (584) hide show
  1. package/package.json +1 -1
  2. package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts +3 -3
  3. package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts.map +1 -1
  4. package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.js +4 -4
  5. package/src/core/collection/PairUint32Map.d.ts +100 -0
  6. package/src/core/collection/PairUint32Map.d.ts.map +1 -0
  7. package/src/core/collection/PairUint32Map.js +321 -0
  8. package/src/core/collection/Uint32Map.d.ts +119 -0
  9. package/src/core/collection/Uint32Map.d.ts.map +1 -0
  10. package/src/core/collection/Uint32Map.js +345 -0
  11. package/src/core/collection/array/array_shuffle.d.ts +10 -3
  12. package/src/core/collection/array/array_shuffle.d.ts.map +1 -1
  13. package/src/core/collection/array/array_shuffle.js +27 -22
  14. package/src/core/collection/heap/FibonacciHeap.d.ts +195 -0
  15. package/src/core/collection/heap/FibonacciHeap.d.ts.map +1 -0
  16. package/src/core/collection/heap/FibonacciHeap.js +586 -0
  17. package/src/core/collection/heap/Uint32Heap.js +1 -1
  18. package/src/core/collection/heap/Uint32Heap4.d.ts +169 -0
  19. package/src/core/collection/heap/Uint32Heap4.d.ts.map +1 -0
  20. package/src/core/collection/heap/Uint32Heap4.js +490 -0
  21. package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts +30 -0
  22. package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts.map +1 -0
  23. package/src/core/geom/3d/aabb/aabb3_transform_oriented.js +93 -0
  24. package/src/core/geom/3d/line/line3_closest_points_segment_segment.d.ts +27 -0
  25. package/src/core/geom/3d/line/line3_closest_points_segment_segment.d.ts.map +1 -0
  26. package/src/core/geom/3d/line/line3_closest_points_segment_segment.js +88 -0
  27. package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts +54 -0
  28. package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts.map +1 -0
  29. package/src/core/geom/3d/quaternion/quat3_to_matrix3.js +69 -0
  30. package/src/core/geom/3d/shape/AbstractShape3D.d.ts +24 -2
  31. package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
  32. package/src/core/geom/3d/shape/AbstractShape3D.js +24 -1
  33. package/src/core/geom/3d/shape/BoxShape3D.d.ts +61 -0
  34. package/src/core/geom/3d/shape/BoxShape3D.d.ts.map +1 -0
  35. package/src/core/geom/3d/shape/BoxShape3D.js +158 -0
  36. package/src/core/geom/3d/shape/CapsuleShape3D.d.ts +11 -0
  37. package/src/core/geom/3d/shape/CapsuleShape3D.d.ts.map +1 -1
  38. package/src/core/geom/3d/shape/CapsuleShape3D.js +12 -0
  39. package/src/core/geom/3d/shape/HeightMapShape3D.d.ts +148 -0
  40. package/src/core/geom/3d/shape/HeightMapShape3D.d.ts.map +1 -0
  41. package/src/core/geom/3d/shape/HeightMapShape3D.js +451 -0
  42. package/src/core/geom/3d/shape/MeshShape3D.d.ts +210 -0
  43. package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -0
  44. package/src/core/geom/3d/shape/MeshShape3D.js +593 -0
  45. package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
  46. package/src/core/geom/3d/shape/TransformedShape3D.js +46 -2
  47. package/src/core/geom/3d/shape/Triangle3D.d.ts +95 -0
  48. package/src/core/geom/3d/shape/Triangle3D.d.ts.map +1 -0
  49. package/src/core/geom/3d/shape/Triangle3D.js +318 -0
  50. package/src/core/geom/3d/shape/UnionShape3D.js +13 -0
  51. package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts +37 -9
  52. package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts.map +1 -1
  53. package/src/core/geom/3d/shape/UnitCubeShape3D.js +45 -98
  54. package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts +10 -0
  55. package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
  56. package/src/core/geom/3d/shape/UnitSphereShape3D.js +11 -0
  57. package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts +30 -0
  58. package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts.map +1 -0
  59. package/src/core/geom/3d/shape/shape_mesh_from_geometry.js +64 -0
  60. package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts +61 -0
  61. package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts.map +1 -0
  62. package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.js +148 -0
  63. package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.d.ts +39 -0
  64. package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.d.ts.map +1 -0
  65. package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.js +147 -0
  66. package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.d.ts +15 -0
  67. package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.d.ts.map +1 -0
  68. package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.js +22 -0
  69. package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.d.ts +2 -0
  70. package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.d.ts.map +1 -0
  71. package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.js +671 -0
  72. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts +28 -0
  73. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts.map +1 -0
  74. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.js +48 -0
  75. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.d.ts +26 -0
  76. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.d.ts.map +1 -0
  77. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.js +222 -0
  78. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.d.ts +34 -0
  79. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.d.ts.map +1 -0
  80. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.js +146 -0
  81. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.d.ts +36 -0
  82. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.d.ts.map +1 -0
  83. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.js +232 -0
  84. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.d.ts +33 -0
  85. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.d.ts.map +1 -0
  86. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.js +255 -0
  87. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts +68 -0
  88. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts.map +1 -0
  89. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.js +387 -0
  90. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts +35 -0
  91. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts.map +1 -0
  92. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.js +140 -0
  93. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts +31 -0
  94. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts.map +1 -0
  95. package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.js +97 -0
  96. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.d.ts +32 -0
  97. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.d.ts.map +1 -0
  98. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.js +66 -0
  99. package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts +41 -0
  100. package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts.map +1 -1
  101. package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.js +124 -13
  102. package/src/core/geom/3d/topology/struct/binary/BinaryTopology.d.ts +134 -0
  103. package/src/core/geom/3d/topology/struct/binary/BinaryTopology.d.ts.map +1 -1
  104. package/src/core/geom/3d/topology/struct/binary/BinaryTopology.js +276 -3
  105. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts +17 -0
  106. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts.map +1 -0
  107. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.js +135 -0
  108. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.d.ts +14 -0
  109. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.d.ts.map +1 -0
  110. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.js +177 -0
  111. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple.d.ts.map +1 -1
  112. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple.js +20 -4
  113. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.d.ts.map +1 -1
  114. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.js +5 -3
  115. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_create.d.ts.map +1 -1
  116. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_create.js +9 -0
  117. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_get_or_create.d.ts.map +1 -1
  118. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_get_or_create.js +21 -45
  119. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill.d.ts.map +1 -1
  120. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill.js +7 -1
  121. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.d.ts +8 -6
  122. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.d.ts.map +1 -1
  123. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.js +8 -6
  124. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.d.ts +22 -0
  125. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.d.ts.map +1 -0
  126. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.js +73 -0
  127. package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vertex_replace.d.ts.map +1 -1
  128. package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vertex_replace.js +51 -1
  129. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.d.ts +10 -0
  130. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.d.ts.map +1 -0
  131. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.js +42 -0
  132. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.d.ts +28 -0
  133. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.d.ts.map +1 -0
  134. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.js +227 -0
  135. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.d.ts +13 -0
  136. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.d.ts.map +1 -0
  137. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.js +108 -0
  138. package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.d.ts +11 -0
  139. package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.d.ts.map +1 -0
  140. package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.js +20 -0
  141. package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.d.ts +20 -0
  142. package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.d.ts.map +1 -0
  143. package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.js +38 -0
  144. package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts +2 -2
  145. package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts.map +1 -1
  146. package/src/core/geom/3d/triangle/v3_compute_triangle_normal.js +1 -1
  147. package/src/core/geom/vec3/v3_dot_array_array.d.ts +3 -3
  148. package/src/core/geom/vec3/v3_dot_array_array.d.ts.map +1 -1
  149. package/src/core/geom/vec3/v3_dot_array_array.js +2 -2
  150. package/src/core/geom/vec3/v3_negate_array.d.ts +3 -3
  151. package/src/core/geom/vec3/v3_negate_array.d.ts.map +1 -1
  152. package/src/core/geom/vec3/v3_negate_array.js +2 -2
  153. package/src/core/geom/vec3/v3_quat3_apply.d.ts +29 -0
  154. package/src/core/geom/vec3/v3_quat3_apply.d.ts.map +1 -0
  155. package/src/core/geom/vec3/v3_quat3_apply.js +39 -0
  156. package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts +30 -0
  157. package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts.map +1 -0
  158. package/src/core/geom/vec3/v3_quat3_apply_inverse.js +41 -0
  159. package/src/core/geom/vec3/v3_triple_cross_product.d.ts +32 -0
  160. package/src/core/geom/vec3/v3_triple_cross_product.d.ts.map +1 -0
  161. package/src/core/geom/vec3/v3_triple_cross_product.js +45 -0
  162. package/src/core/graph/csr/CSRGraph.d.ts +168 -0
  163. package/src/core/graph/csr/CSRGraph.d.ts.map +1 -0
  164. package/src/core/graph/csr/CSRGraph.js +319 -0
  165. package/src/core/graph/metis/cluster_mesh_metis.d.ts +12 -0
  166. package/src/core/graph/metis/cluster_mesh_metis.d.ts.map +1 -1
  167. package/src/core/graph/metis/cluster_mesh_metis.js +12 -0
  168. package/src/core/graph/metis/metis.d.ts +19 -0
  169. package/src/core/graph/metis/metis.d.ts.map +1 -1
  170. package/src/core/graph/metis/metis.js +20 -0
  171. package/src/core/graph/metis/metis_cluster_bs.d.ts +11 -0
  172. package/src/core/graph/metis/metis_cluster_bs.d.ts.map +1 -1
  173. package/src/core/graph/metis/metis_cluster_bs.js +11 -0
  174. package/src/core/graph/metis/metis_options.d.ts +17 -2
  175. package/src/core/graph/metis/metis_options.d.ts.map +1 -1
  176. package/src/core/graph/metis/metis_options.js +17 -2
  177. package/src/core/graph/metis/native/MetisGraph.d.ts +144 -0
  178. package/src/core/graph/metis/native/MetisGraph.d.ts.map +1 -0
  179. package/src/core/graph/metis/native/MetisGraph.js +212 -0
  180. package/src/core/graph/metis/native/bisection/BisectionScratch.d.ts +72 -0
  181. package/src/core/graph/metis/native/bisection/BisectionScratch.d.ts.map +1 -0
  182. package/src/core/graph/metis/native/bisection/BisectionScratch.js +101 -0
  183. package/src/core/graph/metis/native/bisection/bisect_graph.d.ts +37 -0
  184. package/src/core/graph/metis/native/bisection/bisect_graph.d.ts.map +1 -0
  185. package/src/core/graph/metis/native/bisection/bisect_graph.js +100 -0
  186. package/src/core/graph/metis/native/bisection/compute_2way_params.d.ts +15 -0
  187. package/src/core/graph/metis/native/bisection/compute_2way_params.d.ts.map +1 -0
  188. package/src/core/graph/metis/native/bisection/compute_2way_params.js +84 -0
  189. package/src/core/graph/metis/native/bisection/fm_2way.d.ts +30 -0
  190. package/src/core/graph/metis/native/bisection/fm_2way.d.ts.map +1 -0
  191. package/src/core/graph/metis/native/bisection/fm_2way.js +290 -0
  192. package/src/core/graph/metis/native/bisection/grow_bisection.d.ts +23 -0
  193. package/src/core/graph/metis/native/bisection/grow_bisection.d.ts.map +1 -0
  194. package/src/core/graph/metis/native/bisection/grow_bisection.js +137 -0
  195. package/src/core/graph/metis/native/bisection/split_graph_two_way.d.ts +28 -0
  196. package/src/core/graph/metis/native/bisection/split_graph_two_way.d.ts.map +1 -0
  197. package/src/core/graph/metis/native/bisection/split_graph_two_way.js +119 -0
  198. package/src/core/graph/metis/native/coarsen/coarsen_graph.d.ts +20 -0
  199. package/src/core/graph/metis/native/coarsen/coarsen_graph.d.ts.map +1 -0
  200. package/src/core/graph/metis/native/coarsen/coarsen_graph.js +94 -0
  201. package/src/core/graph/metis/native/coarsen/create_coarse_graph.d.ts +24 -0
  202. package/src/core/graph/metis/native/coarsen/create_coarse_graph.d.ts.map +1 -0
  203. package/src/core/graph/metis/native/coarsen/create_coarse_graph.js +158 -0
  204. package/src/core/graph/metis/native/coarsen/match_shem.d.ts +41 -0
  205. package/src/core/graph/metis/native/coarsen/match_shem.d.ts.map +1 -0
  206. package/src/core/graph/metis/native/coarsen/match_shem.js +175 -0
  207. package/src/core/graph/metis/native/initial/initial_kway_bfs.d.ts +24 -0
  208. package/src/core/graph/metis/native/initial/initial_kway_bfs.d.ts.map +1 -0
  209. package/src/core/graph/metis/native/initial/initial_kway_bfs.js +122 -0
  210. package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.d.ts +29 -0
  211. package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.d.ts.map +1 -0
  212. package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.js +170 -0
  213. package/src/core/graph/metis/native/metis_partition_kway.d.ts +41 -0
  214. package/src/core/graph/metis/native/metis_partition_kway.d.ts.map +1 -0
  215. package/src/core/graph/metis/native/metis_partition_kway.js +126 -0
  216. package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.d.ts +62 -0
  217. package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.d.ts.map +1 -0
  218. package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.js +261 -0
  219. package/src/core/graph/metis/native/refine/RefinementScratch.d.ts +45 -0
  220. package/src/core/graph/metis/native/refine/RefinementScratch.d.ts.map +1 -0
  221. package/src/core/graph/metis/native/refine/RefinementScratch.js +53 -0
  222. package/src/core/graph/metis/native/refine/compute_kway_params.d.ts +18 -0
  223. package/src/core/graph/metis/native/refine/compute_kway_params.d.ts.map +1 -0
  224. package/src/core/graph/metis/native/refine/compute_kway_params.js +138 -0
  225. package/src/core/graph/metis/native/refine/fm_kway.d.ts +63 -0
  226. package/src/core/graph/metis/native/refine/fm_kway.d.ts.map +1 -0
  227. package/src/core/graph/metis/native/refine/fm_kway.js +462 -0
  228. package/src/core/graph/metis/native/refine/project_kway.d.ts +22 -0
  229. package/src/core/graph/metis/native/refine/project_kway.d.ts.map +1 -0
  230. package/src/core/graph/metis/native/refine/project_kway.js +43 -0
  231. package/src/core/graph/metis/native/refine/refine_kway.d.ts +34 -0
  232. package/src/core/graph/metis/native/refine/refine_kway.d.ts.map +1 -0
  233. package/src/core/graph/metis/native/refine/refine_kway.js +43 -0
  234. package/src/core/math/linalg/eigen/matrix_householder_in_place.d.ts +2 -2
  235. package/src/core/math/linalg/eigen/matrix_householder_in_place.js +2 -2
  236. package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts +6 -4
  237. package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts.map +1 -1
  238. package/src/core/math/linalg/eigen/matrix_qr_in_place.js +69 -23
  239. package/src/engine/EngineHarness.d.ts +3 -1
  240. package/src/engine/EngineHarness.d.ts.map +1 -1
  241. package/src/engine/EngineHarness.js +3 -0
  242. package/src/engine/control/first-person/DESIGN.md +30 -6
  243. package/src/engine/control/first-person/DESIGN_EXTENSIONS.md +563 -0
  244. package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +115 -9
  245. package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
  246. package/src/engine/control/first-person/FirstPersonPlayerController.js +211 -176
  247. package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +601 -8
  248. package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
  249. package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +349 -8
  250. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +319 -23
  251. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
  252. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +1789 -799
  253. package/src/engine/control/first-person/TODO.md +173 -0
  254. package/src/engine/control/first-person/abilities/Ability.d.ts +101 -0
  255. package/src/engine/control/first-person/abilities/Ability.d.ts.map +1 -0
  256. package/src/engine/control/first-person/abilities/Ability.js +119 -0
  257. package/src/engine/control/first-person/abilities/AbilitySet.d.ts +86 -0
  258. package/src/engine/control/first-person/abilities/AbilitySet.d.ts.map +1 -0
  259. package/src/engine/control/first-person/abilities/AbilitySet.js +185 -0
  260. package/src/engine/control/first-person/abilities/LedgeGrab.d.ts +62 -0
  261. package/src/engine/control/first-person/abilities/LedgeGrab.d.ts.map +1 -0
  262. package/src/engine/control/first-person/abilities/LedgeGrab.js +199 -0
  263. package/src/engine/control/first-person/abilities/Mantle.d.ts +45 -0
  264. package/src/engine/control/first-person/abilities/Mantle.d.ts.map +1 -0
  265. package/src/engine/control/first-person/abilities/Mantle.js +188 -0
  266. package/src/engine/control/first-person/abilities/Slide.d.ts +33 -0
  267. package/src/engine/control/first-person/abilities/Slide.d.ts.map +1 -0
  268. package/src/engine/control/first-person/abilities/Slide.js +166 -0
  269. package/src/engine/control/first-person/abilities/WallJump.d.ts +45 -0
  270. package/src/engine/control/first-person/abilities/WallJump.d.ts.map +1 -0
  271. package/src/engine/control/first-person/abilities/WallJump.js +131 -0
  272. package/src/engine/control/first-person/abilities/WallRun.d.ts +44 -0
  273. package/src/engine/control/first-person/abilities/WallRun.d.ts.map +1 -0
  274. package/src/engine/control/first-person/abilities/WallRun.js +180 -0
  275. package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts +49 -0
  276. package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts.map +1 -0
  277. package/src/engine/control/first-person/composer/EyeOffsetStack.js +60 -0
  278. package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.d.ts +100 -0
  279. package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.d.ts.map +1 -0
  280. package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.js +133 -0
  281. package/src/engine/control/first-person/mastery/DecisionPoint.d.ts +10 -0
  282. package/src/engine/control/first-person/mastery/DecisionPoint.d.ts.map +1 -0
  283. package/src/engine/control/first-person/mastery/DecisionPoint.js +30 -0
  284. package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.d.ts +61 -0
  285. package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.d.ts.map +1 -0
  286. package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.js +109 -0
  287. package/src/engine/control/first-person/mastery/MasteryEvaluator.d.ts +40 -0
  288. package/src/engine/control/first-person/mastery/MasteryEvaluator.d.ts.map +1 -0
  289. package/src/engine/control/first-person/mastery/MasteryEvaluator.js +45 -0
  290. package/src/engine/control/first-person/mastery/MasteryScore.d.ts +68 -0
  291. package/src/engine/control/first-person/mastery/MasteryScore.d.ts.map +1 -0
  292. package/src/engine/control/first-person/mastery/MasteryScore.js +100 -0
  293. package/src/engine/control/first-person/mastery/MasterySet.d.ts +60 -0
  294. package/src/engine/control/first-person/mastery/MasterySet.d.ts.map +1 -0
  295. package/src/engine/control/first-person/mastery/MasterySet.js +86 -0
  296. package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.d.ts +58 -0
  297. package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.d.ts.map +1 -0
  298. package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.js +83 -0
  299. package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.d.ts +69 -0
  300. package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.d.ts.map +1 -0
  301. package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.js +109 -0
  302. package/src/engine/control/first-person/math/Spring.d.ts +56 -0
  303. package/src/engine/control/first-person/math/Spring.d.ts.map +1 -0
  304. package/src/engine/control/first-person/math/Spring.js +71 -0
  305. package/src/engine/control/first-person/math/computeLRCBreathRate.d.ts +26 -0
  306. package/src/engine/control/first-person/math/computeLRCBreathRate.d.ts.map +1 -0
  307. package/src/engine/control/first-person/math/computeLRCBreathRate.js +41 -0
  308. package/src/engine/control/first-person/math/computeMassRatios.d.ts +35 -0
  309. package/src/engine/control/first-person/math/computeMassRatios.d.ts.map +1 -0
  310. package/src/engine/control/first-person/math/computeMassRatios.js +44 -0
  311. package/src/engine/control/first-person/pose/FirstPersonPose.d.ts +31 -1
  312. package/src/engine/control/first-person/pose/FirstPersonPose.d.ts.map +1 -1
  313. package/src/engine/control/first-person/pose/FirstPersonPose.js +49 -3
  314. package/src/engine/control/first-person/pose/FirstPersonPosture.d.ts +7 -0
  315. package/src/engine/control/first-person/pose/FirstPersonPosture.d.ts.map +1 -0
  316. package/src/engine/control/first-person/pose/FirstPersonPosture.js +27 -0
  317. package/src/engine/control/first-person/prototype_first_person_controller.js +637 -120
  318. package/src/engine/control/first-person/sensors/FirstPersonSensors.d.ts +58 -0
  319. package/src/engine/control/first-person/sensors/FirstPersonSensors.d.ts.map +1 -0
  320. package/src/engine/control/first-person/sensors/FirstPersonSensors.js +77 -0
  321. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts +80 -0
  322. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -0
  323. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +196 -0
  324. package/src/engine/control/first-person/test/buildTestPlayer.d.ts +20 -0
  325. package/src/engine/control/first-person/test/buildTestPlayer.d.ts.map +1 -0
  326. package/src/engine/control/first-person/test/buildTestPlayer.js +36 -0
  327. package/src/engine/graphics/camera/testClippingPlaneComputation.js +0 -2
  328. package/src/engine/graphics/ecs/light/Light.d.ts.map +1 -1
  329. package/src/engine/graphics/ecs/light/Light.js +27 -0
  330. package/src/engine/graphics/ecs/light/LightSystem.js +1 -1
  331. package/src/engine/graphics/ecs/path/PathDisplaySystem.d.ts.map +1 -1
  332. package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +0 -2
  333. package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +0 -2
  334. package/src/engine/graphics/geometry/CapsuleGeometry.d.ts +42 -0
  335. package/src/engine/graphics/geometry/CapsuleGeometry.d.ts.map +1 -0
  336. package/src/engine/graphics/geometry/CapsuleGeometry.js +171 -0
  337. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -2
  338. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +0 -2
  339. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +0 -2
  340. package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts.map +1 -1
  341. package/src/engine/navigation/grid/find_path_on_grid_astar.js +11 -2
  342. package/src/engine/navigation/mesh/bt_mesh_face_find_path.d.ts.map +1 -1
  343. package/src/engine/navigation/mesh/bt_mesh_face_find_path.js +11 -1
  344. package/src/engine/physics/BULLET_REVIEW.md +945 -0
  345. package/src/engine/physics/CANNON_REVIEW.md +1300 -0
  346. package/src/engine/physics/JOLT_REVIEW.md +913 -0
  347. package/src/engine/physics/PLAN.md +461 -0
  348. package/src/engine/physics/RAPIER_REVIEW.md +934 -0
  349. package/src/engine/physics/REVIEW_001_ACTION_PLAN.md +642 -0
  350. package/src/engine/physics/body/BodyStorage.d.ts +187 -0
  351. package/src/engine/physics/body/BodyStorage.d.ts.map +1 -0
  352. package/src/engine/physics/body/BodyStorage.js +427 -0
  353. package/src/engine/physics/broadphase/PairList.d.ts +62 -0
  354. package/src/engine/physics/broadphase/PairList.d.ts.map +1 -0
  355. package/src/engine/physics/broadphase/PairList.js +97 -0
  356. package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts +16 -0
  357. package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts.map +1 -0
  358. package/src/engine/physics/broadphase/compute_fat_world_aabb.js +61 -0
  359. package/src/engine/physics/broadphase/generate_pairs.d.ts +38 -0
  360. package/src/engine/physics/broadphase/generate_pairs.d.ts.map +1 -0
  361. package/src/engine/physics/broadphase/generate_pairs.js +101 -0
  362. package/src/engine/physics/contact/ManifoldStore.d.ts +299 -0
  363. package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -0
  364. package/src/engine/physics/contact/ManifoldStore.js +608 -0
  365. package/src/engine/physics/ecs/BodyKind.d.ts +23 -0
  366. package/src/engine/physics/ecs/BodyKind.d.ts.map +1 -0
  367. package/src/engine/physics/ecs/BodyKind.js +24 -0
  368. package/src/engine/physics/ecs/Collider.d.ts +98 -0
  369. package/src/engine/physics/ecs/Collider.d.ts.map +1 -0
  370. package/src/engine/physics/ecs/Collider.js +136 -0
  371. package/src/engine/physics/ecs/ColliderFlags.d.ts +14 -0
  372. package/src/engine/physics/ecs/ColliderFlags.d.ts.map +1 -0
  373. package/src/engine/physics/ecs/ColliderFlags.js +15 -0
  374. package/src/engine/physics/ecs/ColliderObserverSystem.d.ts +58 -0
  375. package/src/engine/physics/ecs/ColliderObserverSystem.d.ts.map +1 -0
  376. package/src/engine/physics/ecs/ColliderObserverSystem.js +103 -0
  377. package/src/engine/physics/ecs/ColliderSerializationAdapter.d.ts +25 -0
  378. package/src/engine/physics/ecs/ColliderSerializationAdapter.d.ts.map +1 -0
  379. package/src/engine/physics/ecs/ColliderSerializationAdapter.js +37 -0
  380. package/src/engine/physics/ecs/PhysicsEvents.d.ts +15 -0
  381. package/src/engine/physics/ecs/PhysicsEvents.d.ts.map +1 -0
  382. package/src/engine/physics/ecs/PhysicsEvents.js +16 -0
  383. package/src/engine/physics/ecs/PhysicsSystem.d.ts +628 -0
  384. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -0
  385. package/src/engine/physics/ecs/PhysicsSystem.js +1301 -0
  386. package/src/engine/physics/ecs/RigidBody.d.ts +197 -0
  387. package/src/engine/physics/ecs/RigidBody.d.ts.map +1 -0
  388. package/src/engine/physics/ecs/RigidBody.js +240 -0
  389. package/src/engine/physics/ecs/RigidBodyFlags.d.ts +21 -0
  390. package/src/engine/physics/ecs/RigidBodyFlags.d.ts.map +1 -0
  391. package/src/engine/physics/ecs/RigidBodyFlags.js +22 -0
  392. package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts +28 -0
  393. package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts.map +1 -0
  394. package/src/engine/physics/ecs/RigidBodySerializationAdapter.js +81 -0
  395. package/src/engine/physics/ecs/SleepState.d.ts +11 -0
  396. package/src/engine/physics/ecs/SleepState.d.ts.map +1 -0
  397. package/src/engine/physics/ecs/SleepState.js +12 -0
  398. package/src/engine/physics/events/ContactEventBuffer.d.ts +46 -0
  399. package/src/engine/physics/events/ContactEventBuffer.d.ts.map +1 -0
  400. package/src/engine/physics/events/ContactEventBuffer.js +83 -0
  401. package/src/engine/physics/events/diff_manifolds.d.ts +25 -0
  402. package/src/engine/physics/events/diff_manifolds.d.ts.map +1 -0
  403. package/src/engine/physics/events/diff_manifolds.js +50 -0
  404. package/src/engine/physics/fluid/FluidField.d.ts +294 -16
  405. package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
  406. package/src/engine/physics/fluid/FluidField.js +510 -66
  407. package/src/engine/physics/fluid/FluidSimulator.d.ts +188 -5
  408. package/src/engine/physics/fluid/FluidSimulator.d.ts.map +1 -1
  409. package/src/engine/physics/fluid/FluidSimulator.js +456 -95
  410. package/src/engine/physics/fluid/SliceVisualiser.d.ts +29 -6
  411. package/src/engine/physics/fluid/SliceVisualiser.d.ts.map +1 -1
  412. package/src/engine/physics/fluid/SliceVisualiser.js +190 -165
  413. package/src/engine/physics/fluid/ecs/FluidComponent.d.ts +154 -0
  414. package/src/engine/physics/fluid/ecs/FluidComponent.d.ts.map +1 -0
  415. package/src/engine/physics/fluid/ecs/FluidComponent.js +238 -0
  416. package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.d.ts +45 -0
  417. package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.d.ts.map +1 -0
  418. package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.js +89 -0
  419. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +107 -0
  420. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts.map +1 -0
  421. package/src/engine/physics/fluid/ecs/FluidSystem.js +278 -0
  422. package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +62 -1
  423. package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts.map +1 -1
  424. package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +81 -6
  425. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts +17 -4
  426. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
  427. package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +105 -12
  428. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts +43 -0
  429. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -0
  430. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +210 -0
  431. package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts +62 -1
  432. package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
  433. package/src/engine/physics/fluid/effector/WakeFluidEffector.js +302 -8
  434. package/src/engine/physics/fluid/prototype.js +102 -91
  435. package/src/engine/physics/fluid/solver/optimal_sor_omega.d.ts +33 -0
  436. package/src/engine/physics/fluid/solver/optimal_sor_omega.d.ts.map +1 -0
  437. package/src/engine/physics/fluid/solver/optimal_sor_omega.js +41 -0
  438. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.d.ts +20 -5
  439. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.d.ts.map +1 -1
  440. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.js +60 -38
  441. package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.d.ts +25 -4
  442. package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.d.ts.map +1 -1
  443. package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.js +93 -73
  444. package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.d.ts +23 -0
  445. package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.d.ts.map +1 -0
  446. package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.js +60 -0
  447. package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.d.ts +23 -0
  448. package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.d.ts.map +1 -0
  449. package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.js +68 -0
  450. package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts +30 -0
  451. package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts.map +1 -0
  452. package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.js +66 -0
  453. package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.d.ts +26 -0
  454. package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.d.ts.map +1 -0
  455. package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.js +113 -0
  456. package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.d.ts +30 -0
  457. package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.d.ts.map +1 -0
  458. package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.js +107 -0
  459. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts +49 -0
  460. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts.map +1 -0
  461. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.js +126 -0
  462. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts +93 -0
  463. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts.map +1 -0
  464. package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.js +424 -0
  465. package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts +48 -0
  466. package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts.map +1 -0
  467. package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.js +92 -0
  468. package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts +6 -6
  469. package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -1
  470. package/src/engine/physics/gjk/expanding_polytope_algorithm.js +76 -32
  471. package/src/engine/physics/gjk/gjk.d.ts +28 -2
  472. package/src/engine/physics/gjk/gjk.d.ts.map +1 -1
  473. package/src/engine/physics/gjk/gjk.js +421 -378
  474. package/src/engine/physics/gjk/minkowski_support.d.ts +37 -0
  475. package/src/engine/physics/gjk/minkowski_support.d.ts.map +1 -0
  476. package/src/engine/physics/gjk/minkowski_support.js +75 -0
  477. package/src/engine/physics/gjk/mpr.d.ts +56 -0
  478. package/src/engine/physics/gjk/mpr.d.ts.map +1 -0
  479. package/src/engine/physics/gjk/mpr.js +344 -0
  480. package/src/engine/physics/inertia/world_inverse_inertia.d.ts +44 -0
  481. package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -0
  482. package/src/engine/physics/inertia/world_inverse_inertia.js +77 -0
  483. package/src/engine/physics/integration/integrate_position.d.ts +34 -0
  484. package/src/engine/physics/integration/integrate_position.d.ts.map +1 -0
  485. package/src/engine/physics/integration/integrate_position.js +79 -0
  486. package/src/engine/physics/integration/integrate_velocity.d.ts +55 -0
  487. package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -0
  488. package/src/engine/physics/integration/integrate_velocity.js +160 -0
  489. package/src/engine/physics/integration/quat_integrate.d.ts +27 -0
  490. package/src/engine/physics/integration/quat_integrate.d.ts.map +1 -0
  491. package/src/engine/physics/integration/quat_integrate.js +62 -0
  492. package/src/engine/physics/island/IslandBuilder.d.ts +167 -0
  493. package/src/engine/physics/island/IslandBuilder.d.ts.map +1 -0
  494. package/src/engine/physics/island/IslandBuilder.js +411 -0
  495. package/src/engine/physics/island/union_find.d.ts +51 -0
  496. package/src/engine/physics/island/union_find.d.ts.map +1 -0
  497. package/src/engine/physics/island/union_find.js +76 -0
  498. package/src/engine/physics/narrowphase/PosedShape.d.ts +51 -0
  499. package/src/engine/physics/narrowphase/PosedShape.d.ts.map +1 -0
  500. package/src/engine/physics/narrowphase/PosedShape.js +108 -0
  501. package/src/engine/physics/narrowphase/box_box_manifold.d.ts +32 -0
  502. package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -0
  503. package/src/engine/physics/narrowphase/box_box_manifold.js +639 -0
  504. package/src/engine/physics/narrowphase/box_triangle_contact.d.ts +30 -0
  505. package/src/engine/physics/narrowphase/box_triangle_contact.d.ts.map +1 -0
  506. package/src/engine/physics/narrowphase/box_triangle_contact.js +811 -0
  507. package/src/engine/physics/narrowphase/capsule_contacts.d.ts +122 -0
  508. package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -0
  509. package/src/engine/physics/narrowphase/capsule_contacts.js +462 -0
  510. package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts +71 -0
  511. package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts.map +1 -0
  512. package/src/engine/physics/narrowphase/capsule_triangle_contact.js +375 -0
  513. package/src/engine/physics/narrowphase/compute_penetration.d.ts +91 -0
  514. package/src/engine/physics/narrowphase/compute_penetration.d.ts.map +1 -0
  515. package/src/engine/physics/narrowphase/compute_penetration.js +396 -0
  516. package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts +35 -0
  517. package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts.map +1 -0
  518. package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.js +80 -0
  519. package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts +31 -0
  520. package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts.map +1 -0
  521. package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.js +55 -0
  522. package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts +42 -0
  523. package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts.map +1 -0
  524. package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.js +204 -0
  525. package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts +42 -0
  526. package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -0
  527. package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +94 -0
  528. package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts +37 -0
  529. package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts.map +1 -0
  530. package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.js +37 -0
  531. package/src/engine/physics/narrowphase/narrowphase_step.d.ts +17 -0
  532. package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -0
  533. package/src/engine/physics/narrowphase/narrowphase_step.js +1422 -0
  534. package/src/engine/physics/narrowphase/sphere_box_contact.d.ts +38 -0
  535. package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -0
  536. package/src/engine/physics/narrowphase/sphere_box_contact.js +123 -0
  537. package/src/engine/physics/narrowphase/sphere_sphere_contact.d.ts +26 -0
  538. package/src/engine/physics/narrowphase/sphere_sphere_contact.d.ts.map +1 -0
  539. package/src/engine/physics/narrowphase/sphere_sphere_contact.js +51 -0
  540. package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts +48 -0
  541. package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts.map +1 -0
  542. package/src/engine/physics/narrowphase/sphere_triangle_contact.js +143 -0
  543. package/src/engine/physics/queries/PhysicsSurfacePoint.d.ts +83 -0
  544. package/src/engine/physics/queries/PhysicsSurfacePoint.d.ts.map +1 -0
  545. package/src/engine/physics/queries/PhysicsSurfacePoint.js +100 -0
  546. package/src/engine/physics/queries/overlap_shape.d.ts +51 -0
  547. package/src/engine/physics/queries/overlap_shape.d.ts.map +1 -0
  548. package/src/engine/physics/queries/overlap_shape.js +183 -0
  549. package/src/engine/physics/queries/raycast.d.ts +20 -0
  550. package/src/engine/physics/queries/raycast.d.ts.map +1 -0
  551. package/src/engine/physics/queries/raycast.js +249 -0
  552. package/src/engine/physics/queries/shape_cast.d.ts +56 -0
  553. package/src/engine/physics/queries/shape_cast.d.ts.map +1 -0
  554. package/src/engine/physics/queries/shape_cast.js +387 -0
  555. package/src/engine/physics/solver/friction_cone.d.ts +16 -0
  556. package/src/engine/physics/solver/friction_cone.d.ts.map +1 -0
  557. package/src/engine/physics/solver/friction_cone.js +37 -0
  558. package/src/engine/physics/solver/solve_contacts.d.ts +122 -0
  559. package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -0
  560. package/src/engine/physics/solver/solve_contacts.js +1016 -0
  561. package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.d.ts +0 -34
  562. package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.d.ts.map +0 -1
  563. package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.js +0 -66
  564. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.d.ts +0 -2
  565. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.d.ts.map +0 -1
  566. package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.js +0 -54
  567. package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.d.ts +0 -2
  568. package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.d.ts.map +0 -1
  569. package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.js +0 -26
  570. package/src/engine/ecs/components/Motion.d.ts +0 -21
  571. package/src/engine/ecs/components/Motion.d.ts.map +0 -1
  572. package/src/engine/ecs/components/Motion.js +0 -27
  573. package/src/engine/ecs/components/MotionSerializationAdapter.d.ts +0 -20
  574. package/src/engine/ecs/components/MotionSerializationAdapter.d.ts.map +0 -1
  575. package/src/engine/ecs/components/MotionSerializationAdapter.js +0 -26
  576. package/src/engine/ecs/systems/MotionSystem.d.ts +0 -9
  577. package/src/engine/ecs/systems/MotionSystem.d.ts.map +0 -1
  578. package/src/engine/ecs/systems/MotionSystem.js +0 -29
  579. package/src/engine/physics/fluid/Fluid.d.ts +0 -26
  580. package/src/engine/physics/fluid/Fluid.d.ts.map +0 -1
  581. package/src/engine/physics/fluid/Fluid.js +0 -221
  582. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.d.ts +0 -7
  583. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.d.ts.map +0 -1
  584. package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.js +0 -8
@@ -0,0 +1,608 @@
1
+ import { assert } from "../../../core/assert.js";
2
+ import { PAIR_UINT32_MAP_ABSENT, PairUint32Map } from "../../../core/collection/PairUint32Map.js";
3
+
4
+ /**
5
+ * Maximum contact points per manifold. Four is the universal industry choice
6
+ * (Bullet's btPersistentManifold, Box2D, Jolt) — enough to express stable
7
+ * face-on-face contact, small enough to fit inertia-driven solver passes.
8
+ * @type {number}
9
+ */
10
+ export const MAX_CONTACTS_PER_MANIFOLD = 4;
11
+
12
+ /**
13
+ * Per-contact field stride in the data Float64Array.
14
+ *
15
+ * Layout per contact (all world-space):
16
+ * 0..2 : world_a (contact point on body A's surface)
17
+ * 3..5 : world_b (contact point on body B's surface)
18
+ * 6..8 : normal_w (from B toward A)
19
+ * 9 : depth (positive = penetration, negative = speculative gap)
20
+ * 10 : j_n (accumulated normal impulse, warm-start)
21
+ * 11 : j_t1 (accumulated tangent impulse, axis 1)
22
+ * 12 : j_t2 (accumulated tangent impulse, axis 2)
23
+ * 13 : feature_id (uint32 packed as f64 — stable cross-frame ID of the
24
+ * geometric feature pair that produced this contact;
25
+ * 0 means "no info, fall back to position matching")
26
+ *
27
+ * Solver uses `(world_a + world_b) * 0.5` as the application point; storing
28
+ * both surface points enables the per-frame warm-start matcher in the
29
+ * narrowphase to compare contact-point positions when feature_id is 0.
30
+ *
31
+ * @type {number}
32
+ */
33
+ export const CONTACT_STRIDE = 14;
34
+
35
+ /**
36
+ * Per-contact feature_id offset within {@link CONTACT_STRIDE}.
37
+ * Exposed for the narrowphase matcher; solver code does not read this.
38
+ * @type {number}
39
+ */
40
+ export const CONTACT_FEATURE_ID_OFFSET = 13;
41
+
42
+ /**
43
+ * Per-slot Float64 stride: room for {@link MAX_CONTACTS_PER_MANIFOLD} contacts.
44
+ * @type {number}
45
+ */
46
+ export const SLOT_DATA_STRIDE = CONTACT_STRIDE * MAX_CONTACTS_PER_MANIFOLD;
47
+
48
+ /**
49
+ * Per-slot meta stride in the Uint32 meta buffer:
50
+ * 0 : bodyA
51
+ * 1 : bodyB
52
+ * 2 : packed = count(0..3) | touched(bit 4) | prev_touched(bit 5) | grace(bits 6..13)
53
+ * @type {number}
54
+ */
55
+ const SLOT_META_STRIDE = 3;
56
+
57
+ const FLAG_TOUCHED = 1 << 4;
58
+ const FLAG_PREV_TOUCHED = 1 << 5;
59
+ const COUNT_MASK = 0x0F;
60
+ const GRACE_SHIFT = 6;
61
+ const GRACE_MASK = 0xFF; // 8 bits
62
+
63
+ /**
64
+ * Number of consecutive frames a manifold may stay untouched before eviction.
65
+ * Two frames of grace lets a one-frame separation survive (jitter friendly)
66
+ * while still keeping the cache bounded.
67
+ * @type {number}
68
+ */
69
+ const DEFAULT_GRACE = 2;
70
+
71
+ /**
72
+ * Sentinel for "no slot".
73
+ * @type {number}
74
+ */
75
+ export const MANIFOLD_SLOT_ABSENT = -1;
76
+
77
+ const DEFAULT_INITIAL_CAPACITY = 64;
78
+
79
+ /**
80
+ * Persistent contact-manifold cache keyed by canonical body-id pairs.
81
+ *
82
+ * Owns:
83
+ * - the SoA `Float64Array` of contact points (per-slot stride 52),
84
+ * - the small meta `Uint32Array` (bodyA, bodyB, packed flags + count),
85
+ * - a {@link PairUint32Map} from `(idA, idB)` to slot id,
86
+ * - a dense `__live_slots` array of currently-allocated slot ids,
87
+ * - a min-heap-free-stack of released slot ids so reuse is deterministic.
88
+ *
89
+ * Lifecycle per simulation step:
90
+ * 1. Broadphase calls {@link acquire} for every encountered pair, which marks
91
+ * each touched slot as "fresh this frame".
92
+ * 2. Narrowphase fills in contact points via {@link set_contact} /
93
+ * {@link clear_contacts}.
94
+ * 3. End-of-step calls {@link advance_frame} to roll touched → prev_touched
95
+ * and evict slots that have been untouched for {@link DEFAULT_GRACE}
96
+ * consecutive frames.
97
+ *
98
+ * @author Alex Goldring
99
+ * @copyright Company Named Limited (c) 2026
100
+ */
101
+ export class ManifoldStore {
102
+
103
+ /**
104
+ * @param {number} [initial_capacity] slots
105
+ */
106
+ constructor(initial_capacity = DEFAULT_INITIAL_CAPACITY) {
107
+ assert.isNonNegativeInteger(initial_capacity, 'initial_capacity');
108
+ this.__capacity = Math.max(4, initial_capacity);
109
+ this.__high_water = 0;
110
+
111
+ this.__data = new Float64Array(this.__capacity * SLOT_DATA_STRIDE);
112
+ this.__meta = new Uint32Array(this.__capacity * SLOT_META_STRIDE);
113
+
114
+ // Per-slot cached GJK separating-axis seed (3 floats / slot).
115
+ // Hot-path GJK callers thread `slot_axis_buffer` +
116
+ // `slot_axis_offset(slot)` into `gjk_with_axis(...)` so the
117
+ // cached axis seeds the next frame's iteration. Initialised to
118
+ // zeros — the `gjk_with_axis` guard catches that and uses
119
+ // (1, 0, 0) as the cold-start fallback.
120
+ this.__slot_axis = new Float64Array(this.__capacity * 3);
121
+
122
+ this.__pair_index = new PairUint32Map(this.__capacity * 2);
123
+
124
+ // Dense list of currently-allocated slot ids + reverse map.
125
+ this.__live_slots = new Uint32Array(this.__capacity);
126
+ this.__live_pos = new Int32Array(this.__capacity);
127
+ this.__live_pos.fill(-1);
128
+ this.__live_count = 0;
129
+
130
+ // Min-heap of released slot ids.
131
+ this.__free_heap = new Uint32Array(this.__capacity);
132
+ this.__free_count = 0;
133
+ }
134
+
135
+ /**
136
+ * @returns {number} number of currently-live slots
137
+ */
138
+ get count() {
139
+ return this.__live_count;
140
+ }
141
+
142
+ /**
143
+ * @returns {number} total allocated slot capacity
144
+ */
145
+ get capacity() {
146
+ return this.__capacity;
147
+ }
148
+
149
+ /**
150
+ * Look up a slot by canonical pair. Caller is responsible for ordering
151
+ * `(idA, idB)` such that the same pair always hashes the same way.
152
+ *
153
+ * @param {number} idA
154
+ * @param {number} idB
155
+ * @returns {number} slot id or {@link MANIFOLD_SLOT_ABSENT}
156
+ */
157
+ find(idA, idB) {
158
+ const v = this.__pair_index.get(idA, idB);
159
+ return v === PAIR_UINT32_MAP_ABSENT ? MANIFOLD_SLOT_ABSENT : v;
160
+ }
161
+
162
+ /**
163
+ * Acquire a slot for the pair, creating one if absent, and mark it
164
+ * "touched this frame". Returns the slot id. Calling `acquire` twice in
165
+ * the same step on the same pair is a no-op for the second call.
166
+ *
167
+ * @param {number} idA
168
+ * @param {number} idB
169
+ * @returns {number} slot id
170
+ */
171
+ acquire(idA, idB) {
172
+ let slot = this.find(idA, idB);
173
+ if (slot === MANIFOLD_SLOT_ABSENT) {
174
+ slot = this.__allocate_slot();
175
+ const meta_off = slot * SLOT_META_STRIDE;
176
+ this.__meta[meta_off] = idA;
177
+ this.__meta[meta_off + 1] = idB;
178
+ this.__meta[meta_off + 2] = 0; // count=0, no flags, grace=0
179
+ // Zero the contact data — important so a recycled slot's warm-start
180
+ // impulses don't leak across pair identities.
181
+ const data_off = slot * SLOT_DATA_STRIDE;
182
+ this.__data.fill(0, data_off, data_off + SLOT_DATA_STRIDE);
183
+ // Zero the cached GJK axis. A stale axis from a previously
184
+ // released pair would mislead `gjk_with_axis` on this fresh
185
+ // pair; resetting to (0, 0, 0) hits the cold-start guard.
186
+ const axis_off = slot * 3;
187
+ this.__slot_axis[axis_off] = 0;
188
+ this.__slot_axis[axis_off + 1] = 0;
189
+ this.__slot_axis[axis_off + 2] = 0;
190
+
191
+ this.__pair_index.set(idA, idB, slot);
192
+ }
193
+ const meta_off = slot * SLOT_META_STRIDE;
194
+ // Set touched bit, clear grace.
195
+ let packed = this.__meta[meta_off + 2];
196
+ packed |= FLAG_TOUCHED;
197
+ packed &= ~(GRACE_MASK << GRACE_SHIFT);
198
+ this.__meta[meta_off + 2] = packed;
199
+ return slot;
200
+ }
201
+
202
+ /**
203
+ * @param {number} slot
204
+ * @returns {number} body A id stored at this slot
205
+ */
206
+ bodyA(slot) {
207
+ return this.__meta[slot * SLOT_META_STRIDE];
208
+ }
209
+
210
+ /**
211
+ * @param {number} slot
212
+ * @returns {number}
213
+ */
214
+ bodyB(slot) {
215
+ return this.__meta[slot * SLOT_META_STRIDE + 1];
216
+ }
217
+
218
+ /**
219
+ * @param {number} slot
220
+ * @returns {number} 0..MAX_CONTACTS_PER_MANIFOLD
221
+ */
222
+ contact_count(slot) {
223
+ return this.__meta[slot * SLOT_META_STRIDE + 2] & COUNT_MASK;
224
+ }
225
+
226
+ /**
227
+ * @param {number} slot
228
+ * @returns {boolean}
229
+ */
230
+ is_touched(slot) {
231
+ return (this.__meta[slot * SLOT_META_STRIDE + 2] & FLAG_TOUCHED) !== 0;
232
+ }
233
+
234
+ /**
235
+ * @param {number} slot
236
+ * @returns {boolean}
237
+ */
238
+ was_touched_prev(slot) {
239
+ return (this.__meta[slot * SLOT_META_STRIDE + 2] & FLAG_PREV_TOUCHED) !== 0;
240
+ }
241
+
242
+ /**
243
+ * Iterate the dense list of currently-live slots without going through
244
+ * the pair map. `i` ranges `[0, count)`.
245
+ * @param {number} i
246
+ * @returns {number}
247
+ */
248
+ live_at(i) {
249
+ return this.__live_slots[i];
250
+ }
251
+
252
+ /**
253
+ * Clear the contact list for a slot (counts go to zero, warm-start
254
+ * impulses also reset). Used when narrowphase determines the pair is
255
+ * separated this frame.
256
+ * @param {number} slot
257
+ */
258
+ clear_contacts(slot) {
259
+ const meta_off = slot * SLOT_META_STRIDE;
260
+ this.__meta[meta_off + 2] = this.__meta[meta_off + 2] & ~COUNT_MASK;
261
+
262
+ const data_off = slot * SLOT_DATA_STRIDE;
263
+ this.__data.fill(0, data_off, data_off + SLOT_DATA_STRIDE);
264
+ }
265
+
266
+ /**
267
+ * Reset the contact count to zero so the next `set_contact(slot, 0, …)`
268
+ * lands at index 0, but DO NOT zero the data slab. Warm-start impulses
269
+ * (`j_n`, `j_t1`, `j_t2`) at each contact slot survive — the subsequent
270
+ * `set_contact` calls only overwrite the first 10 floats (position,
271
+ * normal, depth) per contact.
272
+ *
273
+ * Use this when narrowphase determines the pair still has overlap and
274
+ * is about to refill the slot with the new frame's contacts. Use
275
+ * {@link clear_contacts} instead when the pair has genuinely separated
276
+ * and the cached impulses should be evicted.
277
+ *
278
+ * @param {number} slot
279
+ */
280
+ begin_refill(slot) {
281
+ const meta_off = slot * SLOT_META_STRIDE;
282
+ this.__meta[meta_off + 2] = this.__meta[meta_off + 2] & ~COUNT_MASK;
283
+ }
284
+
285
+ /**
286
+ * Write a contact point into a slot. Increments contact_count if `idx`
287
+ * exceeds the current count.
288
+ *
289
+ * Writes geometry (offsets 0..9) and the feature_id at offset 13.
290
+ * Deliberately does NOT touch the warm-start impulse fields (offsets
291
+ * 10..12) — the narrowphase match-and-merge pass uses this to refill
292
+ * a slot while preserving the cached impulses that the solver's
293
+ * warm-start needs.
294
+ *
295
+ * @param {number} slot
296
+ * @param {number} idx contact index in `[0, MAX_CONTACTS_PER_MANIFOLD)`
297
+ * @param {number} lax
298
+ * @param {number} lay
299
+ * @param {number} laz
300
+ * @param {number} lbx
301
+ * @param {number} lby
302
+ * @param {number} lbz
303
+ * @param {number} nx normal world x (B toward A)
304
+ * @param {number} ny
305
+ * @param {number} nz
306
+ * @param {number} depth
307
+ * @param {number} feature_id stable cross-frame identifier of the
308
+ * geometric feature pair that produced this contact; 0 means
309
+ * "no info, fall back to position matching"
310
+ */
311
+ set_contact(slot, idx, lax, lay, laz, lbx, lby, lbz, nx, ny, nz, depth, feature_id = 0) {
312
+ const off = slot * SLOT_DATA_STRIDE + idx * CONTACT_STRIDE;
313
+ this.__data[off] = lax;
314
+ this.__data[off + 1] = lay;
315
+ this.__data[off + 2] = laz;
316
+ this.__data[off + 3] = lbx;
317
+ this.__data[off + 4] = lby;
318
+ this.__data[off + 5] = lbz;
319
+ this.__data[off + 6] = nx;
320
+ this.__data[off + 7] = ny;
321
+ this.__data[off + 8] = nz;
322
+ this.__data[off + 9] = depth;
323
+ // j_n, j_t1, j_t2 (offsets 10..12) are warm-start; preserved across calls.
324
+ this.__data[off + 13] = feature_id;
325
+
326
+ const meta_off = slot * SLOT_META_STRIDE;
327
+ const count_now = this.__meta[meta_off + 2] & COUNT_MASK;
328
+ if (idx + 1 > count_now) {
329
+ this.__meta[meta_off + 2] = (this.__meta[meta_off + 2] & ~COUNT_MASK) | (idx + 1);
330
+ }
331
+ }
332
+
333
+ /**
334
+ * Zero the warm-start impulse fields (j_n, j_t1, j_t2) for one contact
335
+ * index inside a slot. Called by the narrowphase match-and-merge pass
336
+ * after writing a candidate that did NOT match any prior-frame contact:
337
+ * the geometry at this index is "new" and inheriting impulses from
338
+ * whatever happened to be cached at this index last frame would
339
+ * destabilise the solver.
340
+ *
341
+ * Distinct from {@link clear_contacts} (which wipes the entire slot's
342
+ * data slab including geometry) — `clear_impulses` only touches the
343
+ * three impulse fields at one contact index, leaving the geometric
344
+ * fields and feature_id intact.
345
+ *
346
+ * @param {number} slot
347
+ * @param {number} idx
348
+ */
349
+ clear_impulses(slot, idx) {
350
+ const off = slot * SLOT_DATA_STRIDE + idx * CONTACT_STRIDE;
351
+ this.__data[off + 10] = 0;
352
+ this.__data[off + 11] = 0;
353
+ this.__data[off + 12] = 0;
354
+ }
355
+
356
+ /**
357
+ * Read the feature_id stored at one contact within a slot.
358
+ * @param {number} slot
359
+ * @param {number} idx
360
+ * @returns {number}
361
+ */
362
+ feature_id_of(slot, idx) {
363
+ return this.__data[slot * SLOT_DATA_STRIDE + idx * CONTACT_STRIDE + 13];
364
+ }
365
+
366
+ /**
367
+ * Read a contact point. Writes 10 floats: lax, lay, laz, lbx, lby, lbz, nx, ny, nz, depth.
368
+ * @param {number} slot
369
+ * @param {number} idx
370
+ * @param {number[]|Float64Array} out
371
+ * @param {number} out_offset
372
+ */
373
+ get_contact(slot, idx, out, out_offset) {
374
+ const off = slot * SLOT_DATA_STRIDE + idx * CONTACT_STRIDE;
375
+ for (let i = 0; i < 10; i++) {
376
+ out[out_offset + i] = this.__data[off + i];
377
+ }
378
+ }
379
+
380
+ /**
381
+ * Get the contact-normal world x component for a given contact.
382
+ * Provided for testability without exposing the raw Float64Array view.
383
+ * @param {number} slot
384
+ * @param {number} idx
385
+ * @returns {number}
386
+ */
387
+ contact_normal_x(slot, idx) {
388
+ return this.__data[slot * SLOT_DATA_STRIDE + idx * CONTACT_STRIDE + 6];
389
+ }
390
+
391
+ /** @param {number} slot @param {number} idx @returns {number} */
392
+ contact_normal_y(slot, idx) {
393
+ return this.__data[slot * SLOT_DATA_STRIDE + idx * CONTACT_STRIDE + 7];
394
+ }
395
+
396
+ /** @param {number} slot @param {number} idx @returns {number} */
397
+ contact_normal_z(slot, idx) {
398
+ return this.__data[slot * SLOT_DATA_STRIDE + idx * CONTACT_STRIDE + 8];
399
+ }
400
+
401
+ /** @param {number} slot @param {number} idx @returns {number} */
402
+ contact_depth(slot, idx) {
403
+ return this.__data[slot * SLOT_DATA_STRIDE + idx * CONTACT_STRIDE + 9];
404
+ }
405
+
406
+ /**
407
+ * Raw contact-point buffer. Hot-path solver code dereferences this
408
+ * directly via {@link slot_data_offset} + {@link CONTACT_STRIDE} to avoid
409
+ * per-field accessor overhead. Buffer identity is stable until grow.
410
+ * @returns {Float64Array}
411
+ */
412
+ get data_buffer() {
413
+ return this.__data;
414
+ }
415
+
416
+ /**
417
+ * Per-slot cached GJK separating axis buffer. Hot-path GJK callers
418
+ * pass this together with {@link slot_axis_offset} to
419
+ * `gjk_with_axis(...)` so the cached axis seeds the next iteration.
420
+ * Buffer identity is stable until grow.
421
+ * @returns {Float64Array}
422
+ */
423
+ get slot_axis_buffer() {
424
+ return this.__slot_axis;
425
+ }
426
+
427
+ /**
428
+ * Float offset into {@link slot_axis_buffer} where this slot's
429
+ * cached axis lives (3 floats: x, y, z).
430
+ * @param {number} slot
431
+ * @returns {number}
432
+ */
433
+ slot_axis_offset(slot) {
434
+ return slot * 3;
435
+ }
436
+
437
+ /**
438
+ * Word offset into {@link data_buffer} where the first contact of `slot`
439
+ * begins. Subsequent contacts within the slot are at
440
+ * `offset + c * CONTACT_STRIDE`.
441
+ * @param {number} slot
442
+ * @returns {number}
443
+ */
444
+ slot_data_offset(slot) {
445
+ return slot * SLOT_DATA_STRIDE;
446
+ }
447
+
448
+ /**
449
+ * Advance touched flags by one frame and evict slots that have been
450
+ * untouched for {@link DEFAULT_GRACE} consecutive frames.
451
+ */
452
+ advance_frame() {
453
+ // Iterate live slots backwards so swap-with-last during release doesn't
454
+ // skip indices.
455
+ for (let i = this.__live_count - 1; i >= 0; i--) {
456
+ const slot = this.__live_slots[i];
457
+ const meta_off = slot * SLOT_META_STRIDE;
458
+ let packed = this.__meta[meta_off + 2];
459
+
460
+ const was_touched = (packed & FLAG_TOUCHED) !== 0;
461
+ // Roll touched → prev_touched, clear touched.
462
+ if (was_touched) {
463
+ packed = (packed & ~FLAG_PREV_TOUCHED) | FLAG_PREV_TOUCHED;
464
+ packed &= ~FLAG_TOUCHED;
465
+ // Reset grace.
466
+ packed &= ~(GRACE_MASK << GRACE_SHIFT);
467
+ this.__meta[meta_off + 2] = packed;
468
+ } else {
469
+ // Bump grace.
470
+ const grace = ((packed >>> GRACE_SHIFT) & GRACE_MASK) + 1;
471
+ packed &= ~FLAG_PREV_TOUCHED;
472
+ packed &= ~(GRACE_MASK << GRACE_SHIFT);
473
+ packed |= (grace & GRACE_MASK) << GRACE_SHIFT;
474
+ this.__meta[meta_off + 2] = packed;
475
+
476
+ if (grace >= DEFAULT_GRACE) {
477
+ this.__release_slot(slot);
478
+ }
479
+ }
480
+ }
481
+ }
482
+
483
+ /**
484
+ * @private
485
+ * @returns {number} newly-allocated slot id
486
+ */
487
+ __allocate_slot() {
488
+ let slot;
489
+ if (this.__free_count > 0) {
490
+ slot = this.__heap_pop();
491
+ } else {
492
+ if (this.__high_water === this.__capacity) {
493
+ this.__grow();
494
+ }
495
+ slot = this.__high_water++;
496
+ }
497
+ const pos = this.__live_count++;
498
+ this.__live_slots[pos] = slot;
499
+ this.__live_pos[slot] = pos;
500
+ return slot;
501
+ }
502
+
503
+ /**
504
+ * @private
505
+ * @param {number} slot
506
+ */
507
+ __release_slot(slot) {
508
+ const meta_off = slot * SLOT_META_STRIDE;
509
+ const idA = this.__meta[meta_off];
510
+ const idB = this.__meta[meta_off + 1];
511
+
512
+ this.__pair_index.delete(idA, idB);
513
+
514
+ // Remove from dense live list (swap with last).
515
+ const pos = this.__live_pos[slot];
516
+ const last_pos = --this.__live_count;
517
+ if (pos !== last_pos) {
518
+ const swapped = this.__live_slots[last_pos];
519
+ this.__live_slots[pos] = swapped;
520
+ this.__live_pos[swapped] = pos;
521
+ }
522
+ this.__live_pos[slot] = -1;
523
+
524
+ this.__heap_push(slot);
525
+ }
526
+
527
+ /**
528
+ * @private
529
+ */
530
+ __grow() {
531
+ const new_capacity = this.__capacity << 1;
532
+ this.__capacity = new_capacity;
533
+
534
+ const grow_f64 = (a, stride) => {
535
+ const n = new Float64Array(new_capacity * stride);
536
+ n.set(a);
537
+ return n;
538
+ };
539
+ const grow_u32 = (a, stride) => {
540
+ const n = new Uint32Array(new_capacity * stride);
541
+ n.set(a);
542
+ return n;
543
+ };
544
+
545
+ this.__data = grow_f64(this.__data, SLOT_DATA_STRIDE);
546
+ this.__meta = grow_u32(this.__meta, SLOT_META_STRIDE);
547
+ this.__slot_axis = grow_f64(this.__slot_axis, 3);
548
+
549
+ const next_live = new Uint32Array(new_capacity);
550
+ next_live.set(this.__live_slots);
551
+ this.__live_slots = next_live;
552
+
553
+ const next_live_pos = new Int32Array(new_capacity);
554
+ next_live_pos.set(this.__live_pos);
555
+ next_live_pos.fill(-1, this.__live_pos.length);
556
+ this.__live_pos = next_live_pos;
557
+
558
+ const next_free = new Uint32Array(new_capacity);
559
+ next_free.set(this.__free_heap);
560
+ this.__free_heap = next_free;
561
+ }
562
+
563
+ /**
564
+ * @private
565
+ * @param {number} v
566
+ */
567
+ __heap_push(v) {
568
+ const heap = this.__free_heap;
569
+ let i = this.__free_count++;
570
+ heap[i] = v;
571
+ while (i > 0) {
572
+ const parent = (i - 1) >>> 1;
573
+ if (heap[parent] > heap[i]) {
574
+ const tmp = heap[parent];
575
+ heap[parent] = heap[i];
576
+ heap[i] = tmp;
577
+ i = parent;
578
+ } else break;
579
+ }
580
+ }
581
+
582
+ /**
583
+ * @private
584
+ * @returns {number}
585
+ */
586
+ __heap_pop() {
587
+ const heap = this.__free_heap;
588
+ const result = heap[0];
589
+ const new_count = --this.__free_count;
590
+ if (new_count > 0) {
591
+ heap[0] = heap[new_count];
592
+ let i = 0;
593
+ while (true) {
594
+ const l = (i << 1) + 1;
595
+ const r = l + 1;
596
+ let smallest = i;
597
+ if (l < new_count && heap[l] < heap[smallest]) smallest = l;
598
+ if (r < new_count && heap[r] < heap[smallest]) smallest = r;
599
+ if (smallest === i) break;
600
+ const tmp = heap[i];
601
+ heap[i] = heap[smallest];
602
+ heap[smallest] = tmp;
603
+ i = smallest;
604
+ }
605
+ }
606
+ return result;
607
+ }
608
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Kind of a rigid body. Determines how the body participates in the simulation:
3
+ * - {@link BodyKind.Static }: never moves. Has infinite mass. Ideal for level geometry.
4
+ * Stored in the static broadphase tree.
5
+ * - {@link BodyKind.Dynamic }: integrated under forces, gravity and contact impulses. The
6
+ * common case for game-play objects.
7
+ * - {@link BodyKind.KinematicVelocity }: driven externally by velocity. Pushes Dynamic
8
+ * bodies but is not pushed back. Mass effectively infinite for the solver.
9
+ * - {@link BodyKind.KinematicPosition }: driven externally by direct pose writes. Velocity
10
+ * is derived by the system from the per-step delta so dynamic neighbours respond
11
+ * correctly.
12
+ *
13
+ * Values are bit-distinct so a {@link Static } | {@link Dynamic } mask can be used in
14
+ * filtering predicates, although the primary use is identity comparison.
15
+ */
16
+ export type BodyKind = number;
17
+ export namespace BodyKind {
18
+ let Static: number;
19
+ let Dynamic: number;
20
+ let KinematicVelocity: number;
21
+ let KinematicPosition: number;
22
+ }
23
+ //# sourceMappingURL=BodyKind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BodyKind.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/ecs/BodyKind.js"],"names":[],"mappings":";;;;;;;;;;;;;;;uBAgBU,MAAM"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Kind of a rigid body. Determines how the body participates in the simulation:
3
+ * - {@link BodyKind.Static}: never moves. Has infinite mass. Ideal for level geometry.
4
+ * Stored in the static broadphase tree.
5
+ * - {@link BodyKind.Dynamic}: integrated under forces, gravity and contact impulses. The
6
+ * common case for game-play objects.
7
+ * - {@link BodyKind.KinematicVelocity}: driven externally by velocity. Pushes Dynamic
8
+ * bodies but is not pushed back. Mass effectively infinite for the solver.
9
+ * - {@link BodyKind.KinematicPosition}: driven externally by direct pose writes. Velocity
10
+ * is derived by the system from the per-step delta so dynamic neighbours respond
11
+ * correctly.
12
+ *
13
+ * Values are bit-distinct so a {@link Static} | {@link Dynamic} mask can be used in
14
+ * filtering predicates, although the primary use is identity comparison.
15
+ *
16
+ * @readonly
17
+ * @enum {number}
18
+ */
19
+ export const BodyKind = {
20
+ Static: 0,
21
+ Dynamic: 1,
22
+ KinematicVelocity: 2,
23
+ KinematicPosition: 3,
24
+ };