@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.
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts +3 -3
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.js +4 -4
- package/src/core/collection/PairUint32Map.d.ts +100 -0
- package/src/core/collection/PairUint32Map.d.ts.map +1 -0
- package/src/core/collection/PairUint32Map.js +321 -0
- package/src/core/collection/Uint32Map.d.ts +119 -0
- package/src/core/collection/Uint32Map.d.ts.map +1 -0
- package/src/core/collection/Uint32Map.js +345 -0
- package/src/core/collection/array/array_shuffle.d.ts +10 -3
- package/src/core/collection/array/array_shuffle.d.ts.map +1 -1
- package/src/core/collection/array/array_shuffle.js +27 -22
- package/src/core/collection/heap/FibonacciHeap.d.ts +195 -0
- package/src/core/collection/heap/FibonacciHeap.d.ts.map +1 -0
- package/src/core/collection/heap/FibonacciHeap.js +586 -0
- package/src/core/collection/heap/Uint32Heap.js +1 -1
- package/src/core/collection/heap/Uint32Heap4.d.ts +169 -0
- package/src/core/collection/heap/Uint32Heap4.d.ts.map +1 -0
- package/src/core/collection/heap/Uint32Heap4.js +490 -0
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts +30 -0
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.js +93 -0
- package/src/core/geom/3d/line/line3_closest_points_segment_segment.d.ts +27 -0
- package/src/core/geom/3d/line/line3_closest_points_segment_segment.d.ts.map +1 -0
- package/src/core/geom/3d/line/line3_closest_points_segment_segment.js +88 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts +54 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.js +69 -0
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts +24 -2
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/AbstractShape3D.js +24 -1
- package/src/core/geom/3d/shape/BoxShape3D.d.ts +61 -0
- package/src/core/geom/3d/shape/BoxShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/BoxShape3D.js +158 -0
- package/src/core/geom/3d/shape/CapsuleShape3D.d.ts +11 -0
- package/src/core/geom/3d/shape/CapsuleShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/CapsuleShape3D.js +12 -0
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts +148 -0
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/HeightMapShape3D.js +451 -0
- package/src/core/geom/3d/shape/MeshShape3D.d.ts +210 -0
- package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/MeshShape3D.js +593 -0
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +46 -2
- package/src/core/geom/3d/shape/Triangle3D.d.ts +95 -0
- package/src/core/geom/3d/shape/Triangle3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/Triangle3D.js +318 -0
- package/src/core/geom/3d/shape/UnionShape3D.js +13 -0
- package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts +37 -9
- package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitCubeShape3D.js +45 -98
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts +10 -0
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitSphereShape3D.js +11 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts +30 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts.map +1 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.js +64 -0
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts +61 -0
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts.map +1 -0
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.js +148 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.d.ts +39 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedral_mesh_from_surface.js +147 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.d.ts +15 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedron_quality.js +22 -0
- package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.d.ts +2 -0
- package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.js +671 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts +28 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.js +48 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.d.ts +26 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_carve_outside_surface.js +222 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.d.ts +34 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_around_edge.js +146 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.d.ts +36 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_23.js +232 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.d.ts +33 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_flip_32.js +255 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts +68 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.js +387 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts +35 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.js +140 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts +31 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.js +97 -0
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.d.ts +32 -0
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_quality.js +66 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts +41 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.js +124 -13
- package/src/core/geom/3d/topology/struct/binary/BinaryTopology.d.ts +134 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryTopology.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/BinaryTopology.js +276 -3
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts +17 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.js +135 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.d.ts +14 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compact.js +177 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_face_decouple.js +20 -4
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.js +5 -3
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_create.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_create.js +9 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_get_or_create.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_get_or_create.js +21 -45
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill.js +7 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.d.ts +8 -6
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_kill_parallels.js +8 -6
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.d.ts +22 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_kill_short_edges.js +73 -0
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vertex_replace.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/vertex/bt_vertex_replace.js +51 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.d.ts +10 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_get.js +42 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.d.ts +28 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_sample_interior_grid_points.js +227 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.d.ts +13 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_walk_boundary_loops.js +108 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.d.ts +11 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_query_edge_is_boundary.js +20 -0
- package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.d.ts +20 -0
- package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/triangle_mesh_compute_signed_volume.js +38 -0
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts +2 -2
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.js +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_dot_array_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.js +2 -2
- package/src/core/geom/vec3/v3_negate_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_negate_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_negate_array.js +2 -2
- package/src/core/geom/vec3/v3_quat3_apply.d.ts +29 -0
- package/src/core/geom/vec3/v3_quat3_apply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_quat3_apply.js +39 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts +30 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.js +41 -0
- package/src/core/geom/vec3/v3_triple_cross_product.d.ts +32 -0
- package/src/core/geom/vec3/v3_triple_cross_product.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_triple_cross_product.js +45 -0
- package/src/core/graph/csr/CSRGraph.d.ts +168 -0
- package/src/core/graph/csr/CSRGraph.d.ts.map +1 -0
- package/src/core/graph/csr/CSRGraph.js +319 -0
- package/src/core/graph/metis/cluster_mesh_metis.d.ts +12 -0
- package/src/core/graph/metis/cluster_mesh_metis.d.ts.map +1 -1
- package/src/core/graph/metis/cluster_mesh_metis.js +12 -0
- package/src/core/graph/metis/metis.d.ts +19 -0
- package/src/core/graph/metis/metis.d.ts.map +1 -1
- package/src/core/graph/metis/metis.js +20 -0
- package/src/core/graph/metis/metis_cluster_bs.d.ts +11 -0
- package/src/core/graph/metis/metis_cluster_bs.d.ts.map +1 -1
- package/src/core/graph/metis/metis_cluster_bs.js +11 -0
- package/src/core/graph/metis/metis_options.d.ts +17 -2
- package/src/core/graph/metis/metis_options.d.ts.map +1 -1
- package/src/core/graph/metis/metis_options.js +17 -2
- package/src/core/graph/metis/native/MetisGraph.d.ts +144 -0
- package/src/core/graph/metis/native/MetisGraph.d.ts.map +1 -0
- package/src/core/graph/metis/native/MetisGraph.js +212 -0
- package/src/core/graph/metis/native/bisection/BisectionScratch.d.ts +72 -0
- package/src/core/graph/metis/native/bisection/BisectionScratch.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/BisectionScratch.js +101 -0
- package/src/core/graph/metis/native/bisection/bisect_graph.d.ts +37 -0
- package/src/core/graph/metis/native/bisection/bisect_graph.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/bisect_graph.js +100 -0
- package/src/core/graph/metis/native/bisection/compute_2way_params.d.ts +15 -0
- package/src/core/graph/metis/native/bisection/compute_2way_params.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/compute_2way_params.js +84 -0
- package/src/core/graph/metis/native/bisection/fm_2way.d.ts +30 -0
- package/src/core/graph/metis/native/bisection/fm_2way.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/fm_2way.js +290 -0
- package/src/core/graph/metis/native/bisection/grow_bisection.d.ts +23 -0
- package/src/core/graph/metis/native/bisection/grow_bisection.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/grow_bisection.js +137 -0
- package/src/core/graph/metis/native/bisection/split_graph_two_way.d.ts +28 -0
- package/src/core/graph/metis/native/bisection/split_graph_two_way.d.ts.map +1 -0
- package/src/core/graph/metis/native/bisection/split_graph_two_way.js +119 -0
- package/src/core/graph/metis/native/coarsen/coarsen_graph.d.ts +20 -0
- package/src/core/graph/metis/native/coarsen/coarsen_graph.d.ts.map +1 -0
- package/src/core/graph/metis/native/coarsen/coarsen_graph.js +94 -0
- package/src/core/graph/metis/native/coarsen/create_coarse_graph.d.ts +24 -0
- package/src/core/graph/metis/native/coarsen/create_coarse_graph.d.ts.map +1 -0
- package/src/core/graph/metis/native/coarsen/create_coarse_graph.js +158 -0
- package/src/core/graph/metis/native/coarsen/match_shem.d.ts +41 -0
- package/src/core/graph/metis/native/coarsen/match_shem.d.ts.map +1 -0
- package/src/core/graph/metis/native/coarsen/match_shem.js +175 -0
- package/src/core/graph/metis/native/initial/initial_kway_bfs.d.ts +24 -0
- package/src/core/graph/metis/native/initial/initial_kway_bfs.d.ts.map +1 -0
- package/src/core/graph/metis/native/initial/initial_kway_bfs.js +122 -0
- package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.d.ts +29 -0
- package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.d.ts.map +1 -0
- package/src/core/graph/metis/native/initial/initial_kway_recursive_bisection.js +170 -0
- package/src/core/graph/metis/native/metis_partition_kway.d.ts +41 -0
- package/src/core/graph/metis/native/metis_partition_kway.d.ts.map +1 -0
- package/src/core/graph/metis/native/metis_partition_kway.js +126 -0
- package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.d.ts +62 -0
- package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.js +261 -0
- package/src/core/graph/metis/native/refine/RefinementScratch.d.ts +45 -0
- package/src/core/graph/metis/native/refine/RefinementScratch.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/RefinementScratch.js +53 -0
- package/src/core/graph/metis/native/refine/compute_kway_params.d.ts +18 -0
- package/src/core/graph/metis/native/refine/compute_kway_params.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/compute_kway_params.js +138 -0
- package/src/core/graph/metis/native/refine/fm_kway.d.ts +63 -0
- package/src/core/graph/metis/native/refine/fm_kway.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/fm_kway.js +462 -0
- package/src/core/graph/metis/native/refine/project_kway.d.ts +22 -0
- package/src/core/graph/metis/native/refine/project_kway.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/project_kway.js +43 -0
- package/src/core/graph/metis/native/refine/refine_kway.d.ts +34 -0
- package/src/core/graph/metis/native/refine/refine_kway.d.ts.map +1 -0
- package/src/core/graph/metis/native/refine/refine_kway.js +43 -0
- package/src/core/math/linalg/eigen/matrix_householder_in_place.d.ts +2 -2
- package/src/core/math/linalg/eigen/matrix_householder_in_place.js +2 -2
- package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts +6 -4
- package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts.map +1 -1
- package/src/core/math/linalg/eigen/matrix_qr_in_place.js +69 -23
- package/src/engine/EngineHarness.d.ts +3 -1
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +3 -0
- package/src/engine/control/first-person/DESIGN.md +30 -6
- package/src/engine/control/first-person/DESIGN_EXTENSIONS.md +563 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +115 -9
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.js +211 -176
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +601 -8
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +349 -8
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +319 -23
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +1789 -799
- package/src/engine/control/first-person/TODO.md +173 -0
- package/src/engine/control/first-person/abilities/Ability.d.ts +101 -0
- package/src/engine/control/first-person/abilities/Ability.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/Ability.js +119 -0
- package/src/engine/control/first-person/abilities/AbilitySet.d.ts +86 -0
- package/src/engine/control/first-person/abilities/AbilitySet.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/AbilitySet.js +185 -0
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts +62 -0
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/LedgeGrab.js +199 -0
- package/src/engine/control/first-person/abilities/Mantle.d.ts +45 -0
- package/src/engine/control/first-person/abilities/Mantle.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/Mantle.js +188 -0
- package/src/engine/control/first-person/abilities/Slide.d.ts +33 -0
- package/src/engine/control/first-person/abilities/Slide.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/Slide.js +166 -0
- package/src/engine/control/first-person/abilities/WallJump.d.ts +45 -0
- package/src/engine/control/first-person/abilities/WallJump.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/WallJump.js +131 -0
- package/src/engine/control/first-person/abilities/WallRun.d.ts +44 -0
- package/src/engine/control/first-person/abilities/WallRun.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/WallRun.js +180 -0
- package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts +49 -0
- package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts.map +1 -0
- package/src/engine/control/first-person/composer/EyeOffsetStack.js +60 -0
- package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.d.ts +100 -0
- package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/BreathRhythmEvaluator.js +133 -0
- package/src/engine/control/first-person/mastery/DecisionPoint.d.ts +10 -0
- package/src/engine/control/first-person/mastery/DecisionPoint.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/DecisionPoint.js +30 -0
- package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.d.ts +61 -0
- package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/FootAsymmetryTurnEvaluator.js +109 -0
- package/src/engine/control/first-person/mastery/MasteryEvaluator.d.ts +40 -0
- package/src/engine/control/first-person/mastery/MasteryEvaluator.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/MasteryEvaluator.js +45 -0
- package/src/engine/control/first-person/mastery/MasteryScore.d.ts +68 -0
- package/src/engine/control/first-person/mastery/MasteryScore.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/MasteryScore.js +100 -0
- package/src/engine/control/first-person/mastery/MasterySet.d.ts +60 -0
- package/src/engine/control/first-person/mastery/MasterySet.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/MasterySet.js +86 -0
- package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.d.ts +58 -0
- package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/SlideInitiationTimingEvaluator.js +83 -0
- package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.d.ts +69 -0
- package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.d.ts.map +1 -0
- package/src/engine/control/first-person/mastery/StrideTimingJumpEvaluator.js +109 -0
- package/src/engine/control/first-person/math/Spring.d.ts +56 -0
- package/src/engine/control/first-person/math/Spring.d.ts.map +1 -0
- package/src/engine/control/first-person/math/Spring.js +71 -0
- package/src/engine/control/first-person/math/computeLRCBreathRate.d.ts +26 -0
- package/src/engine/control/first-person/math/computeLRCBreathRate.d.ts.map +1 -0
- package/src/engine/control/first-person/math/computeLRCBreathRate.js +41 -0
- package/src/engine/control/first-person/math/computeMassRatios.d.ts +35 -0
- package/src/engine/control/first-person/math/computeMassRatios.d.ts.map +1 -0
- package/src/engine/control/first-person/math/computeMassRatios.js +44 -0
- package/src/engine/control/first-person/pose/FirstPersonPose.d.ts +31 -1
- package/src/engine/control/first-person/pose/FirstPersonPose.d.ts.map +1 -1
- package/src/engine/control/first-person/pose/FirstPersonPose.js +49 -3
- package/src/engine/control/first-person/pose/FirstPersonPosture.d.ts +7 -0
- package/src/engine/control/first-person/pose/FirstPersonPosture.d.ts.map +1 -0
- package/src/engine/control/first-person/pose/FirstPersonPosture.js +27 -0
- package/src/engine/control/first-person/prototype_first_person_controller.js +637 -120
- package/src/engine/control/first-person/sensors/FirstPersonSensors.d.ts +58 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensors.d.ts.map +1 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensors.js +77 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts +80 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +196 -0
- package/src/engine/control/first-person/test/buildTestPlayer.d.ts +20 -0
- package/src/engine/control/first-person/test/buildTestPlayer.d.ts.map +1 -0
- package/src/engine/control/first-person/test/buildTestPlayer.js +36 -0
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +0 -2
- package/src/engine/graphics/ecs/light/Light.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/Light.js +27 -0
- package/src/engine/graphics/ecs/light/LightSystem.js +1 -1
- package/src/engine/graphics/ecs/path/PathDisplaySystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +0 -2
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +0 -2
- package/src/engine/graphics/geometry/CapsuleGeometry.d.ts +42 -0
- package/src/engine/graphics/geometry/CapsuleGeometry.d.ts.map +1 -0
- package/src/engine/graphics/geometry/CapsuleGeometry.js +171 -0
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -2
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +0 -2
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +0 -2
- package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts.map +1 -1
- package/src/engine/navigation/grid/find_path_on_grid_astar.js +11 -2
- package/src/engine/navigation/mesh/bt_mesh_face_find_path.d.ts.map +1 -1
- package/src/engine/navigation/mesh/bt_mesh_face_find_path.js +11 -1
- package/src/engine/physics/BULLET_REVIEW.md +945 -0
- package/src/engine/physics/CANNON_REVIEW.md +1300 -0
- package/src/engine/physics/JOLT_REVIEW.md +913 -0
- package/src/engine/physics/PLAN.md +461 -0
- package/src/engine/physics/RAPIER_REVIEW.md +934 -0
- package/src/engine/physics/REVIEW_001_ACTION_PLAN.md +642 -0
- package/src/engine/physics/body/BodyStorage.d.ts +187 -0
- package/src/engine/physics/body/BodyStorage.d.ts.map +1 -0
- package/src/engine/physics/body/BodyStorage.js +427 -0
- package/src/engine/physics/broadphase/PairList.d.ts +62 -0
- package/src/engine/physics/broadphase/PairList.d.ts.map +1 -0
- package/src/engine/physics/broadphase/PairList.js +97 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts +16 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.d.ts.map +1 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.js +61 -0
- package/src/engine/physics/broadphase/generate_pairs.d.ts +38 -0
- package/src/engine/physics/broadphase/generate_pairs.d.ts.map +1 -0
- package/src/engine/physics/broadphase/generate_pairs.js +101 -0
- package/src/engine/physics/contact/ManifoldStore.d.ts +299 -0
- package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -0
- package/src/engine/physics/contact/ManifoldStore.js +608 -0
- package/src/engine/physics/ecs/BodyKind.d.ts +23 -0
- package/src/engine/physics/ecs/BodyKind.d.ts.map +1 -0
- package/src/engine/physics/ecs/BodyKind.js +24 -0
- package/src/engine/physics/ecs/Collider.d.ts +98 -0
- package/src/engine/physics/ecs/Collider.d.ts.map +1 -0
- package/src/engine/physics/ecs/Collider.js +136 -0
- package/src/engine/physics/ecs/ColliderFlags.d.ts +14 -0
- package/src/engine/physics/ecs/ColliderFlags.d.ts.map +1 -0
- package/src/engine/physics/ecs/ColliderFlags.js +15 -0
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts +58 -0
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts.map +1 -0
- package/src/engine/physics/ecs/ColliderObserverSystem.js +103 -0
- package/src/engine/physics/ecs/ColliderSerializationAdapter.d.ts +25 -0
- package/src/engine/physics/ecs/ColliderSerializationAdapter.d.ts.map +1 -0
- package/src/engine/physics/ecs/ColliderSerializationAdapter.js +37 -0
- package/src/engine/physics/ecs/PhysicsEvents.d.ts +15 -0
- package/src/engine/physics/ecs/PhysicsEvents.d.ts.map +1 -0
- package/src/engine/physics/ecs/PhysicsEvents.js +16 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +628 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -0
- package/src/engine/physics/ecs/PhysicsSystem.js +1301 -0
- package/src/engine/physics/ecs/RigidBody.d.ts +197 -0
- package/src/engine/physics/ecs/RigidBody.d.ts.map +1 -0
- package/src/engine/physics/ecs/RigidBody.js +240 -0
- package/src/engine/physics/ecs/RigidBodyFlags.d.ts +21 -0
- package/src/engine/physics/ecs/RigidBodyFlags.d.ts.map +1 -0
- package/src/engine/physics/ecs/RigidBodyFlags.js +22 -0
- package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts +28 -0
- package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts.map +1 -0
- package/src/engine/physics/ecs/RigidBodySerializationAdapter.js +81 -0
- package/src/engine/physics/ecs/SleepState.d.ts +11 -0
- package/src/engine/physics/ecs/SleepState.d.ts.map +1 -0
- package/src/engine/physics/ecs/SleepState.js +12 -0
- package/src/engine/physics/events/ContactEventBuffer.d.ts +46 -0
- package/src/engine/physics/events/ContactEventBuffer.d.ts.map +1 -0
- package/src/engine/physics/events/ContactEventBuffer.js +83 -0
- package/src/engine/physics/events/diff_manifolds.d.ts +25 -0
- package/src/engine/physics/events/diff_manifolds.d.ts.map +1 -0
- package/src/engine/physics/events/diff_manifolds.js +50 -0
- package/src/engine/physics/fluid/FluidField.d.ts +294 -16
- package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidField.js +510 -66
- package/src/engine/physics/fluid/FluidSimulator.d.ts +188 -5
- package/src/engine/physics/fluid/FluidSimulator.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidSimulator.js +456 -95
- package/src/engine/physics/fluid/SliceVisualiser.d.ts +29 -6
- package/src/engine/physics/fluid/SliceVisualiser.d.ts.map +1 -1
- package/src/engine/physics/fluid/SliceVisualiser.js +190 -165
- package/src/engine/physics/fluid/ecs/FluidComponent.d.ts +154 -0
- package/src/engine/physics/fluid/ecs/FluidComponent.d.ts.map +1 -0
- package/src/engine/physics/fluid/ecs/FluidComponent.js +238 -0
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.d.ts +45 -0
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.d.ts.map +1 -0
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponent.js +89 -0
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +107 -0
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts.map +1 -0
- package/src/engine/physics/fluid/ecs/FluidSystem.js +278 -0
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +62 -1
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +81 -6
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts +17 -4
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +105 -12
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts +43 -0
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -0
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +210 -0
- package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts +62 -1
- package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/WakeFluidEffector.js +302 -8
- package/src/engine/physics/fluid/prototype.js +102 -91
- package/src/engine/physics/fluid/solver/optimal_sor_omega.d.ts +33 -0
- package/src/engine/physics/fluid/solver/optimal_sor_omega.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/optimal_sor_omega.js +41 -0
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.d.ts +20 -5
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_forward.js +60 -38
- package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.d.ts +25 -4
- package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_apply_diffusion.js +93 -73
- package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.d.ts +23 -0
- package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_apply_scalar_advection.js +60 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.d.ts +23 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_divergence.js +68 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts +30 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.js +66 -0
- package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.d.ts +26 -0
- package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_patch_edges_uniform.js +113 -0
- package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.d.ts +30 -0
- package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_shift_in_place.js +107 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts +49 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.js +126 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts +93 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.js +424 -0
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts +48 -0
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts.map +1 -0
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.js +92 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts +6 -6
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -1
- package/src/engine/physics/gjk/expanding_polytope_algorithm.js +76 -32
- package/src/engine/physics/gjk/gjk.d.ts +28 -2
- package/src/engine/physics/gjk/gjk.d.ts.map +1 -1
- package/src/engine/physics/gjk/gjk.js +421 -378
- package/src/engine/physics/gjk/minkowski_support.d.ts +37 -0
- package/src/engine/physics/gjk/minkowski_support.d.ts.map +1 -0
- package/src/engine/physics/gjk/minkowski_support.js +75 -0
- package/src/engine/physics/gjk/mpr.d.ts +56 -0
- package/src/engine/physics/gjk/mpr.d.ts.map +1 -0
- package/src/engine/physics/gjk/mpr.js +344 -0
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts +44 -0
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -0
- package/src/engine/physics/inertia/world_inverse_inertia.js +77 -0
- package/src/engine/physics/integration/integrate_position.d.ts +34 -0
- package/src/engine/physics/integration/integrate_position.d.ts.map +1 -0
- package/src/engine/physics/integration/integrate_position.js +79 -0
- package/src/engine/physics/integration/integrate_velocity.d.ts +55 -0
- package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -0
- package/src/engine/physics/integration/integrate_velocity.js +160 -0
- package/src/engine/physics/integration/quat_integrate.d.ts +27 -0
- package/src/engine/physics/integration/quat_integrate.d.ts.map +1 -0
- package/src/engine/physics/integration/quat_integrate.js +62 -0
- package/src/engine/physics/island/IslandBuilder.d.ts +167 -0
- package/src/engine/physics/island/IslandBuilder.d.ts.map +1 -0
- package/src/engine/physics/island/IslandBuilder.js +411 -0
- package/src/engine/physics/island/union_find.d.ts +51 -0
- package/src/engine/physics/island/union_find.d.ts.map +1 -0
- package/src/engine/physics/island/union_find.js +76 -0
- package/src/engine/physics/narrowphase/PosedShape.d.ts +51 -0
- package/src/engine/physics/narrowphase/PosedShape.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/PosedShape.js +108 -0
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts +32 -0
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/box_box_manifold.js +639 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts +30 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.js +811 -0
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts +122 -0
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/capsule_contacts.js +462 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts +71 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.js +375 -0
- package/src/engine/physics/narrowphase/compute_penetration.d.ts +91 -0
- package/src/engine/physics/narrowphase/compute_penetration.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/compute_penetration.js +396 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts +35 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.js +80 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts +31 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.js +55 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts +42 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.js +204 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts +42 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +94 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts +37 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.js +37 -0
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts +17 -0
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/narrowphase_step.js +1422 -0
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts +38 -0
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/sphere_box_contact.js +123 -0
- package/src/engine/physics/narrowphase/sphere_sphere_contact.d.ts +26 -0
- package/src/engine/physics/narrowphase/sphere_sphere_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/sphere_sphere_contact.js +51 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts +48 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.js +143 -0
- package/src/engine/physics/queries/PhysicsSurfacePoint.d.ts +83 -0
- package/src/engine/physics/queries/PhysicsSurfacePoint.d.ts.map +1 -0
- package/src/engine/physics/queries/PhysicsSurfacePoint.js +100 -0
- package/src/engine/physics/queries/overlap_shape.d.ts +51 -0
- package/src/engine/physics/queries/overlap_shape.d.ts.map +1 -0
- package/src/engine/physics/queries/overlap_shape.js +183 -0
- package/src/engine/physics/queries/raycast.d.ts +20 -0
- package/src/engine/physics/queries/raycast.d.ts.map +1 -0
- package/src/engine/physics/queries/raycast.js +249 -0
- package/src/engine/physics/queries/shape_cast.d.ts +56 -0
- package/src/engine/physics/queries/shape_cast.d.ts.map +1 -0
- package/src/engine/physics/queries/shape_cast.js +387 -0
- package/src/engine/physics/solver/friction_cone.d.ts +16 -0
- package/src/engine/physics/solver/friction_cone.d.ts.map +1 -0
- package/src/engine/physics/solver/friction_cone.js +37 -0
- package/src/engine/physics/solver/solve_contacts.d.ts +122 -0
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -0
- package/src/engine/physics/solver/solve_contacts.js +1016 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.d.ts +0 -34
- package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/OrderedEdge.js +0 -66
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.d.ts +0 -2
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_mesh_calc_edges.js +0 -54
- package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.d.ts +0 -2
- package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.d.ts.map +0 -1
- package/src/core/geom/3d/topology/struct/binary/io/edge/get_or_create_edge_map.js +0 -26
- package/src/engine/ecs/components/Motion.d.ts +0 -21
- package/src/engine/ecs/components/Motion.d.ts.map +0 -1
- package/src/engine/ecs/components/Motion.js +0 -27
- package/src/engine/ecs/components/MotionSerializationAdapter.d.ts +0 -20
- package/src/engine/ecs/components/MotionSerializationAdapter.d.ts.map +0 -1
- package/src/engine/ecs/components/MotionSerializationAdapter.js +0 -26
- package/src/engine/ecs/systems/MotionSystem.d.ts +0 -9
- package/src/engine/ecs/systems/MotionSystem.d.ts.map +0 -1
- package/src/engine/ecs/systems/MotionSystem.js +0 -29
- package/src/engine/physics/fluid/Fluid.d.ts +0 -26
- package/src/engine/physics/fluid/Fluid.d.ts.map +0 -1
- package/src/engine/physics/fluid/Fluid.js +0 -221
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.d.ts +0 -7
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.d.ts.map +0 -1
- package/src/engine/physics/fluid/solver/v3_grid_apply_advection_reverse.js +0 -8
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test what bodies overlap a convex shape placed at a given pose. Each
|
|
3
|
+
* overlapping body's `body_id` is written to `output` starting at
|
|
4
|
+
* `output_offset`; the function returns the number of body ids written.
|
|
5
|
+
*
|
|
6
|
+
* Use case: speculative physics queries for kinematic / character
|
|
7
|
+
* controllers. An external system can ask "would my body collide with
|
|
8
|
+
* anything if I moved it here?" without committing a tick of
|
|
9
|
+
* simulation. The output is a flat list of body ids so the caller can
|
|
10
|
+
* decide what to do per hit (skip, push, slide, etc.).
|
|
11
|
+
*
|
|
12
|
+
* The pipeline mirrors the narrowphase pair test:
|
|
13
|
+
* 1. Build the query shape's world AABB.
|
|
14
|
+
* 2. Pull candidates from both broadphase trees that overlap that AABB.
|
|
15
|
+
* 3. For each candidate, run GJK in world frame. Convex candidates
|
|
16
|
+
* go through one GJK call; concave candidates (heightmap / mesh)
|
|
17
|
+
* go through the per-triangle decomposition path.
|
|
18
|
+
* 4. Apply the optional `filter` callback (same signature as in
|
|
19
|
+
* raycast / shapeCast) before the GJK test — early-out on bodies
|
|
20
|
+
* the caller already wants to skip (themselves, allies, etc.).
|
|
21
|
+
*
|
|
22
|
+
* The query shape must be convex (`is_convex === true`). Concave shapes
|
|
23
|
+
* are typically static terrain and not used as kinematic query
|
|
24
|
+
* probes; rejecting them avoids the M×N triangle-pair cost.
|
|
25
|
+
*
|
|
26
|
+
* @param {PhysicsSystem} system
|
|
27
|
+
* @param {AbstractShape3D} shape query shape, convex; expressed in
|
|
28
|
+
* its own local frame
|
|
29
|
+
* @param {{x:number,y:number,z:number}} position world position of the
|
|
30
|
+
* query shape
|
|
31
|
+
* @param {{x:number,y:number,z:number,w:number}} rotation world rotation
|
|
32
|
+
* of the query shape (unit quaternion)
|
|
33
|
+
* @param {Uint32Array|number[]} output buffer to write body_ids into.
|
|
34
|
+
* Caller is responsible for sizing it; ids past its end are dropped.
|
|
35
|
+
* @param {number} output_offset float-index in output to start writing at
|
|
36
|
+
* @param {(entity:number, collider:Collider)=>boolean} [filter]
|
|
37
|
+
* defaults to {@link returnTrue} (accept every candidate)
|
|
38
|
+
* @returns {number} number of overlapping bodies written
|
|
39
|
+
* @throws {Error} if `shape.is_convex === false`
|
|
40
|
+
*/
|
|
41
|
+
export function overlap_shape(system: PhysicsSystem, shape: AbstractShape3D, position: {
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
z: number;
|
|
45
|
+
}, rotation: {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
z: number;
|
|
49
|
+
w: number;
|
|
50
|
+
}, output: Uint32Array | number[], output_offset: number, filter?: (entity: number, collider: Collider) => boolean): number;
|
|
51
|
+
//# sourceMappingURL=overlap_shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlap_shape.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/queries/overlap_shape.js"],"names":[],"mappings":"AA4CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,uFAZW;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,YAE5B;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,UAErC,WAAW,GAAC,MAAM,EAAE,iBAEpB,MAAM,oBACE,MAAM,yBAAsB,OAAO,GAEzC,MAAM,CAqGlB"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { bvh_query_user_data_overlaps_aabb } from "../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.js";
|
|
2
|
+
import { returnTrue } from "../../../core/function/returnTrue.js";
|
|
3
|
+
import { aabb3_transform_oriented } from "../../../core/geom/3d/aabb/aabb3_transform_oriented.js";
|
|
4
|
+
import { Triangle3D } from "../../../core/geom/3d/shape/Triangle3D.js";
|
|
5
|
+
import { body_id_index } from "../body/BodyStorage.js";
|
|
6
|
+
import { gjk } from "../gjk/gjk.js";
|
|
7
|
+
import { aabb_world_to_local } from "../narrowphase/decomposition/aabb_world_to_local.js";
|
|
8
|
+
import { decompose_to_triangles } from "../narrowphase/decomposition/decompose_to_triangles.js";
|
|
9
|
+
import { TRIANGLE_FLOAT_STRIDE } from "../narrowphase/decomposition/triangle_buffer_layout.js";
|
|
10
|
+
import { PosedShape } from "../narrowphase/PosedShape.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Scratch state — module-scoped to avoid per-query allocation. Safe
|
|
14
|
+
* because PhysicsSystem queries run on the main thread, sequentially.
|
|
15
|
+
*/
|
|
16
|
+
const local_aabb = new Float64Array(6);
|
|
17
|
+
const world_aabb = new Float64Array(6);
|
|
18
|
+
const concave_query_aabb = new Float64Array(6);
|
|
19
|
+
const simplex_buf = new Float64Array(12);
|
|
20
|
+
|
|
21
|
+
const query_posed = new PosedShape();
|
|
22
|
+
const candidate_posed = new PosedShape();
|
|
23
|
+
const triangle_shape = new Triangle3D();
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Maximum triangles a concave candidate can emit per overlap pair.
|
|
27
|
+
* Same rationale as the narrowphase's `MAX_TRIANGLES_PER_PAIR`: the
|
|
28
|
+
* broadphase has already bounded the query AABB to the query shape's
|
|
29
|
+
* envelope, so a single candidate typically yields tens of triangles.
|
|
30
|
+
* Excess triangles are dropped by the enumerator's bounds check —
|
|
31
|
+
* worst case is a missed overlap on a far edge of the candidate's
|
|
32
|
+
* geometry, recovered next query.
|
|
33
|
+
* @type {number}
|
|
34
|
+
*/
|
|
35
|
+
const MAX_TRIANGLES_PER_PAIR = 1024;
|
|
36
|
+
|
|
37
|
+
const triangle_buffer = new Float64Array(MAX_TRIANGLES_PER_PAIR * TRIANGLE_FLOAT_STRIDE);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Broadphase candidate buffer. Grows by doubling on overflow.
|
|
41
|
+
* @type {Uint32Array}
|
|
42
|
+
*/
|
|
43
|
+
let scratch_candidates = new Uint32Array(64);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Test what bodies overlap a convex shape placed at a given pose. Each
|
|
47
|
+
* overlapping body's `body_id` is written to `output` starting at
|
|
48
|
+
* `output_offset`; the function returns the number of body ids written.
|
|
49
|
+
*
|
|
50
|
+
* Use case: speculative physics queries for kinematic / character
|
|
51
|
+
* controllers. An external system can ask "would my body collide with
|
|
52
|
+
* anything if I moved it here?" without committing a tick of
|
|
53
|
+
* simulation. The output is a flat list of body ids so the caller can
|
|
54
|
+
* decide what to do per hit (skip, push, slide, etc.).
|
|
55
|
+
*
|
|
56
|
+
* The pipeline mirrors the narrowphase pair test:
|
|
57
|
+
* 1. Build the query shape's world AABB.
|
|
58
|
+
* 2. Pull candidates from both broadphase trees that overlap that AABB.
|
|
59
|
+
* 3. For each candidate, run GJK in world frame. Convex candidates
|
|
60
|
+
* go through one GJK call; concave candidates (heightmap / mesh)
|
|
61
|
+
* go through the per-triangle decomposition path.
|
|
62
|
+
* 4. Apply the optional `filter` callback (same signature as in
|
|
63
|
+
* raycast / shapeCast) before the GJK test — early-out on bodies
|
|
64
|
+
* the caller already wants to skip (themselves, allies, etc.).
|
|
65
|
+
*
|
|
66
|
+
* The query shape must be convex (`is_convex === true`). Concave shapes
|
|
67
|
+
* are typically static terrain and not used as kinematic query
|
|
68
|
+
* probes; rejecting them avoids the M×N triangle-pair cost.
|
|
69
|
+
*
|
|
70
|
+
* @param {PhysicsSystem} system
|
|
71
|
+
* @param {AbstractShape3D} shape query shape, convex; expressed in
|
|
72
|
+
* its own local frame
|
|
73
|
+
* @param {{x:number,y:number,z:number}} position world position of the
|
|
74
|
+
* query shape
|
|
75
|
+
* @param {{x:number,y:number,z:number,w:number}} rotation world rotation
|
|
76
|
+
* of the query shape (unit quaternion)
|
|
77
|
+
* @param {Uint32Array|number[]} output buffer to write body_ids into.
|
|
78
|
+
* Caller is responsible for sizing it; ids past its end are dropped.
|
|
79
|
+
* @param {number} output_offset float-index in output to start writing at
|
|
80
|
+
* @param {(entity:number, collider:Collider)=>boolean} [filter]
|
|
81
|
+
* defaults to {@link returnTrue} (accept every candidate)
|
|
82
|
+
* @returns {number} number of overlapping bodies written
|
|
83
|
+
* @throws {Error} if `shape.is_convex === false`
|
|
84
|
+
*/
|
|
85
|
+
export function overlap_shape(system, shape, position, rotation, output, output_offset, filter = returnTrue) {
|
|
86
|
+
if (shape.is_convex === false) {
|
|
87
|
+
throw new Error(`overlap_shape: query shape must be convex; received \`${shape.constructor.name}\` (is_convex=false)`);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ── 1. Query shape's world AABB ─────────────────────────────────
|
|
91
|
+
shape.compute_bounding_box(local_aabb);
|
|
92
|
+
aabb3_transform_oriented(
|
|
93
|
+
world_aabb, 0,
|
|
94
|
+
local_aabb[0], local_aabb[1], local_aabb[2],
|
|
95
|
+
local_aabb[3], local_aabb[4], local_aabb[5],
|
|
96
|
+
position.x, position.y, position.z,
|
|
97
|
+
rotation.x, rotation.y, rotation.z, rotation.w
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
// ── 2. Gather broadphase candidates ─────────────────────────────
|
|
101
|
+
const n_static = bvh_query_user_data_overlaps_aabb(
|
|
102
|
+
scratch_candidates, 0, system.staticBvh, world_aabb
|
|
103
|
+
);
|
|
104
|
+
const n_dynamic = bvh_query_user_data_overlaps_aabb(
|
|
105
|
+
scratch_candidates, n_static, system.dynamicBvh, world_aabb
|
|
106
|
+
);
|
|
107
|
+
const n_total = n_static + n_dynamic;
|
|
108
|
+
if (n_total === 0) return 0;
|
|
109
|
+
|
|
110
|
+
// ── 3. Set up query PosedShape (constant across candidates) ─────
|
|
111
|
+
query_posed.setup(shape, position, rotation);
|
|
112
|
+
|
|
113
|
+
// ── 4. Per-candidate narrowphase ────────────────────────────────
|
|
114
|
+
const output_capacity = output.length - output_offset;
|
|
115
|
+
let count = 0;
|
|
116
|
+
let cursor = output_offset;
|
|
117
|
+
|
|
118
|
+
for (let i = 0; i < n_total; i++) {
|
|
119
|
+
if (count >= output_capacity) break;
|
|
120
|
+
|
|
121
|
+
const body_id = scratch_candidates[i];
|
|
122
|
+
const body_idx = body_id_index(body_id);
|
|
123
|
+
|
|
124
|
+
const entity = system.entityOf(body_id);
|
|
125
|
+
if (entity < 0) continue;
|
|
126
|
+
|
|
127
|
+
const collider = system.__primary_collider(body_idx);
|
|
128
|
+
if (collider === null) continue;
|
|
129
|
+
if (!filter(entity, collider)) continue;
|
|
130
|
+
|
|
131
|
+
const candidate_tr = system.__transforms[body_idx];
|
|
132
|
+
|
|
133
|
+
let overlaps = false;
|
|
134
|
+
|
|
135
|
+
if (collider.shape.is_convex !== false) {
|
|
136
|
+
candidate_posed.setup(collider.shape, candidate_tr.position, candidate_tr.rotation);
|
|
137
|
+
overlaps = gjk(simplex_buf, query_posed, candidate_posed);
|
|
138
|
+
} else {
|
|
139
|
+
// Concave candidate: project the query's world AABB into
|
|
140
|
+
// the candidate's body-local frame, decompose to triangles,
|
|
141
|
+
// run per-triangle GJK until one overlap is found.
|
|
142
|
+
aabb_world_to_local(
|
|
143
|
+
concave_query_aabb, 0,
|
|
144
|
+
world_aabb,
|
|
145
|
+
candidate_tr.position.x, candidate_tr.position.y, candidate_tr.position.z,
|
|
146
|
+
candidate_tr.rotation.x, candidate_tr.rotation.y, candidate_tr.rotation.z, candidate_tr.rotation.w
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const tri_count = decompose_to_triangles(
|
|
150
|
+
triangle_buffer, 0, collider.shape,
|
|
151
|
+
concave_query_aabb[0], concave_query_aabb[1], concave_query_aabb[2],
|
|
152
|
+
concave_query_aabb[3], concave_query_aabb[4], concave_query_aabb[5]
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
// Re-pose candidate as the concave body, rebinding the
|
|
156
|
+
// flyweight triangle per iteration.
|
|
157
|
+
candidate_posed.shape = triangle_shape;
|
|
158
|
+
candidate_posed.px = candidate_tr.position.x;
|
|
159
|
+
candidate_posed.py = candidate_tr.position.y;
|
|
160
|
+
candidate_posed.pz = candidate_tr.position.z;
|
|
161
|
+
candidate_posed.qx = candidate_tr.rotation.x;
|
|
162
|
+
candidate_posed.qy = candidate_tr.rotation.y;
|
|
163
|
+
candidate_posed.qz = candidate_tr.rotation.z;
|
|
164
|
+
candidate_posed.qw = candidate_tr.rotation.w;
|
|
165
|
+
|
|
166
|
+
for (let t = 0; t < tri_count; t++) {
|
|
167
|
+
triangle_shape.bind(triangle_buffer, t * TRIANGLE_FLOAT_STRIDE);
|
|
168
|
+
if (gjk(simplex_buf, query_posed, candidate_posed)) {
|
|
169
|
+
overlaps = true;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (overlaps) {
|
|
176
|
+
output[cursor] = body_id;
|
|
177
|
+
cursor++;
|
|
178
|
+
count++;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return count;
|
|
183
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raycast against both broadphase trees (static + dynamic) of a
|
|
3
|
+
* {@link PhysicsSystem}, filling `result` with the nearest hit and returning
|
|
4
|
+
* `true` on hit, `false` on miss.
|
|
5
|
+
*
|
|
6
|
+
* Hit normal is the AABB face normal — exact for AABB-shaped colliders,
|
|
7
|
+
* a stable approximation for general convex shapes (an upcoming narrowphase
|
|
8
|
+
* refinement pass will replace this with the true shape normal at the same
|
|
9
|
+
* call site, no API change).
|
|
10
|
+
*
|
|
11
|
+
* @param {PhysicsSystem} system
|
|
12
|
+
* @param {Ray3} ray origin + unit direction + `tMax`
|
|
13
|
+
* @param {PhysicsSurfacePoint} result populated on hit; untouched on miss
|
|
14
|
+
* @param {(entity:number, collider:Collider)=>boolean} [filter] mandatory in
|
|
15
|
+
* contract; defaults to {@link returnTrue} (accept everything). Called once
|
|
16
|
+
* per BVH leaf that crosses the ray.
|
|
17
|
+
* @returns {boolean} true on hit, false on miss
|
|
18
|
+
*/
|
|
19
|
+
export function raycast(system: PhysicsSystem, ray: Ray3, result: PhysicsSurfacePoint, filter?: (entity: number, collider: Collider) => boolean): boolean;
|
|
20
|
+
//# sourceMappingURL=raycast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raycast.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/queries/raycast.js"],"names":[],"mappings":"AA2HA;;;;;;;;;;;;;;;;;GAiBG;AACH,yGALmB,MAAM,yBAAsB,OAAO,GAGzC,OAAO,CA6GnB"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
2
|
+
import {
|
|
3
|
+
COLUMN_CHILD_1,
|
|
4
|
+
COLUMN_CHILD_2,
|
|
5
|
+
COLUMN_USER_DATA,
|
|
6
|
+
ELEMENT_WORD_COUNT,
|
|
7
|
+
NULL_NODE,
|
|
8
|
+
} from "../../../core/bvh2/bvh3/BVH.js";
|
|
9
|
+
import { returnTrue } from "../../../core/function/returnTrue.js";
|
|
10
|
+
import { aabb3_near_distance_to_intersection_ray_segment } from "../../../core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.js";
|
|
11
|
+
|
|
12
|
+
const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Walk a single BVH along a ray and update the running nearest hit.
|
|
16
|
+
*
|
|
17
|
+
* Hit refinement is broadphase-only: the returned `t` is the distance to
|
|
18
|
+
* the inflated leaf AABB. Narrowphase shape refinement is a follow-up.
|
|
19
|
+
*
|
|
20
|
+
* @param {BVH} bvh
|
|
21
|
+
* @param {number} root
|
|
22
|
+
* @param {number} ox
|
|
23
|
+
* @param {number} oy
|
|
24
|
+
* @param {number} oz
|
|
25
|
+
* @param {number} dx
|
|
26
|
+
* @param {number} dy
|
|
27
|
+
* @param {number} dz
|
|
28
|
+
* @param {number} inv_dx
|
|
29
|
+
* @param {number} inv_dy
|
|
30
|
+
* @param {number} inv_dz
|
|
31
|
+
* @param {number} max_distance
|
|
32
|
+
* @param {{best_t:number, best_body:number, best_node:number, best_bvh:BVH|null}} acc
|
|
33
|
+
* @param {(body_id:number)=>boolean} test per-leaf filter
|
|
34
|
+
*/
|
|
35
|
+
function bvh_raycast_nearest(
|
|
36
|
+
bvh, root,
|
|
37
|
+
ox, oy, oz,
|
|
38
|
+
dx, dy, dz,
|
|
39
|
+
inv_dx, inv_dy, inv_dz,
|
|
40
|
+
max_distance,
|
|
41
|
+
acc,
|
|
42
|
+
test
|
|
43
|
+
) {
|
|
44
|
+
if (root === NULL_NODE) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const float32 = bvh.__data_float32;
|
|
49
|
+
const uint32 = bvh.__data_uint32;
|
|
50
|
+
|
|
51
|
+
let pointer = stack.pointer;
|
|
52
|
+
const stack_top = pointer;
|
|
53
|
+
stack[pointer++] = root;
|
|
54
|
+
|
|
55
|
+
while (pointer > stack_top) {
|
|
56
|
+
pointer--;
|
|
57
|
+
const node = stack[pointer];
|
|
58
|
+
const address = node * ELEMENT_WORD_COUNT;
|
|
59
|
+
|
|
60
|
+
const t_near = aabb3_near_distance_to_intersection_ray_segment(
|
|
61
|
+
float32[address], float32[address + 1], float32[address + 2],
|
|
62
|
+
float32[address + 3], float32[address + 4], float32[address + 5],
|
|
63
|
+
ox, oy, oz,
|
|
64
|
+
inv_dx, inv_dy, inv_dz,
|
|
65
|
+
0, max_distance
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// No intersection or this subtree can't beat the best known hit — prune.
|
|
69
|
+
if (t_near >= acc.best_t) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const child_1 = uint32[address + COLUMN_CHILD_1];
|
|
74
|
+
if (child_1 !== NULL_NODE) {
|
|
75
|
+
stack[pointer++] = uint32[address + COLUMN_CHILD_2];
|
|
76
|
+
stack[pointer++] = child_1;
|
|
77
|
+
} else {
|
|
78
|
+
const body_id = uint32[address + COLUMN_USER_DATA];
|
|
79
|
+
if (test(body_id)) {
|
|
80
|
+
acc.best_t = t_near;
|
|
81
|
+
acc.best_body = body_id;
|
|
82
|
+
acc.best_node = node;
|
|
83
|
+
acc.best_bvh = bvh;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
stack.pointer = stack_top;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Reusable nearest-hit accumulator. Module-scoped so {@link raycast} doesn't
|
|
93
|
+
* allocate per call. The physics step is single-threaded so contention isn't
|
|
94
|
+
* a concern.
|
|
95
|
+
* @type {{best_t:number, best_body:number, best_node:number, best_bvh:BVH|null}}
|
|
96
|
+
*/
|
|
97
|
+
const acc = { best_t: Infinity, best_body: 0, best_node: 0, best_bvh: null };
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Reusable closure bound to the current system + user filter so we don't
|
|
101
|
+
* allocate a new function object per call. Re-wired at the top of each
|
|
102
|
+
* {@link raycast} invocation. The BVH traversal sees a stable identity
|
|
103
|
+
* which helps V8 keep the call site monomorphic.
|
|
104
|
+
*
|
|
105
|
+
* Carries state via the module-scoped `bound_*` slots below.
|
|
106
|
+
* @type {(body_id:number)=>boolean}
|
|
107
|
+
*/
|
|
108
|
+
const bound_test = (body_id) => {
|
|
109
|
+
const system = bound_system;
|
|
110
|
+
const entity = system.entityOf(body_id);
|
|
111
|
+
if (entity < 0) return false;
|
|
112
|
+
// v1 limitation: when a multi-collider body's BVH leaf is hit, we pass
|
|
113
|
+
// the body's primary (first-attached) collider rather than the specific
|
|
114
|
+
// collider the ray actually crossed. Sufficient for entity-level
|
|
115
|
+
// filtering; per-collider filtering needs the BVH user_data scheme to
|
|
116
|
+
// encode collider index too — future work.
|
|
117
|
+
const collider = system.__primary_collider(system.__index_of(body_id));
|
|
118
|
+
return bound_filter(entity, collider);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
let bound_system = null;
|
|
122
|
+
let bound_filter = returnTrue;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Raycast against both broadphase trees (static + dynamic) of a
|
|
126
|
+
* {@link PhysicsSystem}, filling `result` with the nearest hit and returning
|
|
127
|
+
* `true` on hit, `false` on miss.
|
|
128
|
+
*
|
|
129
|
+
* Hit normal is the AABB face normal — exact for AABB-shaped colliders,
|
|
130
|
+
* a stable approximation for general convex shapes (an upcoming narrowphase
|
|
131
|
+
* refinement pass will replace this with the true shape normal at the same
|
|
132
|
+
* call site, no API change).
|
|
133
|
+
*
|
|
134
|
+
* @param {PhysicsSystem} system
|
|
135
|
+
* @param {Ray3} ray origin + unit direction + `tMax`
|
|
136
|
+
* @param {PhysicsSurfacePoint} result populated on hit; untouched on miss
|
|
137
|
+
* @param {(entity:number, collider:Collider)=>boolean} [filter] mandatory in
|
|
138
|
+
* contract; defaults to {@link returnTrue} (accept everything). Called once
|
|
139
|
+
* per BVH leaf that crosses the ray.
|
|
140
|
+
* @returns {boolean} true on hit, false on miss
|
|
141
|
+
*/
|
|
142
|
+
export function raycast(system, ray, result, filter = returnTrue) {
|
|
143
|
+
const ox = ray.origin_x;
|
|
144
|
+
const oy = ray.origin_y;
|
|
145
|
+
const oz = ray.origin_z;
|
|
146
|
+
const dx = ray.direction_x;
|
|
147
|
+
const dy = ray.direction_y;
|
|
148
|
+
const dz = ray.direction_z;
|
|
149
|
+
const max_distance = ray.tMax;
|
|
150
|
+
|
|
151
|
+
acc.best_t = max_distance;
|
|
152
|
+
acc.best_body = 0;
|
|
153
|
+
acc.best_node = 0;
|
|
154
|
+
acc.best_bvh = null;
|
|
155
|
+
|
|
156
|
+
bound_system = system;
|
|
157
|
+
bound_filter = filter;
|
|
158
|
+
|
|
159
|
+
const inv_dx = 1 / dx;
|
|
160
|
+
const inv_dy = 1 / dy;
|
|
161
|
+
const inv_dz = 1 / dz;
|
|
162
|
+
|
|
163
|
+
bvh_raycast_nearest(
|
|
164
|
+
system.staticBvh, system.staticBvh.root,
|
|
165
|
+
ox, oy, oz,
|
|
166
|
+
dx, dy, dz,
|
|
167
|
+
inv_dx, inv_dy, inv_dz,
|
|
168
|
+
max_distance,
|
|
169
|
+
acc, bound_test
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
bvh_raycast_nearest(
|
|
173
|
+
system.dynamicBvh, system.dynamicBvh.root,
|
|
174
|
+
ox, oy, oz,
|
|
175
|
+
dx, dy, dz,
|
|
176
|
+
inv_dx, inv_dy, inv_dz,
|
|
177
|
+
max_distance,
|
|
178
|
+
acc, bound_test
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
if (acc.best_bvh === null || acc.best_t >= max_distance) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const entity = system.entityOf(acc.best_body);
|
|
186
|
+
if (entity < 0) {
|
|
187
|
+
// Body was unlinked concurrently; treat as a miss.
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Hit position in world space.
|
|
192
|
+
const t = acc.best_t;
|
|
193
|
+
const hx = ox + dx * t;
|
|
194
|
+
const hy = oy + dy * t;
|
|
195
|
+
const hz = oz + dz * t;
|
|
196
|
+
|
|
197
|
+
// AABB face normal at the hit point. Read the best leaf's AABB back from
|
|
198
|
+
// its BVH; project the hit point into the AABB's normalised local space
|
|
199
|
+
// (centre = 0, faces = ±1); the dominant component is the entry-face
|
|
200
|
+
// axis, its sign gives the outward normal.
|
|
201
|
+
const bvh = acc.best_bvh;
|
|
202
|
+
const node_address = acc.best_node * ELEMENT_WORD_COUNT;
|
|
203
|
+
const f32 = bvh.__data_float32;
|
|
204
|
+
const aabb_min_x = f32[node_address];
|
|
205
|
+
const aabb_min_y = f32[node_address + 1];
|
|
206
|
+
const aabb_min_z = f32[node_address + 2];
|
|
207
|
+
const aabb_max_x = f32[node_address + 3];
|
|
208
|
+
const aabb_max_y = f32[node_address + 4];
|
|
209
|
+
const aabb_max_z = f32[node_address + 5];
|
|
210
|
+
|
|
211
|
+
const cx = (aabb_min_x + aabb_max_x) * 0.5;
|
|
212
|
+
const cy = (aabb_min_y + aabb_max_y) * 0.5;
|
|
213
|
+
const cz = (aabb_min_z + aabb_max_z) * 0.5;
|
|
214
|
+
// Multiplicative inverse of the half-extent saves one divide per axis.
|
|
215
|
+
// A degenerate AABB (zero extent on an axis) is impossible for live BVH
|
|
216
|
+
// leaves — physics shapes always have non-zero bounding extent.
|
|
217
|
+
const inv_half_x = 2 / (aabb_max_x - aabb_min_x);
|
|
218
|
+
const inv_half_y = 2 / (aabb_max_y - aabb_min_y);
|
|
219
|
+
const inv_half_z = 2 / (aabb_max_z - aabb_min_z);
|
|
220
|
+
|
|
221
|
+
const px = (hx - cx) * inv_half_x;
|
|
222
|
+
const py = (hy - cy) * inv_half_y;
|
|
223
|
+
const pz = (hz - cz) * inv_half_z;
|
|
224
|
+
|
|
225
|
+
const apx = px < 0 ? -px : px;
|
|
226
|
+
const apy = py < 0 ? -py : py;
|
|
227
|
+
const apz = pz < 0 ? -pz : pz;
|
|
228
|
+
|
|
229
|
+
let nx, ny, nz;
|
|
230
|
+
if (apx >= apy && apx >= apz) {
|
|
231
|
+
nx = px >= 0 ? 1 : -1; ny = 0; nz = 0;
|
|
232
|
+
} else if (apy >= apz) {
|
|
233
|
+
nx = 0; ny = py >= 0 ? 1 : -1; nz = 0;
|
|
234
|
+
} else {
|
|
235
|
+
nx = 0; ny = 0; nz = pz >= 0 ? 1 : -1;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Fill result. Direct typed-array writes — Vector3 extends Float32Array,
|
|
239
|
+
// and there are no observers subscribed to a query-result vector.
|
|
240
|
+
const rp = result.position;
|
|
241
|
+
const rn = result.normal;
|
|
242
|
+
rp[0] = hx; rp[1] = hy; rp[2] = hz;
|
|
243
|
+
rn[0] = nx; rn[1] = ny; rn[2] = nz;
|
|
244
|
+
result.t = t;
|
|
245
|
+
result.entity = entity;
|
|
246
|
+
result.body_id = acc.best_body;
|
|
247
|
+
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sweep a convex shape along a ray and find the first body it would
|
|
3
|
+
* hit. Used by character controllers (sweep a capsule along intended
|
|
4
|
+
* movement to find blockers), high-speed projectile movement (avoid
|
|
5
|
+
* tunnelling without paying for full per-body CCD), and any kinematic
|
|
6
|
+
* "where would this body end up if I tried to move it?" query.
|
|
7
|
+
*
|
|
8
|
+
* Pipeline:
|
|
9
|
+
* 1. Build the swept AABB: the shape's local-frame AABB rotated
|
|
10
|
+
* into world by `rotation`, translated to `ray.origin`, then
|
|
11
|
+
* stretched along `ray.direction * ray.tMax`.
|
|
12
|
+
* 2. Query both broadphase BVHs (static + dynamic) for leaves whose
|
|
13
|
+
* AABB overlaps the swept volume.
|
|
14
|
+
* 3. For each candidate, bisect the [0, best_t] interval for the
|
|
15
|
+
* smallest `t` at which the swept shape overlaps the candidate's
|
|
16
|
+
* collider. GJK on each midpoint.
|
|
17
|
+
*
|
|
18
|
+
* Picking `best_t` (rather than always running the full [0, tMax]
|
|
19
|
+
* bisection) is the early-termination optimisation: once we have a
|
|
20
|
+
* hit at some t, no later candidate can produce a smaller TOI by
|
|
21
|
+
* being checked at its full [0, tMax] interval.
|
|
22
|
+
*
|
|
23
|
+
* Output on hit:
|
|
24
|
+
* - `result.t` — sweep distance to impact (in the same units as
|
|
25
|
+
* `ray.direction`'s magnitude; for a unit-direction ray, this is
|
|
26
|
+
* metres).
|
|
27
|
+
* - `result.position` — `ray.origin + t * ray.direction`, i.e. the
|
|
28
|
+
* centre of the swept shape at the moment of first contact. NOT
|
|
29
|
+
* a point on the target's surface; that would need narrowphase
|
|
30
|
+
* refinement which the broadphase-only architecture doesn't have
|
|
31
|
+
* wired up yet.
|
|
32
|
+
* - `result.normal` — target surface's outward normal at the kiss
|
|
33
|
+
* point (unit length), computed by running GJK + EPA against the
|
|
34
|
+
* just-overlapping configuration at the TOI. Falls back to
|
|
35
|
+
* `-ray.direction` on the rare case EPA degenerates (NaN / zero
|
|
36
|
+
* depth) — see comment near the EPA call.
|
|
37
|
+
* - `result.entity` / `result.body_id` — the hit body.
|
|
38
|
+
*
|
|
39
|
+
* Output on miss: untouched; same convention as `raycast`.
|
|
40
|
+
*
|
|
41
|
+
* @param {PhysicsSystem} system
|
|
42
|
+
* @param {Ray3} ray origin + unit direction + `tMax`
|
|
43
|
+
* @param {AbstractShape3D} shape shape being swept, in its local frame
|
|
44
|
+
* @param {{x:number,y:number,z:number,w:number}} rotation fixed orientation
|
|
45
|
+
* @param {PhysicsSurfacePoint} result populated on hit; untouched on miss
|
|
46
|
+
* @param {(entity:number, collider:Collider)=>boolean} [filter] mandatory in
|
|
47
|
+
* contract; defaults to {@link returnTrue}
|
|
48
|
+
* @returns {boolean}
|
|
49
|
+
*/
|
|
50
|
+
export function shape_cast(system: PhysicsSystem, ray: Ray3, shape: AbstractShape3D, rotation: {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
z: number;
|
|
54
|
+
w: number;
|
|
55
|
+
}, result: PhysicsSurfacePoint, filter?: (entity: number, collider: Collider) => boolean): boolean;
|
|
56
|
+
//# sourceMappingURL=shape_cast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape_cast.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/queries/shape_cast.js"],"names":[],"mappings":"AAwEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,+FANW;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,iDAE7B,MAAM,yBAAsB,OAAO,GAEzC,OAAO,CA2QnB"}
|